summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorAllan McRae <allan@archlinux.org>2011-06-15 14:32:42 +1000
committerDan McGee <dan@archlinux.org>2011-06-22 10:45:55 -0500
commit508b360c24ddfdb79f66cc14b197988a829b0ecd (patch)
tree32b0e68a2c9ee5d272673c91f1ee4f21da100863 /scripts
parentb803a33a8fc2ef86ba2d986c36f31524532d454b (diff)
downloadpacman-508b360c24ddfdb79f66cc14b197988a829b0ecd.tar.xz
makepkg: allow specifying alternative build directory
Add a BUILDDIR variable (which can be overridden in the environment) to specify an alternative location for building the package. This is useful for people who want to build on a different filesystem for improved performance (e.g. tmpfs). Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/makepkg.sh.in18
1 files changed, 16 insertions, 2 deletions
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index b0247bdf..09eacbb1 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -41,8 +41,6 @@ myver='@PACKAGE_VERSION@'
confdir='@sysconfdir@'
BUILDSCRIPT='@BUILDSCRIPT@'
startdir="$PWD"
-srcdir="$startdir/src"
-pkgdir="$startdir/pkg"
packaging_options=('strip' 'docs' 'libtool' 'emptydirs' 'zipman' 'purge' 'upx')
other_options=('ccache' 'distcc' 'buildflags' 'makeflags')
@@ -1726,6 +1724,7 @@ done
[[ -n ${PKGDEST} ]] && _PKGDEST=$(canonicalize_path ${PKGDEST})
[[ -n ${SRCDEST} ]] && _SRCDEST=$(canonicalize_path ${SRCDEST})
[[ -n ${SRCPKGDEST} ]] && _SRCPKGDEST=$(canonicalize_path ${SRCPKGDEST})
+[[ -n ${BUILDDIR} ]] && _BUILDDIR=$(canonicalize_path ${BUILDDIR})
[[ -n ${PKGEXT} ]] && _PKGEXT=${PKGEXT}
[[ -n ${SRCEXT} ]] && _SRCEXT=${SRCEXT}
[[ -n ${GPGKEY} ]] && _GPGKEY=${GPGKEY}
@@ -1773,6 +1772,21 @@ fi
readonly ALL_OFF BOLD BLUE GREEN RED YELLOW
# override settings with an environment variable for batch processing
+BUILDDIR=${_BUILDDIR:-$BUILDDIR}
+BUILDDIR=${BUILDDIR:-$startdir} #default to $startdir if undefined
+if [[ ! -d $BUILDDIR ]]; then
+ mkdir -p "$BUILDDIR" ||
+ error "$(gettext "You do not have write permission to create packages in %s.")" "$BUILDDIR"
+ chmod a-s "$BUILDDIR"
+fi
+if [[ ! -w $BUILDDIR ]]; then
+ error "$(gettext "You do not have write permission to create packages in %s.")" "$BUILDDIR"
+ plain "$(gettext "Aborting...")"
+ exit 1
+fi
+srcdir="$BUILDDIR/src"
+pkgdir="$BUILDDIR/pkg"
+
PKGDEST=${_PKGDEST:-$PKGDEST}
PKGDEST=${PKGDEST:-$startdir} #default to $startdir if undefined
if [[ ! -w $PKGDEST ]]; then