Allan McRae wrote:
This patch allows us to split the building and packaging stages of
a PKGBUILD and minimize fakeroot usage. This can be done with less
code duplication (run_build and run_package look quite familiar) but
the run_package function will be where the package splitting logic
is implemented

Example usage:
# $Id: PKGBUILD 366 2008-04-19 13:01:23Z travis $
# Maintainer: Allan McRae <[EMAIL PROTECTED]>

pkgname=abs
pkgver=2.3
pkgrel=1
pkgdesc="Utilities to download and work with the Arch Build System (ABS)"
arch=('i686' 'x86_64')
url="http://projects.archlinux.org/git/?p=abs.git";
license=('GPL')
depends=('bash' 'rsync')
backup=(etc/abs.conf)
install=abs.install
source=(ftp://ftp.archlinux.org/other/abs/${pkgname}-${pkgver}.tar.gz)
md5sums=('d6fd791aa487ba8bb5ff48c3ace20592')

build() {
 cd ${srcdir}/${pkgname}
 make CONFDIR=/etc/ || return 1

 # change ABS tags for x86_64 to correct values
 if [ "$CARCH" = "x86_64" ]; then
   sed -i "s|i686|x86_64|g" ${pkgdir}/etc/abs.conf
 fi
}

package() {
 cd ${srcdir}/${pkgname}
 make CONFDIR=/etc/ DESTDIR=${pkgdir} install || return 1

 # Add readme file, and make base /var/abs path
 install -dm0755 ${pkgdir}/var/abs/local/
 install -Dm0644 ${srcdir}/abs/README ${pkgdir}/var/abs/README
}

# vim: set ts=2 sw=2 noet:



Output:
> makepkg
==> Making package: abs 2.3-1 i686 (Sat Nov 22 13:58:08 EST 2008)
==> Checking Runtime Dependencies...
==> Checking Buildtime Dependencies...
==> Retrieving Sources...
 -> Found abs-2.3.tar.gz in build dir
==> Validating source files with md5sums...
   abs-2.3.tar.gz ... Passed
==> Extracting Sources...
 -> bsdtar -x -f abs-2.3.tar.gz
==> Removing existing pkg/ directory...
==> Starting build()...
<snip>
==> Entering fakeroot environment...
==> Starting package()...
<snip>
==> Tidying install...
 -> Compressing man and info pages...
 -> Stripping debugging symbols from binaries and libraries...
==> Creating package...
 -> Generating .PKGINFO file...
 -> Adding install script...
 -> Adding package changelog...
 -> Compressing package...
==> Leaving fakeroot environment.
==> Finished making: abs 2.3-1 i686 (Sat Nov 22 13:58:09 EST 2008)



_______________________________________________
pacman-dev mailing list
[email protected]
http://archlinux.org/mailman/listinfo/pacman-dev

Reply via email to