mirror of
https://github.com/moparisthebest/pacman
synced 2024-12-21 23:38:49 -05:00
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>
This commit is contained in:
parent
b803a33a8f
commit
508b360c24
@ -206,6 +206,9 @@ Environment Variables
|
||||
Folder where the downloaded sources will be stored. Overrides the
|
||||
corresponding value defined in linkman:makepkg.conf[5].
|
||||
|
||||
**BUILDDIR=**"/path/to/folder"::
|
||||
Folder where the package will be built. Overrides the corresponding
|
||||
value defined in linkman:makepkg.conf[5].
|
||||
|
||||
Configuration
|
||||
-------------
|
||||
|
@ -110,6 +110,14 @@ Options
|
||||
running in the DistCC cluster. In addition, you will want to modify your
|
||||
`MAKEFLAGS`.
|
||||
|
||||
**BUILDDIR=**"/path/to/folder"::
|
||||
If this value is not set, packages will by default be built in
|
||||
subdirectories of the directory that makepkg is called from. This
|
||||
option allows setting the build location to another folder.
|
||||
Incorrect use of `$startdir` in a PKGBUILD may cause building with
|
||||
this option to fail.
|
||||
|
||||
|
||||
**GPGKEY=**""::
|
||||
Specify a key to use for gpg signing instead of the default key in the
|
||||
keyring. Can be overridden with makepkg's `--key` option.
|
||||
|
@ -54,6 +54,9 @@ BUILDENV=(fakeroot !distcc color !ccache check !sign)
|
||||
#-- If using DistCC, your MAKEFLAGS will also need modification. In addition,
|
||||
#-- specify a space-delimited list of hosts running in the DistCC cluster.
|
||||
#DISTCC_HOSTS=""
|
||||
#
|
||||
#-- Specify a directory for package building.
|
||||
#BUILDDIR=/tmp/makepkg
|
||||
|
||||
#########################################################################
|
||||
# GLOBAL PACKAGE OPTIONS
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user