Arch Linux Easy-to-pack guide

Source: Internet
Author: User
Tags arch linux

These two days to Kreogistµ dozen Arch Linux package, follow the wiki followed, at the same time in the Fat Cat and wicast C and tyrants and jimmy66 and other powerful thighs and small partners, the support of a few toss finally played well, also considered into a door.

After the completion of the discovery is simple, in general, is actually a PKGBUILD document written. Just write a simple guide to the bag that Μ called. In the writing when really do not know how to write the place can also directly refer to the other software package PKGBUILD is how to write I will not say it.

Writing PKGBUILD

At the very beginning, copy a prototype: /usr/share/pacman/PKGBUILD.proto (there are other special types of prototypes in the same directory), and then start writing from this file.

Read the note at the beginning of the file, then delete it ~

Maintainer

The first line of comments is the maintainer's information, in the format it provides to fill in the valid information.

Pkgname

The name of the package. You can only use lowercase letters, numbers @ . _ + - , and these characters, and do not allow . or - start.

Also do not have the same name as the package in the AUR or even the official warehouse (´@@facesymbol@@ ')

Pkgver

The version of the package is the version of the software that you packaged. You can use numbers and decimal points, as well as other characters.

Pkgrel

Package release number, generally set to 1, if you for some reason to the same version number of software repeatedly packaging, then each time you pack the Pkgrel should be on the basis of the increment of a number, and when packaging a new version, should be reset to 1.

Epoch

Forcibly interfering with the old and new relationship of the package, a package with a greater epoch value will be recognized as a newer package (ignoring the version number at this time) and can be used when the version number style changes and so on. The default value is 0, and the value is a positive integer. Generally not used.

Pkgdesc

The description of the package, preferably a word, and does not contain the name of the software.

Arch

Represents the architecture of the supported Arch Linux, for example, i686 x86_64 if the package is platform-independent any .

Url

The link to the package is usually the project home page or something.

License

The software release agreement, if it is a common GPL, can be filled in against the following:

    • L GPL-(L) GPLv2 and later.
    • L GPL2-Only (L) GPL2
    • L GPL3-(L) GPL3 and later
Depends

This is a very important item that needs to be correctly filled in on the software dependencies.

For the direct release executable program, you can use LDD to see which library files connected to the program, combined with the search to determine what the specific dependencies are software packages. You can use Google to search the https://www.archlinux.org of the specific library file name, generally can find the corresponding package.

If you've already played with Makepkg. TAR.XZ's package, you can also use the Namcap to check for problems with dependencies, and it will provide useful information to help fix dependencies. For the meaning of his output can be directly referenced ArchWiki.

Multi-Test multi-test to ensure that the dependency is really no problem.

Source

The files needed to build the package. Can be a local file, or it can be a remote file. Makepkg will automatically download the completed remote files when the package is built, and will automatically unpack the compressed files.

Md5sums

The MD5 check code for the corresponding source file.

Package ()

The function that executes when the package is architected. You need to write the corresponding operation of the installation software here. function is executed in an fakeroot environment, the corresponding root directory is $pkgdir , for example, you have an executable file named to $pkgname be installed /usr/bin below, the corresponding command can be similar to write:

install -m=775$pkgname"${pkgdir}/usr/bin"

-mOptions represent the permissions of the target file, and the parameters are the same chmod .

Common Directory
Catalogue Use
/etc System Key configuration files, if there are multiple, you should create a suitable subdirectory to store
/usr/bin binary files
/usr/lib Library
/usr/include Header file
/USR/LIB/{PKG} Modules, plugins, etc.
/USR/SHARE/DOC/{PKG} Application documentation
/usr/share/info GNU Info System File
/usr/share/man Manual
/USR/SHARE/{PKG} Program Data
/VAR/LIB/{PKG} Apply Persistent data
/ETC/{PKG} Configuration file for {pkg}
/OPT/{PKG} Large standalone programs, such as Java
/usr/share/applications/ Desktop Entry (. Desktop) files
/usr/share/icons/ icon, the corresponding subdirectory location exists in this directory

Directories that should not be touched:

    • /dev
    • /home
    • /srv
    • /media
    • /mnt
    • /proc
    • /root
    • /selinux
    • /sys
    • /tmp
    • /var/tmp
Build/DEBUG Package

In the directory where the PKGBUILD is executed makepkg can build a corresponding package, it is recommended to namcap detect the built-up package has no more significant problems.

Then you can pacman -U install it with a command to see if something strange happens and the software is normal.

Of course, it is possible because PKGBUILD did not write well, directly on the error, this time need to follow the wrong information to correct the PKGBUILD.

Publish to AUR

In the directory where the PKGBUILD is executed makepkg --source , the .src.tar.gz source code package is generated, which is what needs to be uploaded to the AUR, and be careful not to add any binary files to the source package.

Register (login) account number in the AUR (Arch User Repository). Go to the Submit page, select a package corresponding to the classification, and then add the source package upload.

Even if you are updating a package, just upload it directly on the Submit page, and the package information will be handled by the AUR itself.

Reference Documents/Wiki

For more detailed content and more complex packaging please refer to the following.

    • PKGBUILD (5) Manual Page
    • Creating Packages-archwiki
    • Arch Packaging Standards-archwiki
    • Namcap-archwiki

Arch Linux Easy-to-pack guide

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.