forked from KNMI/adaguc-server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcompile.sh
executable file
·125 lines (98 loc) · 3.17 KB
/
compile.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
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
#!/bin/bash
if [[ $1 == dev ]]; then
export ADAGUCCOMPILERSETTINGS="-Wall -DMEMLEAKCHECK -std=c++11 -g -pipe"
ulimit -c unlimited
fi
#For developing, use:
#export ADAGUCCOMPILERSETTINGS="-Wall -DMEMLEAKCHECK -std=c++11 -g"
#For time measurement of components use
#export ADAGUCCOMPILERSETTINGS="-Wall -DMEMLEAKCHECK -DMEASURETIME -std=c++11 -g"
#For operational, use:
#export ADAGUCCOMPILERSETTINGS="-msse -msse2 -msse3 -mssse3 -mfpmath=sse -O2 -std=c++11"
DEFAULTCOMPILERSETTINGS="-msse -msse2 -msse3 -mssse3 -mfpmath=sse -O2 -std=c++11"
DEFAULTADAGUCCOMPONENTS="-DENABLE_CURL -DADAGUC_USE_GDAL -DADAGUC_USE_SQLITE -DADAGUC_USE_POSTGRESQL -DADAGUC_USE_WEBP"
CURRENTDIR=`pwd`
if [ -z "${ADAGUCCOMPILERSETTINGS}" ]; then
export BUILDER_ADAGUCCOMPILERSETTINGS=$DEFAULTCOMPILERSETTINGS
echo "BUILDER_ADAGUCCOMPILERSETTINGS is set to default 'BUILDER_ADAGUCCOMPILERSETTINGS'";
else
echo "Note: ADAGUCCOMPILERSETTINGS is set to '$ADAGUCCOMPILERSETTINGS'";
export BUILDER_ADAGUCCOMPILERSETTINGS=$ADAGUCCOMPILERSETTINGS
fi
#Minimal instalation can be compiled by settign:
#export ADAGUCCOMPONENTS="-DADAGUC_USE_SQLITE"
if [ -z "${ADAGUCCOMPONENTS}" ]; then
export BUILDER_ADAGUCCOMPONENTS=$DEFAULTADAGUCCOMPONENTS
echo "BUILDER_ADAGUCCOMPONENTS is set to default '$BUILDER_ADAGUCCOMPONENTS'";
else
echo "ADAGUCCOMPONENTS is set to '$ADAGUCCOMPONENTS'";
export BUILDER_ADAGUCCOMPONENTS=$ADAGUCCOMPONENTS
fi
function quit {
echo "Make sure include directories are indicated with CPPFLAGS and library directories with LDFLAGS"
echo " For example:"
echo " export CPPFLAGS=-I/home/user/software/install/include -I/home/user/othersoftware/install/include"
echo " export LDFLAGS=-L/home/user/software/install/lib/ -L/home/user/othersoftware/install/lib/"
echo ""
exit 1;
}
function clean {
cd $CURRENTDIR/hclasses
rm -f *.o
rm -f *.a
cd $CURRENTDIR/CCDFDataModel
rm -f *.o
rm -f *.a
cd $CURRENTDIR/adagucserverEC
rm -f *.o
rm -f adagucserver
rm -f h5ncdump
rm -f aggregate_time
rm -f geojsondump
test -d $CURRENTDIR/bin || mkdir $CURRENTDIR/bin/
rm -f $CURRENTDIR/bin/adagucserver
rm -f $CURRENTDIR/bin/h5ncdump
rm -f $CURRENTDIR/bin/aggregate_time
rm -f $CURRENTDIR/bin/geojsondump
}
function build {
clean
cd $CURRENTDIR/hclasses
make -j4
if [ -f hclasses.a ]
then
echo "[OK] hclasses have succesfully been compiled."
else
echo "[FAILED] hclasses compilation failed"
quit;
fi
cd $CURRENTDIR/CCDFDataModel
make -j4
if [ -f CCDFDataModel.a ]
then
echo "[OK] CCDFDataModel has been succesfully compiled."
else
echo "[FAILED] CCDFDataModel compilation failed"
quit;
fi
cd $CURRENTDIR/adagucserverEC
make -j4
if [ -f adagucserver ]
then
echo "[OK] ADAGUC has been succesfully compiled."
else
echo "[FAILED] ADAGUC compilation failed"
quit;
fi
test -d $CURRENTDIR/bin || mkdir $CURRENTDIR/bin/
cp adagucserver $CURRENTDIR/bin/
cp h5ncdump $CURRENTDIR/bin/
cp aggregate_time $CURRENTDIR/bin/
cp geojsondump $CURRENTDIR/bin/
echo "[OK] Everything is installed in the ./bin directory"
}
if [ "$*" = "--clean" ]; then
clean
else
build
fi