--- /usr/bin/makepkg 2009-01-06 21:18:59.000000000 -0500 +++ makepkg 2009-02-07 20:44:38.000000000 -0500 @@ -41,7 +41,7 @@ startdir="$PWD" srcdir="$startdir/src" pkgdir="$startdir/pkg" -known_options=('strip' 'docs' 'libtool' 'emptydirs' 'zipman' 'ccache' 'distcc' 'makeflags' 'force') +known_options=('strip' 'docs' 'libtool' 'emptydirs' 'zipman' 'ccache' 'distcc' 'makeflags' 'force' 'check') readonly -a known_options # Options @@ -670,17 +670,24 @@ MAKEFLAGS="" fi - msg "$(gettext "Starting build()...")" - cd "$srcdir" - # ensure all necessary build variables are exported export CFLAGS CXXFLAGS MAKEFLAGS CHOST # save our shell options so build() can't override what we need local shellopts=$(shopt -p) + # run_build is called 3 times. Once each for build(), check(), and inst(). If + # the PKGBUILD does not have such a function, skip it for backwards + # compatability reasons. + if ! type -t $1 |grep -q function ; then + return 0 + fi + + msg "$(gettext "Starting ${1}()...")" + [ -d ${srcdir}/${pkgname}-${pkgver} ] && cd ${srcdir}/${pkgname}-${pkgver} + local ret=0 if [ "$LOGGING" = "1" ]; then - BUILDLOG="${startdir}/${pkgname}-${pkgver}-${pkgrel}-${CARCH}.log" + BUILDLOG="${startdir}/${pkgname}-${pkgver}-${pkgrel}-${CARCH}-${1}.log" if [ -f "$BUILDLOG" ]; then local i=1 while true; do @@ -693,10 +700,11 @@ mv "$BUILDLOG" "$BUILDLOG.$i" fi - build 2>&1 | tee "$BUILDLOG"; ret=${PIPESTATUS[0]} + $1 2>&1 | tee "$BUILDLOG"; ret=${PIPESTATUS[0]} else - build 2>&1 || ret=$? + $1 2>&1 || ret=$? fi + # reset our shell options eval "$shellopts" @@ -1522,7 +1530,9 @@ if [ "$REPKG" = "1" ]; then warning "$(gettext "Skipping build.")" else - run_build + run_build "build" + [ "$(check_option check)" = "y" ] && run_build "check" + run_build "inst" tidy_install fi @@ -1619,7 +1629,9 @@ warning "$(gettext "Skipping build.")" else devel_update - run_build + run_build "build" + [ "$(check_option check)" = "y" ] && run_build "check" + run_build "inst" tidy_install fi