Include:Setup your system and account for building packages: Difference between revisions

From Alpine Linux
m (Fixed wikilink.)
 
(17 intermediate revisions by 14 users not shown)
Line 1: Line 1:
The <tt>alpine-sdk</tt> is a metapackage that pulls in the most essential packages used to build new packages.<BR>
The {{Pkg|alpine-sdk}} is a metapackage that pulls in the most essential packages used to build new packages. Also install and configure a way to elevate privileges, such as sudo or doas, and an editor, such as vi, nano, micro.
Install those packages now:


{{Cmd|apk add alpine-sdk}}
{{Cmd|# apk add alpine-sdk}}


This would be a good time to create a normal user account for you to work in. (You weren't going to develop as root now, were you!) To create the user:
This would be a good time to [[Setting_up_a_new_user|create a normal user account for you to work in]]. To make life easier later, it's a good idea to add this user to the wheel group; operations that require superuser privileges can now be done with sudo or doas.


{{Cmd|adduser <yourusername>}}
The [[Aports_tree|aports tree]] is in git so before we clone it, let's configure git.


To make life easier later, it's a good idea to add this user to /etc/sudoers. Append the line
{{Cmd|$ git config --global user.name "Your Full Name"
$ git config --global user.email "your@email.address"}}


<yourusername>    ALL=(ALL) ALL
Read carefully [[Development using git]] to grasp basic Git operations and how to configure for sending email patches.


using the command:
Now we can clone the [[Aports_tree|aports tree]].


{{Cmd|visudo}}
{{Cmd|$ git clone https://gitlab.alpinelinux.org/alpine/aports}}


Now logout of the root account, and login as <yourusername>. From here on everything can be done in a normal user account, and operations that require superuser privileges can be done with sudo.
Before we start creating or modifying [[APKBUILD_Reference|APKBUILD]] files, we need to setup abuild for our system and user. Edit the file {{Path|/etc/abuild.conf}} to your requirements.


The [[Aports_tree|aports tree]] is in git so before we clone the [[Aports_tree|aports tree]] we should configure git.
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.
 
{{Cmd|git config --global user.name "Your Full Name"
git config --global user.email "your@email.address"}}
 
Read carefully [[Development using git]] to grasp basic Git operations and configure email patches sending.
 
Now we can clone the [[Aports_tree|aports tree]].  


{{Cmd|git clone git://dev.alpinelinux.org/aports}}
To use 'abuild -r' command to install dependency packages automatically.
{{Cmd|# addgroup <yourusername> abuild}}


Before we start creating or modifying [[APKBUILD_Reference|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.
We also need to prepare the location where the build process caches files when they are downloaded. By default this is {{Path|/var/cache/distfiles/}}. To create this directory and ensure that it is writeable, enter the following commands:


{{Cmd|sudo vi /etc/abuild.conf}}
{{Cmd|# mkdir -p /var/cache/distfiles}}
{{Cmd|# chmod a+w /var/cache/distfiles}}


We also need to prepare the location that the build process caches files when they are downloaded. By default this is /var/cache/distfiles. To create this directory and ensure that it is writeable, enter the following commands:
As an alternative to the second command, you can add yourself to the abuild group:


{{Cmd|sudo mkdir -p /var/cache/distfiles}}
{{Cmd|# chgrp abuild /var/cache/distfiles}}
{{Cmd|sudo chmod a+w /var/cache/distfiles}}
{{Cmd|# chmod g+w /var/cache/distfiles}}


Or add yourself to the abuild group
{{Note|Remember to logout and login again for the group change to have effect.}}


{{Cmd|sudo addgroup <yourusername> abuild}}
The last step is to configure the security keys with the [[Abuild-keygen|abuild-keygen]] script for [[Abuild and Helpers|abuild]] with the command:


{{Note|<nowiki>remember to logout and login again for the group change to have effect.</nowiki>}}
{{Cmd|# abuild-keygen -a -i}}


The last step in preparation is to configure the security keys with the [[Abuild-keygen|abuild-keygen]] script for [[Abuild|abuild]] with the command:
If you want to share the generated keys between multiple computers ({{Path|~/.abuild}}), you will have to manually copy the generated public key into {{Path|/etc/apk/keys}} for the signing process of generated packages to work, example:


{{Cmd|abuild-keygen -a -i}}
{{Cmd|# cp /home/user/.abuild/user@domain.tld-12345abc.rsa.pub /etc/apk/keys}}


[[Category:Development]]
[[Category:Development]]

Latest revision as of 18:51, 19 November 2023

The alpine-sdk is a metapackage that pulls in the most essential packages used to build new packages. Also install and configure a way to elevate privileges, such as sudo or doas, and an editor, such as vi, nano, micro.

# apk add alpine-sdk

This would be a good time to create a normal user account for you to work in. To make life easier later, it's a good idea to add this user to the wheel group; operations that require superuser privileges can now be done with sudo or doas.

The aports tree is in git so before we clone it, let's configure git.

$ git config --global user.name "Your Full Name" $ git config --global user.email "your@email.address"

Read carefully Development using git to grasp basic Git operations and how to configure for sending email patches.

Now we can clone the aports tree.

$ git clone https://gitlab.alpinelinux.org/alpine/aports

Before we start creating or modifying APKBUILD files, we need to setup abuild for our system and user. Edit the file /etc/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.

To use 'abuild -r' command to install dependency packages automatically.

# addgroup <yourusername> abuild

We also need to prepare the location where the build process caches files when they are downloaded. By default this is /var/cache/distfiles/. To create this directory and ensure that it is writeable, enter the following commands:

# mkdir -p /var/cache/distfiles

# chmod a+w /var/cache/distfiles

As an alternative to the second command, you can add yourself to the abuild group:

# chgrp abuild /var/cache/distfiles

# chmod g+w /var/cache/distfiles

Note: Remember to logout and login again for the group change to have effect.

The last step is to configure the security keys with the abuild-keygen script for abuild with the command:

# abuild-keygen -a -i

If you want to share the generated keys between multiple computers (~/.abuild), you will have to manually copy the generated public key into /etc/apk/keys for the signing process of generated packages to work, example:

# cp /home/user/.abuild/user@domain.tld-12345abc.rsa.pub /etc/apk/keys