Last active
March 5, 2016 16:44
-
-
Save adammw/5195263 to your computer and use it in GitHub Desktop.
Node.js for Raspberry Pi Packaging Script
This file contains 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/sh | |
## Node.js for Raspberry Pi Packaging Script | |
## ========================================= | |
## Execute this script from within node.js git repo | |
## Use like this: | |
## ~/node/$ VERSION=v0.10.0 ./buildnode.sh | |
if [ -z $VERSION ]; then | |
echo "set the VERSION first" | |
exit 1 | |
fi | |
# raspberry pi cross-compile exports | |
export HOST="arm-linux-gnueabihf" | |
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 "updating git repo to ${VERSION}-release..." | |
git pull | |
git checkout ${VERSION}-release | |
# clear out old builds | |
echo "cleaning..." | |
make clean | |
# build | |
echo "building..." | |
./configure --prefix=/ --without-snapshot --dest-cpu=arm | |
export BINARYNAME=node-${VERSION}-linux-arm-armv6j-vfp-hard | |
mkdir ${BINARYNAME} | |
make install DESTDIR=${BINARYNAME} V=1 PORTABLE=1 | |
# package | |
echo "packaging..." | |
cp README.md ${BINARYNAME} | |
cp LICENSE ${BINARYNAME} | |
cp ChangeLog ${BINARYNAME} | |
tar -cf ${BINARYNAME}.tar ${BINARYNAME} | |
gzip -f -9 ${BINARYNAME}.tar |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment