-
-
Notifications
You must be signed in to change notification settings - Fork 21
/
recipe.sh
232 lines (210 loc) · 7.95 KB
/
recipe.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
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
231
232
#!/bin/bash
BUNDLE_GDAL_PLUGINS_DIR=$BUNDLE_LIB_DIR/gdalplugins
LINK_MRSID_SDK_lti_lidar_dsdk=liblti_lidar_dsdk.1.dylib
LINK_MRSID_SDK_libtbb=libtbb.dylib
LINK_MRSID_SDK_libltidsdk=libltidsdk.9.dylib
function check_gdal() {
env_var_exists VERSION_gdal
env_var_exists LINK_gdal
env_var_exists QGIS_VERSION
env_var_exists VERSION_grass_major
}
function bundle_gdal() {
try cp -av $DEPS_LIB_DIR/libgdal*dylib $BUNDLE_LIB_DIR
# GDAL binaries
GDAL_RECIPE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
try cp -av $GDAL_RECIPE_DIR/run_gdal_binary.bash $BUNDLE_BIN_DIR/
chmod +x $BUNDLE_BIN_DIR/run_gdal_binary.bash
for i in \
gdal_contour \
gdal_grid \
gdal_rasterize \
gdal_translate \
gdal_viewshed \
gdaladdo \
gdalbuildvrt \
gdaldem \
gdalenhance \
gdalinfo \
gdallocationinfo \
gdalmanage \
gdalmdiminfo \
gdalmdimtranslate \
gdalsrsinfo \
gdaltindex \
gdaltransform \
gdalwarp \
ogr2ogr \
ogrinfo \
ogrlineref \
ogrtindex
do
touch $BUNDLE_BIN_DIR/$i
chmod +x $BUNDLE_BIN_DIR/$i
echo "#!/bin/bash" >> $BUNDLE_BIN_DIR/$i
echo 'THISDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"' >> $BUNDLE_BIN_DIR/$i
echo '$THISDIR/run_gdal_binary.bash "'$i'" "$@"' >> $BUNDLE_BIN_DIR/$i
try cp -av $DEPS_BIN_DIR/$i $BUNDLE_BIN_DIR/_$i
done
# GDAL plugins
# https://github.com/qgis/QGIS/blob/518cc16e87aba6798658acf75c86f27a0f4d99b3/src/app/main.cpp#L1198
# should be in Contents/MacOS/lib/gdalplugins
DEPS_GDAL_NOFOSS_PLUGINS_DIR=$DEPS_LIB_DIR/../3rdParty/gdalplugins
try mkdir $BUNDLE_GDAL_PLUGINS_DIR
# folder for some 3rdparty SDKs and libs
try mkdir $BUNDLE_GDAL_PLUGINS_DIR/3rdparty
if [[ "$WITH_ECW" == "true" ]]; then
try cp -av $DEPS_GDAL_NOFOSS_PLUGINS_DIR/$LINK_gdal_ecw $BUNDLE_GDAL_PLUGINS_DIR/
fi
if [[ "$WITH_MRSID" == "true" ]]; then
try cp -av $DEPS_GDAL_NOFOSS_PLUGINS_DIR/$LINK_gdal_mrsid_raster $BUNDLE_GDAL_PLUGINS_DIR/
try cp -av $DEPS_GDAL_NOFOSS_PLUGINS_DIR/$LINK_gdal_mrsid_lidar $BUNDLE_GDAL_PLUGINS_DIR/
MRSID_SDK="$QGIS_BUNDLE_SCRIPT_DIR/../../external/$MRSID_SDK_VER"
if [ ! -d "$MRSID_SDK" ]; then
echo "Missing MRSID SDK in $MRSID_SDK"
exit 1
fi
try cp -av $MRSID_SDK/Lidar_DSDK/lib/$LINK_MRSID_SDK_lti_lidar_dsdk $BUNDLE_GDAL_PLUGINS_DIR/3rdparty/
try cp -av $MRSID_SDK/Lidar_DSDK/lib/$LINK_MRSID_SDK_libtbb $BUNDLE_GDAL_PLUGINS_DIR/3rdparty/
try cp -av $MRSID_SDK/Raster_DSDK/lib/$LINK_MRSID_SDK_libltidsdk $BUNDLE_GDAL_PLUGINS_DIR/3rdparty/
fi
# GDAL data
# https://github.com/qgis/QGIS/blob/518cc16e87aba6798658acf75c86f27a0f4d99b3/src/app/main.cpp#L1205
# should be Contents/Resources/gdal
try rsync -av $DEPS_SHARE_DIR/gdal $BUNDLE_RESOURCES_DIR/
}
function fix_binaries_gdal() {
install_name_id @rpath/$LINK_gdal $BUNDLE_LIB_DIR/$LINK_gdal
for i in \
bin/_gdal_contour \
bin/_gdal_grid \
bin/_gdal_rasterize \
bin/_gdal_translate \
bin/_gdal_viewshed \
bin/_gdaladdo \
bin/_gdalbuildvrt \
bin/_gdaldem \
bin/_gdalenhance \
bin/_gdalinfo \
bin/_gdallocationinfo \
bin/_gdalmanage \
bin/_gdalmdiminfo \
bin/_gdalmdimtranslate \
bin/_gdalsrsinfo \
bin/_gdaltindex \
bin/_gdaltransform \
bin/_gdalwarp \
bin/_ogr2ogr \
bin/_ogrinfo \
bin/_ogrlineref \
bin/_ogrtindex \
lib/$LINK_gdal
do
for j in \
$LINK_freexl \
$LINK_libgeos_c \
$LINK_libhdf5 \
$LINK_netcdf \
$LINK_jpeg \
$LINK_libtiff \
$LINK_libxml2 \
$LINK_libcrypto \
$LINK_libssl \
$LINK_libpng \
$LINK_libpq \
$LINK_libproj \
$LINK_spatialite \
$LINK_sqlite \
$LINK_libwebp \
$LINK_libxerces_c \
$LINK_zlib \
$LINK_zstd \
$LINK_libkmlbase \
$LINK_libkmlconvenience \
$LINK_libkmldom \
$LINK_libkmlengine \
$LINK_libkmlregionator \
$LINK_libkmlxsd \
$LINK_libminizip \
$LINK_expat \
$LINK_liburiparser \
$LINK_pcre \
$LINK_poppler \
$LINK_openjpeg \
$LINK_libltdl \
$LINK_libcurl \
$LINK_libssh2 \
$LINK_gdal \
$LINK_rttopo \
$LINK_liblerc
do
install_name_change $DEPS_LIB_DIR/$j @rpath/$j $BUNDLE_CONTENTS_DIR/MacOS/$i
done
install_name_change $QGIS_DEPS_STAGE_PATH/unixodbc/lib/$LINK_unixodbc @rpath/$LINK_unixodbc $BUNDLE_CONTENTS_DIR/MacOS/$i
install_name_change $QGIS_DEPS_STAGE_PATH/unixodbc/lib/$LINK_unixodbcinst @rpath/$LINK_unixodbcinst $BUNDLE_CONTENTS_DIR/MacOS/$i
done
# bin/gdal_viewshed \
for i in \
bin/_gdal_contour \
bin/_gdal_grid \
bin/_gdal_rasterize \
bin/_gdal_translate \
bin/_gdaladdo \
bin/_gdalbuildvrt \
bin/_gdaldem \
bin/_gdalenhance \
bin/_gdalinfo \
bin/_gdallocationinfo \
bin/_gdalmanage \
bin/_gdalmdiminfo \
bin/_gdalmdimtranslate \
bin/_gdalsrsinfo \
bin/_gdaltindex \
bin/_gdaltransform \
bin/_gdalwarp \
bin/_ogr2ogr \
bin/_ogrinfo \
bin/_ogrlineref \
bin/_ogrtindex
do
install_name_add_rpath @executable_path/../../Frameworks $BUNDLE_CONTENTS_DIR/MacOS/$i
install_name_add_rpath @executable_path/../lib $BUNDLE_CONTENTS_DIR/MacOS/$i
done
if [[ "$WITH_ECW" == "true" ]]; then
install_name_id @rpath/gdalplugins/$LINK_gdal_ecw $BUNDLE_GDAL_PLUGINS_DIR/$LINK_gdal_ecw
install_name_change $DEPS_LIB_DIR/gdalplugins/$LINK_gdal_ecw @rpath/gdalplugins/$LINK_gdal_ecw $BUNDLE_GDAL_PLUGINS_DIR/$LINK_gdal_ecw
fi
if [[ "$WITH_MRSID" == "true" ]]; then
install_name_id @rpath/gdalplugins/$LINK_gdal_mrsid_lidar $BUNDLE_GDAL_PLUGINS_DIR/$LINK_gdal_mrsid_lidar
install_name_change $DEPS_LIB_DIR/gdalplugins/$LINK_gdal_mrsid_raster @rpath/gdalplugins/$LINK_gdal_mrsid_lidar $BUNDLE_GDAL_PLUGINS_DIR/$LINK_gdal_mrsid_raster
install_name_id @rpath/gdalplugins/3rdparty/$LINK_MRSID_SDK_lti_lidar_dsdk $BUNDLE_GDAL_PLUGINS_DIR/3rdparty/$LINK_MRSID_SDK_lti_lidar_dsdk
install_name_id @rpath/gdalplugins/3rdparty/$LINK_MRSID_SDK_libtbb $BUNDLE_GDAL_PLUGINS_DIR/3rdparty/$LINK_MRSID_SDK_libtbb
install_name_change @rpath/$LINK_MRSID_SDK_lti_lidar_dsdk @rpath/gdalplugins/3rdparty/$LINK_MRSID_SDK_lti_lidar_dsdk $BUNDLE_GDAL_PLUGINS_DIR/$LINK_gdal_mrsid_lidar
install_name_change @rpath/$LINK_MRSID_SDK_libtbb @rpath/gdalplugins/3rdparty/$LINK_MRSID_SDK_libtbb $BUNDLE_GDAL_PLUGINS_DIR/3rdparty/$LINK_MRSID_SDK_lti_lidar_dsdk
install_name_id @rpath/gdalplugins/$LINK_gdal_mrsid_raster $BUNDLE_GDAL_PLUGINS_DIR/$LINK_gdal_mrsid_raster
install_name_change $DEPS_LIB_DIR/gdalplugins/$LINK_gdal_mrsid_raster @rpath/gdalplugins/$LINK_gdal_mrsid_raster $BUNDLE_GDAL_PLUGINS_DIR/$LINK_gdal_mrsid_raster
install_name_id @rpath/gdalplugins/3rdparty/$LINK_MRSID_SDK_libltidsdk $BUNDLE_GDAL_PLUGINS_DIR/3rdparty/$LINK_MRSID_SDK_libltidsdk
install_name_change @rpath/$LINK_MRSID_SDK_libltidsdk @rpath/gdalplugins/3rdparty/$LINK_MRSID_SDK_libltidsdk $BUNDLE_GDAL_PLUGINS_DIR/$LINK_gdal_mrsid_raster
install_name_change @rpath/$LINK_MRSID_SDK_libtbb @rpath/gdalplugins/3rdparty/$LINK_MRSID_SDK_libtbb $BUNDLE_GDAL_PLUGINS_DIR/3rdparty/$LINK_MRSID_SDK_libltidsdk
fi
}
function fix_binaries_gdal_check() {
verify_binary $BUNDLE_LIB_DIR/$LINK_gdal
verify_binary $BUNDLE_BIN_DIR/_gdalinfo
if [[ "$WITH_ECW" == "true" ]]; then
verify_binary $BUNDLE_GDAL_PLUGINS_DIR/$LINK_gdal_ecw
fi
if [[ "$WITH_MRSID" == "true" ]]; then
verify_binary $BUNDLE_GDAL_PLUGINS_DIR/$LINK_gdal_mrsid_raster
verify_binary $BUNDLE_GDAL_PLUGINS_DIR/$LINK_gdal_mrsid_lidar
verify_binary $BUNDLE_GDAL_PLUGINS_DIR/3rdparty/$LINK_MRSID_SDK_libtbb
verify_binary $BUNDLE_GDAL_PLUGINS_DIR/3rdparty/$LINK_MRSID_SDK_lti_lidar_dsdk
verify_binary $BUNDLE_GDAL_PLUGINS_DIR/3rdparty/$LINK_MRSID_SDK_libltidsdk
fi
}
function fix_paths_gdal() {
:
}
function fix_paths_gdal_check() {
:
}