2002-03-18 09:36:01 +00:00
|
|
|
.TH makepkg 8 "Mar 17, 2002" "makepkg #VERSION#" ""
|
|
|
|
.SH NAME
|
|
|
|
makepkg \- package build utility
|
|
|
|
.SH SYNOPSIS
|
|
|
|
\fBmakepkg\fP
|
|
|
|
.SH DESCRIPTION
|
|
|
|
\fBmakepkg\fP will build packages for you. All it needs is
|
|
|
|
a build-capable linux platform, wget, and some build scripts. The advantage
|
|
|
|
to a script-based build is that you only really do the work once. Once you
|
|
|
|
have the build script for a package, you just need to run makepkg and it
|
|
|
|
will do the rest: download source files, configure the buildtime settings,
|
|
|
|
build the package, install the package into a temporary root, make
|
|
|
|
customizations, and package the whole thing up for pacman to use.
|
|
|
|
|
|
|
|
\fBmakeworld\fP can be used to rebuild an entire package group, or the
|
|
|
|
entire build tree.
|
|
|
|
.SH BUILD PROCESS (or How To Build Your Own Packages)
|
|
|
|
Start in an isolated directory (ie, it's not used for anything other
|
|
|
|
than building this package). The build script should be called PKGBUILD
|
|
|
|
and it should bear resemblance to the example below.
|
|
|
|
|
|
|
|
.TP
|
|
|
|
.TP
|
|
|
|
.SH PKGBUILD Example:
|
|
|
|
.RS
|
|
|
|
.nf
|
|
|
|
pkgname=modutils
|
|
|
|
pkgver=2.4.13
|
|
|
|
pkgrel=1
|
|
|
|
backup=(etc/modules.conf)
|
|
|
|
source=(ftp://ftp.server.com/$pkgname-$pkgver.tar.gz modules.conf)
|
|
|
|
|
|
|
|
build() {
|
|
|
|
cd $startdir/src/$pkgname-$pkgver
|
|
|
|
./configure --prefix=/usr
|
|
|
|
make || return 1
|
|
|
|
make prefix=$startdir/pkg/usr install
|
|
|
|
# copy our custom modules.conf into the package root
|
|
|
|
mkdir -p $startdir/pkg/etc
|
|
|
|
cp ../modules.conf $startdir/pkg/etc
|
|
|
|
}
|
|
|
|
.fi
|
|
|
|
.RE
|
|
|
|
|
|
|
|
As you can see, the setup is fairly simple. The first three lines define
|
|
|
|
the package name and version info. They also define the final package name,
|
|
|
|
which will be of the form $pkgname-$pkgver-$pkgrel.pkg.tar.gz
|
|
|
|
|
|
|
|
The sources are then decompressed (if necessary) into a directory called ./src.
|
|
|
|
Then the \fIbuild\fP function is called. This is where all package configuration,
|
|
|
|
building, and installing should be done. Any customization will likely take
|
|
|
|
place here.
|
|
|
|
|
|
|
|
After a package is built, the \fIbuild\fP function must install the package
|
|
|
|
files into a special package root, which can be referenced by \fB$startdir/pkg\fP
|
|
|
|
in the \fIbuild\fP function. The typical way to do this is one of the following:
|
|
|
|
.RS
|
|
|
|
.nf
|
|
|
|
|
|
|
|
make DESTDIR=$startdir/pkg install
|
|
|
|
|
|
|
|
or
|
|
|
|
|
|
|
|
make prefix=$startdir/pkg/usr install
|
|
|
|
|
|
|
|
.fi
|
|
|
|
.RE
|
|
|
|
Notice that the "/usr" portion should be present with "prefix", but not "DESTDIR."
|
|
|
|
|
|
|
|
Once the package is successfully installed into the package root, \fImakepkg\fP
|
|
|
|
will remove some directories (as per Arch Linux package guidelines; if you use
|
|
|
|
this elsewhere, feel free to change it) like /usr/doc and /usr/info. It will
|
2002-04-03 08:40:12 +00:00
|
|
|
then strip debugging info from libraries and binaries and compress everything
|
|
|
|
into a .pkg.tar.gz file in the directory you ran \fBmakepkg\fP from.
|
2002-03-18 09:36:01 +00:00
|
|
|
|
2002-04-30 18:53:55 +00:00
|
|
|
At this point you should have a package file in the current directory, named
|
|
|
|
something like name-version-release.pkg.tar.gz. Done!
|
|
|
|
|
|
|
|
.SH Install/Upgrade/Remove Scripting
|
|
|
|
Pacman has the ability to store and execute a package-specific script when it
|
|
|
|
installs, removes, or upgrades a package. This allows a package to "configure
|
|
|
|
itself" after installation and do the opposite right before it is removed.
|
|
|
|
|
|
|
|
The exact time the script is run varies with each operation:
|
|
|
|
.TP
|
|
|
|
.B post_install
|
|
|
|
script is run right after files are installed.
|
|
|
|
|
|
|
|
.TP
|
|
|
|
.B post_upgrade
|
|
|
|
script is run after all files have been upgraded.
|
|
|
|
|
|
|
|
.TP
|
|
|
|
.B pre_remove
|
|
|
|
script is run right before files are removed.
|
|
|
|
|
|
|
|
.RE
|
|
|
|
In order to use this feature, your build function should put the script in
|
|
|
|
$startdir/pkg/var/lib/pacman/scripts and it must be named exactly the same
|
|
|
|
as the \fI$pkgname\fP variable in the PKGBUILD script. For example, an
|
|
|
|
install script for grep will be $startdir/pkg/var/lib/pacman/scripts/grep.
|
|
|
|
Note that the scripts should be 644, not 755 (we don't need execute permission).
|
|
|
|
|
|
|
|
.TP
|
|
|
|
.TP
|
|
|
|
.SH Install scripts must follow this format:
|
|
|
|
.RS
|
|
|
|
.nf
|
|
|
|
# arg 1: the new package version
|
|
|
|
post_install() {
|
|
|
|
#
|
|
|
|
# do post-install stuff here
|
|
|
|
#
|
|
|
|
}
|
|
|
|
|
|
|
|
# arg 1: the new package version
|
|
|
|
# arg 2: the old package version
|
|
|
|
post_upgrade() {
|
|
|
|
#
|
|
|
|
# do post-upgrade stuff here
|
|
|
|
#
|
|
|
|
}
|
|
|
|
|
|
|
|
# arg 1: the old package version
|
|
|
|
pre_remove() {
|
|
|
|
#
|
|
|
|
# do pre-remove stuff here
|
|
|
|
#
|
|
|
|
}
|
|
|
|
|
|
|
|
op=$1
|
|
|
|
shift
|
|
|
|
|
|
|
|
$op $*
|
|
|
|
.fi
|
|
|
|
.RE
|
|
|
|
|
|
|
|
This template is also available in your ABS tree (/usr/abs/install.proto).
|
|
|
|
|
2002-03-18 09:36:01 +00:00
|
|
|
.SH PKGBUILD Directives
|
2002-04-30 18:53:55 +00:00
|
|
|
.TP
|
|
|
|
.B pkgname
|
|
|
|
The name of the package. This has be a unix-friendly name as it will be
|
|
|
|
used in the package filename.
|
|
|
|
|
|
|
|
.TP
|
|
|
|
.B pkgver
|
|
|
|
This is the version of the software as released from the author (eg, 2.7.1).
|
|
|
|
|
|
|
|
.TP
|
|
|
|
.B pkgrel
|
|
|
|
This is the release number specific to Arch Linux packages.
|
|
|
|
|
2002-03-18 09:36:01 +00:00
|
|
|
.TP
|
|
|
|
.B backup
|
2002-04-03 08:40:12 +00:00
|
|
|
A space-delimited array of filenames (without a preceding slash). The
|
2002-03-18 09:36:01 +00:00
|
|
|
\fIbackup\fP line will be propagated to the package meta-info file for
|
|
|
|
pacman. This will designate all files listed there to be backed up if this
|
|
|
|
package is ever removed from a system.
|
|
|
|
|
|
|
|
.TP
|
|
|
|
.B source
|
|
|
|
The \fIsource\fP line is an array of source files required to build the
|
|
|
|
package. Source files must reside in the same directory as the PKGBUILD
|
|
|
|
file, unless they have a fully-qualified URL. Then if the source file
|
|
|
|
does not already exist in /var/cache/pacman/src, the file is downloaded
|
|
|
|
by wget.
|
|
|
|
|
|
|
|
.SH CONFIGURATION
|
|
|
|
Configuration options are stored in /etc/makepkg.conf. This file is parsed
|
|
|
|
as a bash script, so you can export any special compiler flags you wish
|
|
|
|
to use. This is helpful for building for different architectures, or with
|
|
|
|
different optimizations.
|
|
|
|
|
|
|
|
\fBNOTE:\fP This does not guarantee that all package Makefiles will use
|
|
|
|
your exported variables. Some of them are flaky...
|
|
|
|
.SH AUTHOR
|
|
|
|
.nf
|
|
|
|
Judd Vinet <jvinet@zeroflux.org>
|
|
|
|
.fi
|