Creating an Alpine package
DRAFT
This document assumes that you have a working build environment, or use a diskbased alpine installation.
The APKBUILDs
The abuild script reads the APKBUILD and executes the steps needed to create a package.
The aports tree
The aports tree is a directory tree with many APKBUILDs. Those files are used when building alpine from source.
Installing and configuring the alpine-sdk
The alpine-sdk is a metapackage that pulls in the most essinsial packages used to build new packages. To install those packages:
NOTE: if you used the build environment howto, you already have alpine-sdk installed.
apk add alpine-sdk
The aports tree is in git so before we can clone the aports tree we need to install and configure git. We need to tell git our name and email.
git config --global user.name "Your Full Name" git config --global user.email "your@email.address"
Now we can clone the aports tree.
git clone git://dev.alpinelinux.org/aports
Creating an APKBUILD file
APKBUILD files are read by the abuild program mentioned above. To see what abuilld can/cannot do you can execute:
abuild -h
To create the actual APKBUILD file abuild has the option -n (new). It will simply copy an example APKBUILD file to the given directory and fill some variables. If you are create a daemon package which needs initd scripts you can add the -c making it:
abuild -cn $packagename
NOTE: order does matter.
This will copy the sample initd and confd files to the build directory. A third file sample.install file will be copied as well (we will discuss this later on).
Edit APKBUILD and fill in the needed info (especially pkgname, pkgver, pkgdesc, url, license, depends and source)
Build the package
cd $pkgname abuild checksum >> APKBUILD abuild
Add any custom configure option into proper line of build() section
Splitting packages
For packages that install man and info files, it's better to put these file in a separated $pkgname-doc package. Edit APKBUILD and add:
subpackages="$pkgname-doc"
Be sure to put man files in /usr/share/man and info files in /usr/share/info. You need to re-run abuild to regenerate program and doc packages
Commit your work
Update you git repo, before adding new files:
cd $aportsdir git pull git://dev.alpinelinux.org/aports git add extra/$pkgname/APKBUILD git commit -v -m'extra/$pkgname: new aport'
If your package belongs to core or testing, replace extra accordingly. Send the file 000x-extra-$pkgname-new-aport.patch in the current dir to alpine-devel@lists.alpinelinux.org