Commit b6223c2d authored by Masahiro Yamada's avatar Masahiro Yamada

kbuild: pacman-pkg: move common commands to a separate function

All build and package functions share the following commands:

  export MAKEFLAGS="${KBUILD_MAKEFLAGS}"
  cd "${objtree}"

Factor out the common code.
Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
Acked-by: default avatar  Thomas Weißschuh <linux@weissschuh.net>
Reviewed-by: default avatarNathan Chancellor <nathan@kernel.org>
Reviewed-by: default avatarChristian Heusel <christian@heusel.eu>
parent e6b65ee1
...@@ -36,11 +36,15 @@ makedepends=( ...@@ -36,11 +36,15 @@ makedepends=(
) )
options=(!debug !strip !buildflags !makeflags) options=(!debug !strip !buildflags !makeflags)
build() { _prologue() {
# MAKEFLAGS from makepkg.conf override the ones inherited from kbuild. # MAKEFLAGS from makepkg.conf override the ones inherited from kbuild.
# Bypass this override with a custom variable. # Bypass this override with a custom variable.
export MAKEFLAGS="${KBUILD_MAKEFLAGS}" export MAKEFLAGS="${KBUILD_MAKEFLAGS}"
cd "${objtree}" cd "${objtree}"
}
build() {
_prologue
${MAKE} KERNELRELEASE="${KERNELRELEASE}" KBUILD_BUILD_VERSION="${pkgrel}" ${MAKE} KERNELRELEASE="${KERNELRELEASE}" KBUILD_BUILD_VERSION="${pkgrel}"
} }
...@@ -48,10 +52,10 @@ build() { ...@@ -48,10 +52,10 @@ build() {
_package() { _package() {
pkgdesc="The ${pkgdesc} kernel and modules" pkgdesc="The ${pkgdesc} kernel and modules"
export MAKEFLAGS="${KBUILD_MAKEFLAGS}"
cd "${objtree}"
local modulesdir="${pkgdir}/usr/${MODLIB}" local modulesdir="${pkgdir}/usr/${MODLIB}"
_prologue
echo "Installing boot image..." echo "Installing boot image..."
# systemd expects to find the kernel here to allow hibernation # systemd expects to find the kernel here to allow hibernation
# https://github.com/systemd/systemd/commit/edda44605f06a41fb86b7ab8128dcf99161d2344 # https://github.com/systemd/systemd/commit/edda44605f06a41fb86b7ab8128dcf99161d2344
...@@ -76,10 +80,10 @@ _package() { ...@@ -76,10 +80,10 @@ _package() {
_package-headers() { _package-headers() {
pkgdesc="Headers and scripts for building modules for the ${pkgdesc} kernel" pkgdesc="Headers and scripts for building modules for the ${pkgdesc} kernel"
export MAKEFLAGS="${KBUILD_MAKEFLAGS}"
cd "${objtree}"
local builddir="${pkgdir}/usr/${MODLIB}/build" local builddir="${pkgdir}/usr/${MODLIB}/build"
_prologue
if grep -q CONFIG_MODULES=y include/config/auto.conf; then if grep -q CONFIG_MODULES=y include/config/auto.conf; then
echo "Installing build files..." echo "Installing build files..."
"${srctree}/scripts/package/install-extmod-build" "${builddir}" "${srctree}/scripts/package/install-extmod-build" "${builddir}"
...@@ -100,8 +104,7 @@ _package-api-headers() { ...@@ -100,8 +104,7 @@ _package-api-headers() {
provides=(linux-api-headers) provides=(linux-api-headers)
conflicts=(linux-api-headers) conflicts=(linux-api-headers)
export MAKEFLAGS="${KBUILD_MAKEFLAGS}" _prologue
cd "${objtree}"
${MAKE} headers_install INSTALL_HDR_PATH="${pkgdir}/usr" ${MAKE} headers_install INSTALL_HDR_PATH="${pkgdir}/usr"
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment