-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·49 lines (40 loc) · 1.11 KB
/
build.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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/sh
# Get the number of CPUs on the system
# This is not portable
if [ ! "$NCPUS" ]; then
unamestr=`uname`
if [ "$unamestr" = 'Linux' ]; then
NCPUS=`grep -c ^processor /proc/cpuinfo`
elif [ "$unamestr" = 'Darwin' ] || [ "$unamestr" = 'FreeBSD' ]; then
NCPUS=`sysctl -n hw.ncpu`
else
NCPUS=1
fi
fi
OWD="${PWD}"
BASE=`dirname "${0}"`
cd "${BASE}"
if [ ! -e "yaml-cpp/CMakeLists.txt" ]; then
# Manually clone yaml-cpp, removing the directory first
rm -r yaml-cpp
git clone --depth=1 --branch=yaml-cpp-0.6.2 https://github.com/jbeder/yaml-cpp.git
fi
cd yaml-cpp
git checkout yaml-cpp-0.6.2
TMPFILE=`mktemp`
cp src/regex_yaml.h "${TMPFILE}"
#echo '#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"' > src/regex_yaml.h
cat "${TMPFILE}" >> src/regex_yaml.h
rm "${TMPFILE}"
cd ..
cd ./BUILD
if [ "$PREFIX" ]; then
cmake -DCMAKE_BUILD_TYPE="RELEASE" -DCMAKE_INSTALL_PREFIX=$PREFIX ..
else
cmake -DCMAKE_BUILD_TYPE="RELEASE" -DCMAKE_INSTALL_PREFIX='/usr/local' ..
fi
make -j"$NCPUS"
if [ "$?" = 0 ] && [ ! "$NO_INSTALL" ]; then
make install
fi;
cd "$OWD"