Patchwork [2/3] nodejs-0.8.18: prefix CC/CXX with STAGING_BINDIR_TOOLCHAIN

login
register
mail settings
Submitter Martin Jansa
Date Feb. 4, 2013, 11:31 a.m.
Message ID <1359977464-19529-2-git-send-email-Martin.Jansa@gmail.com>
Download mbox | patch
Permalink /patch/44007/
State Changes Requested, archived
Headers show

Comments

Martin Jansa - Feb. 4, 2013, 11:31 a.m.
* this way there is smaller chance that gcc/g++/ld wrapper will cause fork bomb

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
---
 meta-oe/recipes-devtools/nodejs/nodejs_0.8.18.bb | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

Patch

diff --git a/meta-oe/recipes-devtools/nodejs/nodejs_0.8.18.bb b/meta-oe/recipes-devtools/nodejs/nodejs_0.8.18.bb
index 1a1c66b..63c9660 100644
--- a/meta-oe/recipes-devtools/nodejs/nodejs_0.8.18.bb
+++ b/meta-oe/recipes-devtools/nodejs/nodejs_0.8.18.bb
@@ -21,15 +21,26 @@  ARCHFLAGS_arm = "${@bb.utils.contains('TUNE_FEATURES', 'callconvention-hard', '-
 ARCHFLAGS ?= ""
 
 # Node is way too cool to use proper autotools, so we install two wrappers to forcefully inject proper arch cflags to workaround gypi
+do_configure_prepend_class-target () {
+  TOOLCHAIN_CC_PREFIX="${STAGING_BINDIR_TOOLCHAIN}"
+  TOOLCHAIN_CXX_PREFIX="${STAGING_BINDIR_TOOLCHAIN}"
+}
+do_configure_prepend_class-native () {
+  NATIVE_CC=`which gcc`
+  NATIVE_CXX=`which g++`
+  TOOLCHAIN_CC_PREFIX=`dirname "${NATIVE_CC}"`
+  TOOLCHAIN_CXX_PREFIX=`dirname "${NATIVE_CXX}"`
+}
+
 do_configure () {
   echo '#!/bin/sh' > ${WORKDIR}/gcc
-  echo '${CC} $@' >> ${WORKDIR}/gcc
+  echo "${TOOLCHAIN_CC_PREFIX}/${CC} \$@" >> ${WORKDIR}/gcc
 
   echo '#!/bin/sh' > ${WORKDIR}/g++
-  echo '${CXX} $@'>> ${WORKDIR}/g++
+  echo "${TOOLCHAIN_CXX_PREFIX}/${CXX} \$@" >> ${WORKDIR}/g++
 
   echo '#!/bin/sh' > ${WORKDIR}/ld
-  echo '${CXX} $@'>> ${WORKDIR}/ld
+  echo "${TOOLCHAIN_CXX_PREFIX}/${CXX} \$@" >> ${WORKDIR}/ld
 
   chmod +x ${WORKDIR}/gcc ${WORKDIR}/g++ ${WORKDIR}/ld