* [Buildroot] [git commit] nodejs: force python interpreter
@ 2014-04-15 21:18 Thomas Petazzoni
0 siblings, 0 replies; only message in thread
From: Thomas Petazzoni @ 2014-04-15 21:18 UTC (permalink / raw)
To: buildroot
commit: http://git.buildroot.net/buildroot/commit/?id=40218a16526946f35dab0d05f379f71a01f29530
branch: http://git.buildroot.net/buildroot/commit/?id=refs/heads/master
nodejs build system is based on python, and it does not support python3.
This patch makes sure python2 is used for the build.
Note that, setting PYTHON=... at configure time or in the make
environment is not enough to override all the hard-coded python call, so
we have to sed some python scripts to avoid being screwed.
Signed-off-by: Samuel Martin <s.martin49@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
package/nodejs/nodejs.mk | 24 ++++++++++++++++++------
1 files changed, 18 insertions(+), 6 deletions(-)
diff --git a/package/nodejs/nodejs.mk b/package/nodejs/nodejs.mk
index 46b3056..b5973b5 100644
--- a/package/nodejs/nodejs.mk
+++ b/package/nodejs/nodejs.mk
@@ -17,6 +17,10 @@ ifeq ($(BR2_PACKAGE_OPENSSL),y)
NODEJS_DEPENDENCIES += openssl
endif
+# nodejs build system is based on python, but only support python-2.6 or
+# python-2.7. So, we have to enforce PYTHON interpreter to be python2.
+# However, few build scripts hard-code 'python' as the interpreter to be
+# invoked; so we have to manually fix them.
define HOST_NODEJS_CONFIGURE_CMDS
# Build with the static, built-in OpenSSL which is supplied as part of
# the nodejs source distribution. This is needed on the host because
@@ -24,20 +28,23 @@ define HOST_NODEJS_CONFIGURE_CMDS
# buildroot.
(cd $(@D); \
$(HOST_CONFIGURE_OPTS) \
- ./configure \
+ PYTHON=$(HOST_DIR)/usr/bin/python2 \
+ $(HOST_DIR)/usr/bin/python2 ./configure \
--prefix=$(HOST_DIR)/usr \
--without-snapshot \
--without-dtrace \
--without-etw \
)
+ $(SED) "s@'python',@'$(HOST_DIR)/usr/bin/python2',@" \
+ $(@D)/deps/v8/tools/gyp/v8.gyp
endef
define HOST_NODEJS_BUILD_CMDS
- $(HOST_MAKE_ENV) $(MAKE) -C $(@D)
+ $(HOST_MAKE_ENV) PYTHON=$(HOST_DIR)/usr/bin/python2 $(MAKE) -C $(@D)
endef
define HOST_NODEJS_INSTALL_CMDS
- $(HOST_MAKE_ENV) $(MAKE) -C $(@D) install
+ $(HOST_MAKE_ENV) PYTHON=$(HOST_DIR)/usr/bin/python2 $(MAKE) -C $(@D) install
endef
ifeq ($(BR2_i386),y)
@@ -62,7 +69,8 @@ define NODEJS_CONFIGURE_CMDS
(cd $(@D); \
$(TARGET_CONFIGURE_OPTS) \
LD="$(TARGET_CXX)" \
- ./configure \
+ PYTHON=$(HOST_DIR)/usr/bin/python2 \
+ $(HOST_DIR)/usr/bin/python2 ./configure \
--prefix=/usr \
--without-snapshot \
$(if $(BR2_PACKAGE_OPENSSL),--shared-openssl,--without-ssl) \
@@ -73,10 +81,13 @@ define NODEJS_CONFIGURE_CMDS
$(if $(NODEJS_ARM_FP),--with-arm-float-abi=$(NODEJS_ARM_FP)) \
--dest-os=linux \
)
+ $(SED) "s@'python',@'$(HOST_DIR)/usr/bin/python2',@" \
+ $(@D)/deps/v8/tools/gyp/v8.gyp
endef
define NODEJS_BUILD_CMDS
- $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) \
+ $(TARGET_MAKE_ENV) PYTHON=$(HOST_DIR)/usr/bin/python2 \
+ $(MAKE) -C $(@D) \
$(TARGET_CONFIGURE_OPTS) \
LD="$(TARGET_CXX)"
endef
@@ -110,7 +121,8 @@ endef
endif
define NODEJS_INSTALL_TARGET_CMDS
- $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) install \
+ $(TARGET_MAKE_ENV) PYTHON=$(HOST_DIR)/usr/bin/python2 \
+ $(MAKE) -C $(@D) install \
DESTDIR=$(TARGET_DIR) \
$(TARGET_CONFIGURE_OPTS) \
LD="$(TARGET_CXX)"
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2014-04-15 21:18 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-15 21:18 [Buildroot] [git commit] nodejs: force python interpreter Thomas Petazzoni
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.