diff --git a/doc/makepkg.8.asciidoc b/doc/makepkg.8.asciidoc index 69a5fd64..35cca301 100644 --- a/doc/makepkg.8.asciidoc +++ b/doc/makepkg.8.asciidoc @@ -276,6 +276,14 @@ Environment Variables Directory where the package will be built. Overrides the corresponding value defined in linkman:makepkg.conf[5]. +**BUILDSRCDIR=**"/path/to/directory":: + Directory where the package source will be extracted. Overrides the + corresponding value defined in linkman:makepkg.conf[5]. + +**BUILDPKGDIR=**"/path/to/directory":: + Directory where the package files will be packaged prior to archival. + Overrides the corresponding value defined in linkman:makepkg.conf[5]. + **CARCH=**"(i686|x86_64)":: Force build for a specific architecture. Useful for cross-compiling. Overrides the corresponding value defined in linkman:makepkg.conf[5]. diff --git a/doc/makepkg.conf.5.asciidoc b/doc/makepkg.conf.5.asciidoc index f67b673b..b5dae2ca 100644 --- a/doc/makepkg.conf.5.asciidoc +++ b/doc/makepkg.conf.5.asciidoc @@ -147,6 +147,18 @@ Options Incorrect use of `$startdir` in a PKGBUILD may cause building with this option to fail. +**BUILDSRCDIR=**"/path/to/directory":: + If this value is not set, package source will, by default, be extracted in + a subdirectory of the build directory. This option allows setting the build + extraction location to another directory. Incorrect use of `$startdir` in a + PKGBUILD may cause building with this option to fail. + +**BUILDPKGDIR=**"/path/to/directory":: + If this value is not set, package files will, by default, be packaged in a + subdirectory of the build directory. This option allows setting the build + packaging location to another directory. 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. diff --git a/etc/makepkg.conf.in b/etc/makepkg.conf.in index 5e910c01..da91ec0a 100644 --- a/etc/makepkg.conf.in +++ b/etc/makepkg.conf.in @@ -69,8 +69,14 @@ BUILDENV=(!distcc color !ccache check !sign) #-- specify a space-delimited list of hosts running in the DistCC cluster. #DISTCC_HOSTS="" # -#-- Specify a directory for package building. +#-- Specify a directory for package building. Default: working directory #BUILDDIR=/tmp/makepkg +#-- Specify a directory for package source code extracted during build. +#-- Default: src directory inside build directory +#BUILDSRCDIR=/tmp/makepkg/src +#-- Specify a directory for package files prior to archival and compression. +#-- Default: pkg directory inside build directory +#BUILDPKGDIR=/tmp/makepkg/pkg ######################################################################### # GLOBAL PACKAGE OPTIONS diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 820d068f..ff76ebb4 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -1164,9 +1164,17 @@ if [[ $BUILDDIR -ef "$startdir" ]]; then srcdir="$BUILDDIR/src" pkgdirbase="$BUILDDIR/pkg" else - srcdir="$BUILDDIR/$pkgbase/src" - pkgdirbase="$BUILDDIR/$pkgbase/pkg" + if [[ -n "$BUILDSRCDIR" ]]; then + srcdir="$BUILDSRCDIR/$pkgbase" + else + srcdir="$BUILDDIR/$pkgbase/src" + fi + if [[ -n "$BUILDPKGDIR" ]]; then + pkgdirbase="$BUILDPKGDIR/$pkgbase" + else + pkgdirbase="$BUILDDIR/$pkgbase/pkg" + fi fi # set pkgdir to something "sensible" for (not recommended) use during build()