-
Notifications
You must be signed in to change notification settings - Fork 527
/
rebuild_cxx.sh
executable file
·30 lines (26 loc) · 814 Bytes
/
rebuild_cxx.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/env bash
echo 'rebuilding node cxx modules'
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd ${CURRENT_DIR}
echo "starting work in ${CURRENT_DIR}"
TILEMILL_ROOT=`pwd`
PATH=${TILEMILL_ROOT}/node_modules/.bin:${PATH}
PATH="`npm explore npm -g -- pwd`/bin/node-gyp-bin":${PATH}
RUN_SETUP=false
while getopts "s" OPT; do
case $OPT in
s)
RUN_SETUP=true
;;
esac
done
BUILD_ROOT=${TILEMILL_ROOT}/node_root_dir
if [ "${RUN_SETUP}" = true ]; then
NVER=`node -e "console.log(process.versions.node)"`
echo "Running node-gyp setup for ${NVER}"
node-gyp install ${NVER}
BUILD_ROOT=${TILEMILL_ROOT}/node_root_dir
cp -r ~/.node-gyp/${NVER}/ ${BUILD_ROOT}
rm -rf ~/.node-gyp/
fi
npm rebuild --nodedir=${BUILD_ROOT} --build-from-source