-
Notifications
You must be signed in to change notification settings - Fork 3
/
compile.sh
executable file
·98 lines (86 loc) · 2.74 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
#!/usr/bin/env bash
# The make step requires something access to dynamically linked libraries:
# LD_LIBRARY_PATH=$PREFIX/lib:$LD_LIBRARY_PATH
set -o errexit
if [[ $# -ne 5 ]]; then
echo >&2 "Usage: $0 CODE_DIR SOURCE_REPO GRASS_VERSION LIB_PREFIX INSTALL_PREFIX"
exit 1
fi
CODE_DIR="$1"
SOURCE_REPO="$2"
GRASS_VERSION="$3"
LIBS="$4"
INSTALL_PREFIX="$5"
# Get the code
git clone --depth=1 --branch "$GRASS_VERSION" "$SOURCE_REPO" "$CODE_DIR"
cd "$CODE_DIR"
# Apply patches to GRASS GIS source code
for FILE in ../patches/"$GRASS_VERSION"/*.patch; do
patch -p0 <"$FILE"
done
# Configure with dependencies
./configure \
--prefix="$INSTALL_PREFIX"/ \
--with-openmp \
--with-pthread \
--with-freetype \
--with-freetype-includes="$LIBS"/include/freetype2 \
--with-freetype-libs="$LIBS"/lib \
--with-gdal="$LIBS"/bin/gdal-config \
--with-gdal-libs="$LIBS"/lib \
--with-proj="$LIBS"/bin/proj \
--with-proj-includes="$LIBS"/include \
--with-proj-libs="$LIBS"/lib \
--with-proj-share="$LIBS"/share/proj \
--with-geos="$LIBS"/bin/geos-config \
--with-jpeg-includes="$LIBS"/include \
--with-jpeg-libs="$LIBS"/lib \
--with-png-includes="$LIBS"/include \
--with-png-libs="$LIBS"/lib \
--with-tiff-includes="$LIBS"/include \
--with-tiff-libs="$LIBS"/lib \
--with-postgres=yes \
--with-postgres-includes="$LIBS"/include \
--with-postgres-libs="$LIBS"/lib \
--without-mysql \
--with-sqlite \
--with-sqlite-libs="$LIBS"/lib \
--with-sqlite-includes="$LIBS"/include \
--with-fftw-includes="$LIBS"/include \
--with-fftw-libs="$LIBS"/lib \
--with-cxx \
--with-cairo \
--with-cairo-includes="$LIBS"/include/cairo \
--with-cairo-libs="$LIBS"/lib \
--with-cairo-ldflags="-lcairo" \
--with-zstd \
--with-zstd-libs="$LIBS"/lib \
--with-zstd-includes="$LIBS"/include \
--with-bzlib \
--with-bzlib-libs="$LIBS"/lib \
--with-bzlib-includes="$LIBS"/include \
--with-netcdf="$LIBS"/bin/nc-config \
--with-blas \
--with-blas-libs="$LIBS"/lib \
--with-blas-includes="$LIBS"/include \
--with-lapack \
--with-lapack-includes="$LIBS"/include \
--with-lapack-libs="$LIBS"/lib \
--with-netcdf="$LIBS"/bin/nc-config \
--with-nls \
--with-libs="$LIBS"/lib \
--with-includes="$LIBS"/include \
--with-pdal="$LIBS"/bin/pdal-config \
--with-pdal-libs="$LIBS"/lib \
--with-readline \
--with-readline-includes="$LIBS"/include/readline \
--with-readline-libs="$LIBS"/lib ||
(cat "config.log" &&
echo "ERROR in configure step. Log printed after the configure output" &&
exit 1)
# Compile and install
make
make install
# for scripts:
# eval "$(conda shell.bash hook)"
# conda activate bin/conda