Makepkg (Italiano)

From ArchWiki
Revision as of 21:02, 13 January 2008 by BaSh (Talk | contribs) (New page: Category:Package management (Italiano) Category:About Arch (Italiano) Category:Development (Italiano) Category:HOWTOs (Italiano) {{translateme}} {{i18n_links_start}} {{i18n...)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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 is used for compiling your own packages suitable for Pacman to use. It uses a script-based build system which can download and validate source files, check dependencies, configure build time settings, build the package, install the package into a temporary root, make customizations, generate meta-info and package the whole thing up. As you can see makepkg has a lot of features, the basics of which are described below.

Setting Things Up

ABS - The Arch Build System

First make sure you have all the necessary tools installed in order to run abs/makepkg and to actually compile software from their sources:

pacman -Sy base-devel

Answer 'Y' or just press Enter.

You could now run abs to fetch all the PKGBUILDs and associated files from which the original Arch packages are being built:

abs

That will recreate the CVS hierarchy under /var/abs on your harddrive. By default some repositories are disabled; you'd have to edit /etc/abs/abs.conf first and remove the exclamation marks.

As /var/abs is normally owned by root (it's part of the 'filesystem' package) and most people and guides assume for you to build packages inside /var/abs/local, you need to allow your user to access it:

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