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

From Alpine Linux
No edit summary
m (fix typo)
(4 intermediate revisions by 3 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. Install those packages now:  
Install those packages now:  


{{Cmd|apk add alpine-sdk}}
{{Cmd|apk add alpine-sdk}}
Line 8: Line 7:
{{Cmd|adduser <yourusername>}}
{{Cmd|adduser <yourusername>}}


To make life easier later, it's a good idea to add this user to /etc/sudoers. Append the line
To make life easier later, it's a good idea to add this user to {{Path|/etc/sudoers}}. Append the line


  <yourusername>    ALL=(ALL) ALL
  <yourusername>    ALL=(ALL) ALL
Line 18: Line 17:
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.
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.


The [[Aports_tree|aports tree]] is in git so before we clone the [[Aports_tree|aports tree]] we should 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 configure email patches sending.
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|aports tree]].  
Now we can clone the [[Aports_tree|aports tree]].  


{{Cmd|git clone git://dev.alpinelinux.org/aports}}
NOTE: You can also clone aports from our github https://github.com/alpinelinux/aports


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.
{{Cmd|git clone git://git.alpinelinux.org/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:


{{Cmd|sudo vi /etc/abuild.conf}}
{{Cmd|sudo vi /etc/abuild.conf}}


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:
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|sudo mkdir -p /var/cache/distfiles}}
To use 'abuild -r' command to install dependency packages automatically.
{{Cmd|sudo chmod a+w /var/cache/distfiles}}
{{Cmd|sudo addgroup <yourusername> abuild}}


Or add yourself to the abuild group
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 addgroup <yourusername> abuild}}
{{Cmd|sudo mkdir -p /var/cache/distfiles
sudo chmod a+w /var/cache/distfiles}}
 
As an alternative to the second command, you can add yourself to the abuild group:
 
{{Cmd|sudo chgrp abuild /var/cache/distfiles
sudo chmod g+w /var/cache/distfiles}}


{{Note|<nowiki>remember to logout and login again for the group change to have effect.</nowiki>}}
{{Note|Remember to logout and login again for the group change to have effect.}}


The last step in preparation 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|abuild-keygen -a -i}}
{{Cmd|abuild-keygen -a -i}}


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

Revision as of 08:03, 23 April 2018

The alpine-sdk is a metapackage that pulls in the most essential packages used to build new packages. Install those packages now:

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:

adduser <yourusername>

To make life easier later, it's a good idea to add this user to /etc/sudoers. Append the line

<yourusername>    ALL=(ALL) ALL

using the command:

visudo

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.

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.

NOTE: You can also clone aports from our github https://github.com/alpinelinux/aports

git clone git://git.alpinelinux.org/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:

sudo vi /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.

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

sudo 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:

sudo mkdir -p /var/cache/distfiles sudo chmod a+w /var/cache/distfiles

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

sudo chgrp abuild /var/cache/distfiles sudo 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