diff mbox series

[2/2] kbuild: pacman-pkg: do not override objtree

Message ID 20240816141844.1217356-2-masahiroy@kernel.org (mailing list archive)
State New
Headers show
Series [1/2] kbuild: pacman-pkg: move common commands to a separate function | expand

Commit Message

Masahiro Yamada Aug. 16, 2024, 2:18 p.m. UTC
objtree is defined and exported by the top-level Makefile. I prefer
not to override it.

There is no need to pass the absolute pass of objtree. PKGBUILD can
detect it by itself.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---

 scripts/Makefile.package | 3 +--
 scripts/package/PKGBUILD | 4 +++-
 2 files changed, 4 insertions(+), 3 deletions(-)

Comments

Thomas Weißschuh Aug. 16, 2024, 7:01 p.m. UTC | #1
Aug 16, 2024 16:18:56 Masahiro Yamada <masahiroy@kernel.org>:

> objtree is defined and exported by the top-level Makefile. I prefer
> not to override it.
>
> There is no need to pass the absolute pass of objtree. PKGBUILD can

s/pass/path/g

> detect it by itself.
>
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>

Acked-by:  Thomas Weißschuh <linux@weissschuh.net>


> ---
>
> scripts/Makefile.package | 3 +--
> scripts/package/PKGBUILD | 4 +++-
> 2 files changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/scripts/Makefile.package b/scripts/Makefile.package
> index 4a80584ec771..2c261a0d42b0 100644
> --- a/scripts/Makefile.package
> +++ b/scripts/Makefile.package
> @@ -147,8 +147,7 @@ snap-pkg:
> PHONY += pacman-pkg
> pacman-pkg:
>     @ln -srf $(srctree)/scripts/package/PKGBUILD $(objtree)/PKGBUILD
> -   +objtree="$(realpath $(objtree))" \
> -       BUILDDIR="$(realpath $(objtree))/pacman" \
> +   BUILDDIR="$(realpath $(objtree))/pacman" \
>         CARCH="$(UTS_MACHINE)" \
>         KBUILD_MAKEFLAGS="$(MAKEFLAGS)" \
>         KBUILD_REVISION="$(shell $(srctree)/scripts/build-version)" \
> diff --git a/scripts/package/PKGBUILD b/scripts/package/PKGBUILD
> index e2d9c2601ca9..839cd5e634d2 100644
> --- a/scripts/package/PKGBUILD
> +++ b/scripts/package/PKGBUILD
> @@ -40,7 +40,9 @@ _prologue() {
>     # MAKEFLAGS from makepkg.conf override the ones inherited from kbuild.
>     # Bypass this override with a custom variable.
>     export MAKEFLAGS="${KBUILD_MAKEFLAGS}"
> -   cd "${objtree}"
> +
> +   # Kbuild works in the output directory, where this PKGBUILD is located.
> +   cd "$(dirname "${BASH_SOURCE[0]}")"
> }
>
> build() {
> --
> 2.43.0
Nathan Chancellor Aug. 16, 2024, 9 p.m. UTC | #2
On Fri, Aug 16, 2024 at 11:18:15PM +0900, Masahiro Yamada wrote:
> objtree is defined and exported by the top-level Makefile. I prefer
> not to override it.
> 
> There is no need to pass the absolute pass of objtree. PKGBUILD can
> detect it by itself.
> 
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>

Reviewed-by: Nathan Chancellor <nathan@kernel.org>

> ---
> 
>  scripts/Makefile.package | 3 +--
>  scripts/package/PKGBUILD | 4 +++-
>  2 files changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/scripts/Makefile.package b/scripts/Makefile.package
> index 4a80584ec771..2c261a0d42b0 100644
> --- a/scripts/Makefile.package
> +++ b/scripts/Makefile.package
> @@ -147,8 +147,7 @@ snap-pkg:
>  PHONY += pacman-pkg
>  pacman-pkg:
>  	@ln -srf $(srctree)/scripts/package/PKGBUILD $(objtree)/PKGBUILD
> -	+objtree="$(realpath $(objtree))" \
> -		BUILDDIR="$(realpath $(objtree))/pacman" \
> +	BUILDDIR="$(realpath $(objtree))/pacman" \
>  		CARCH="$(UTS_MACHINE)" \
>  		KBUILD_MAKEFLAGS="$(MAKEFLAGS)" \
>  		KBUILD_REVISION="$(shell $(srctree)/scripts/build-version)" \
> diff --git a/scripts/package/PKGBUILD b/scripts/package/PKGBUILD
> index e2d9c2601ca9..839cd5e634d2 100644
> --- a/scripts/package/PKGBUILD
> +++ b/scripts/package/PKGBUILD
> @@ -40,7 +40,9 @@ _prologue() {
>  	# MAKEFLAGS from makepkg.conf override the ones inherited from kbuild.
>  	# Bypass this override with a custom variable.
>  	export MAKEFLAGS="${KBUILD_MAKEFLAGS}"
> -	cd "${objtree}"
> +
> +	# Kbuild works in the output directory, where this PKGBUILD is located.
> +	cd "$(dirname "${BASH_SOURCE[0]}")"
>  }
>  
>  build() {
> -- 
> 2.43.0
>
Christian Heusel Aug. 17, 2024, 9:53 a.m. UTC | #3
On 24/08/16 11:18PM, Masahiro Yamada wrote:
> objtree is defined and exported by the top-level Makefile. I prefer
> not to override it.
> 
> There is no need to pass the absolute pass of objtree. PKGBUILD can
> detect it by itself.

Thomas already spotted the typo in the sentence above :)

> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
> ---

Reviewed-by: Christian Heusel <christian@heusel.eu>
Masahiro Yamada Aug. 23, 2024, 1:30 p.m. UTC | #4
On Fri, Aug 16, 2024 at 11:18 PM Masahiro Yamada <masahiroy@kernel.org> wrote:
>
> objtree is defined and exported by the top-level Makefile. I prefer
> not to override it.
>
> There is no need to pass the absolute pass of objtree. PKGBUILD can
> detect it by itself.
>
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
> ---
>
>  scripts/Makefile.package | 3 +--
>  scripts/package/PKGBUILD | 4 +++-
>  2 files changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/scripts/Makefile.package b/scripts/Makefile.package
> index 4a80584ec771..2c261a0d42b0 100644
> --- a/scripts/Makefile.package
> +++ b/scripts/Makefile.package
> @@ -147,8 +147,7 @@ snap-pkg:
>  PHONY += pacman-pkg
>  pacman-pkg:
>         @ln -srf $(srctree)/scripts/package/PKGBUILD $(objtree)/PKGBUILD
> -       +objtree="$(realpath $(objtree))" \
> -               BUILDDIR="$(realpath $(objtree))/pacman" \
> +       BUILDDIR="$(realpath $(objtree))/pacman" \


I restored the '+' prefix
when I applied this.






>                 CARCH="$(UTS_MACHINE)" \
>                 KBUILD_MAKEFLAGS="$(MAKEFLAGS)" \
>                 KBUILD_REVISION="$(shell $(srctree)/scripts/build-version)" \
> diff --git a/scripts/package/PKGBUILD b/scripts/package/PKGBUILD
> index e2d9c2601ca9..839cd5e634d2 100644
> --- a/scripts/package/PKGBUILD
> +++ b/scripts/package/PKGBUILD
> @@ -40,7 +40,9 @@ _prologue() {
>         # MAKEFLAGS from makepkg.conf override the ones inherited from kbuild.
>         # Bypass this override with a custom variable.
>         export MAKEFLAGS="${KBUILD_MAKEFLAGS}"
> -       cd "${objtree}"
> +
> +       # Kbuild works in the output directory, where this PKGBUILD is located.
> +       cd "$(dirname "${BASH_SOURCE[0]}")"
>  }
>
>  build() {
> --
> 2.43.0
>
diff mbox series

Patch

diff --git a/scripts/Makefile.package b/scripts/Makefile.package
index 4a80584ec771..2c261a0d42b0 100644
--- a/scripts/Makefile.package
+++ b/scripts/Makefile.package
@@ -147,8 +147,7 @@  snap-pkg:
 PHONY += pacman-pkg
 pacman-pkg:
 	@ln -srf $(srctree)/scripts/package/PKGBUILD $(objtree)/PKGBUILD
-	+objtree="$(realpath $(objtree))" \
-		BUILDDIR="$(realpath $(objtree))/pacman" \
+	BUILDDIR="$(realpath $(objtree))/pacman" \
 		CARCH="$(UTS_MACHINE)" \
 		KBUILD_MAKEFLAGS="$(MAKEFLAGS)" \
 		KBUILD_REVISION="$(shell $(srctree)/scripts/build-version)" \
diff --git a/scripts/package/PKGBUILD b/scripts/package/PKGBUILD
index e2d9c2601ca9..839cd5e634d2 100644
--- a/scripts/package/PKGBUILD
+++ b/scripts/package/PKGBUILD
@@ -40,7 +40,9 @@  _prologue() {
 	# MAKEFLAGS from makepkg.conf override the ones inherited from kbuild.
 	# Bypass this override with a custom variable.
 	export MAKEFLAGS="${KBUILD_MAKEFLAGS}"
-	cd "${objtree}"
+
+	# Kbuild works in the output directory, where this PKGBUILD is located.
+	cd "$(dirname "${BASH_SOURCE[0]}")"
 }
 
 build() {