Skip to content

Instantly share code, notes, and snippets.

@dinobei
Forked from Gioyik/nodejs.sh
Last active September 18, 2019 06:49
Show Gist options
  • Save dinobei/6681c4aa0b331497e93df4bb6f046e40 to your computer and use it in GitHub Desktop.
Save dinobei/6681c4aa0b331497e93df4bb6f046e40 to your computer and use it in GitHub Desktop.
Script to cross compile NodeJS for ARMv7, Cortex-a5
#!/bin/sh -e
#Define our target device
export TARGET_ARCH="-march=armv7-a"
export TARGET_TUNE="-mtune=cortex-a5 -mfpu=neon -mfloat-abi=softfp -mthumb-interwork -mno-thumb"
#Define the cross compilators on your system
export AR="arm-none-linux-gnueabi-ar"
export CC="arm-none-linux-gnueabi-gcc"
export CXX="arm-none-linux-gnueabi-g++"
export LINK="arm-none-linux-gnueabi-g++"
export CPP="arm-none-linux-gnueabi-gcc -E"
export LD="arm-none-linux-gnueabi-ld"
export AS="arm-none-linux-gnueabi-as"
export CCLD="arm-none-linux-gnueabi-gcc ${TARGET_ARCH} ${TARGET_TUNE}"
export NM="arm-none-linux-gnueabi-nm"
export STRIP="arm-none-linux-gnueabi-strip"
export OBJCOPY="arm-none-linux-gnueabi-objcopy"
export RANLIB="arm-none-linux-gnueabi-ranlib"
export F77="arm-none-linux-gnueabi-g77 ${TARGET_ARCH} ${TARGET_TUNE}"
unset LIBC
#Define flags
export CXXFLAGS="-march=armv7-a"
export LDFLAGS="-L${CSTOOLS_LIB} -Wl,-rpath-link,${CSTOOLS_LIB} -Wl,-O1 -Wl,--hash-style=gnu"
export CFLAGS="-isystem${CSTOOLS_INC} -fexpensive-optimizations -frename-registers -fomit-frame-pointer -O2 -ggdb3"
export CPPFLAGS="-isystem${CSTOOLS_INC}"
export CCFLAGS="-march=armv7-a"
#Tools
export CSTOOLS=/root/share/arm-2014.05/arm-none-linux-gnueabi
export CSTOOLS_INC=${CSTOOLS}/include
export CSTOOLS_LIB=${CSTOOLS}/lib
export ARM_TARGET_LIB=$CSTOOLS_LIB
export GYP_DEFINES="armv7=1"
#Define other things, those are not 'must' to have defined but we added
export SHELL="/bin/bash"
export TERM="screen"
export LANG="en_US.UTF-8"
export MAKE="make"
#Export the path for your system
export HOME="/root" #Change this one with the name of your user directoy
export PATH="${PATH}:${CSTOOLS}/bin::${HOME}"
./configure --without-snapshot --dest-cpu=arm --dest-os=linux --with-arm-float-abi=softfp --without-intl
bash --norc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment