Difference between revisions of "Manjaro Packaging Standards"

Marked this version for translation
m (added languages and translate tags)
(Marked this version for translation)
Line 2: Line 2:
__TOC__
__TOC__
<translate>
<translate>
<!--T:1-->
'''The submitted PKGBUILDs must not build applications already in any of the official binary repositories under any circumstances. Exception to this strict rule may only be packages having extra features enabled and/or patches in comparison to the official ones. In such an occasion, the pkgname array should be different.'''
'''The submitted PKGBUILDs must not build applications already in any of the official binary repositories under any circumstances. Exception to this strict rule may only be packages having extra features enabled and/or patches in comparison to the official ones. In such an occasion, the pkgname array should be different.'''


<!--T:2-->
When building packages for Manjaro Linux, '''adhere to the package guidelines''' below, especially if the intention is
When building packages for Manjaro Linux, '''adhere to the package guidelines''' below, especially if the intention is
to '''contribute''' a new package
to '''contribute''' a new package
Line 10: Line 12:
</translate>
</translate>
<translate>
<translate>
==PKGBUILD prototype==
==PKGBUILD prototype== <!--T:3-->
{{bc|1=
{{bc|1=
# Maintainer: Your Name <youremail@domain.com>
# Maintainer: Your Name <youremail@domain.com>
Line 35: Line 37:
md5sums=() #autofill using updpkgsums
md5sums=() #autofill using updpkgsums


<!--T:4-->
build() {
build() {
   cd $pkgname-$pkgver
   cd $pkgname-$pkgver


   ./configure --prefix=/usr
   <!--T:5-->
./configure --prefix=/usr
   make
   make
}
}


<!--T:6-->
package() {
package() {
   cd $pkgname-$pkgver
   cd $pkgname-$pkgver


   make DESTDIR="$pkgdir/" install
   <!--T:7-->
make DESTDIR="$pkgdir/" install
}
}
}}
}}


<!--T:8-->
Other prototypes are found in {{ic|/usr/share/pacman}} from the pacman and abs packages.
Other prototypes are found in {{ic|/usr/share/pacman}} from the pacman and abs packages.
</translate>
</translate>
<translate>
<translate>
==Package etiquette==
==Package etiquette== <!--T:9-->


<ul>
<!--T:10-->
<ul>
<li>Packages should '''never''' be installed to {{ic|/usr/local}}</li>
<li>Packages should '''never''' be installed to {{ic|/usr/local}}</li>
<li>
<li>
Line 62: Line 70:
in makepkg itself.
in makepkg itself.


If a new variable is absolutely required,
<!--T:11-->
If a new variable is absolutely required,
'''prefix the variable name with an underscore''' ({{ic|_}}), e.g.
'''prefix the variable name with an underscore''' ({{ic|_}}), e.g.
{{bc|1=_customvariable=}}
{{bc|1=_customvariable=}}


The AUR cannot detect the use of custom variables and so cannot use them in substitutions.  This can most often be seen in the source array e.g.
<!--T:12-->
The AUR cannot detect the use of custom variables and so cannot use them in substitutions.  This can most often be seen in the source array e.g.
{{bc|<nowiki>http://downloads.sourceforge.net/directxwine/$patchname.$patchver.diff.bz2</nowiki>}}
{{bc|<nowiki>http://downloads.sourceforge.net/directxwine/$patchname.$patchver.diff.bz2</nowiki>}}
Such a situation defeats the effective functionality of the AUR.
Such a situation defeats the effective functionality of the AUR.
</li>
</li>


<li>
<!--T:13-->
<li>
'''Avoid''' using {{ic|/usr/libexec/}} for
'''Avoid''' using {{ic|/usr/libexec/}} for
anything. Use {{ic|/usr/lib/${pkgname}/}} instead.
anything. Use {{ic|/usr/lib/${pkgname}/}} instead.
Line 80: Line 91:
the appropriate option in the {{ic|/etc/makepkg.conf}}
the appropriate option in the {{ic|/etc/makepkg.conf}}


file, or alternatively override it by creating ~/.makepkg.conf
<!--T:14-->
file, or alternatively override it by creating ~/.makepkg.conf


</li>
<!--T:15-->
</li>
<li>
<li>
All important messages should be echoed during install using an '''.install file'''. For
All important messages should be echoed during install using an '''.install file'''. For
Line 99: Line 112:
}}
}}


<!--T:16-->
The above example is taken from the <b>wine</b> package in {{Ic|extra}}. The optdepends
The above example is taken from the <b>wine</b> package in {{Ic|extra}}. The optdepends
information is automatically printed out on installation/upgrade so
information is automatically printed out on installation/upgrade so
one should <b>not</b> keep this kind of information in .install files.
one should <b>not</b> keep this kind of information in .install files.


<!--T:17-->
</li>
</li>
         <li>When creating a '''package description''' for a package, do not include
         <li>When creating a '''package description''' for a package, do not include
Line 113: Line 128:
</translate>
</translate>
<translate>
<translate>
==Package naming==
==Package naming== <!--T:18-->
* Package names should consist of '''alphanumeric characters only'''; all letters should be '''lowercase'''.
* Package names should consist of '''alphanumeric characters only'''; all letters should be '''lowercase'''.
* Package names should NOT be suffixed with the upstream major release version number (e.g. we don't want libfoo2 if upstream calls it libfoo v2.3.4) in case the library and its dependencies are expected to be able to keep using the most recent library version with each respective upstream release. However, for some software or dependencies, this can not be assumed. In the past this has been especially true for widget toolkits such as GTK and Qt. Software that depends on such toolkits can usually not be trivially ported to a new major version. As such, in cases where software can not trivially keep rolling alongside its dependencies, package names should carry the major version suffix (e.g. gtk2, gtk3, qt4, qt5). For cases where most dependencies can keep rolling along the newest release but some can't (for instance closed source that needs libpng12 or similar), a deprecated version of that package might be called libfoo1 while the current version is just libfoo.
* Package names should NOT be suffixed with the upstream major release version number (e.g. we don't want libfoo2 if upstream calls it libfoo v2.3.4) in case the library and its dependencies are expected to be able to keep using the most recent library version with each respective upstream release. However, for some software or dependencies, this can not be assumed. In the past this has been especially true for widget toolkits such as GTK and Qt. Software that depends on such toolkits can usually not be trivially ported to a new major version. As such, in cases where software can not trivially keep rolling alongside its dependencies, package names should carry the major version suffix (e.g. gtk2, gtk3, qt4, qt5). For cases where most dependencies can keep rolling along the newest release but some can't (for instance closed source that needs libpng12 or similar), a deprecated version of that package might be called libfoo1 while the current version is just libfoo.
Line 120: Line 135:
</translate>
</translate>
<translate>
<translate>
==Directories==
==Directories== <!--T:19-->
* '''Configuration files''' should be placed in the {{ic|/etc}} directory. If there is more than one configuration file, it is customary to '''use a subdirectory''' in order to keep the {{ic|/etc}} area as clean as possible. Use {{ic|/etc/{pkgname}/}}  where {{ic|<nowiki>{pkgname}</nowiki>}} is the name of the package (or a suitable alternative, eg, apache uses {{ic|/etc/httpd/}}).
* '''Configuration files''' should be placed in the {{ic|/etc}} directory. If there is more than one configuration file, it is customary to '''use a subdirectory''' in order to keep the {{ic|/etc}} area as clean as possible. Use {{ic|/etc/{pkgname}/}}  where {{ic|<nowiki>{pkgname}</nowiki>}} is the name of the package (or a suitable alternative, eg, apache uses {{ic|/etc/httpd/}}).


<!--T:20-->
* Package files should follow these '''general directory guidelines''':
* Package files should follow these '''general directory guidelines''':


<!--T:21-->
:{|
:{|
|-
|-
Line 164: Line 181:
|}
|}


<!--T:22-->
* Packages should not contain any of the following directories:
* Packages should not contain any of the following directories:
** {{ic|/dev}}
** {{ic|/dev}}
Line 179: Line 197:
</translate>
</translate>
<translate>
<translate>
==Makepkg duties==
==Makepkg duties== <!--T:23-->


<p>
<!--T:24-->
<p>
When [[makepkg]] is used to build a package, it does the
When [[makepkg]] is used to build a package, it does the
following automatically:
following automatically:
</p>
</p>


<ol>
<!--T:25-->
<ol>
<li>
<li>
Checks if package '''dependencies''' and '''makedepends''' are installed
Checks if package '''dependencies''' and '''makedepends''' are installed
Line 204: Line 224:
<li>
<li>


'''Builds''' the software and installs it in a fake
<!--T:26-->
'''Builds''' the software and installs it in a fake
root
root
</li>
</li>
Line 220: Line 241:
</li>
</li>


<li>
<!--T:27-->
<li>
'''Compresses''' the fake root into the package file
'''Compresses''' the fake root into the package file
</li>
</li>
Line 227: Line 249:
</li>
</li>


</ol>
<!--T:28-->
</ol>
</translate>
</translate>
<translate>
<translate>
==Architectures==
==Architectures== <!--T:29-->
The {{Ic|arch}} array should contain {{Ic|'i686'}} and/or {{Ic|'x86_64'}} depending on which architectures it can be built on. You can also use {{Ic|'any'}} for architecture independent packages.
The {{Ic|arch}} array should contain {{Ic|'i686'}} and/or {{Ic|'x86_64'}} depending on which architectures it can be built on. You can also use {{Ic|'any'}} for architecture independent packages.
</translate>
</translate>
<translate>
<translate>
==Licenses==
==Licenses== <!--T:30-->
The [[Licenses|license]] array is being implemented in the official repos, and it <b>should</b> be used in your packages as well. Use it as follows:
The [[Licenses|license]] array is being implemented in the official repos, and it <b>should</b> be used in your packages as well. Use it as follows:
<ul>
<ul>
Line 259: Line 282:
</translate>
</translate>
<translate>
<translate>
==Submitting packages to the AUR==
==Submitting packages to the AUR== <!--T:31-->
<p>Note the following before submitting any packages to the AUR:</p>
<p>Note the following before submitting any packages to the AUR:</p>


<ol>
<!--T:32-->
<ol>
         <li>
         <li>
                 The submitted PKGBUILDs '''MUST NOT''' build applications already in any of the official binary repositories under any circumstances. Exception to this strict rule may only be packages having extra features enabled and/or patches in compare to the official ones. In such an occasion the pkgname array should be different to express that difference.
                 The submitted PKGBUILDs '''MUST NOT''' build applications already in any of the official binary repositories under any circumstances. Exception to this strict rule may only be packages having extra features enabled and/or patches in compare to the official ones. In such an occasion the pkgname array should be different to express that difference.
Line 275: Line 299:
                 your email to protect against spam:
                 your email to protect against spam:


<!--T:33-->
{{bc|# Maintainer: Your Name <address at domain dot com>}}
{{bc|# Maintainer: Your Name <address at domain dot com>}}


<!--T:34-->
If you are assuming the role of maintainer for an existing PKGBUILD, add your name to the top as described above and change the title of the previous Maintainer(s) to Contributor:
If you are assuming the role of maintainer for an existing PKGBUILD, add your name to the top as described above and change the title of the previous Maintainer(s) to Contributor:


<!--T:35-->
{{bc|# Maintainer: Your Name <address at domain dot com>
{{bc|# Maintainer: Your Name <address at domain dot com>
# Contributor: Previous Name <address at domain dot com>}}
# Contributor: Previous Name <address at domain dot com>}}


</li>
<!--T:36-->
</li>
<li>
<li>
Verify the package '''dependencies''' (eg, run
Verify the package '''dependencies''' (eg, run
Line 288: Line 316:
by scripts, etc).
by scripts, etc).


The TU team '''strongly''' recommend the use of the
<!--T:37-->
The TU team '''strongly''' recommend the use of the
{{ic|namcap}} utility, written by Jason Chu (jason@archlinux.org), to analyze the
{{ic|namcap}} utility, written by Jason Chu (jason@archlinux.org), to analyze the
sanity of packages. {{ic|namcap}} will warn you about
sanity of packages. {{ic|namcap}} will warn you about
Line 295: Line 324:
{{ic|namcap}} package with {{ic|pacman}}.
{{ic|namcap}} package with {{ic|pacman}}.


Remember {{ic|namcap}} can be used to check both pkg.tar.gz files and PKGBUILDs
<!--T:38-->
Remember {{ic|namcap}} can be used to check both pkg.tar.gz files and PKGBUILDs
</li>
</li>
<li> '''Dependencies'''
<li> '''Dependencies'''
Line 312: Line 342:
e.g. foo.tar.gz.
e.g. foo.tar.gz.


<!--T:39-->
One can easily build a tarball containing all the required files by using {{Ic|makepkg --source}}. This
One can easily build a tarball containing all the required files by using {{Ic|makepkg --source}}. This
makes a tarball named {{Ic|$pkgname-$pkgver-$pkgrel.src.tar.gz}}, which can then be uploaded to the AUR.
makes a tarball named {{Ic|$pkgname-$pkgver-$pkgrel.src.tar.gz}}, which can then be uploaded to the AUR.
Line 318: Line 349:
</li>
</li>


</ol>
<!--T:40-->
</ol>
</translate>
</translate>


[[Category:Contents Page{{#translation:}}]]
[[Category:Contents Page{{#translation:}}]]