Created
March 7, 2016 14:34
-
-
Save artynet/bd4ec40e36aff9f559af to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
## Node.js for Raspberry Pi 1 Packaging Script | |
## ========================================= | |
## Use like this: | |
## ./buildnode.sh <node_tarball_version> | |
clean () { | |
rm -rvf node-v$1/ | |
} | |
if [ -z $1 ]; then | |
echo "set the VERSION first" | |
exit 1 | |
fi | |
# clear out old builds | |
echo "cleaning..." | |
clean $1 | |
sleep 3 | |
# exporting compilers | |
export PATH=/opt/armv6-rpi-linux-gnueabi/bin:$PATH | |
# raspberry pi 1 cross-compile exports | |
export HOST="armv6-rpi-linux-gnueabi" | |
export CPP="${HOST}-gcc -E" | |
export STRIP="${HOST}-strip" | |
export OBJCOPY="${HOST}-objcopy" | |
export AR="${HOST}-ar" | |
export RANLIB="${HOST}-ranlib" | |
export LD="${HOST}-g++" | |
export OBJDUMP="${HOST}-objdump" | |
export CC="${HOST}-gcc" | |
export CXX="${HOST}-g++" | |
export NM="${HOST}-nm" | |
export AS="${HOST}-as" | |
export PS1="[${HOST}] \w$ " | |
# update git repo, pull new version | |
echo "Downloading node source ${VERSION}-release..." | |
if [ ! -e node-v${1}.tar.gz ] | |
then | |
wget http://nodejs.org/dist/v${1}/node-v${1}.tar.gz | |
tar xvf node-v${1}.tar.gz | |
else | |
tar xvf node-v${1}.tar.gz | |
fi | |
cd node-v${1}/ | |
# clear out old builds | |
echo "cleaning..." | |
make clean | |
# build | |
echo "building..." | |
export ARCH=arm DESTCPU=arm | |
export CONFIG_FLAGS="--without-snapshot" | |
sed -i -e s/small-icu/none/g Makefile | |
sed -i -e "s/-\$(ARCH)/\-armv6l/g" Makefile | |
make -j2 binary |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment