Here is a practical approach on how to port packages from other Linux distributions to pmOS (because that is usually the fastest way). Feel free to extend this information, and to add other distributions.
=== General information ===
* Please read [https://wiki.alpinelinux.org/wiki/Creating_an_Alpine_package#APKBUILD_variables.2Ffunctions this section] from our upstream friends wiki (''which we should also extend and improve'')
* [[How to create a patch when packaging software]]
==== Beware of legacy APKBUILDs ====
Alpine's program to build packages, <code>abuild</code> evolves constantly. But the APKBUILDs sometimes lack behind. Some APKBUILDs still have the following, which is unnecessary:
* <code>|| return 1</code> statements after every line (e.g. <code>make || return 1</code> is not needed anymore, use <code>make</code> instead)
* ''not'' using the <code>builddir</code> variable to point to the extracted source location (usually: <code>builddir="$srcdir/$pkgname-$pkgver"</code>)
==== Packaging git commits ====
Only package git commits when necessary. Stable releases are preferred. Consider asking upstream to tag releases.
* <code>pkgver</code>: We use the following format: <code>$lastrelease_gitYYYYMMDD</code>, e.g. <code>1.0_git20171101</code> (that makes it easy to see how old the commit is and <code>apk</code> is able to upgrade the package properly when the next release, e.g. <code>1.1</code>, comes out)
* <code>device-*</code> packages: This was not done consistently in the past, but it makes sense to update the <code>pkgver</code> when anything but the <code>APKBUILD</code> was changed. Because that is essentially the version of the software being packaged.
=== Porting packages from Arch Linux === ==== Find the package ====
[https://www.archlinux.org/packages/ Search here], click the package name, click on "Source Files" on the top right. A git repo with the <code>PKGBUILD</code> and all other files (such as patches) appears.
==== Differences between APKBUILDs and PKGBUILDs ====
* <code>APKBUILD</code>s do not have the arrays from bash, use flat strings instead