-
Notifications
You must be signed in to change notification settings - Fork 0
/
install
executable file
·148 lines (124 loc) · 2.97 KB
/
install
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
#!/usr/bin/env bash
### variable initialization ###
project_name="QL_AGILE-Setup"
prefix=$AGILE
echo $prefix
numthreads=1
build_type="Release"
verbose=false
# use a number of threads equals the double of the number of cores
if [[ -a /proc/cpuinfo ]] ; then
numthreads=`grep -c ^processor /proc/cpuinfo`
let numthreads=$numthreads*2
fi
declare -a repo_install=("common_include" "PacketLib" "scriptsMVAFilter")
declare -a cmake_repoinstall=("libQLBase" "libQL3" "libAGILE" "QL_AGILE" "AGILE_GRID_FILE_GENERATOR" "libMVAFilter" "filter_FT5")
#AGILE_GRID_FILE_GENERATOR
### parse command line options ###
trap exit ERR
function show_help {
echo "Usage: $0 [-hl] [-p PREFIX] [-n NUMTHREADS] [clean]"
echo " -h print this help"
echo " -p PREFIX set installation prefix"
echo " -n NUMTHREADS default number of threads is number of core * 2"
echo " -d build debug version (flags \"-O0 -g\")"
echo " -v verbose mode"
exit
}
while getopts "hp:ln:dv" o;
do
case "${o}" in
h)
show_help
;;
p)
prefix=${OPTARG}
;;
n)
numthreads=${OPTARG}
;;
d)
build_type="Debug"
;;
v)
verbose=true
;;
esac
done
shift $((OPTIND-1))
### check for prefix ###
if [[ -z $prefix && $1 != "clean" ]] ; then
echo "Prefix option (-p) and \$AGILE env variable are not used. Please provide one of them."
exit
fi
### update environment ###
export CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH:${prefix}/include
export LIBRARY_PATH=$LIBRARY_PATH:${prefix}/lib
if [[ $build_type == "Release" ]] ; then
export CFLAGS="-O3 -g -fPIC -Wall -Wno-parentheses -Wno-unused-but-set-variable"
else
export CFLAGS="-O0 -g -fPIC -Wall -Wno-parentheses -Wno-unused-but-set-variable"
fi
export CXXFLAGS=$CFLAGS
export CMAKE_INCLUDE_PATH=$CPLUS_INCLUDE_PATH
export CMAKE_LIBRARY_PATH=$LIBRARY_PATH
### build ###
# workaround for CentOS 6 cmake naming..
if [ -e /usr/bin/cmake28 ]; then
cmake_exe=cmake28
else
cmake_exe=cmake
fi
for i in "${repo_install[@]}"
do
pushd $PWD
cd $i
if [[ $1 == "clean" ]]
then
echo
echo "Cleaning $i..."
make clean
else
echo
echo "Building $i..."
make -j$numthreads
echo
echo "Installing $i..."
make install prefix=$prefix
fi
popd
done
for i in "${cmake_repoinstall[@]}"
do
pushd $PWD
cd $i
if [[ $1 == "clean" ]]
then
echo
echo "Cleaning $i..."
rm -rf build
else
echo
echo "Building $i..."
mkdir -p build/$i
cd build/
${cmake_exe} -DCMAKE_BUILD_TYPE=$cmake_build_type \
-DCMAKE_INSTALL_PREFIX:PATH=$prefix \
-DBoost_NO_BOOST_CMAKE=ON \
-DUSE_LIBASTRO=OFF \
..
if $verbose ; then
make VERBOSE=1 -j$numthreads
else
make -j$numthreads
fi
echo "Installing $1..."
make install
fi
popd
done
if [[ $1 != "clean" ]]
then
echo "Install path: ${prefix}"
fi
echo "Done."