Skip to content

Instantly share code, notes, and snippets.

@logicalparadox
Forked from adammw/buildnode.sh
Created April 25, 2013 21:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save logicalparadox/5463570 to your computer and use it in GitHub Desktop.
Save logicalparadox/5463570 to your computer and use it in GitHub Desktop.
#!/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