Makepkg (Italiano)

From ArchWiki
Revision as of 06:17, 2 May 2008 by Marco.it (Talk | contribs)

Jump to: navigation, search

Tango-preferences-desktop-locale.pngThis article or section needs to be translated.Tango-preferences-desktop-locale.png

Notes: please use the first argument of the template to provide more detailed indications. (Discuss in Talk:Makepkg (Italiano)#)
Template:I18n links start

Template:I18n entry Template:I18n entry Template:I18n links end makepkg è usato per compilare i nostri pacchetti per poterli usare con Pacman. Usa uno script-base sviluppato su un sistema che può scaricare e verificare i sorgenti dei file, controllare le dipendenze, configurare le impostazioni, creare un pacchetto, installare il pacchetto in una radice temporanea, personalizzare i pacchetti. Come si può vedere makepkg ha molte caratteristiche, le caratteristiche base vengono descritte di seguito.

Setting Things Up

ABS - The Arch Build System

Assicurati dapprima di avere tutti gli strumenti necessari per avviare abs/makepkg e, quindi, compilare il software dai sorgenti:

pacman -Sy base-devel

Rispondi 'S' oppure premi Invio.

A questo punto potresti lanciare abs per ottenere tutti i PKGBUILD e i file associati da cui i pacchetti originali di Arch sono stati costruiti:

abs

Ciò ricreerà la CVS hierarchy sotto /var/abs sul tuo hard disk. Per default alcuni repository sono disabilitati; prima dovrai modificare /etc/abs/abs.conf e rimuovere i punti esclamativi.

Dato che /var/abs è normalmente di proprietà dell'utente root (è parte del pacchetto 'filesystem') e la maggior parte delle persone e delle guide presumono di costruire tali pacchetti in /var/abs/local, hai bisogno di permettere al tuo utente di accedervi:

groupadd abs
gpasswd -a $USER abs
chown root:abs /var/abs/local
chmod 775 /var/abs/local

Makepkg

If you want to be able to install dependencies with makepkg as user (with makepkg -s, see below) you need to install sudo and add yourself to /etc/sudoers using this line:

<user> <hostname>=/usr/sbin/pacman

Next you need to decide where you want your finished packages to be placed, for instance you could have them under your home directory under a separate folder. You can also skip this step, and your packages will be created in the same directory where you've started makepkg.

Create the directory:

mkdir /home/$USER/packages

Then modify the PKGDEST variable in /etc/makepkg.conf accordingly.

While you're at it, you could also have a look at the other values in makepkg.conf. For example, you could edit PACKAGER, or remove the ! from docs in the default OPTIONS array, in case you don't want the /usr/share/doc/<package> directory to be deleted by makepkg. See makepkg.conf(5) for more.

Building a Package

To build a package you either need to create one as described at The_Arch_package_making_HOW-TO_-_with_guidelines, or obtain one from AUR or ABS (see above) or some other source. You should be careful where you obtain your packages from and only install those from people and sources you trust.

Say you found an excellent package on AUR that you wanted to build and install (in this example we will use "rufus", a Python based bit torrent client). You can obtain the PKGBUILD and all files needed from its AUR page, click on the "Tarball" link.

cd /path/to/file
tar -zxf rufus.tar.gz
cd rufus

You will notice there are a number of files located under this directory, including the PKGBUILD script that is used to build your package. To build this package just issue (as your normal user):

makepkg

which will then set up, download and attempt to build your package. If you don't have all the required dependencies installed, makepkg will warn you before failing. To build your package and install these dependencies, simply use the command:

makepkg -s

Note that these dependences will need to be in your configured repositories. Alternatively, you can manually download the packages first using pacman -Sy dep1 dep2 etc.

Once you have satisfied all the dependencies and your package builds successfully you should now have the rufus-0.7.0-1.pkg.tar.gz file in the directory you run makepkg in. To install it (as the root user) issue:

pacman -U rufus-0.7.0-1.pkg.tar.gz

Congratulations! You now have successfully installed your own package!

Useful Links