-
Notifications
You must be signed in to change notification settings - Fork 0
/
mink.def
executable file
·230 lines (116 loc) · 4.66 KB
/
mink.def
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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
Bootstrap: docker
From: centos:7
%setup
mkdir -p ${SINGULARITY_ROOTFS}/build/grass_modules
mkdir -p ${SINGULARITY_ROOTFS}/build/grass_program
%files
./GRASS_modules/* /build/grass_modules
./GRASS_program/* /build/grass_program
%environment
# this is what is needed to set grass up properly
# the reason we need to do this is that we are running scripts outside of the interactive grass environment,
# and thus need to do all the environmental set up ourselves in order to run grass commands in the shell
# see https://grasswiki.osgeo.org/wiki/Working_with_GRASS_without_starting_it_explicitly for explanation
# "bash examples" section, and https://grasswiki.osgeo.org/wiki/GRASS_and_Shell for further explanation
export GISBASE=/usr/local/grass-6.5.svn
export PATH=$PATH:$GISBASE/bin:$GISBASE/scripts
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$GISBASE/lib
# set PYTHONPATH to include the GRASS Python lib
if [ ! "$PYTHONPATH" ] ; then
PYTHONPATH="$GISBASE/etc/python"
else
PYTHONPATH="$GISBASE/etc/python:$PYTHONPATH"
fi
export PYTHONPATH
# use process ID (PID) as lock file number:
export GIS_LOCK=$$
# settings for graphical output to PNG file (optional)
export GRASS_PNGFILE=/mnt/data/grass6out.png
export GRASS_RENDER_TRANSPARENT=TRUE
export GRASS_RENDER_FILE_READ=TRUE
export GRASS_TRUECOLOR=TRUE
export GRASS_WIDTH=1200
export GRASS_HEIGHT=800
export GRASS_RENDER_IMMEDIATE=png
export GRASS_VERSION="6.5.svn"
MYGISDBASE=/mnt/data/grassdata
MYMAPSET=morgan_DSSAT_cat_0
MYLOC=world
MYGISRC="$HOME/.grassrc.$GRASS_VERSION.$$"
echo "GISDBASE: $MYGISDBASE" > "$MYGISRC"
echo "LOCATION_NAME: $MYLOC" >> "$MYGISRC"
echo "MAPSET: $MYMAPSET" >> "$MYGISRC"
echo "GRASS_GUI: text" >> "$MYGISRC"
# path to GRASS settings file
export GISRC=$MYGISRC
export GRASS_PYTHON=python
export GRASS_MESSAGE_FORMAT=plain
export GRASS_TRUECOLOR=TRUE
export GRASS_TRANSPARENT=TRUE
export GRASS_PNG_AUTO_WRITE=TRUE
export GRASS_GNUPLOT='gnuplot -persist'
export GRASS_HTML_BROWSER=firefox
export GRASS_PAGER=cat
#For the temporal modules
export TGISDB_DRIVER=sqlite
export TGISDB_DATABASE=$MYGISDBASE/$MYLOC/PERMANENT/tgis/sqlite.db
# for fun, we can even set the shell prompt to contain a hint on GRASS GIS env being active
export PS1="[\u@\h \W G-$GRASS_VERSION]$ "
# system vars
export PATH="$GISBASE/bin:$GISBASE/scripts:$PATH"
export LD_LIBRARY_PATH="$GISBASE/lib"
export GRASS_LD_LIBRARY_PATH="$LD_LIBRARY_PATH"
export PYTHONPATH="$GISBASE/etc/python:$PYTHONPATH"
export MANPATH=$MANPATH:$GISBASE/man
export JAVA_HOME=/usr/bin/java
%post
mkdir /mnt/data
# install GRASS dependencies
#yum -y update
yum groupinstall -y "Development Tools"
yum install -y epel-release
#yum --disablerepo=epel -y update ca-certificates
yum install -y proj-devel gdal-devel sqlite-devel mesa-libGL-devel \
mesa-libGLU-devel libXmu-devel libX11-devel tcl-devel tk-devel geos \
fftw-devel libtiff-devel lesstif-devel python-devel numpy wxPython wxGTK-devel \
gcc gcc-c++ bison flex ncurses-devel proj-epsg proj-nad xml2 subversion \
geos-devel blas-devel lapack-devel xorg-x11-xauth python3
## add okay repo, install gpg key and then ffmpeg
rpm -ivh http://repo.okay.com.mx/centos/7/x86_64/release/okay-release-1-5.el7.noarch.rpm \
&& yum install -y ffmpeg-devel
yum -y install ImageMagick
yum install -y java-11-openjdk-devel
curl -L https://services.gradle.org/distributions/gradle-5.0-bin.zip > /tmp/gradle-5.0-bin.zip
unzip -d /opt/gradle /tmp/gradle-5.0-bin.zip
## build GRASS
cd /build/grass_program
./configure \
--with-cxx \
--with-gdal=/usr/bin/gdal-config \
--with-proj --with-proj-share=/usr/share/proj \
--with-sqlite \
--with-nls \
--with-geos \
--with-wxwidgets=/usr/bin/wx-config \
--with-python=/usr/bin/python-config \
--with-freetype --with-freetype-includes=/usr/include/freetype2 \
--enable-largefile \
--without-odbc \
--with-fftw \
--with-blas \
--with-lapack
make -j$(nproc) && make -j$(nproc) install
## Create generic GRASS GIS binary name regardless of version number
ln -sf `find /usr/local/bin -name "grass??" | sort | tail -n 1` /usr/local/bin/grass
## build custom modules
cd /build/grass_modules
## enter each module directory and make
export GRASS_PREFIX=/usr/local/grass-6.5.svn/
for m in {r.in.new,r.intersection,r.out.new,r.pixelarea}; do
cd $m; make; cd ../
done
## # clean up
#cd
#rm -rf /build
%runscript
grass --version