Skip to content

Commit

Permalink
package/nodejs: force the use of python2
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
martinbark authored and Ben Whitten committed Feb 20, 2017
1 parent b0d4dc9 commit e56a528
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 157 deletions.
43 changes: 0 additions & 43 deletions package/nodejs/0.10.42/0003-use-python-variable.patch

This file was deleted.

This file was deleted.

18 changes: 16 additions & 2 deletions package/nodejs/nodejs.mk
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,18 @@ 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.
define HOST_NODEJS_CONFIGURE_CMDS
# The build system directly calls python. Work around this by forcing python2
# into PATH. See https://github.com/nodejs/node/issues/2735
mkdir -p $(@D)/bin
ln -sf $(HOST_DIR)/usr/bin/python2 $(@D)/bin/python

# Build with the static, built-in OpenSSL which is supplied as part of
# the nodejs source distribution. This is needed on the host because
# NPM is non-functional without it, and host-openssl isn't part of
# buildroot.
(cd $(@D); \
$(HOST_CONFIGURE_OPTS) \
PATH=$(@D)/bin:$(BR_PATH) \
PYTHON=$(HOST_DIR)/usr/bin/python2 \
$(HOST_DIR)/usr/bin/python2 ./configure \
--prefix=$(HOST_DIR)/usr \
Expand All @@ -39,13 +45,15 @@ endef
define HOST_NODEJS_BUILD_CMDS
$(HOST_MAKE_ENV) PYTHON=$(HOST_DIR)/usr/bin/python2 \
$(MAKE) -C $(@D) \
$(HOST_CONFIGURE_OPTS)
$(HOST_CONFIGURE_OPTS) \
PATH=$(@D)/bin:$(BR_PATH)
endef

define HOST_NODEJS_INSTALL_CMDS
$(HOST_MAKE_ENV) PYTHON=$(HOST_DIR)/usr/bin/python2 \
$(MAKE) -C $(@D) install \
$(HOST_CONFIGURE_OPTS)
$(HOST_CONFIGURE_OPTS) \
PATH=$(@D)/bin:$(BR_PATH)
endef

ifeq ($(BR2_i386),y)
Expand Down Expand Up @@ -75,8 +83,12 @@ endif
endif

define NODEJS_CONFIGURE_CMDS
mkdir -p $(@D)/bin
ln -sf $(HOST_DIR)/usr/bin/python2 $(@D)/bin/python

(cd $(@D); \
$(TARGET_CONFIGURE_OPTS) \
PATH=$(@D)/bin:$(BR_PATH) \
LD="$(TARGET_CXX)" \
PYTHON=$(HOST_DIR)/usr/bin/python2 \
$(HOST_DIR)/usr/bin/python2 ./configure \
Expand All @@ -99,6 +111,7 @@ define NODEJS_BUILD_CMDS
$(TARGET_MAKE_ENV) PYTHON=$(HOST_DIR)/usr/bin/python2 \
$(MAKE) -C $(@D) \
$(TARGET_CONFIGURE_OPTS) \
PATH=$(@D)/bin:$(BR_PATH) \
LD="$(TARGET_CXX)"
endef

Expand Down Expand Up @@ -138,6 +151,7 @@ define NODEJS_INSTALL_TARGET_CMDS
$(MAKE) -C $(@D) install \
DESTDIR=$(TARGET_DIR) \
$(TARGET_CONFIGURE_OPTS) \
PATH=$(@D)/bin:$(BR_PATH) \
LD="$(TARGET_CXX)"
$(NODEJS_INSTALL_MODULES)
endef
Expand Down

0 comments on commit e56a528

Please sign in to comment.