]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
kbuild: control extra pacman packages with PACMAN_EXTRAPACKAGES
authorJose Fernandez <jose.fernandez@linux.dev>
Tue, 13 Aug 2024 01:16:19 +0000 (19:16 -0600)
committerMasahiro Yamada <masahiroy@kernel.org>
Sun, 1 Sep 2024 11:34:49 +0000 (20:34 +0900)
Introduce the PACMAN_EXTRAPACKAGES variable in PKGBUILD to allow users
to specify which additional packages are built by the pacman-pkg target.

Previously, the api-headers package was always included, and the headers
package was included only if CONFIG_MODULES=y. With this change, both
headers and api-headers packages are included by default. Users can now
control this behavior by setting PACMAN_EXTRAPACKAGES to a
space-separated list of desired extra packages or leaving it empty to
exclude all.

For example, to build only the base package without extras:

make pacman-pkg PACMAN_EXTRAPACKAGES=""

Signed-off-by: Jose Fernandez <jose.fernandez@linux.dev>
Reviewed-by: Peter Jung <ptr1337@cachyos.org>
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
Tested-by: Nathan Chancellor <nathan@kernel.org>
Reviewed-by: Christian Heusel <christian@heusel.eu>
Tested-by: Christian Heusel <christian@heusel.eu>
Acked-by: Thomas Weißschuh <linux@weissschuh.net>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
scripts/package/PKGBUILD

index 663ce300dd06df838b5627f35f10241c2a263c44..fbd7eb10a52c5c9f855c2fb755e01a2258590444 100644 (file)
@@ -3,10 +3,13 @@
 # Contributor: Jan Alexander Steffens (heftig) <heftig@archlinux.org>
 
 pkgbase=${PACMAN_PKGBASE:-linux-upstream}
-pkgname=("${pkgbase}" "${pkgbase}-api-headers")
-if grep -q CONFIG_MODULES=y include/config/auto.conf; then
-       pkgname+=("${pkgbase}-headers")
-fi
+pkgname=("${pkgbase}")
+
+_extrapackages=${PACMAN_EXTRAPACKAGES-headers api-headers}
+for pkg in $_extrapackages; do
+       pkgname+=("${pkgbase}-${pkg}")
+done
+
 pkgver="${KERNELRELEASE//-/_}"
 # The PKGBUILD is evaluated multiple times.
 # Running scripts/build-version from here would introduce inconsistencies.
@@ -77,10 +80,13 @@ _package-headers() {
        cd "${objtree}"
        local builddir="${pkgdir}/usr/${MODLIB}/build"
 
-       echo "Installing build files..."
-       "${srctree}/scripts/package/install-extmod-build" "${builddir}"
+       if grep -q CONFIG_MODULES=y include/config/auto.conf; then
+               echo "Installing build files..."
+               "${srctree}/scripts/package/install-extmod-build" "${builddir}"
+       fi
 
        echo "Installing System.map and config..."
+       mkdir -p "${builddir}"
        cp System.map "${builddir}/System.map"
        cp .config "${builddir}/.config"