Skip to contentSkip to conversation

Pull request for branch for-master/misc-fixes

GIT PULL New Samuel Martin 4 participants 14 messages Dec 30, 2012 – Feb 7, 2013

lore
Share & tools
lore
#0 lore raw

Hello,

Here are few random fixes, some of them are related to python handling from the host system.

The patches handling the python binary provided by the host system are also an RFC that summarize few discussions on the IRC channel.

The following changes since commit f1d44593a04ff3be981c8a3b01a502f0b18193ee:

docs/manual: small fixes and enhancements to adding generic packages (2012-12-30 22:39:13 +0100)

are available in the git repository at:

git at github.com:tSed/buildroot.git for-master/misc-fixes

for you to fetch changes up to 8de478e5aa4b0f15008159ea3ad238605e5ffe0e:

manual: add host python2 dependency section (2012-12-30 23:47:23 +0100)

----------------------------------------------------------------
Samuel Martin (8):
matchbox-lib: fix license info
fluxbox: fix build against imlib2
package/Makefile.in: update/fix HOST_PATH variable package/pkg-cmake.mk: make sure $(HOST_PATH) is in the PATH at configure time
dependencies: build a host python2 if no suitable one can be found
scons: add host-python2-if-needed dependency
scons: ensure $(HOST_DIR)/usr/bin is in the PATH when invoking $(SCONS)
manual: add host python2 dependency section

 docs/manual/adding-packages-tips.txt              | 38 +++++++++++++++++++++++
 package/Makefile.in                               |  2 +-
 package/fluxbox/fluxbox-1.3.2-fix-configure.patch | 19 ++++++++++++
 package/fluxbox/fluxbox.mk                        | 10 +++++-
 package/matchbox/matchbox-lib/matchbox-lib.mk     |  2 +-
 package/pkg-cmake.mk                              |  5 +--
 package/scons/scons.mk                            | 10 ++++--
 support/dependencies/check-host-python2.mk        | 18 +++++++++++
 support/dependencies/check-host-python2.sh        | 13 ++++++++
 support/dependencies/dependencies.sh              |  2 +-
 10 files changed, 110 insertions(+), 9 deletions(-)
 create mode 100644 package/fluxbox/fluxbox-1.3.2-fix-configure.patch
 create mode 100644 support/dependencies/check-host-python2.mk
 create mode 100755 support/dependencies/check-host-python2.sh

Yours,

--

Samuel

#1 lore raw

PATCH 1/8 matchbox-lib: fix license info

---
 package/matchbox/matchbox-lib/matchbox-lib.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
package/matchbox/matchbox-lib/matchbox-lib.mk +1 -1
index 7730d94..d18df6b 100644
@@ -7,7 +7,7 @@
 MATCHBOX_LIB_VERSION = 1.9
 MATCHBOX_LIB_SOURCE = libmatchbox-$(MATCHBOX_LIB_VERSION).tar.bz2
 MATCHBOX_LIB_SITE = http://downloads.yoctoproject.org/releases/matchbox/libmatchbox/$(MATCHBOX_LIB_VERSION)
-MATCHBOX_LIB_LICENSE = LGPLv2.1
+MATCHBOX_LIB_LICENSE = LGPLv2.1+
 MATCHBOX_LIB_LICENSE_FILES = COPYING
 MATCHBOX_LIB_INSTALL_STAGING = YES
 MATCHBOX_LIB_DEPENDENCIES = host-pkgconf expat xlib_libXext
Signature · 1 line
1.8.0.3
#2 lore raw

PATCH 2/8 fluxbox: fix build against imlib2

In reply to Samuel Martin

* fix configure.in to take care of the given imlib2-prefix
* disable imlib2 support if imlib2 is not part of the selection

---
 package/fluxbox/fluxbox-1.3.2-fix-configure.patch | 19 +++++++++++++++++++
 package/fluxbox/fluxbox.mk                        | 10 +++++++++-
 2 files changed, 28 insertions(+), 1 deletion(-)
 create mode 100644 package/fluxbox/fluxbox-1.3.2-fix-configure.patch
package/fluxbox/fluxbox-1.3.2-fix-configure.patch new file +19 -0
new file mode 100644
index 0000000..2cb8273
@@ -0,0 +1,19 @@
+Avoid to call the imlib2-config that may be installed on the host system
+(even when --with-imlib2-prefix or --with-imlib2-exec-prefix is passed to
+the configure script), which totally screws up the resulting linker flags.
+
+Inspired by: http://git.fluxbox.org/fluxbox.git/commit/?id=b178bed60b5bd8b2c9ed0cbc67fd729ff3820589
+
+Signed-off-by: Samuel Martin <[email protected]>
+
+--- fluxbox-1.3.2.orig/configure.in	2012-10-21 16:11:59.445749396 +0200
++++ fluxbox-1.3.2/configure.in	2012-10-21 16:35:27.658390856 +0200
+@@ -443,8 +443,6 @@ if test x$enable_imlib2 = "xyes"; then
+       [
+          IMLIB2=true
+          AC_DEFINE(HAVE_IMLIB2, [], [Imlib2 support])
+-         IMLIB2_LIBS=`imlib2-config --libs`
+-         IMLIB2_CFLAGS=`imlib2-config --cflags`
+          LIBS="$LIBS $IMLIB2_LIBS"
+          CXXFLAGS="$CXXFLAGS $IMLIB2_CFLAGS"
+        ], [ AC_MSG_RESULT(no)]
package/fluxbox/fluxbox.mk +9 -1
index 356c5a2..04ffb91 100644
@@ -10,11 +10,19 @@ FLUXBOX_SITE = http://downloads.sourceforge.net/project/fluxbox/fluxbox/$(FLUXBO
 FLUXBOX_LICENSE = MIT
 FLUXBOX_LICENSE_FILES = COPYING
 
+FLUXBOX_AUTORECONF = YES
+
 FLUXBOX_CONF_OPT = --x-includes=$(STAGING_DIR)/usr/include/X11 \
 		   --x-libraries=$(STAGING_DIR)/usr/lib
-
 FLUXBOX_DEPENDENCIES = xlib_libX11 $(if $(BR2_PACKAGE_LIBICONV),libiconv)
 
+ifeq ($(BR2_PACKAGE_IMLIB2),y)
+FLUXBOX_CONF_OPT += --enable-imlib2 --with-imlib2-prefix=$(STAGING_DIR)/usr
+FLUXBOX_DEPENDENCIES += imlib2
+else
+FLUXBOX_CONF_OPT += --disable-imlib2
+endif
+
 define FLUXBOX_INSTALL_XSESSION_FILE
 	[ -f $(TARGET_DIR)/root/.xsession ] || $(INSTALL) -m 0755 -D \
 		package/fluxbox/xsession $(TARGET_DIR)/root/.xsession
Signature · 1 line
1.8.0.3
#3 lore raw

PATCH 2/8 fluxbox: fix build against imlib2

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Samuel" == Samuel Martin <[email protected]> writes:

Samuel> * fix configure.in to take care of the given imlib2-prefix Samuel> * disable imlib2 support if imlib2 is not part of the selection

Samuel> Signed-off-by: Samuel Martin <[email protected]>

Samuel> +++ b/package/fluxbox/fluxbox.mk
Samuel> @@ -10,11 +10,19 @@ FLUXBOX_SITE = http://downloads.sourceforge.net/project/fluxbox/fluxbox/$(FLUXBO
Samuel> FLUXBOX_LICENSE = MIT
Samuel> FLUXBOX_LICENSE_FILES = COPYING

Samuel> +FLUXBOX_AUTORECONF = YES
Samuel> +
Samuel> FLUXBOX_CONF_OPT = --x-includes=$(STAGING_DIR)/usr/include/X11 \
Samuel> --x-libraries=$(STAGING_DIR)/usr/lib
Samuel> -
Samuel> FLUXBOX_DEPENDENCIES = xlib_libX11 $(if $(BR2_PACKAGE_LIBICONV),libiconv)

Samuel> +ifeq ($(BR2_PACKAGE_IMLIB2),y)
Samuel> +FLUXBOX_CONF_OPT += --enable-imlib2 --with-imlib2-prefix=$(STAGING_DIR)/usr

Imlib2 needs to be built with X11 support, otherwise linking fails, so I've updated the test to handle this and committed, thanks.

Signature · 1 line
Bye, Peter Korsgaard
#4 lore raw

PATCH 3/8 package/Makefile.in: update/fix HOST_PATH variable

In reply to Samuel Martin
---
 package/Makefile.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
package/Makefile.in +1 -1
index cc8f320..dd04e25 100644
@@ -165,7 +165,7 @@ HOST_CFLAGS   ?= -O2
 HOST_CFLAGS   += $(HOST_CPPFLAGS)
 HOST_CXXFLAGS += $(HOST_CFLAGS)
 HOST_LDFLAGS  += -L$(HOST_DIR)/lib -L$(HOST_DIR)/usr/lib -Wl,-rpath,$(HOST_DIR)/usr/lib
-HOST_PATH=$(HOST_DIR)/bin:$(HOST_DIR)/usr/bin:$(PATH)
+HOST_PATH="$(HOST_DIR)/bin:$(HOST_DIR)/usr/bin:$(HOST_DIR)/usr/sbin/:$(PATH)"
 
 # hostcc version as an integer - E.G. 4.3.2 => 432
 HOSTCC_VERSION:=$(shell $(HOSTCC_NOCCACHE) --version | \
Signature · 1 line
1.8.0.3
#5 lore raw

PATCH 3/8 package/Makefile.in: update/fix HOST_PATH variable

Quoted 2 lines · Samuel Martin

This series should still go in for 2013.02, I think.

Regards,
Arnout

Quoted 18 lines
---
  package/Makefile.in | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
package/Makefile.in +1 -1
index cc8f320..dd04e25 100644
@@ -165,7 +165,7 @@ HOST_CFLAGS   ?= -O2
  HOST_CFLAGS   += $(HOST_CPPFLAGS)
  HOST_CXXFLAGS += $(HOST_CFLAGS)
  HOST_LDFLAGS  += -L$(HOST_DIR)/lib -L$(HOST_DIR)/usr/lib -Wl,-rpath,$(HOST_DIR)/usr/lib
-HOST_PATH=$(HOST_DIR)/bin:$(HOST_DIR)/usr/bin:$(PATH)
+HOST_PATH="$(HOST_DIR)/bin:$(HOST_DIR)/usr/bin:$(HOST_DIR)/usr/sbin/:$(PATH)"
 
  # hostcc version as an integer - E.G. 4.3.2 => 432
  HOSTCC_VERSION:=$(shell $(HOSTCC_NOCCACHE) --version | \
Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
#6 lore raw

PATCH 3/8 package/Makefile.in: update/fix HOST_PATH variable

In reply to Samuel Martin

Dear Samuel Martin,

Quoted 11 lines · Samuel Martin
---
 package/Makefile.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
package/Makefile.in +0 -0
index cc8f320..dd04e25 100644

package/Makefile.in HOST_CFLAGS ?= -O2 · line 170

Quoted 8 lines
package/Makefile.in +1 -2
@@ -165,7 +165,7 @@ HOST_CFLAGS   ?= -O2
 HOST_CFLAGS   += $(HOST_CPPFLAGS)
 HOST_CXXFLAGS += $(HOST_CFLAGS)
 HOST_LDFLAGS  += -L$(HOST_DIR)/lib -L$(HOST_DIR)/usr/lib
-Wl,-rpath,$(HOST_DIR)/usr/lib
-HOST_PATH=$(HOST_DIR)/bin:$(HOST_DIR)/usr/bin:$(PATH)
+HOST_PATH="$(HOST_DIR)/bin:$(HOST_DIR)/usr/bin:$(HOST_DIR)/usr/sbin/:$(PATH)" 
 # hostcc version as an integer - E.G. 4.3.2 => 432
 HOSTCC_VERSION:=$(shell $(HOSTCC_NOCCACHE) --version | \

I am ok with the patch, and also your 4/8, but I really believe you should be more verbose in the commit log. Here the only information is "update/fix HOST_PATH variable". But why? What is the reason? What are the impacts? It is especially true when we look at those patches with a little bit of delay as is the case now.

Thanks!

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#7 lore raw

PATCH 3/8 package/Makefile.in: update/fix HOST_PATH variable

Hi Thomas,

2013/2/7 Thomas Petazzoni <[email protected]>:

Quoted 18 lines

Dear Samuel Martin,

Quoted 15 lines · Samuel Martin
---
 package/Makefile.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
package/Makefile.in +0 -1
index cc8f320..dd04e25 100644
@@ -165,7 +165,7 @@ HOST_CFLAGS   ?= -O2
 HOST_CFLAGS   += $(HOST_CPPFLAGS)
 HOST_CXXFLAGS += $(HOST_CFLAGS)
 HOST_LDFLAGS  += -L$(HOST_DIR)/lib -L$(HOST_DIR)/usr/lib
-Wl,-rpath,$(HOST_DIR)/usr/lib
Quoted 8 lines

package/Makefile.in HOST_CFLAGS ?= -O2 · line 171

Quoted 4 lines
package/Makefile.in +1 -1
-HOST_PATH=$(HOST_DIR)/bin:$(HOST_DIR)/usr/bin:$(PATH)
+HOST_PATH="$(HOST_DIR)/bin:$(HOST_DIR)/usr/bin:$(HOST_DIR)/usr/sbin/:$(PATH)"
 # hostcc version as an integer - E.G. 4.3.2 => 432
 HOSTCC_VERSION:=$(shell $(HOSTCC_NOCCACHE) --version | \

I am ok with the patch, and also your 4/8, but I really believe you should be more verbose in the commit log. Here the only information is "update/fix HOST_PATH variable".

I agree and I may be more guilty than anyone else since I regularly ask for more details. ;)

Quoted 3 lines

But why? What is the reason? What are
the impacts? It is especially true when we look at those patches with a little bit of delay as is the case now.

Well, I think I already answered this:
http://lists.busybox.net/pipermail/buildroot/2012-December/064434.html

I planned to re-spin part of the serie, but would like some inputs to the question:
"do we need 2 distinct variables for this?"

So, meanwhile, if you prefer merge this patch as is (with a commit message more verbose), tell me, I'll repost it shortly.

Regards,

Signature · 1 line
Samuel
#8 lore raw

PATCH 4/8 package/pkg-cmake.mk: make sure $(HOST_PATH) is in the PATH at configure time

In reply to Samuel Martin
---
 package/pkg-cmake.mk | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
package/pkg-cmake.mk +3 -2
index 626a0b0..1e8302f 100644
@@ -62,7 +62,8 @@ ifeq ($(5),target)
 define $(2)_CONFIGURE_CMDS
 	(cd $$($$(PKG)_BUILDDIR) && \
 	rm -f CMakeCache.txt && \
-	$$($$(PKG)_CONF_ENV) $(HOST_DIR)/usr/bin/cmake $$($$(PKG)_SRCDIR) \
+	PATH="$(TARGET_PATH)" $$($$(PKG)_CONF_ENV) \
+		$(HOST_DIR)/usr/bin/cmake $$($$(PKG)_SRCDIR) \
 		-DCMAKE_TOOLCHAIN_FILE="$$(HOST_DIR)/usr/share/buildroot/toolchainfile.cmake" \
 		-DCMAKE_INSTALL_PREFIX="/usr" \
 		$$($$(PKG)_CONF_OPT) \
@@ -74,7 +75,7 @@ else
 define $(2)_CONFIGURE_CMDS
 	(cd $$($$(PKG)_BUILDDIR) && \
 	rm -f CMakeCache.txt && \
-	$(HOST_DIR)/usr/bin/cmake $$($$(PKG)_SRCDIR) \
+	PATH="$(HOST_PATH)" $(HOST_DIR)/usr/bin/cmake $$($$(PKG)_SRCDIR) \
 		-DCMAKE_INSTALL_SO_NO_EXE=0 \
 		-DCMAKE_FIND_ROOT_PATH="$$(HOST_DIR)" \
 		-DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM="BOTH" \
Signature · 1 line
1.8.0.3
#9 lore raw

PATCH 4/8 package/pkg-cmake.mk: make sure $(HOST_PATH) is in the PATH at configure time

Quoted 2 lines · Samuel Martin

Regards,
Arnout

Quoted 28 lines
---
  package/pkg-cmake.mk | 5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)
package/pkg-cmake.mk +3 -2
index 626a0b0..1e8302f 100644
@@ -62,7 +62,8 @@ ifeq ($(5),target)
  define $(2)_CONFIGURE_CMDS
  	(cd $$($$(PKG)_BUILDDIR) && \
  	rm -f CMakeCache.txt && \
-	$$($$(PKG)_CONF_ENV) $(HOST_DIR)/usr/bin/cmake $$($$(PKG)_SRCDIR) \
+	PATH="$(TARGET_PATH)" $$($$(PKG)_CONF_ENV) \
+		$(HOST_DIR)/usr/bin/cmake $$($$(PKG)_SRCDIR) \
  		-DCMAKE_TOOLCHAIN_FILE="$$(HOST_DIR)/usr/share/buildroot/toolchainfile.cmake" \
  		-DCMAKE_INSTALL_PREFIX="/usr" \
  		$$($$(PKG)_CONF_OPT) \
@@ -74,7 +75,7 @@ else
  define $(2)_CONFIGURE_CMDS
  	(cd $$($$(PKG)_BUILDDIR) && \
  	rm -f CMakeCache.txt && \
-	$(HOST_DIR)/usr/bin/cmake $$($$(PKG)_SRCDIR) \
+	PATH="$(HOST_PATH)" $(HOST_DIR)/usr/bin/cmake $$($$(PKG)_SRCDIR) \
  		-DCMAKE_INSTALL_SO_NO_EXE=0 \
  		-DCMAKE_FIND_ROOT_PATH="$$(HOST_DIR)" \
  		-DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM="BOTH" \
Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
#10 lore raw

PATCH 5/8 dependencies: build a host python2 if no suitable one can be found

In reply to Samuel Martin

Some distros now comes with only python3 installed, with or without a /usr/bin/python pointing to python3.

So, /usr/bin/python may refer to either python2 or python3.

This may have some bad consequences for packages that uses some non python{2,3}-friendly scripts in their build system (eg. in install or post-install scripts).

This patch checks for a suitable python2 version (2.6 or 2.7) on the host system, and:
* if a valid python2 interperter is found on the host system, then:
- a symlink pointing to the found python2 interpreter is created in the

    buildroot host tree at the beginning of the build;

- a make target host-python2-if-needed is set to '$(HOST_DIR)/usr/bin/python'. This way, if the host-python package is built later, the symlink will be automatically overriden by the host-python install rules.
* if no valid python2 interperter is found on the host system, then:
- a make target host-python2-if-needed is set to 'host-python'.

Note 1: The symlink is checked and created if necessary at the beginning of
each build.
Note 2: Since there is no target named '$(HOST_DIR)/usr/bin/python' in the
python makefiles, there is no need for removing the symlink before installing the host-pyhton package.
Note 3: The host-python is only built when necessary.
This also means that in the case there is no python2 interperter available on the host system, there won't any host python2 interperter until the host-python package is built.
Note 4: Any package containing some non python{2,3}-friendly scripts should:
- have 'host-python2-if-needed' in its *_DEPENDENCIES list;
- set and add to their build/install environment, either PATH="$(HOST_PATH)" or PATH="$(TARGET_PATH)".

A (good) side effect of this patch is getting rid of any host python dependency.

Buildroot can run on a host without python, or with a too old python2 version, or with only python3.

In any case where a host python2 interpreter is expected to run some build or install scripts, 'host-python2-if-needed' should be added to the dependency list.

With this patch, the host python2 interpreter is either found in the host system, or build by Buildroot. So, we can drop the python dependency check.

---
 support/dependencies/check-host-python2.mk | 18 ++++++++++++++++++
 support/dependencies/check-host-python2.sh | 13 +++++++++++++
 support/dependencies/dependencies.sh       |  2 +-
 3 files changed, 32 insertions(+), 1 deletion(-)
 create mode 100644 support/dependencies/check-host-python2.mk
 create mode 100755 support/dependencies/check-host-python2.sh
support/dependencies/check-host-python2.mk new file +18 -0
new file mode 100644
index 0000000..5bc2986
@@ -0,0 +1,18 @@
+PYTHON2 = $(call suitable-host-package,python2,$(HOST_DIR)/usr/bin/python)
+
+ifeq ($(PYTHON2),)
+host-python2-if-needed: host-python
+else
+host-python2-if-needed: $(HOST_DIR)/usr/bin/python
+# Create the python symlink once for all at the beginning of the build.
+DEPENDENCIES_HOST_PREREQ += host-python2-symlink
+endif
+
+# host-python install rules override the symlink created here.
+# So, there is no need to patch the python package to remove the symlink
+# before installing itself.
+host-python2-symlink:
+	@mkdir -p $(HOST_DIR)/usr/bin
+	test -x "$(HOST_DIR)/usr/bin/python" -a \
+		"$(PYTHON2)" = "$(HOST_DIR)/usr/bin/python" || \
+		$(HOSTLN) -sf "$(PYTHON2)" "$(HOST_DIR)/usr/bin/python"
support/dependencies/check-host-python2.sh new file +13 -0
new file mode 100755
index 0000000..a340674
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+candidates="${@} python python2"
+
+for candidate in ${candidates} ; do
+  which "${candidate}" &>/dev/null || continue
+  # restrict version of python2 to 2.6 or 2.7
+  if "${candidate}" --version 2>&1 | grep -q 'Python 2\.[6-7]\..*' ; then
+    # found a valid candidate, so quit now
+    echo $(which "${candidate}")
+    exit
+  fi
+done
support/dependencies/dependencies.sh +1 -1
index eb5a481..1427ce3 100755
@@ -131,7 +131,7 @@ if ! $SHELL --version 2>&1 | grep -q '^GNU bash'; then
 fi;
 
 # Check that a few mandatory programs are installed
-for prog in awk bison flex msgfmt makeinfo patch gzip bzip2 perl tar wget cpio python unzip rsync ${DL_TOOLS} ; do
+for prog in awk bison flex msgfmt makeinfo patch gzip bzip2 perl tar wget cpio unzip rsync ${DL_TOOLS} ; do
     if ! which $prog > /dev/null ; then
 	/bin/echo -e "\nYou must install '$prog' on your build machine";
 	if test $prog = "makeinfo" ; then
Signature · 1 line
1.8.0.3
#11 lore raw

PATCH 6/8 scons: add host-python2-if-needed dependency

In reply to Samuel Martin

Also, ensure $(HOST_DIR)/usr/bin is in the PATH during the configure phase.

---
 package/scons/scons.mk | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
package/scons/scons.mk +6 -2
index 79fd6b1..e3ada92 100644
@@ -4,12 +4,16 @@ SCONS_SITE = http://downloads.sourceforge.net/project/scons/scons/$(SCONS_VERSIO
 SCONS_LICENSE = MIT
 SCONS_LICENSE_FILES = LICENSE.txt
 
+# Because Scons is not python3-friendly, we have to ensure that
+HOST_SCONS_DEPENDENCIES = host-python2-if-needed
+
 define HOST_SCONS_BUILD_CMDS
-	(cd $(@D); python setup.py build)
+	(cd $(@D); $(HOST_CONFIGURE_OPTS) python setup.py build)
 endef
 
 define HOST_SCONS_INSTALL_CMDS
-	(cd $(@D); python setup.py install --prefix=$(HOST_DIR)/usr \
+	(cd $(@D) ; $(HOST_CONFIGURE_OPTS) python setup.py install \
+		--prefix=$(HOST_DIR)/usr \
 		--install-lib=$(HOST_DIR)/usr/lib/scons-$(SCONS_VERSION))
 endef
 
Signature · 1 line
1.8.0.3
#12 lore raw

PATCH 7/8 scons: ensure $(HOST_DIR)/usr/bin is in the PATH when invoking $(SCONS)

In reply to Samuel Martin
---
 package/scons/scons.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
package/scons/scons.mk +1 -1
index e3ada92..e828588 100644
@@ -20,4 +20,4 @@ endef
 $(eval $(host-generic-package))
 
 # variables used by other packages
-SCONS = $(HOST_DIR)/usr/bin/scons
+SCONS = PATH=$(HOST_PATH) $(HOST_DIR)/usr/bin/scons
Signature · 1 line
1.8.0.3
#13 lore raw

PATCH 8/8 manual: add host python2 dependency section

In reply to Samuel Martin
---
 docs/manual/adding-packages-tips.txt | 38 ++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)
docs/manual/adding-packages-tips.txt +38 -0
index acdee40..4a971cb 100644
@@ -62,3 +62,41 @@ FOO_SITE = http://github.com/<user>/<package>/tarball/<branch>
 
 Note that the name of the tarball is the default +foo-1234567.tar.gz+
 so it is not necessary to specify it in the +.mk+ file.
+
+[[python2-and-package-build-env]]
+Host python2 dependency and package environment
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Some packages provide some python scripts as part of their
+build/install system.
+
+Unfortunately, those python scripts are not always python3-friendly.
+So, a python2 interpreter on the host system is a prerequisite for
+those packages. Besides, their build system may call them invoking
++python <some script> ...+ which have bad consequences if the +python+
+command does not exist or if it call a python3 interperter instead of
+a python2 one.
+
+Buildroot provides a way to handle this case, without requiring to
+patch anything in the package sources.
+
+* add +host-python2-if-needed+ to the +*_DEPENDENCIES+ list;
+* make sure the +PATH+ environment variable contains
+  +$(HOST_DIR)/usr/bin+.
+
+.Notes
+- This is automatic if the package relies on the _autotools_ or
+  _cmake_ infrastructure and does not need to override some of the
+  configure, build or install commands.
+- Otherwise (i.e. the package uses the _generic_ infrastructure or
+  overrides some of the configure, build or install commands), you
+  should ensure +PATH=$(HOST_PATH)+ or +PATH=$(TARGET_PATH)+ to
+  overridden commands.
+- The +PATH+ environment variable is correctly set in the variables
+  +TARGET_CONFIGURE_OPTS+ or +TARGET_MAKE_ENV+ as well as in their
+  +HOST+ variants.
+- For package relying on http://www.scons.org[Scons] build system,
+  it should depend on +host-scons+ and use the +$(SCONS)+ variable.
+  This will automatically take care of the host python2 dependency
+  since http://www.scons.org[Scons] does not support python3 yet
+  (see http://www.scons.org/doc/production/HTML/scons-user/c95.html#AEN102).
Signature · 1 line
1.8.0.3