8,560
edits
(Created page with "=== Выходной пакет ===") |
(Updating to match new version of source page) |
||
Line 7: | Line 7: | ||
== Конфигурация == | == Конфигурация == | ||
{{ic|/etc/makepkg.conf}} - это основной конфигурационный файл для makepkg. Большинство пользователей захотят уточнить параметры конфигурации makepkg перед сборкой каких-либо пакетов. | {{ic|/etc/makepkg.conf}} - это основной конфигурационный файл для makepkg. Большинство пользователей захотят уточнить параметры конфигурации makepkg перед сборкой каких-либо пакетов. | ||
<div lang="en" dir="ltr" class="mw-content-ltr"> | |||
A user specific configuration file which takes precedence over the system wide configuration may exist in {{ic|$HOME/.makepkg.conf}}. This is important to note if using i3, cinnamon, or deepin as the manjaro-desktop-settings packages for these desktop environments automatically create the user configuration file for new users by way of {{ic|/etc/skel/.makepkg.conf}}. | |||
</div> | |||
=== Архитектура, флаги компиляции === | === Архитектура, флаги компиляции === | ||
Line 64: | Line 68: | ||
=== Выходной пакет === | === Выходной пакет === | ||
<div lang="en" dir="ltr" class="mw-content-ltr"> | |||
Next, one can configure where source files and packages should be placed and identify themselves as the packager. This step is optional; packages will be created in the working directory where makepkg is run by default. | Next, one can configure where source files and packages should be placed and identify themselves as the packager. This step is optional; packages will be created in the working directory where makepkg is run by default. | ||
</div> | |||
{{hc|/etc/makepkg.conf|<nowiki> | {{hc|/etc/makepkg.conf|<nowiki> | ||
[...] | [...] | ||
<div lang="en" dir="ltr" class="mw-content-ltr"> | |||
######################################################################### | ######################################################################### | ||
# PACKAGE OUTPUT | # PACKAGE OUTPUT | ||
Line 83: | Line 90: | ||
#-- Packager: name/email of the person or organization building packages | #-- Packager: name/email of the person or organization building packages | ||
#PACKAGER="John Doe <john@doe.com>" | #PACKAGER="John Doe <john@doe.com>" | ||
</div> | |||
[...] | [...] | ||
</nowiki>}} | </nowiki>}} | ||
<div lang="en" dir="ltr" class="mw-content-ltr"> | |||
For example, create the directory: | For example, create the directory: | ||
</div> | |||
$ mkdir /home/$USER/packages | $ mkdir /home/$USER/packages | ||
<div lang="en" dir="ltr" class="mw-content-ltr"> | |||
Then modify the {{ic|PKGDEST}} variable in {{ic|/etc/makepkg.conf}} accordingly. | Then modify the {{ic|PKGDEST}} variable in {{ic|/etc/makepkg.conf}} accordingly. | ||
</div> | |||
<div lang="en" dir="ltr" class="mw-content-ltr"> | |||
The {{ic|PACKAGER}} variable will set the {{ic|packager}} value within compiled packages' {{ic|.PKGINFO}} metadata file. By default, user-compiled packages will display: | The {{ic|PACKAGER}} variable will set the {{ic|packager}} value within compiled packages' {{ic|.PKGINFO}} metadata file. By default, user-compiled packages will display: | ||
</div> | |||
<div lang="en" dir="ltr" class="mw-content-ltr"> | |||
{{hc|pacman -Qi package|<nowiki> | {{hc|pacman -Qi package|<nowiki> | ||
[...] | [...] | ||
Line 100: | Line 115: | ||
[...] | [...] | ||
</nowiki>}} | </nowiki>}} | ||
</div> | |||
<div lang="en" dir="ltr" class="mw-content-ltr"> | |||
Afterwards: | Afterwards: | ||
</div> | |||
<div lang="en" dir="ltr" class="mw-content-ltr"> | |||
{{hc|pacman -Qi package|<nowiki> | {{hc|pacman -Qi package|<nowiki> | ||
[...] | [...] | ||
Line 108: | Line 127: | ||
[...] | [...] | ||
</nowiki>}} | </nowiki>}} | ||
</div> | |||
<div lang="en" dir="ltr" class="mw-content-ltr"> | |||
This is useful if multiple users will be compiling packages on a system, or you are otherwise distributing your packages to other users. | This is useful if multiple users will be compiling packages on a system, or you are otherwise distributing your packages to other users. | ||
</div> | |||
<div lang="en" dir="ltr" class="mw-content-ltr"> | |||
=== Signature checking === | === Signature checking === | ||
The following procedure is not necessary for compiling with makepkg, for your initial configuration proceed to [[#Usage]]. To temporarily disable signature checking call the makepkg command with the {{ic|--skippgpcheck}} option. | The following procedure is not necessary for compiling with makepkg, for your initial configuration proceed to [[#Usage]]. To temporarily disable signature checking call the makepkg command with the {{ic|--skippgpcheck}} option. | ||
If a signature file in the form of .sig is part of the [[PKGBUILD]] source array, makepkg validates the authenticity of source files. For example, the signature pkgname-pkgver.tar.gz.sig is used to check the integrity of the file pkgname-pkgver.tar.gz with the gpg program. If desired, signatures by other developers can be manually added to the gpg keyring. Look into the [[GnuPG]] article for further information. | If a signature file in the form of .sig is part of the [[PKGBUILD]] source array, makepkg validates the authenticity of source files. For example, the signature pkgname-pkgver.tar.gz.sig is used to check the integrity of the file pkgname-pkgver.tar.gz with the gpg program. If desired, signatures by other developers can be manually added to the gpg keyring. Look into the [[GnuPG]] article for further information. | ||
</div> | |||
<div lang="en" dir="ltr" class="mw-content-ltr"> | |||
{{Note|The signature checking implemented in makepkg does not use pacman's keyring. Configure gpg as explained below to allow makepkg reading pacman's keyring.}} | {{Note|The signature checking implemented in makepkg does not use pacman's keyring. Configure gpg as explained below to allow makepkg reading pacman's keyring.}} | ||
</div> | |||
<div lang="en" dir="ltr" class="mw-content-ltr"> | |||
The gpg keys are expected to be stored in the user's {{ic|~/.gnupg/pubring.gpg}} file. In case it does not contain the given signature, makepkg shows a warning. | The gpg keys are expected to be stored in the user's {{ic|~/.gnupg/pubring.gpg}} file. In case it does not contain the given signature, makepkg shows a warning. | ||
{{hc|makepkg|<nowiki> | {{hc|makepkg|<nowiki> | ||
Line 136: | Line 163: | ||
</nowiki>}} | </nowiki>}} | ||
When configured as before, the output of {{ic|gpg --list-keys}} contains a list of keyrings and developers. Now makepkg can compile AUR packages submitted by Arch Linux developers with successful signature checking. | When configured as before, the output of {{ic|gpg --list-keys}} contains a list of keyrings and developers. Now makepkg can compile AUR packages submitted by Arch Linux developers with successful signature checking. | ||
</div> | |||
<div lang="en" dir="ltr" class="mw-content-ltr"> | |||
== Usage == | == Usage == | ||
</div> | |||
<div lang="en" dir="ltr" class="mw-content-ltr"> | |||
Before continuing, ensure the "base-devel" group is installed. Packages belonging to this group are not required to be listed as dependencies in [[PKGBUILD]] files. Install the "base-devel" group by issuing (as root): | Before continuing, ensure the "base-devel" group is installed. Packages belonging to this group are not required to be listed as dependencies in [[PKGBUILD]] files. Install the "base-devel" group by issuing (as root): | ||
</div> | |||
# pacman -S base-devel | <div lang="en" dir="ltr" class="mw-content-ltr"> | ||
# pacman -S base-devel | |||
</div> | |||
<div lang="en" dir="ltr" class="mw-content-ltr"> | |||
{{Note|Before complaining about missing (make) dependencies, remember that the "base" group is assumed to be installed on all Manjaro Linux systems. The group "base-devel" is assumed to be installed when building with '''makepkg'''.}} | {{Note|Before complaining about missing (make) dependencies, remember that the "base" group is assumed to be installed on all Manjaro Linux systems. The group "base-devel" is assumed to be installed when building with '''makepkg'''.}} | ||
</div> | |||
To build a package, one must first create a [[PKGBUILD]], or build script, as described in [[Create Manjaro Packages]], or obtain one from the [https://gitlab.manjaro.org Manjaro Gitlab Repositories], [[Arch User Repository]], or some other source. | <div lang="en" dir="ltr" class="mw-content-ltr"> | ||
To build a package, one must first create a [[PKGBUILD]], or build script, as described in [[Create Manjaro Packages]], or obtain one from the [https://gitlab.manjaro.org Manjaro Gitlab Repositories], [[Arch User Repository]], or some other source. | |||
</div> | |||
<div lang="en" dir="ltr" class="mw-content-ltr"> | |||
{{Warning|Only build and/or install packages from trusted sources.}} | {{Warning|Only build and/or install packages from trusted sources.}} | ||
</div> | |||
<div lang="en" dir="ltr" class="mw-content-ltr"> | |||
Once in possession of a {{ic|PKGBUILD}}, change to the directory where it is saved and issue the following command to build the package described by said {{ic|PKGBUILD}}: | Once in possession of a {{ic|PKGBUILD}}, change to the directory where it is saved and issue the following command to build the package described by said {{ic|PKGBUILD}}: | ||
</div> | |||
$ makepkg | $ makepkg | ||
<div lang="en" dir="ltr" class="mw-content-ltr"> | |||
To have makepkg clean out leftover files and folders, such as files extracted to the $srcdir, add the following option. This is useful for multiple builds of the same package or updating the package version, while using the same build folder. It prevents obsolete and remnant files from carrying over to the new builds. | To have makepkg clean out leftover files and folders, such as files extracted to the $srcdir, add the following option. This is useful for multiple builds of the same package or updating the package version, while using the same build folder. It prevents obsolete and remnant files from carrying over to the new builds. | ||
</div> | |||
$ makepkg -c | $ makepkg -c | ||
<div lang="en" dir="ltr" class="mw-content-ltr"> | |||
If required dependencies are missing, makepkg will issue a warning before failing. To build the package and install needed dependencies automatically, simply use the command: | If required dependencies are missing, makepkg will issue a warning before failing. To build the package and install needed dependencies automatically, simply use the command: | ||
</div> | |||
$ makepkg -s | $ makepkg -s | ||
<div lang="en" dir="ltr" class="mw-content-ltr"> | |||
Note that these dependencies must be available in the configured repositories; see [[pacman]] for details. Alternatively, one can manually install dependencies prior to building ({{ic|pacman -S --asdeps dep1 dep2}}). | Note that these dependencies must be available in the configured repositories; see [[pacman]] for details. Alternatively, one can manually install dependencies prior to building ({{ic|pacman -S --asdeps dep1 dep2}}). | ||
</div> | |||
<div lang="en" dir="ltr" class="mw-content-ltr"> | |||
Once all dependencies are satisfied and the package builds successfully, a package file ({{ic|pkgname-pkgver.pkg.tar.xz}}) will be created in the working directory. To install, run (as root): | Once all dependencies are satisfied and the package builds successfully, a package file ({{ic|pkgname-pkgver.pkg.tar.xz}}) will be created in the working directory. To install, run (as root): | ||
</div> | |||
# pacman -U pkgname-pkgver.pkg.tar.xz | # pacman -U pkgname-pkgver.pkg.tar.xz | ||
<div lang="en" dir="ltr" class="mw-content-ltr"> | |||
Alternatively, to install, using the {{ic|-i}} flag is an easier way of running {{ic|pacman -U pkgname-pkgver.pkg.tar.xz}}, as in: | Alternatively, to install, using the {{ic|-i}} flag is an easier way of running {{ic|pacman -U pkgname-pkgver.pkg.tar.xz}}, as in: | ||
</div> | |||
$ makepkg -i | $ makepkg -i | ||
<div lang="en" dir="ltr" class="mw-content-ltr"> | |||
== Tips and Tricks == | == Tips and Tricks == | ||
=== Improving compile times === | === Improving compile times === | ||
Line 176: | Line 229: | ||
{{hc|/etc/makepkg.conf|<nowiki> | {{hc|/etc/makepkg.conf|<nowiki> | ||
[...] | [...] | ||
</div> | |||
<div lang="en" dir="ltr" class="mw-content-ltr"> | |||
######################################################################### | ######################################################################### | ||
# BUILD ENVIRONMENT | # BUILD ENVIRONMENT | ||
Line 199: | Line 254: | ||
#-- Specify a directory for package building. | #-- Specify a directory for package building. | ||
#BUILDDIR=/tmp | #BUILDDIR=/tmp | ||
</div> | |||
<div lang="en" dir="ltr" class="mw-content-ltr"> | |||
[...] | [...] | ||
</nowiki>}} | </nowiki>}} | ||
</div> | |||
<div lang="en" dir="ltr" class="mw-content-ltr"> | |||
Uncommenting the {{ic|1=BUILDDIR=/tmp}} line and setting it to e.g. {{ic|1=BUILDDIR=/tmp/builds}} (or leaving it to its default value) will make use of Arch default {{ic|/tmp}} [[tmpfs]]. | Uncommenting the {{ic|1=BUILDDIR=/tmp}} line and setting it to e.g. {{ic|1=BUILDDIR=/tmp/builds}} (or leaving it to its default value) will make use of Arch default {{ic|/tmp}} [[tmpfs]]. | ||
{{Note|The [[tmpfs]] folder needs to be mounted without the {{ic|noexec}} option, else it will prevent build scripts or utilities from being executed. Also, as stated in [[fstab#tmpfs]], its default size is half of the available RAM so you may run out of space.}} | {{Note|The [[tmpfs]] folder needs to be mounted without the {{ic|noexec}} option, else it will prevent build scripts or utilities from being executed. Also, as stated in [[fstab#tmpfs]], its default size is half of the available RAM so you may run out of space.}} | ||
For more information, please refer to [[fstab]] and [[Tmpfs#Improving compile times]]. | For more information, please refer to [[fstab]] and [[Tmpfs#Improving compile times]]. | ||
</div> | |||
<div lang="en" dir="ltr" class="mw-content-ltr"> | |||
=== Generate new md5sums === | === Generate new md5sums === | ||
Since [http://allanmcrae.com/2013/04/pacman-4-1-released/ pacman 4.1] {{ic|makepkg -g >> PKGBUILD}} is no longer required as pacman-contrib was [https://projects.archlinux.org/pacman.git/tree/NEWS merged] along with the {{ic|updpkgsums}} script that will generate new checksums and replace them in the PKGBUILD: | Since [http://allanmcrae.com/2013/04/pacman-4-1-released/ pacman 4.1] {{ic|makepkg -g >> PKGBUILD}} is no longer required as pacman-contrib was [https://projects.archlinux.org/pacman.git/tree/NEWS merged] along with the {{ic|updpkgsums}} script that will generate new checksums and replace them in the PKGBUILD: | ||
$ updpkgsums | $ updpkgsums | ||
</div> | |||
<div lang="en" dir="ltr" class="mw-content-ltr"> | |||
=== Makepkg source PKGBUILD twice === | === Makepkg source PKGBUILD twice === | ||
Makepkg sources the PKGBUILD twice (once when initially run, and the second time under fakeroot). Any non-standard functions placed in the PKGBUILD will be run twice as well. | Makepkg sources the PKGBUILD twice (once when initially run, and the second time under fakeroot). Any non-standard functions placed in the PKGBUILD will be run twice as well. | ||
</div> | |||
<div lang="en" dir="ltr" class="mw-content-ltr"> | |||
=== WARNING: Package contains reference to $srcdir === | === WARNING: Package contains reference to $srcdir === | ||
Somehow, the literal strings {{ic|$srcdir}} or {{ic|$pkgdir}} ended up in one of the installed files in your package. | Somehow, the literal strings {{ic|$srcdir}} or {{ic|$pkgdir}} ended up in one of the installed files in your package. | ||
</div> | |||
<div lang="en" dir="ltr" class="mw-content-ltr"> | |||
To identify which files, run the following from the makepkg build directory: | To identify which files, run the following from the makepkg build directory: | ||
$ grep -R "$(pwd)/src" pkg/ | $ grep -R "$(pwd)/src" pkg/ | ||
</div> | |||
<div lang="en" dir="ltr" class="mw-content-ltr"> | |||
[http://www.mail-archive.com/arch-general@archlinux.org/msg15561.html Link] to discussion thread. | [http://www.mail-archive.com/arch-general@archlinux.org/msg15561.html Link] to discussion thread. | ||
</div> | |||
<div lang="en" dir="ltr" class="mw-content-ltr"> | |||
=== Create uncompressed packages === | === Create uncompressed packages === | ||
If you only want to install packages locally, you can speed up the process by avoiding compression and subsequent decompression. In {{ic|makepkg.conf}}, change {{ic|<nowiki>PKGEXT='.pkg.tar.xz'</nowiki>}} to {{ic|<nowiki>PKGEXT='.pkg.tar'</nowiki>}}. | If you only want to install packages locally, you can speed up the process by avoiding compression and subsequent decompression. In {{ic|makepkg.conf}}, change {{ic|<nowiki>PKGEXT='.pkg.tar.xz'</nowiki>}} to {{ic|<nowiki>PKGEXT='.pkg.tar'</nowiki>}}. | ||
</div> | |||
[[Category:Contents Page{{#translation:}}]] | [[Category:Contents Page{{#translation:}}]] |