<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.alpinelinux.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Louipc</id>
	<title>Alpine Linux - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.alpinelinux.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Louipc"/>
	<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/wiki/Special:Contributions/Louipc"/>
	<updated>2026-05-03T12:04:31Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.40.0</generator>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Alpine_Linux:About&amp;diff=4472</id>
		<title>Alpine Linux:About</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Alpine_Linux:About&amp;diff=4472"/>
		<updated>2010-10-09T07:01:41Z</updated>

		<summary type="html">&lt;p&gt;Louipc: /* What&amp;#039;s It Like? */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Image:knotes.svg|96px|left|link=]]&lt;br /&gt;
{{TOC right}}&lt;br /&gt;
&#039;&#039;&#039;Alpine Linux&#039;&#039;&#039; is a community-developed operating system designed for x86 Routers, Firewalls, VPNs, VoIP and servers.&lt;br /&gt;
&lt;br /&gt;
Alpine Linux is and always will be &#039;&#039;&#039;free of charge&#039;&#039;&#039;. You do not pay any licensing fees. You can download, use and share Alpine Linux with anyone for absolutely nothing.&lt;br /&gt;
&lt;br /&gt;
Alpine Linux was designed with security in mind. It has &#039;&#039;&#039;proactive security&#039;&#039;&#039; features, such as [http://en.wikipedia.org/wiki/PaX PaX] and [http://en.wikipedia.org/wiki/Stack-smashing_protection SSP], that prevent security holes from being exploited.&lt;br /&gt;
&lt;br /&gt;
Alpine Linux uses the [http://en.wikipedia.org/wiki/UClibc uClibc] C library and all of the base tools from [http://en.wikipedia.org/wiki/BusyBox BusyBox]. These are normally found on embedded systems and are &#039;&#039;&#039;smaller&#039;&#039;&#039; than the tools found on GNU/Linux systems.&lt;br /&gt;
&lt;br /&gt;
== Why Should I Try It? ==&lt;br /&gt;
&lt;br /&gt;
We&#039;re partial, of course, but here are a few reasons:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;It&#039;s quick:&#039;&#039;&#039; You can boot it from a USB stick and have a very usable system in less than 10 minutes.&lt;br /&gt;
* &#039;&#039;&#039;It&#039;s simple:&#039;&#039;&#039; The [[Alpine Linux package management|package management]] and [[Alpine Linux Init System|init system]] is a breeze to use.&lt;br /&gt;
* &#039;&#039;&#039;It&#039;s more secure:&#039;&#039;&#039; When The Linux 0-day [http://en.wikipedia.org/wiki/Vmsplice%28%29_local_root_exploit vmsplice vulnerability] was causing admins everywhere to upgrade their kernels post-haste, Alpine Linux systems were basically impervious. Yes, the code crashed the application, but the PaX protection prevented system compromise. The value of PaX and SSP has been proven on more than one occasion.&lt;br /&gt;
* &#039;&#039;&#039;It&#039;s small:&#039;&#039;&#039; The traditional GNU/Linux base system is over 100MB in size (excluding the kernel), while the base system in Alpine Linux is only 4-5MB in size (excluding the kernel).&lt;br /&gt;
* &#039;&#039;&#039;It has the [[Alpine Configuration Framework Design|Alpine Configuration Framework (ACF)]]:&#039;&#039;&#039; While optional, ACF is a powerful web application used to configure an Alpine Linux device. ([[User:K0gen/ACF_Screenshots|Screenshots]])&lt;br /&gt;
* &#039;&#039;&#039;It&#039;s great for experimenting:&#039;&#039;&#039; Since the system configuration can be backed up to a single file, you will be able to test configurations before deploying them to production systems. (See [[Alpine local backup|Alpine Local Backup]].)&lt;br /&gt;
* &#039;&#039;&#039;It supports [http://linux-vserver.org/ Linux-VServer]:&#039;&#039;&#039; Similar to FreeBSD Jails, it allows you to run virtual servers.&lt;br /&gt;
&lt;br /&gt;
== What&#039;s It Like? ==&lt;br /&gt;
&lt;br /&gt;
Its network configuration is similar to Debian&#039;s and its package management is, in some ways, similar to Debian&#039;s APT or RedHat&#039;s yum, the BSDs&#039; &amp;lt;code&amp;gt;pkg_*&amp;lt;/code&amp;gt; commands (&amp;lt;code&amp;gt;apk_*&amp;lt;/code&amp;gt; under Alpine), and Arch Linux&#039;s PKGBUILDs (&amp;lt;code&amp;gt;APKBUILD&amp;lt;/code&amp;gt; under Alpine).&lt;br /&gt;
&lt;br /&gt;
Also, if you&#039;ve ever used a BusyBox-based system before, you would know that its applets do not support all of the features of their GNU/Linux counterparts. However, in an effort to make the system run like any other, the Alpine developers have contributed a number of enhancements to the BusyBox project.&lt;br /&gt;
&lt;br /&gt;
Having said that, there are situations where things do not run like they do on a traditional GNU/Linux system. When you run into those situations, just remember these two things:&lt;br /&gt;
&lt;br /&gt;
* The base installation is kept small enough for a firewall or router system, so there&#039;s not much there except the basics. (You can probably get away with just using the tools that are there, although crudely. When combined, tools like sh, awk, sed, and grep can do everything Perl can &amp;amp;mdash; seriously.)&lt;br /&gt;
* Alpine does have a complete set of packages, but you have to explicitly choose what to install.&lt;br /&gt;
&lt;br /&gt;
== What Should I Know? ==&lt;br /&gt;
&lt;br /&gt;
In addition to basic *nix management, you should know that...&lt;br /&gt;
&lt;br /&gt;
* Alpine Linux uses [[Alpine Linux package management|apk-tools]] for its package management system and [http://roy.marples.name/projects/openrc OpenRC] for [[Alpine Linux Init System|its init system]]. You will need to learn how to use them both before you can effectively manage an Alpine Linux system.&lt;br /&gt;
* Alpine Linux uses the [[Alpine local backup|Alpine Local Backup Utility]] (&amp;lt;code&amp;gt;lbu&amp;lt;/code&amp;gt;) primarily for RAM-based installs so you don&#039;t lose everything between reboots &amp;amp;mdash; however &amp;amp;mdash; it can also be used on HDD installs to test configurations before deploying them to production systems.&lt;br /&gt;
* In some cases, there is not a lot of documentation available, and what is available can be scattered about the wiki and/or mailing lists. We&#039;re working on it, but could use some help. Please see the [[Contribute]] page if you would like to help out.&lt;br /&gt;
&lt;br /&gt;
== How did Alpine Linux Begin? ==&lt;br /&gt;
&lt;br /&gt;
Alpine Linux began as a fork of the [http://en.wikipedia.org/wiki/LEAF_Project LEAF Project].&lt;br /&gt;
&lt;br /&gt;
The active members of the LEAF Project wanted to continue making a Linux distribution that ran off of a single floppy disk &amp;amp;mdash; and we think that&#039;s great &amp;amp;mdash; however, our needs required Squid, DansGuardian, Samba, and a slew of other heavyweight applications. So, we ended up with a set of packages that fit onto a CD-ROM.&lt;br /&gt;
&lt;br /&gt;
The LEAF concept of &amp;quot;run from RAM&amp;quot; has a number of appealing features, especially for a firewall:&lt;br /&gt;
&lt;br /&gt;
* If your configs are all on a floppy, an upgrade is as simple as burning a new CD and rebooting.&lt;br /&gt;
* If your configs are all on a (write-protected) floppy, recovering from a root-kit is as simple as rebooting.&lt;br /&gt;
&lt;br /&gt;
Aside from the applications that we required, there were some things that we wanted to experiment with that wasn&#039;t easy to do in the LEAF build environment at that time, such as:&lt;br /&gt;
&lt;br /&gt;
* A Complete Build-from-Source Environment (e.g. Gentoo-Style Build World)&lt;br /&gt;
* 2.6.x Kernel Support&lt;br /&gt;
* Stack-Smashing Support (SSP) in GCC&lt;br /&gt;
* PaX Kernel Security&lt;br /&gt;
* Better package management with dependencies, upgrade path, pre- and post-install scripts, etc.&lt;br /&gt;
&lt;br /&gt;
And so the project began.&lt;br /&gt;
&lt;br /&gt;
Although Alpine Linux won&#039;t fit on a floppy disk today, it has and always will be our goal to keep it as small and simple as possible.&lt;br /&gt;
&lt;br /&gt;
== Why the Name Alpine? ==&lt;br /&gt;
&lt;br /&gt;
&amp;quot;Alpine&amp;quot; originally stood for A Linux Powered Integrated Network Engine. The idea was that the distribution would be focused on networking, and be a tiny &amp;quot;engine&amp;quot; or framework, which larger systems could be built upon.&lt;br /&gt;
&lt;br /&gt;
Today, &amp;quot;Alpine&amp;quot; is nothing more than a name, despite continuing to live up to its original name. As an example, here are a few of Alpine&#039;s achievements and real-world uses:&lt;br /&gt;
&lt;br /&gt;
* The first open-source implementation of Cisco&#039;s DMVPN, called [http://sourceforge.net/projects/opennhrp/ OpenNHRP], was written for Alpine Linux.&lt;br /&gt;
* In addition to its use as a firewall or router system, Alpine Linux is also used in a number of installations as the basis for enterprise servers, running such software as PostgreSQL, Postfix, Asterisk, Kamailio, and being used for iSCSI SANs. It is the little engine that could.&lt;/div&gt;</summary>
		<author><name>Louipc</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Creating_an_Alpine_package&amp;diff=4471</id>
		<title>Creating an Alpine package</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Creating_an_Alpine_package&amp;diff=4471"/>
		<updated>2010-10-09T07:00:58Z</updated>

		<summary type="html">&lt;p&gt;Louipc: /* depends &amp;amp;amp; makedepends */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== General ==&lt;br /&gt;
&lt;br /&gt;
This document assumes that you have a working [[Setting up the build environment|build environment]], or use a diskbased alpine installation. &lt;br /&gt;
&lt;br /&gt;
=== The APKBUILDs  ===&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;[http://dev.alpinelinux.org/cgit/abuild/ abuild]&#039;&#039; script reads the &#039;&#039;[http://dev.alpinelinux.org/cgit/abuild/tree/sample.APKBUILD APKBUILD]&#039;&#039; and executes the steps needed to create a package. &lt;br /&gt;
&lt;br /&gt;
=== The aports tree  ===&lt;br /&gt;
&lt;br /&gt;
The [http://dev.alpinelinux.org/cgit/aports aports] tree is a [http://dev.alpinelinux.org/cgit/aports/tree directory tree] with many APKBUILDs. Those files are used when building alpine from source. &lt;br /&gt;
&lt;br /&gt;
== Installing and configuring the alpine-sdk  ==&lt;br /&gt;
&lt;br /&gt;
The alpine-sdk is a metapackage that pulls in the most essential packages used to build new packages.&amp;lt;BR&amp;gt;&lt;br /&gt;
Install those packages now: &lt;br /&gt;
&lt;br /&gt;
  apk add alpine-sdk&lt;br /&gt;
&lt;br /&gt;
This would be a good time to create a normal user account for you to work in. (You weren&#039;t going to develop as root now, were you!) To create the user:&lt;br /&gt;
&lt;br /&gt;
  adduser &amp;lt;yourusername&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To make life easier later, it&#039;s a good idea to add this user to /etc/sudoers. Append the line&lt;br /&gt;
&lt;br /&gt;
&amp;lt;yourusername&amp;gt;    ALL=(ALL) ALL&lt;br /&gt;
&lt;br /&gt;
using the command:&lt;br /&gt;
&lt;br /&gt;
  visudo&lt;br /&gt;
&lt;br /&gt;
Now logout of the root account, and login as &amp;lt;yourusername&amp;gt;. From here on everything can be done in a normal user account, and operations that require superuser privileges can be done with sudo.&lt;br /&gt;
&lt;br /&gt;
The aports tree is in git so before we clone the aports tree we should configure git.&lt;br /&gt;
&lt;br /&gt;
  git config --global user.name &amp;quot;Your Full Name&amp;quot;&lt;br /&gt;
  git config --global user.email &amp;quot;your@email.address&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Now we can clone the aports tree. &lt;br /&gt;
&lt;br /&gt;
  git clone git://dev.alpinelinux.org/aports&lt;br /&gt;
&lt;br /&gt;
Before we start creating or modifying APKBUILD files we need to setup abuild to our system/user. Edit the file abuild.conf to your requirements. Most of the defaults can be left alone, unless you are developing for a custom platform, in which case the comments in the file should guide you. The one field to edit is PACKAGER, so that you can get credit (or blame) for packages you create.&lt;br /&gt;
&lt;br /&gt;
  sudo vi /etc/abuild.conf&lt;br /&gt;
&lt;br /&gt;
The last step in preparation is to configure the security keys for abuild with the command:&lt;br /&gt;
&lt;br /&gt;
  abuild-keygen -a -i&lt;br /&gt;
&lt;br /&gt;
== Getting some help ==&lt;br /&gt;
&lt;br /&gt;
It might be wise to start by checking what the abuild program can/cannot do.&lt;br /&gt;
&lt;br /&gt;
 abuild -h&lt;br /&gt;
&lt;br /&gt;
== Creating an APKBUILD file  ==&lt;br /&gt;
&lt;br /&gt;
=== Use a template APKBUILD ===&lt;br /&gt;
&lt;br /&gt;
To create the actual APKBUILD file abuild has the option -n (new). It will simply copy an example/template APKBUILD file to the given directory and fill some variables.&amp;lt;BR&amp;gt;&lt;br /&gt;
If you are create a daemon package which needs initd scripts you can add the -c making it: &lt;br /&gt;
&lt;br /&gt;
 abuild -c -n &#039;&#039;packagename&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;NOTE:&#039;&#039;&#039; The &#039;packagename&#039; is a parameter to the -n option so order of -c and -n matters.  Further, on newer Alpine systems, &#039;newapkbuild&#039; has replaced abuild with the -n switch.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This will copy the sample initd and confd files to the build directory.&amp;lt;BR&amp;gt;&lt;br /&gt;
A third file sample.install file will be copied as well (we will discuss this later on).&lt;br /&gt;
&lt;br /&gt;
=== Modify your APKBUILD ===&lt;br /&gt;
Edit APKBUILD and fill in the needed info (especially pkgname, pkgver, pkgdesc, url, license, depends and source). &lt;br /&gt;
&lt;br /&gt;
If you are going to use any of the variables for directories like $pkgdir, always make sure they are double quoted like: &lt;br /&gt;
&lt;br /&gt;
 &amp;quot;$pkgdir&amp;quot;/somedir&lt;br /&gt;
&lt;br /&gt;
This will prevent issues with spaces/special characters in the future. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Note:&#039;&#039;&#039; If you like syntax highlighting we suggest you to install vim. We have setup vim to recognize the APKBUILD file as a bash scripts so its easier to read them.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== APKBUILD variables/functions  ===&lt;br /&gt;
&lt;br /&gt;
==== source  ====&lt;br /&gt;
&lt;br /&gt;
Source is not only the link from which abuild will fetch the source, it should also hold all files abuild needs to build the apk. This could mean initd file, confd file, install file, patches or any other file needed. When you are finished adding them you can execute the following command to add their checksums to the APKBUILD file: &lt;br /&gt;
&lt;br /&gt;
 abuild checksum&lt;br /&gt;
&lt;br /&gt;
Another thing to note is when a package is using sourceforge for hosting. If so you should specify the special mirrors link used by sf: &lt;br /&gt;
&lt;br /&gt;
 http://downloads.sourceforge.net/$pkgname/$pkgname-$pkgver.tar.gz &lt;br /&gt;
&lt;br /&gt;
(or similar depending on the package). &lt;br /&gt;
&lt;br /&gt;
Currently abuild supports the following archives/extensions: &lt;br /&gt;
&lt;br /&gt;
 *.tar.gz, *.tgz, *.tar.bz2, *.tar.lzma, *.zip&lt;br /&gt;
&lt;br /&gt;
==== depends &amp;amp;amp; makedepends  ====&lt;br /&gt;
&lt;br /&gt;
Depends are the actual running dependencies that a package would need when it is running. Makedepends are only needed when you are building a package. If you set a package, in depends you do not need to add it to makedepends as well. The best way to find out what the depends and makedepends of a package are is to [http://en.wikipedia.org/wiki/Rtfm RTFM]. &lt;br /&gt;
&lt;br /&gt;
No kidding, lots of important information can be found it the package INSTALL and README file (or the likes). Another good way is the run ./configure --help from the source directory to see which options are needed for configure to finish without errors. If you do not yet have a src directory you can create one with the command: &lt;br /&gt;
&lt;br /&gt;
 abuild unpack&lt;br /&gt;
&lt;br /&gt;
Running configure will also show you how you can disable a specific option for this package. A good example is for instance &amp;quot;--disable-nls&amp;quot; which will disable native language support and thus does not depend on gettext(libiconv,glib..). &lt;br /&gt;
&lt;br /&gt;
Alpine likes to keep things small, so we try to disable as much as possible without losing too many features. The exact disable/enable options are decided the package builder but please try to follow Alpine&#039;s design concept as much as possible. &lt;br /&gt;
&lt;br /&gt;
An easy way of quickly finding out the build info for a package is to check Arch Linux (Alpine package management and build scripts are similar) or Gentoo linux ebuilds (previous versions of Alpine were based on Gentoo). &lt;br /&gt;
&lt;br /&gt;
[http://www.gentoo-portage.com Search ebuilds] &lt;br /&gt;
&lt;br /&gt;
[http://sources.gentoo.org/viewcvs.py/gentoo-x86/ Gentoo CVS] &lt;br /&gt;
&lt;br /&gt;
[http://www.archlinux.org/packages/search/ Arch Linux packages] &lt;br /&gt;
&lt;br /&gt;
After the package is successfully compiled and created we should make sure it didn&#039;t link to any package that is not present in the $depends variable. We do this by using scanelf. If scanelf is not yet installed on your system you can do that by installing pax-utils. &lt;br /&gt;
&lt;br /&gt;
 scanelf -nR pkg&lt;br /&gt;
&lt;br /&gt;
An example output of libcurl would be: &lt;br /&gt;
&lt;br /&gt;
 ET_DYN libssl.so.0.9.8,libcrypto.so.0.9.8,libz.so.1,libc.so.0,ld-uClibc.so.0 pkg/usr/lib/libcurl.so.4.1.1&lt;br /&gt;
&lt;br /&gt;
You can see the needed files and should be able to find out which file belongs to which package.&lt;br /&gt;
&lt;br /&gt;
==== license  ====&lt;br /&gt;
&lt;br /&gt;
If a package has a special/custom license we need to provide it with the release. Because we want to save space and don&#039;t like to have licenses all over our system we have decided to include the license in the doc subpackage. Please follow the following guidelines to add a proper license. Locate the license file inside the source package. Add the doc subpackage to the $subpackages variable as follows: &lt;br /&gt;
&lt;br /&gt;
 subpackages=&amp;quot;$pkgname-doc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Add a similar line to the following to your build() function, depending on the license description file: &lt;br /&gt;
&lt;br /&gt;
 install -Dm644 COPYING &amp;quot;$pkgdir&amp;quot;/usr/share/licenses/$pkgname/COPYING&lt;br /&gt;
&lt;br /&gt;
If you follow these steps then abuild will automatically add the license to the package-doc apk for you.&lt;br /&gt;
&lt;br /&gt;
==== url  ====&lt;br /&gt;
&lt;br /&gt;
Website address for the program. This is usefully later on when either finding documentation or other information about the package.&lt;br /&gt;
&lt;br /&gt;
==== pkgdesc  ====&lt;br /&gt;
&lt;br /&gt;
A brief, one line, description of what the package does. Useful for the package management system.&lt;br /&gt;
&lt;br /&gt;
Here is an example from apk_info for the OpenSSH client package&lt;br /&gt;
&lt;br /&gt;
 pkgdesc=&amp;quot;Port of OpenBSD&#039;s free SSH release - client&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==== pkgver  ====&lt;br /&gt;
&lt;br /&gt;
Provide the release number of the package you are building.&lt;br /&gt;
&lt;br /&gt;
==== pkgrel  ====&lt;br /&gt;
&lt;br /&gt;
The $pkgrel versioning is made so if you change something to your APKBUILD file without changing the actual $pkgver you can higer pkgrel so apk tools will detect it as an update. For instance if you forget to add a dependency you can add it afterward and you can +1 pkgver so apk finds this update and add the missing dependency. &lt;br /&gt;
&lt;br /&gt;
==== pkgname  ====&lt;br /&gt;
&lt;br /&gt;
The base name of the package you are creating.  For Freeswitch 1.0.6, you would use &amp;quot;freeswitch&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==== install  ====&lt;br /&gt;
&lt;br /&gt;
There are 6 different kinds of install scripts. Each script is called with the $pkgname.&#039;&#039;&amp;lt;action&amp;gt;&#039;&#039; where &#039;&#039;&amp;lt;action&amp;gt;&#039;&#039; is one of the following:&lt;br /&gt;
&lt;br /&gt;
===== $pkgname.pre-install =====&lt;br /&gt;
This script is executed before package is installed. Typical use is when package needs a user/group to be created. For example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
adduser -H -s /bin/false -D clamav 2&amp;gt;/dev/null&lt;br /&gt;
exit 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note the &#039;&#039;exit 0&#039;&#039; at the end. If the script exits with failure (if the user already exist), the package will not be installed and apk add will exit with failure.&lt;br /&gt;
&lt;br /&gt;
===== $pkgname.post-install =====&lt;br /&gt;
This script is executed after package is installed. Can be used to generate font cache and similar.&lt;br /&gt;
&lt;br /&gt;
===== $pkgname.pre-upgrade =====&lt;br /&gt;
Same as pre-install but is executed before upgrading an already installed package.&lt;br /&gt;
&lt;br /&gt;
===== $pkgname.post-upgrade =====&lt;br /&gt;
Same as post-install but is executed after upgrading an already installed package. &lt;br /&gt;
&lt;br /&gt;
===== $pkgname.pre-deinstall =====&lt;br /&gt;
This script is executed before uninstalling a package. If script exits with failure apk will not uninstall the package.&lt;br /&gt;
&lt;br /&gt;
===== $pkgname.post-deinstall =====&lt;br /&gt;
This script is executed after a package have been uninstalled. Can be used to update font caches and restore busybox links. For example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
busybox --install -s&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If the package have an pre-install and post-install script the APKBUILD should have the &#039;&#039;install&#039;&#039; variable defined and the scripts should also be added to the source variable:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
install=&amp;quot;$pkgname.pre-install $pkgname.post-install&amp;quot;&lt;br /&gt;
source=&amp;quot;http://....&lt;br /&gt;
       $install&amp;quot;&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== subpackages  ====&lt;br /&gt;
&lt;br /&gt;
$subpackages are made to split up the normal &amp;quot;make install&amp;quot; into separate packages. The most common subpackages we use are doc and dev. Because we like to keep our target system small we move documentation and development files (only needed when building packages) into separate packages. To use the specific program a user only need to install the base apk without package-doc or package-dev, but if he wants to read the manual he will need to install package-doc. &lt;br /&gt;
&lt;br /&gt;
The easiest way to find out if you need to use -dev and -doc is to first build the package without these options set and wait until the build finishes. When its finished you should have a pkg directory which is the fake root directory. Inside this directory you will see the structure as how it would be installed in / on the target system. &lt;br /&gt;
&lt;br /&gt;
To see if you need the -dev package you can run the following cmd: &lt;br /&gt;
&lt;br /&gt;
 find pkg/usr/ -name &#039;*.[acho]&#039; -o -name &#039;*.la&#039;&lt;br /&gt;
&lt;br /&gt;
If this returns any files you need to include the -dev package. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; To see if you need the -doc package you can run the following cmd: &lt;br /&gt;
&lt;br /&gt;
 find pkg/usr/share -name doc -o -name man -o -name info -o -name html -o -name sgml -o -name licenses&lt;br /&gt;
&lt;br /&gt;
If this returns any directories you need to include the -doc package. &lt;br /&gt;
&lt;br /&gt;
===== Custom subpackages  =====&lt;br /&gt;
&lt;br /&gt;
Some applications will have except doc and dev files other non needed at run time files which we want to separate away from the base package. Some packages include large test suites which are only needed in specific circumstances or binaries which have depends which we prefer not to install. To handle those we create our own package/function. In the APKBUILD below the build() function we create another function: &lt;br /&gt;
&lt;br /&gt;
 test() {&lt;br /&gt;
        mkdir -p &amp;quot;$subpkgdir&amp;quot;/usr&lt;br /&gt;
        mv &amp;quot;$pkgdir&amp;quot;/usr/package-test &amp;quot;$subpkgdir&amp;quot;/usr/&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
We also need to add the package info to $subpackages variable: &lt;br /&gt;
&lt;br /&gt;
 subpackages=&amp;quot;$pkgname-doc $pkgname-dev $pkgname-test&amp;quot;&lt;br /&gt;
&lt;br /&gt;
After we finish building the package you should see another apk called packagename-test.apk which includes the files which we moved to the $subpkgdir dir. &lt;br /&gt;
&lt;br /&gt;
The above mentioned variables can also be used in our custom function. If we want for instance to build the test() function with perl support we would add: &lt;br /&gt;
&lt;br /&gt;
 depends=&amp;quot;perl&amp;quot;&lt;br /&gt;
 makedepends=&amp;quot;perl-dev&amp;quot;&lt;br /&gt;
&lt;br /&gt;
If we would install the base package it would not install perl, but if we install the package-test package it would.&lt;br /&gt;
&lt;br /&gt;
==== Patches  ====&lt;br /&gt;
&lt;br /&gt;
Please make sure you always submit human readable patches. Way&#039;s to create them are: &lt;br /&gt;
&lt;br /&gt;
directory compare: &lt;br /&gt;
&lt;br /&gt;
 diff -urp original_directory new_directory &amp;amp;gt; filename.patch&lt;br /&gt;
&lt;br /&gt;
file compare: &lt;br /&gt;
&lt;br /&gt;
 diff -up original.file new.file &amp;amp;gt; filename.patch&lt;br /&gt;
&lt;br /&gt;
If you are going to use multiple patches for a single package, the preferred way to handle those is a loop and numbering the patches. &lt;br /&gt;
&lt;br /&gt;
 for i in &amp;quot;$srcdir&amp;quot;/*.patch; do&lt;br /&gt;
        msg &amp;quot;Applying ${i}&amp;quot;&lt;br /&gt;
        patch -p0 -i $i || return 1&lt;br /&gt;
 done&lt;br /&gt;
&lt;br /&gt;
Because multiple patches can patch the same file, we could create offset for the next patch. To make sure we always patch in a specified way we should number the patches as followed: &lt;br /&gt;
&lt;br /&gt;
 10-patch1.patch 20-patch2.patch 30-patch3.patch&lt;br /&gt;
&lt;br /&gt;
This way we are always sure patch 1 is first and if we want to add additional patches between them we can use 11,12,21,22... &lt;br /&gt;
&lt;br /&gt;
==== Configure options  ====&lt;br /&gt;
&lt;br /&gt;
Alpine has some default configure options we set by default. We use /usr for prefix to make sure everyting is installed with /usr in front of it. If you notice that anything is installed in the wrong directory please run ./configure --help and see if you can set the correct location. &lt;br /&gt;
&lt;br /&gt;
We are not covering the depend switches here we have discussed this already in the depend section. &lt;br /&gt;
&lt;br /&gt;
==== Make options  ====&lt;br /&gt;
&lt;br /&gt;
If you notice weird problems when compiling or installing the package with make/make install you could try to disable [http://www.gnu.org/software/make/manual/make.html#Parallel parallel] building/installing. A normal make line would be: &lt;br /&gt;
&lt;br /&gt;
 make || return 1&lt;br /&gt;
&lt;br /&gt;
To disable parallel we use: &lt;br /&gt;
&lt;br /&gt;
 make -j1 || return 1&lt;br /&gt;
&lt;br /&gt;
We can use the same for make install. &lt;br /&gt;
&lt;br /&gt;
Because we do not want to install the package in our build environment but we want to install it in a fake root directory we need to tell &#039;make install&#039; to use another destination directory instead of &#039;/&#039;. We do this by setting a variable when we execute make install as followed: &lt;br /&gt;
&lt;br /&gt;
 make DESTDIR=&amp;quot;$pkgdir&amp;quot; install&lt;br /&gt;
&lt;br /&gt;
Please note that some Makefiles do not support this variable and will always install software in &#039;/&#039;. To make sure you do not mess up your build system NEVER run your build system as root but always use a custom user and sudo when needed. If by accident the Makefile does not support DESTDIR variable it will fail to install in our build system system directories.&lt;br /&gt;
&lt;br /&gt;
==== Additional files  ====&lt;br /&gt;
&lt;br /&gt;
If you want/need to install additional files not mentioned above you can use the following cmd (this is an example of a conf file): &lt;br /&gt;
&lt;br /&gt;
 install -Dm644 doc/$pkgname.conf &amp;quot;$pkgdir&amp;quot;/etc/$pkgname.conf&lt;br /&gt;
&lt;br /&gt;
== Build the package  ==&lt;br /&gt;
&lt;br /&gt;
If you did not already create the checksums as mentioned above you can do so now: &lt;br /&gt;
&lt;br /&gt;
 cd $pkgname&lt;br /&gt;
 abuild checksum&lt;br /&gt;
&lt;br /&gt;
Its about time we build our package. Because a build system should never have all the package installed to prevent linking to packages we dont want it to link we use a abuild recursively with the -r switch. It will install all dependency&#039;s from your repository and builds it, afterwards it will uninstall all those depending packages again. You could also use the -R switch which would build your package including the dependency packages. &lt;br /&gt;
&lt;br /&gt;
 abuild -r&lt;br /&gt;
&lt;br /&gt;
== Commit your work  ==&lt;br /&gt;
&lt;br /&gt;
After you successfully build your package you can submit your APKBUILD to alpine git repository. &lt;br /&gt;
&lt;br /&gt;
Update you git repo, before adding new files: &lt;br /&gt;
&lt;br /&gt;
 cd $aportsdir&lt;br /&gt;
 git pull&lt;br /&gt;
&lt;br /&gt;
This should pull all the changes made by others into you local git repo. When you think you are ready you can add your files to git: &lt;br /&gt;
&lt;br /&gt;
 cd $apkbuilddir&lt;br /&gt;
 git add APKBUILD (include any other files needed for the build; $pkgname.install...)&lt;br /&gt;
 git commit&lt;br /&gt;
&lt;br /&gt;
Now your changes are only available locally in your repo. Because you do not have push rights to the alpine repo you need to create diff (patch) of the changes you made: &lt;br /&gt;
&lt;br /&gt;
 git format-patch -1&lt;br /&gt;
&lt;br /&gt;
Where -1 sets how many commits you want to go back (mostly this is 1). This should create a patch called 0001......patch. &lt;br /&gt;
&lt;br /&gt;
An easy way to send this patch to the list is with an program called &#039;email&#039;. &lt;br /&gt;
&lt;br /&gt;
 apk_add email&lt;br /&gt;
&lt;br /&gt;
to send to the mailing list you would do: &lt;br /&gt;
&lt;br /&gt;
 email -a 0001...patch alpine-devel@lists.alpinelinux.org&lt;br /&gt;
&lt;br /&gt;
And provide a subject and body after you execute the above cmd. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; If you doubt to which repo your package belongs to you can safely use testing.&lt;/div&gt;</summary>
		<author><name>Louipc</name></author>
	</entry>
</feed>