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 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
|
#! /bin/bash
#
# Builds czmq.node package from a fresh git clone
#
################################################################################
# THIS FILE IS 100% GENERATED BY ZPROJECT; DO NOT EDIT EXCEPT EXPERIMENTALLY #
# Read the zproject/README.md for information about making permanent changes. #
################################################################################
#
set -e # exit on any error
FORCE=0
VERBOSE=0
QUIET="--quiet"
LOGLEVEL="--loglevel=error"
for ARG in $*; do
if [ "$ARG" == "--help" -o "$ARG" == "-h" ]; then
echo "build.sh"
echo " --help / -h This help"
echo " --force / -f Force full rebuild"
echo " --verbose / -v Show build output"
echo " --xverbose / -x Extra verbose"
exit
elif [ "$ARG" == "--force" -o "$ARG" == "-f" ]; then
FORCE=1
elif [ "$ARG" == "--verbose" -o "$ARG" == "-v" ]; then
VERBOSE=1
QUIET=""
LOGLEVEL=""
elif [ "$ARG" == "--xverbose" -o "$ARG" == "-x" ]; then
VERBOSE=1
QUIET=""
LOGLEVEL="--loglevel=verbose"
set -x
fi
done
BUILD_ROOT=`pwd`
cd ../../..
# Note: here we go to parent directory that contains current project,
# so the checkout is nearby, same as expected for usual developer work
# Check dependent projects
if [ ! -d libzmq ]; then
echo "I: cloning https://github.com/zeromq/libzmq.git into `pwd`/libzmq..."
git clone $QUIET https://github.com/zeromq/libzmq.git || exit
fi
if [ ! -f libzmq/builds/gyp/project.gyp ]; then
echo "E: `pwd`/libzmq out of date (builds/gyp/project.gyp missing)" >&2
exit 1
fi
# Check Node.js dependencies
cd $BUILD_ROOT
echo "I: checking Node.js dependencies..."
failed=0
set +e
for package in node-ninja bindings nan prebuild; do
npm list --depth 1 $package > /dev/null 2>&1
if [ $? -eq 1 ]; then
npm list --global --depth 1 $package > /dev/null 2>&1
if [ $? -eq 1 ]; then
echo "E: $package isn't installed, run 'npm install [-g] $package'"
failed=1
fi
fi
done
test $failed -eq 0 || exit
set -e
# Calculate how many compiles we can do in parallel
export JOBS=$([[ $(uname) = 'Darwin' ]] \
&& sysctl -n hw.logicalcpu_max \
|| lscpu -p | egrep -v '^#' | wc -l)
# Build the binding using node-ninja directly, not prebuild
echo "I: building Node.js binding:"
node-ninja configure
node-ninja build
|