objtree is defined and exported by the top-level Makefile. I prefer not to override it. There is no need to pass the absolute path of objtree. PKGBUILD can detect it by itself.
Unified · Split
| @@ -147,8 +147,7 @@ snap-pkg: · 146 unmodified lines | |||
| 147 | PHONY += pacman-pkg | 147 | PHONY += pacman-pkg |
| 148 | pacman-pkg: | 148 | pacman-pkg: |
| 149 | @ln -srf $(srctree)/scripts/package/PKGBUILD $(objtree)/PKGBUILD | 149 | @ln -srf $(srctree)/scripts/package/PKGBUILD $(objtree)/PKGBUILD |
| 150 | +objtree="$(realpath $(objtree))" \ | 150 | +BUILDDIR="$(realpath $(objtree))/pacman" \ |
| 151 | BUILDDIR="$(realpath $(objtree))/pacman" \ | ||
| 152 | CARCH="$(UTS_MACHINE)" \ | 151 | CARCH="$(UTS_MACHINE)" \ |
| 153 | KBUILD_MAKEFLAGS="$(MAKEFLAGS)" \ | 152 | KBUILD_MAKEFLAGS="$(MAKEFLAGS)" \ |
| 154 | KBUILD_REVISION="$(shell $(srctree)/scripts/build-version)" \ | 153 | KBUILD_REVISION="$(shell $(srctree)/scripts/build-version)" \ |
| @@ -40,7 +40,9 @@ _prologue() { · 39 unmodified lines | |||
| 40 | # MAKEFLAGS from makepkg.conf override the ones inherited from kbuild. | 40 | # MAKEFLAGS from makepkg.conf override the ones inherited from kbuild. |
| 41 | # Bypass this override with a custom variable. | 41 | # Bypass this override with a custom variable. |
| 42 | export MAKEFLAGS="${KBUILD_MAKEFLAGS}" | 42 | export MAKEFLAGS="${KBUILD_MAKEFLAGS}" |
| 43 | cd "${objtree}" | 43 | |
| 44 | # Kbuild works in the output directory, where this PKGBUILD is located. | ||
| 45 | cd "$(dirname "${BASH_SOURCE[0]}")" | ||
| 44 | } | 46 | } |
| 45 | 47 | ||
| 46 | build() { | 48 | build() { |