APKBUILDs are scripts to build alpine packages using the abuild tool.
The following variables are defined by abuild:
- The directory where APKBUILD script is found.
- The directory here sources are downloaded to and unpacked.
- This directory should hold the data files for main package. A normal autotools package has a make DESTDIR="$pkgdir" install.
- This directory should have the data files for a subpackage. This variable should only be used from subpackage functions.
The following variables should be defined by user in APKBUILD:
- Runtime dependencies that are not shared-object dependencies. Shared objects dependencies are autodetected and should not be specified here.
- Runtime dependencies for -dev subpackage.
- pre/post install/deinstall/remove scripts.
- License(s) for the package.
- Build time dependencies.
- build time options for package. Valid values are currently only !strip for avoid stripping the binaries.
- Short package description.
- Groups to be created during buildtime. This group should be created in a $pkgname.pre-install script as well so group is created during runtime.
- The name of the package. All letters should be lowercase. Lua libraries/modules should be prefixed with lua- (for example lua-posix), perl modules with perl- (for example perl-xml-parser), php modules with php- and python modules with py--.
- Users to be created during buildtime. Use $pkgname.pre-install for creating the user(s) during runtime.
- The package version.
- package(s) that this package replaces. Useful when files moves from one package to another.
- URL(s) to sources and patches.
- Subpackages built from this APKBUILD.
- The homepage for the package. This is to help users find upstream developer, documentation etc.
The following functions should be specified in the APKBUILD. The functions should consider current work directory as undefined.
- Optional. Build preparation. Here should patches etc be applied. This is function is for convenience while working with the APKBUILD.
- Required. This is the compilation stage. This function will be called as normal user (unless the package() function is missing - for compatibility reasons). If no compilation is needed this function can contain a single return 0.
- Required. In this function the built application and files should be installed in "$pkgdir".
The following functions are provided by abuild and is overrideable:
- download remote sources listed in $source to $SRCDEST and create symlinks to $srcdir.
- unpacks .tar.gz .tar.bz2 .tgz and .zip archices in $srcdir.
- Subpackage function for -dev packages. By default this will only call default_dev which will move $pkgdir/usr/include, *.a, *.la and similar files to $subpkgdir.
- Subpackage function for -doc packages. By default this will only call default_doc which will move $pkgdir/usr/share/doc, $pkgdir/usr/share/man and similar to $subpkgdir.