forked from apache/arrow
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild_thirdparty.sh
More file actions
executable file
·65 lines (51 loc) · 1.94 KB
/
Copy pathbuild_thirdparty.sh
File metadata and controls
executable file
·65 lines (51 loc) · 1.94 KB
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
#!/bin/bash
set -x
set -e
TP_DIR=$(cd "$(dirname "$BASH_SOURCE")"; pwd)
source $TP_DIR/versions.sh
PREFIX=$TP_DIR/installed
################################################################################
if [ "$#" = "0" ]; then
F_ALL=1
else
# Allow passing specific libs to build on the command line
for arg in "$*"; do
case $arg in
"gtest") F_GTEST=1 ;;
*) echo "Unknown module: $arg"; exit 1 ;;
esac
done
fi
################################################################################
# Determine how many parallel jobs to use for make based on the number of cores
if [[ "$OSTYPE" =~ ^linux ]]; then
PARALLEL=$(grep -c processor /proc/cpuinfo)
elif [[ "$OSTYPE" == "darwin"* ]]; then
PARALLEL=$(sysctl -n hw.ncpu)
else
echo Unsupported platform $OSTYPE
exit 1
fi
mkdir -p "$PREFIX/include"
mkdir -p "$PREFIX/lib"
# On some systems, autotools installs libraries to lib64 rather than lib. Fix
# this by setting up lib64 as a symlink to lib. We have to do this step first
# to handle cases where one third-party library depends on another.
ln -sf lib "$PREFIX/lib64"
# use the compiled tools
export PATH=$PREFIX/bin:$PATH
type cmake >/dev/null 2>&1 || { echo >&2 "cmake not installed. Aborting."; exit 1; }
type make >/dev/null 2>&1 || { echo >&2 "make not installed. Aborting."; exit 1; }
# build googletest
GOOGLETEST_ERROR="failed for googletest!"
if [ -n "$F_ALL" -o -n "$F_GTEST" ]; then
cd $TP_DIR/$GTEST_BASEDIR
if [[ "$OSTYPE" == "darwin"* ]]; then
CXXFLAGS=-fPIC cmake -DCMAKE_CXX_FLAGS="-std=c++11 -stdlib=libc++ -DGTEST_USE_OWN_TR1_TUPLE=1 -Wno-unused-value -Wno-ignored-attributes" || { echo "cmake $GOOGLETEST_ERROR" ; exit 1; }
else
CXXFLAGS=-fPIC cmake . || { echo "cmake $GOOGLETEST_ERROR"; exit 1; }
fi
make VERBOSE=1 || { echo "Make $GOOGLETEST_ERROR" ; exit 1; }
fi
echo "---------------------"
echo "Thirdparty dependencies built and installed into $PREFIX successfully"