Skip to contentSkip to conversation

pkg-waf: add support for <pkg>_SUBDIR

PATCH New Lionel Orry 2 participants 3 messages Sep 19, 2018 – Oct 10, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pkg-waf: add support for <pkg>_SUBDIR

In the Buildroot manual, it is specified that the Waf-based infrastructure supports the <pkg>_SUBDIR variable, which was not true.

This patch makes use of this variable by changing to the given sub-directory before executing waf commands.

---
 package/pkg-waf.mk | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
package/pkg-waf.mk +6 -4
index e5b606f063..826b73291b 100644
@@ -54,13 +54,15 @@ $(2)_INSTALL_STAGING_OPTS        ?=
 $(2)_INSTALL_TARGET_OPTS        ?=
 $(2)_WAF_OPTS                ?=
 
+$(2)_SRCDIR            = $$($(2)_DIR)/$$($(2)_SUBDIR)
+
 #
 # Configure step. Only define it if not already defined by the package
 # .mk file.
 #
 ifndef $(2)_CONFIGURE_CMDS
 define $(2)_CONFIGURE_CMDS
-    cd $$(@D) && \
+    cd $$($$(PKG)_SRCDIR) && \
     $$(TARGET_CONFIGURE_OPTS) \
     $$($(2)_CONF_ENV) \
     $$(HOST_DIR)/bin/python2 $$($(2)_WAF) configure \
@@ -77,7 +79,7 @@ endif
 #
 ifndef $(2)_BUILD_CMDS
 define $(2)_BUILD_CMDS
-    cd $$(@D) && \
+    cd $$($$(PKG)_SRCDIR) && \
     $$(TARGET_MAKE_ENV) $$(HOST_DIR)/bin/python2 $$($(2)_WAF) \
         build -j $$(PARALLEL_JOBS) $$($(2)_BUILD_OPTS) \
         $$($(2)_WAF_OPTS)
@@ -90,7 +92,7 @@ endif
 #
 ifndef $(2)_INSTALL_STAGING_CMDS
 define $(2)_INSTALL_STAGING_CMDS
-    cd $$(@D) && \
+    cd $$($$(PKG)_SRCDIR) && \
     $$(TARGET_MAKE_ENV) $$(HOST_DIR)/bin/python2 $$($(2)_WAF) \
         install --destdir=$$(STAGING_DIR) \
         $$($(2)_INSTALL_STAGING_OPTS) \
@@ -104,7 +106,7 @@ endif
 #
 ifndef $(2)_INSTALL_TARGET_CMDS
 define $(2)_INSTALL_TARGET_CMDS
-    cd $$(@D) && \
+    cd $$($$(PKG)_SRCDIR) && \
     $$(TARGET_MAKE_ENV) $$(HOST_DIR)/bin/python2 $$($(2)_WAF) \
         install --destdir=$$(TARGET_DIR) \
         $$($(2)_INSTALL_TARGET_OPTS) \
Signature · 1 line
2.19.0
#1 lore raw

PATCH 1/1 pkg-waf: add support for <pkg>_SUBDIR

Hello, does anyone have the time to look at this small patch ? Thanks a lot!

Best regards,
Lionel

Quoted 62 lines · Lionel Orry

In the Buildroot manual, it is specified that the Waf-based infrastructure supports the <pkg>_SUBDIR variable, which was not true.

This patch makes use of this variable by changing to the given sub-directory before executing waf commands.

---
 package/pkg-waf.mk | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
package/pkg-waf.mk +6 -5
index e5b606f063..826b73291b 100644
@@ -54,13 +54,15 @@ $(2)_INSTALL_STAGING_OPTS        ?=
 $(2)_INSTALL_TARGET_OPTS        ?=
 $(2)_WAF_OPTS                ?=
 
+$(2)_SRCDIR            = $$($(2)_DIR)/$$($(2)_SUBDIR)
+
 #
 # Configure step. Only define it if not already defined by the package
 # .mk file.
 #
 ifndef $(2)_CONFIGURE_CMDS
 define $(2)_CONFIGURE_CMDS
-    cd $$(@D) && \
+    cd $$($$(PKG)_SRCDIR) && \
     $$(TARGET_CONFIGURE_OPTS) \
     $$($(2)_CONF_ENV) \
     $$(HOST_DIR)/bin/python2 $$($(2)_WAF) configure \
@@ -77,7 +79,7 @@ endif
 #
 ifndef $(2)_BUILD_CMDS
 define $(2)_BUILD_CMDS
-    cd $$(@D) && \
+    cd $$($$(PKG)_SRCDIR) && \
     $$(TARGET_MAKE_ENV) $$(HOST_DIR)/bin/python2 $$($(2)_WAF) \
         build -j $$(PARALLEL_JOBS) $$($(2)_BUILD_OPTS) \
         $$($(2)_WAF_OPTS)
@@ -90,7 +92,7 @@ endif
 #
 ifndef $(2)_INSTALL_STAGING_CMDS
 define $(2)_INSTALL_STAGING_CMDS
-    cd $$(@D) && \
+    cd $$($$(PKG)_SRCDIR) && \
     $$(TARGET_MAKE_ENV) $$(HOST_DIR)/bin/python2 $$($(2)_WAF) \
         install --destdir=$$(STAGING_DIR) \
         $$($(2)_INSTALL_STAGING_OPTS) \
@@ -104,7 +106,7 @@ endif
 #
 ifndef $(2)_INSTALL_TARGET_CMDS
 define $(2)_INSTALL_TARGET_CMDS
-    cd $$(@D) && \
+    cd $$($$(PKG)_SRCDIR) && \
     $$(TARGET_MAKE_ENV) $$(HOST_DIR)/bin/python2 $$($(2)_WAF) \
         install --destdir=$$(TARGET_DIR) \
         $$($(2)_INSTALL_TARGET_OPTS) \
--

2.19.0

#2 lore raw

PATCH 1/1 pkg-waf: add support for <pkg>_SUBDIR

In reply to Lionel Orry

Hello Lionel,

Thanks for your patch, sorry for the slow reply. See some feedback below.

Quoted 7 lines · Lionel Orry

In the Buildroot manual, it is specified that the Waf-based infrastructure supports the <pkg>_SUBDIR variable, which was not true.

This patch makes use of this variable by changing to the given sub-directory before executing waf commands.

First, could you update the Buildroot manual to document this new variable of the waf package infrastructure ?

Quoted 1 line

+$(2)_SRCDIR = $$($(2)_DIR)/$$($(2)_SUBDIR)

Could you try after dropping this line? In fact the generic package infrastructure already defines <pkg>_SRCDIR as <pkg>_DIR/<pkg>_SUBDIR, so it shouldn't be needed to replicate that here.

And bonus point if you submit another patch that drops those redundant lines from pkg-cmake, pkg-meson and pkg-python, of course after testing that it still works fine :)

Thanks a lot!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com