Skip to content

Commit

Permalink
fix ECW, MrSID
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterPetrik committed Sep 4, 2020
1 parent a629b23 commit b51a1fb
Show file tree
Hide file tree
Showing 3 changed files with 106 additions and 10 deletions.
91 changes: 87 additions & 4 deletions qgis_bundle/recipes/gdal/recipe.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
#!/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
Expand Down Expand Up @@ -42,8 +47,27 @@ function bundle_gdal() {
# GDAL plugins
# https://github.com/qgis/QGIS/blob/518cc16e87aba6798658acf75c86f27a0f4d99b3/src/app/main.cpp#L1198
# should be in Contents/MacOS/lib/gdalplugins
# we do not have any gdalplugins yet
try mkdir $BUNDLE_CONTENTS_DIR/MacOS/lib/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_LIB_DIR/gdalplugins/$LINK_gdal_ecw $BUNDLE_GDAL_PLUGINS_DIR/
fi

if [[ "$WITH_MRSID" == "true" ]]; then
try cp -av $DEPS_LIB_DIR/gdalplugins/$LINK_gdal_mrsid_raster $BUNDLE_GDAL_PLUGINS_DIR/
try cp -av $DEPS_LIB_DIR/gdalplugins/$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
Expand Down Expand Up @@ -113,15 +137,74 @@ function fix_binaries_gdal() {
$LINK_gdal
do
install_name_change $DEPS_LIB_DIR/$j @rpath/$j $BUNDLE_CONTENTS_DIR/MacOS/$i
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
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/gdalserver \
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() {
Expand Down
4 changes: 4 additions & 0 deletions qgis_bundle/recipes/python_packages/ssl.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,7 @@
raise Exception("Unable to load certs.pem required by ssl from " + DIR1 + " nor " + DIR2)

from _ssl2 import *

# private functions are not imported by default
# but this one is used in some QGIS plugins
from _ssl2 import _create_unverified_context
21 changes: 15 additions & 6 deletions qgis_deps/recipes/gdal/recipe.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,12 @@ RECIPE_gdal=$RECIPES_PATH/gdal

# 3rd Party
GDAL_PLUGINS_DIR=${STAGE_PATH}/lib/gdalplugins
ECW_SDK="$RECIPES_PATH/../../../external/ERDASEcwJpeg2000SDK5.4.0/Desktop_Read-Only/"
ECW_SDK_VER="ERDASEcwJpeg2000SDK5.4.0"
ECW_SDK="$RECIPES_PATH/../../../external/$ECW_SDK_VER/Desktop_Read-Only/"
LINK_gdal_ecw=gdal_ECW_JP2ECW.dylib
MRSID_SDK="$RECIPES_PATH/../../../external/MrSID_DSDK-9.5.1.4427-darwin14.universal.clang60"

MRSID_SDK_VER="MrSID_DSDK-9.5.1.4427-darwin14.universal.clang60"
MRSID_SDK="$RECIPES_PATH/../../../external/$MRSID_SDK_VER"
LINK_gdal_mrsid_lidar=gdal_MG4Lidar.dylib
LINK_gdal_mrsid_raster=gdal_MrSID.dylib

Expand Down Expand Up @@ -214,13 +217,19 @@ function postbuild_gdal() {

# function to append information to config file
function add_config_info_gdal() {
append_to_config_file "# gdal with ECW driver"
append_to_config_file "# gdal-${VERSION_gdal}: ${DESC_gdal}"
if [[ "$WITH_ECW" == "true" ]]; then
append_to_config_file "# gdal-${VERSION_gdal}: ${DESC_gdal}"
append_to_config_file "# gdal with ECW driver (SDK not bundled in deps)"
append_to_config_file "export LINK_gdal_ecw=${LINK_gdal_ecw}"
append_to_config_file "export ECW_SDK_VER=${ECW_SDK_VER}"
fi
if [[ "$MRSID_SDK" == "true" ]]; then
append_to_config_file "# gdal with MRSID driver"
if [[ "$WITH_MRSID" == "true" ]]; then
append_to_config_file "# gdal with MRSID driver (SDK not bundled in deps)"
append_to_config_file "export LINK_gdal_mrsid_raster=${LINK_gdal_mrsid_raster}"
append_to_config_file "export LINK_gdal_mrsid_lidar=${LINK_gdal_mrsid_lidar}"
append_to_config_file "export MRSID_SDK_VER=${MRSID_SDK_VER}"
fi

append_to_config_file "export VERSION_gdal=${VERSION_gdal}"
append_to_config_file "export LINK_gdal=${LINK_gdal}"
}

0 comments on commit b51a1fb

Please sign in to comment.