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

From Alpine Linux
m (Fix Cmd template syntax (thanks Hello71))
(This wiki page forced people to use doas and nano, when there are other permission elevators and editors. I removed all mentions of nano and just instructed the reader to edit the file, and changed commands to $ and #.)
Line 1: Line 1:
The {{Pkg|alpine-sdk}} is a metapackage that pulls in the most essential packages used to build new packages. We'll also install doas to perform superuser operations, and nano to allow us to edit text:
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.


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


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 doas.
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 doas.
Line 7: Line 7:
The [[Aports_tree|aports tree]] is in git so before we clone the it, let's configure git.
The [[Aports_tree|aports tree]] is in git so before we clone the it, let's configure git.


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


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


Before we start creating or modifying [[APKBUILD_Reference|APKBUILD]] files, we need to setup abuild for our system and user. Edit the file {{Path|abuild.conf}} to your requirements:
Before we start creating or modifying [[APKBUILD_Reference|APKBUILD]] files, we need to setup abuild for our system and user. Edit the file {{Path|abuild.conf}} to your requirements.
 
{{Cmd|doas nano /etc/abuild.conf}}


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.
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.
To use 'abuild -r' command to install dependency packages automatically.
{{Cmd|doas addgroup <yourusername> abuild}}
{{Cmd|# addgroup <yourusername> abuild}}


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:
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|doas mkdir -p /var/cache/distfiles
{{Cmd|# mkdir -p /var/cache/distfiles
doas chmod a+w /var/cache/distfiles}}
# chmod a+w /var/cache/distfiles}}


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


{{Cmd|doas chgrp abuild /var/cache/distfiles
{{Cmd|# chgrp abuild /var/cache/distfiles
doas chmod g+w /var/cache/distfiles}}
# chmod g+w /var/cache/distfiles}}


{{Note|Remember to logout and login again for the group change to have effect.}}
{{Note|Remember to logout and login again for the group change to have effect.}}
Line 39: Line 37:
The last step is to configure the security keys with the [[Abuild-keygen|abuild-keygen]] script for [[Abuild|abuild]] with the command:
The last step is to configure the security keys with the [[Abuild-keygen|abuild-keygen]] script for [[Abuild|abuild]] with the command:


{{Cmd|1=SUDO=doas abuild-keygen -a -i}}
{{Cmd|# abuild-keygen -a -i}}


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

Revision as of 23:37, 27 April 2022

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 doas.

The aports tree is in git so before we clone the 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 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

  1. 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

  1. 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