Merge branch 'voskresenie/add-srcdir-pkgdir-confs' into 'master'

Add BUILDSRCDIR and BUILDPKGDIR confs

See merge request pacman/pacman!229
This commit is contained in:
voskresenie 2025-06-24 20:33:34 +00:00
commit e4db5534b6
4 changed files with 37 additions and 3 deletions

View file

@ -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].

View file

@ -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.

View file

@ -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

View file

@ -1163,10 +1163,18 @@ basever=$(get_full_version)
if [[ $BUILDDIR -ef "$startdir" ]]; then
srcdir="$BUILDDIR/src"
pkgdirbase="$BUILDDIR/pkg"
else
if [[ -n "$BUILDSRCDIR" ]]; then
srcdir="$BUILDSRCDIR/$pkgbase"
else
srcdir="$BUILDDIR/$pkgbase/src"
pkgdirbase="$BUILDDIR/$pkgbase/pkg"
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()