Skip to content

Commit e56a528

Browse files
martinbarkBen Whitten
authored and
Ben Whitten
committed
package/nodejs: force the use of python2
Remove the patches to use a python variable and instead force python2 into the PATH. Upstream the python variable was recently removed (see nodejs/node@c3e50ca) and due to dependencies directly calling python there is a reluctance to change this. Instead it is recommended to add python2 into PATH as the nodejs build machines do (see nodejs/node#418 and nodejs/node#2735). Signed-off-by: Martin Bark <martin@barkynet.com> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
1 parent b0d4dc9 commit e56a528

7 files changed

+16
-157
lines changed

package/nodejs/0.10.42/0003-use-python-variable.patch

-43
This file was deleted.

package/nodejs/5.6.0/0003-Use-a-python-variable-instead-of-hardcoding-Python.patch

-112
This file was deleted.

package/nodejs/nodejs.mk

+16-2
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,18 @@ endif
2020
# nodejs build system is based on python, but only support python-2.6 or
2121
# python-2.7. So, we have to enforce PYTHON interpreter to be python2.
2222
define HOST_NODEJS_CONFIGURE_CMDS
23+
# The build system directly calls python. Work around this by forcing python2
24+
# into PATH. See https://github.com/nodejs/node/issues/2735
25+
mkdir -p $(@D)/bin
26+
ln -sf $(HOST_DIR)/usr/bin/python2 $(@D)/bin/python
27+
2328
# Build with the static, built-in OpenSSL which is supplied as part of
2429
# the nodejs source distribution. This is needed on the host because
2530
# NPM is non-functional without it, and host-openssl isn't part of
2631
# buildroot.
2732
(cd $(@D); \
2833
$(HOST_CONFIGURE_OPTS) \
34+
PATH=$(@D)/bin:$(BR_PATH) \
2935
PYTHON=$(HOST_DIR)/usr/bin/python2 \
3036
$(HOST_DIR)/usr/bin/python2 ./configure \
3137
--prefix=$(HOST_DIR)/usr \
@@ -39,13 +45,15 @@ endef
3945
define HOST_NODEJS_BUILD_CMDS
4046
$(HOST_MAKE_ENV) PYTHON=$(HOST_DIR)/usr/bin/python2 \
4147
$(MAKE) -C $(@D) \
42-
$(HOST_CONFIGURE_OPTS)
48+
$(HOST_CONFIGURE_OPTS) \
49+
PATH=$(@D)/bin:$(BR_PATH)
4350
endef
4451

4552
define HOST_NODEJS_INSTALL_CMDS
4653
$(HOST_MAKE_ENV) PYTHON=$(HOST_DIR)/usr/bin/python2 \
4754
$(MAKE) -C $(@D) install \
48-
$(HOST_CONFIGURE_OPTS)
55+
$(HOST_CONFIGURE_OPTS) \
56+
PATH=$(@D)/bin:$(BR_PATH)
4957
endef
5058

5159
ifeq ($(BR2_i386),y)
@@ -75,8 +83,12 @@ endif
7583
endif
7684

7785
define NODEJS_CONFIGURE_CMDS
86+
mkdir -p $(@D)/bin
87+
ln -sf $(HOST_DIR)/usr/bin/python2 $(@D)/bin/python
88+
7889
(cd $(@D); \
7990
$(TARGET_CONFIGURE_OPTS) \
91+
PATH=$(@D)/bin:$(BR_PATH) \
8092
LD="$(TARGET_CXX)" \
8193
PYTHON=$(HOST_DIR)/usr/bin/python2 \
8294
$(HOST_DIR)/usr/bin/python2 ./configure \
@@ -99,6 +111,7 @@ define NODEJS_BUILD_CMDS
99111
$(TARGET_MAKE_ENV) PYTHON=$(HOST_DIR)/usr/bin/python2 \
100112
$(MAKE) -C $(@D) \
101113
$(TARGET_CONFIGURE_OPTS) \
114+
PATH=$(@D)/bin:$(BR_PATH) \
102115
LD="$(TARGET_CXX)"
103116
endef
104117

@@ -138,6 +151,7 @@ define NODEJS_INSTALL_TARGET_CMDS
138151
$(MAKE) -C $(@D) install \
139152
DESTDIR=$(TARGET_DIR) \
140153
$(TARGET_CONFIGURE_OPTS) \
154+
PATH=$(@D)/bin:$(BR_PATH) \
141155
LD="$(TARGET_CXX)"
142156
$(NODEJS_INSTALL_MODULES)
143157
endef

0 commit comments

Comments
 (0)