Archlinux: Create cross-platform packages and from .deb packages

About a year ago I explained how create packages for Archlinux. Well, today I am going to explain how to create them from packages .deb, those used in Debian / Mint / Ubuntu / etc.
This article arose after reading a question from the user in the forum jorgegc because I could not install a package from AUR, mainly because it is outdated and used a version discontinued of the PKGBUILD (luckily I have previously made packages in this way), I will also explain how to make packages of programs that need 32-bit libraries, closed code o already compiled and that it has different packages for download.

The basis for the PKGBUILD is the same, only with a few changes.
The first change will be the use of a sentence ifelif by Bash


if [ "${CARCH}" = 'x86_64' ]; then
ARCH='amd64'
md5sums=('192a0a222893d59d95f00c34f3c8a674')
depends=('openal' 'lib32-openal')
elif [ "${CARCH}" = 'i686' ]; then
ARCH='i386'
md5sums=('047c670443124193c5cc3dd54da99925')
depends=('openal')
fi
source=("http://www.unaurl.com/files/${name}.$ARCH.deb")

In this example a variable has been defined that will later be used to change the URL where is the package (in this case the architecture of the package to download).
In addition, depending on the architecture, the MD5 sums so we will change these to the corresponding ones.

When using makepkg -g to generate the MD5sums This will only generate the one corresponding to the architecture you are using. To know the MD5 sum of the other package, download it and use the command md5sum file.deb to know yours

Finally we see that in the example we change the dependencies. In some 64-bit programs it is necessary to install 32-bit versions of some libraries so we have to indicate them. If they are not necessary simply define the variable in the usual way.

Now for .deb packages we are only going to need the following lines inside the function package ():

cd "${srcdir}/"
tar xvzf data.tar.gz -C .
cp -r usr ${pkgdir}

As you can see, we only need 3 lines in this case to generate the package. If something else is necessary (for example copying a file that does not come with the package, or modifying the content of one) you just have to put it as with any other package.

The same could apply (with some changes) if instead of a .deb we are going to use packages rpm or other types of packages. The function build () is not needed, so we don't need to add it.

And voila, we already have a multilib package or created from a deb package ready to use.
I hope you like it and that it has explained me well 😀


Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   ulysses said

    Isn't it easier to use checkinstall?

  2.   Luciano Lagassa said

    Hi. I have some bash scripts. One to generate the basic folders and files for a deb package. And the last one to generate the package from all files and folders. If you are interested, I can share it.

    1.    jorgecg said

      Of course it interests ... at least to me.

      Now that I am with Manjaro I appreciate all possible information.

  3.   jorgecg said

    How great you are, partner.

    I was going to have told you in the forum that if you could explain to me how to compile .deb packages and I have not told you anything so as not to abuse your generosity…. and I go to the page and I see that you have uploaded an article explaining the whole process.

    This shows that you are a generous person.

    I said, you are a crack.

    All the best

  4.   Anibal said

    It's great friend, once I tried a soft that I don't remember the name that converted from .deb to .rpm, but it didn't work well for me.

    someone with arch could test if this soft is passed well to rpm and the installation opens well?

    http://www.justcloud.com/download/linux-64

    It is to backup in the cloud, I already paid for a while and I have more than 40gb in the cloud =)

  5.   Inspiron said

    Great! I always told myself that one day I wanted to make a package, even if it is to know how to do it :).

    In these types of post I would appreciate that the blog implement the option to add entries like this in "favorites" of my account

    1.    chinoloco said

      Totally agree, I planted it, but nothing 🙂
      It would also be good, to be able to follow certain users

  6.   Rabba said

    Great old man, I have been using manjaro for a few days and for studies I need to install packet tracer from Cisco but it only has a .deb package of the latest version and the ke is in AUR always gives me an error when compiling, I hope with these steps I can install it since by force I have been using linux mint, thank you very much

  7.   mitcoes said

    to see if anyone dares to put in AUR Multisystem

    depends on deb libraries that are not in arch

    But if it works, its function is to create multi-ISO pen drives with grub2 better than unetbootin that only makes one.

    At the moment I have a ubuntu ISO of hers inside that allows me to add images if I want by booting from it on the USB itself

    but if no one dares save my ticket

  8.   mitcoes said

    Sorry, there is already a multisystem, and I think not

    1.    mitcoes said

      In multisystem ...

      but fatresize since yaourt gives problems, and they have put it as optional

  9.   frameworks said

    Great 😀 to approve with "Purrr" a program to rename files in bulk.

  10.   Apr4xas said

    Regards,

    Currently in AUR they are eliminating the packages that do not have the package () function, how can I know what lines to put there? That is, I have several packages and I did it this way but I don't know if it's okay https://github.com/abr4xas/Arch-pkgbuild/blob/master/%20django-admin-honeypot/PKGBUILD what I really did is pass what was in build () to package () but as I said, I don't know if it's okay ... Can you give me your comments and suggestions?

    Thank you

  11.   Azazel said

    Thanks for the information I will bookmark it for future reference.

  12.   clerafel said

    Can someone explain what it is to me, I'm new, and I don't know if this helps me to install a .deb package but locally in manjaro, a game to be exact. Yes, it works?

    I look for and they tell me to install the deb2targz package but I get an error when installing it from the terminal, and I don't know if it can be

    1.    Germaine said

      The same happens to me; I need to install on Kademar which is based on Arch; a couple of packages that I only get in .deb
      Can someone help me?

      1.    holds said

        If what you mean is a failure in the deb2targz installation, I just finished installing it with the command yaourt -S deb2targz. Of course, in ArchLinux.

  13.   Free Cloud Storage said

    Very informative post. Thanks for sharing.

  14.   Angry Birds said

    Good post. Thank you for sharing this useful information.

  15.   Apps for PC said

    Thanks for this helpful post. It is going to help a lot.

  16.   jacob said

    hi, can you leave the script for the conversion and how to use it? It is that in parts it confuses a bit, I already have the deb that I want to convert and I know that it is possible because the google chrome of AUR is a deb but I don't know how to make "MAKEPKG SI" with another deb 🙁