Skip to content

Commit

Permalink
fix the links to bundle
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterPetrik committed Jul 2, 2020
1 parent 4fbd12e commit e6a9f3f
Show file tree
Hide file tree
Showing 13 changed files with 70 additions and 34 deletions.
37 changes: 25 additions & 12 deletions qgis_bundle/qgis_bundle.bash
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ function check_binary_linker_links() {
cd ${BUNDLE_DIR}
OTOOL_L=$(otool -L $1)

ok=true
ok="true"

#### LINKED LIBS
if [ -z "$OTOOL_L" ]; then
Expand All @@ -143,25 +143,37 @@ function check_binary_linker_links() {
if echo "${OTOOL_L}" | grep -q /usr/local/
then
echo "$1 contains /usr/local/ string <-- Picked some homebrew libraries!"
ok=false
ok="false"
fi

if echo "${OTOOL_L}" | grep -q $QGIS_INSTALL_DIR
then
echo "$1 contains $QGIS_INSTALL_DIR string <-- forgot to change install_name for the linked library?"
ok=false
ok="false"
fi

if echo "${OTOOL_L}" | grep -q $QGIS_BUILD_DIR
then
echo "$1 contains $QGIS_BUILD_DIR string <-- forgot to change install_name for the linked library?"
ok="false"
fi

if echo "${OTOOL_L}" | grep -q $STAGE_PATH
then
echo "$1 contains $STAGE_PATH string <-- forgot to change install_name for the linked library?"
ok=false
ok="false"
fi

if echo "${OTOOL_L}" | grep -q $QT_BASE
then
echo "$1 contains $QT_BASE string <-- forgot to change install_name for the linked library?"
ok="false"
fi

if echo ${OTOOL_L} | grep -q $BUNDLE_DIR
then
echo "$1 contains $BUNDLE_DIR string <-- forgot to change install_name for the linked library?"
ok=false
ok="false"
fi

targets=(
Expand All @@ -180,11 +192,11 @@ function check_binary_linker_links() {
if echo "${OTOOL_L}" | grep -q /usr/lib/$i.dylib
then
echo "$1 contains /usr/lib/$i.dylib string -- we should be using our $i, not system!"
ok=false
ok="false"
fi
done

if [ "ok" = false ]; then
if [[ "$ok" == "false" ]]; then
echo "${OTOOL_L}"
error "error encountered for checking $1 (LINKS)"
fi
Expand All @@ -196,28 +208,28 @@ function check_binary_linker_links() {
if echo "${OTOOL_RPATH}" | grep -q /usr/local/
then
echo "$1 RPATH contains /usr/local/ string <-- forgot to delete/modify RPATH?"
ok=false
ok="false"
fi

if echo "${OTOOL_RPATH}" | grep -q $QGIS_INSTALL_DIR
then
echo "$1 RPATH contains $QGIS_INSTALL_DIR string <-- forgot to delete/modify RPATH?"
ok=false
ok="false"
fi

if echo "${OTOOL_RPATH}" | grep -q $ROOT_OUT_PATH
then
echo "$1 RPATH contains $ROOT_OUT_PATH string <-- forgot to delete/modify RPATH?"
ok=false
ok="false"
fi

if echo ${OTOOL_RPATH} | grep -q $BUNDLE_DIR
then
echo "$1 RPATH contains $BUNDLE_DIR string <-- forgot to delete/modify RPATH?"
ok=false
ok="false"
fi

if [ "ok" = false ]; then
if [[ "$ok" == "false" ]]; then
echo "${OTOOL_RPATH}"
error "error encountered for checking $1 (RPATH)"
fi
Expand All @@ -244,6 +256,7 @@ run_final_check() {
for lib in $LIBS; do
attachmenttype=$(file ${STAGE_PATH}/bin/$lib | cut -d\ -f2 )
if [[ $attachmenttype = "Mach-O" ]]; then
echo "checking $lib"
check_binary_linker_links $lib
fi
done
Expand Down
2 changes: 1 addition & 1 deletion qgis_bundle/recipes/geos/recipe.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ function bundle_geos() {

function postbundle_geos() {
install_name_id @rpath/$LINK_libgeos_c $BUNDLE_LIB_DIR/$LINK_libgeos_c
install_name_id @rpath/$LINK_libgeos $BUNDLE_LIB_DIR/$LINK_libgeos

install_name_change $DEPS_LIB_DIR/$LINK_libgeos_c @rpath/$LINK_libgeos_c $BUNDLE_CONTENTS_DIR/MacOS/QGIS
install_name_change $DEPS_LIB_DIR/$LINK_libgeos_c @rpath/$LINK_libgeos_c $BUNDLE_CONTENTS_DIR/Frameworks/qgis_core.framework/Versions/$QGIS_VERSION/qgis_core
Expand Down Expand Up @@ -58,7 +59,6 @@ function postbundle_geos() {
install_name_change $DEPS_LIB_DIR/$LINK_libgeos_c @rpath/$LINK_libgeos_c $BUNDLE_CONTENTS_DIR/MacOS/lib/libqgispython.$QGIS_VERSION.0.dylib

install_name_change $DEPS_LIB_DIR/$LINK_libgeos @rpath/$LINK_libgeos $BUNDLE_CONTENTS_DIR/MacOS/lib/$LINK_libgeos_c

install_name_change $DEPS_LIB_DIR/$LINK_libgeos_c @rpath/$LINK_libgeos_c $BUNDLE_CONTENTS_DIR/MacOS/lib/libgrass_vector.${VERSION_grass_major}.${VERSION_grass_minor}.dylib
install_name_change $DEPS_LIB_DIR/$LINK_libgeos_c @rpath/$LINK_libgeos_c $BUNDLE_CONTENTS_DIR/MacOS/lib/$LINK_spatialite
install_name_change $DEPS_LIB_DIR/$LINK_libgeos_c @rpath/$LINK_libgeos_c $BUNDLE_CONTENTS_DIR/MacOS/lib/$LINK_gdal
Expand Down
6 changes: 6 additions & 0 deletions qgis_bundle/recipes/gsl/recipe.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ function postbundle_gsl() {

# install_name_change $DEPS_LIB_DIR/$LINK_libgsl @rpath/$LINK_libgsl $BUNDLE_CONTENTS_DIR/PlugIns/qgis/libgeorefplugin.so
# install_name_change $DEPS_LIB_DIR/$LINK_libgslcblas @rpath/$LINK_libgslcblas $BUNDLE_CONTENTS_DIR/PlugIns/qgis/libgeorefplugin.so

install_name_change $DEPS_LIB_DIR/$LINK_libgsl @rpath/$LINK_libgsl $BUNDLE_CONTENTS_DIR/PlugIns/qgis/libgrassplugin${VERSION_grass_major}.so
install_name_change $DEPS_LIB_DIR/$LINK_libgslcblas @rpath/$LINK_libgslcblas $BUNDLE_CONTENTS_DIR/PlugIns/qgis/libgrassplugin${VERSION_grass_major}.so

install_name_change $DEPS_LIB_DIR/$LINK_libgsl @rpath/$LINK_libgsl $BUNDLE_CONTENTS_DIR/MacOS/lib/libqgis_app.$QGIS_VERSION.0.dylib
install_name_change $DEPS_LIB_DIR/$LINK_libgslcblas @rpath/$LINK_libgslcblas $BUNDLE_CONTENTS_DIR/MacOS/lib/libqgis_app.$QGIS_VERSION.0.dylib
}

function add_config_info_gsl() {
Expand Down
2 changes: 2 additions & 0 deletions qgis_bundle/recipes/hdf5/recipe.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ function postbundle_hdf5() {
install_name_change $DEPS_LIB_DIR/$LINK_libhdf5 @rpath/$LINK_libhdf5 $BUNDLE_CONTENTS_DIR/Resources/python/site-packages/h5py/h5pl.cpython-37m-darwin.so
install_name_change $DEPS_LIB_DIR/$LINK_libhdf5 @rpath/$LINK_libhdf5 $BUNDLE_CONTENTS_DIR/Resources/python/site-packages/h5py/h5p.cpython-37m-darwin.so
install_name_change $DEPS_LIB_DIR/$LINK_libhdf5 @rpath/$LINK_libhdf5 $BUNDLE_CONTENTS_DIR/MacOS/lib/$LINK_libhdf5_hl
install_name_change $DEPS_LIB_DIR/$LINK_libhdf5 @rpath/$LINK_libhdf5 $BUNDLE_CONTENTS_DIR/Resources/python/site-packages/netCDF4-$VERSION_python_netcdf4-py$VERSION_major_python-macosx-$MACOSX_DEPLOYMENT_TARGET-x86_64.egg/netCDF4/_netCDF4.cpython-${VERSION_major_python//./}m-darwin.so

install_name_change $DEPS_LIB_DIR/$LINK_libhdf5_hl @rpath/$LINK_libhdf5_hl $BUNDLE_CONTENTS_DIR/MacOS/lib/$LINK_netcdf
install_name_change $DEPS_LIB_DIR/$LINK_libhdf5_hl @rpath/$LINK_libhdf5_hl $BUNDLE_CONTENTS_DIR/Resources/python/site-packages/h5py/defs.cpython-37m-darwin.so
Expand All @@ -68,6 +69,7 @@ function postbundle_hdf5() {
install_name_change $DEPS_LIB_DIR/$LINK_libhdf5_hl @rpath/$LINK_libhdf5_hl $BUNDLE_CONTENTS_DIR/Resources/python/site-packages/h5py/h5a.cpython-37m-darwin.so
install_name_change $DEPS_LIB_DIR/$LINK_libhdf5_hl @rpath/$LINK_libhdf5_hl $BUNDLE_CONTENTS_DIR/Resources/python/site-packages/h5py/h5pl.cpython-37m-darwin.so
install_name_change $DEPS_LIB_DIR/$LINK_libhdf5_hl @rpath/$LINK_libhdf5_hl $BUNDLE_CONTENTS_DIR/Resources/python/site-packages/h5py/h5p.cpython-37m-darwin.so
install_name_change $DEPS_LIB_DIR/$LINK_libhdf5_hl @rpath/$LINK_libhdf5_hl $BUNDLE_CONTENTS_DIR/Resources/python/site-packages/netCDF4-$VERSION_python_netcdf4-py$VERSION_major_python-macosx-$MACOSX_DEPLOYMENT_TARGET-x86_64.egg/netCDF4/_netCDF4.cpython-${VERSION_major_python//./}m-darwin.so
}

function add_config_info_hdf5() {
Expand Down
3 changes: 3 additions & 0 deletions qgis_bundle/recipes/netcdf/recipe.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ function postbundle_netcdf() {

install_name_change $DEPS_LIB_DIR/$LINK_netcdf @rpath/$LINK_netcdf $BUNDLE_CONTENTS_DIR/PlugIns/qgis/libmdalprovider.so
install_name_change $DEPS_LIB_DIR/$LINK_netcdf @rpath/$LINK_netcdf $BUNDLE_CONTENTS_DIR/MacOS/lib/$LINK_gdal

install_name_change $DEPS_LIB_DIR/$LINK_netcdf @rpath/$LINK_netcdf $BUNDLE_CONTENTS_DIR/Resources/python/site-packages/netCDF4-$VERSION_python_netcdf4-py$VERSION_major_python-macosx-$MACOSX_DEPLOYMENT_TARGET-x86_64.egg/netCDF4/_netCDF4.cpython-${VERSION_major_python//./}m-darwin.so

}

function add_config_info_netcdf() {
Expand Down
2 changes: 1 addition & 1 deletion qgis_bundle/recipes/python_packages/recipe.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ function postbundle_python_packages() {
install_name_delete_rpath $QT_BASE/clang_64/lib $BUNDLE_CONTENTS_DIR/Resources/python/site-packages/PyQt5/QtSerialPort.so
install_name_delete_rpath $QT_BASE/clang_64/lib $BUNDLE_CONTENTS_DIR/Resources/python/site-packages/PyQt5/QtSvg.so
install_name_delete_rpath $QT_BASE/clang_64/lib $BUNDLE_CONTENTS_DIR/Resources/python/site-packages/PyQt5/pyrcc.so
}
}

function add_config_info_python_packages() {
:
Expand Down
10 changes: 10 additions & 0 deletions qgis_bundle/recipes/qgis/recipe.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ function postbundle_qgis() {
## PYTHON
install_name_id @rpath/libqgispython.$QGIS_VERSION.0.dylib $BUNDLE_CONTENTS_DIR/MacOS/lib/libqgispython.$QGIS_VERSION.0.dylib

## APP
install_name_id @rpath/libqgis_app.$QGIS_VERSION.0.dylib $BUNDLE_CONTENTS_DIR/MacOS/lib/libqgis_app.$QGIS_VERSION.0.dylib

## CORE
install_name_id @rpath/qgis_core.framework/Versions/$QGIS_VERSION/qgis_core $BUNDLE_CONTENTS_DIR/Frameworks/qgis_core.framework/Versions/$QGIS_VERSION/qgis_core

Expand Down Expand Up @@ -174,11 +177,18 @@ function postbundle_qgis() {
install_name_change $QGIS_BUILD_DIR/output/lib/qgis_native.framework/Versions/$QGIS_VERSION/qgis_native @rpath/qgis_native.framework/Versions/$QGIS_VERSION/qgis_native $BUNDLE_CONTENTS_DIR/MacOS/lib/libqgis_app.$QGIS_VERSION.0.dylib
install_name_change $QGIS_BUILD_DIR/output/lib/qgis_native.framework/Versions/$QGIS_VERSION/qgis_native @rpath/qgis_native.framework/Versions/$QGIS_VERSION/qgis_native $BUNDLE_CONTENTS_DIR/MacOS/lib/libqgispython.$QGIS_VERSION.0.dylib

# 3D
install_name_change $QGIS_BUILD_DIR/output/lib/qgis_3d.framework/Versions/$QGIS_VERSION/qgis_3d @rpath/qgis_3d.framework/Versions/$QGIS_VERSION/qgis_3d $BUNDLE_CONTENTS_DIR/Resources/python/qgis/_3d.so
install_name_change $QGIS_BUILD_DIR/output/lib/qgis_3d.framework/Versions/$QGIS_VERSION/qgis_3d @rpath/qgis_3d.framework/Versions/$QGIS_VERSION/qgis_3d $BUNDLE_CONTENTS_DIR/MacOS/lib/libqgis_app.$QGIS_VERSION.0.dylib

# GRASS
install_name_change $QGIS_BUILD_DIR/output/lib/qgisgrass${VERSION_grass_major}.framework/Versions/$QGIS_VERSION/qgisgrass${VERSION_grass_major} @rpath/qgisgrass${VERSION_grass_major}.framework/Versions/$QGIS_VERSION/qgisgrass${VERSION_grass_major} $BUNDLE_CONTENTS_DIR/Frameworks/qgisgrass${VERSION_grass_major}.framework/Versions/$QGIS_VERSION/qgisgrass${VERSION_grass_major}
install_name_change $QGIS_BUILD_DIR/output/lib/qgisgrass${VERSION_grass_major}.framework/Versions/$QGIS_VERSION/qgisgrass${VERSION_grass_major} @rpath/qgisgrass${VERSION_grass_major}.framework/Versions/$QGIS_VERSION/qgisgrass${VERSION_grass_major} $BUNDLE_CONTENTS_DIR/PlugIns/qgis/libgrassrasterprovider${VERSION_grass_major}.so
install_name_change $QGIS_BUILD_DIR/output/lib/qgisgrass${VERSION_grass_major}.framework/Versions/$QGIS_VERSION/qgisgrass${VERSION_grass_major} @rpath/qgisgrass${VERSION_grass_major}.framework/Versions/$QGIS_VERSION/qgisgrass${VERSION_grass_major} $BUNDLE_CONTENTS_DIR/PlugIns/qgis/libgrassprovider${VERSION_grass_major}.so
install_name_change $QGIS_BUILD_DIR/output/lib/qgisgrass${VERSION_grass_major}.framework/Versions/$QGIS_VERSION/qgisgrass${VERSION_grass_major} @rpath/qgisgrass${VERSION_grass_major}.framework/Versions/$QGIS_VERSION/qgisgrass${VERSION_grass_major} $BUNDLE_CONTENTS_DIR/PlugIns/qgis/libgrassplugin${VERSION_grass_major}.so

install_name_change $QGIS_BUILD_DIR/output/lib/libqgis_app.$QGIS_VERSION.0.dylib @rpath/libqgis_app.$QGIS_VERSION.0.dylib $BUNDLE_CONTENTS_DIR/PlugIns/qgis/libgrassplugin${VERSION_grass_major}.so
install_name_change $QGIS_BUILD_DIR/output/lib/qgis_3d.framework/Versions/$QGIS_VERSION/qgis_3d @rpath/qgis_3d.framework/Versions/$QGIS_VERSION/qgis_3d $BUNDLE_CONTENTS_DIR/PlugIns/qgis/libgrassplugin${VERSION_grass_major}.so
}

function add_config_info_qgis() {
Expand Down
1 change: 1 addition & 0 deletions qgis_bundle/recipes/spatialite/recipe.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ function postbundle_spatialite() {
install_name_change $DEPS_LIB_DIR/$LINK_spatialite @rpath/$LINK_spatialite $BUNDLE_CONTENTS_DIR/Resources/python/qgis/_gui.so
install_name_change $DEPS_LIB_DIR/$LINK_spatialite @rpath/$LINK_spatialite $BUNDLE_CONTENTS_DIR/MacOS/lib/libqgis_app.$QGIS_VERSION.0.dylib
install_name_change $DEPS_LIB_DIR/$LINK_spatialite @rpath/$LINK_spatialite $BUNDLE_CONTENTS_DIR/MacOS/lib/libqgispython.$QGIS_VERSION.0.dylib
install_name_change $DEPS_LIB_DIR/$LINK_spatialite @rpath/$LINK_spatialite $BUNDLE_CONTENTS_DIR/MacOS/lib/$LINK_gdal
}

function add_config_info_spatialite() {
Expand Down
3 changes: 2 additions & 1 deletion qgis_bundle/recipes/sqlite/recipe.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ function postbundle_sqlite() {
install_name_change $DEPS_LIB_DIR/$LINK_sqlite @rpath/$LINK_sqlite $BUNDLE_CONTENTS_DIR/Resources/python/qgis/_gui.so
install_name_change $DEPS_LIB_DIR/$LINK_sqlite @rpath/$LINK_sqlite $BUNDLE_CONTENTS_DIR/MacOS/lib/libqgis_app.$QGIS_VERSION.0.dylib
install_name_change $DEPS_LIB_DIR/$LINK_sqlite @rpath/$LINK_sqlite $BUNDLE_CONTENTS_DIR/MacOS/lib/libqgispython.$QGIS_VERSION.0.dylib
install_name_change $DEPS_LIB_DIR/$LINK_sqlite @rpath/$LINK_sqlite $BUNDLE_CONTENTS_DIR/MacOS/lib/libproj.18.1.3.dylib
install_name_change $DEPS_LIB_DIR/$LINK_sqlite @rpath/$LINK_sqlite $BUNDLE_CONTENTS_DIR/MacOS/lib/$LINK_libproj
install_name_change $DEPS_LIB_DIR/$LINK_sqlite @rpath/$LINK_sqlite $BUNDLE_CONTENTS_DIR/MacOS/lib/$LINK_gdal

install_name_change $DEPS_LIB_DIR/$LINK_sqlite @rpath/$LINK_sqlite $BUNDLE_CONTENTS_DIR/MacOS/lib/$LINK_spatialite
install_name_change $DEPS_LIB_DIR/$LINK_sqlite @rpath/$LINK_sqlite $BUNDLE_CONTENTS_DIR/Resources/python/lib-dynload/_sqlite3.cpython-37m-darwin.so
Expand Down
6 changes: 4 additions & 2 deletions qgis_bundle/recipes/xerces/recipe.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ function check_xerces() {
}

function bundle_xerces() {
:
try cp -av $DEPS_LIB_DIR/libxerces*dylib $BUNDLE_LIB_DIR
}

function postbundle_xerces() {
:
install_name_id @rpath/$LINK_libxerces_c $BUNDLE_LIB_DIR/$LINK_libxerces_c

install_name_change $DEPS_LIB_DIR/$LINK_libxerces_c @rpath/$LINK_libxerces_c $BUNDLE_CONTENTS_DIR/MacOS/lib/$LINK_gdal
}

function add_config_info_xerces() {
Expand Down
29 changes: 13 additions & 16 deletions qgis_deps/sign_deps.bash
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,12 @@ source $CONFIG_FILE

PATH_TO_SIGN=$ROOT_OUT_PATH/stage/

IDENTITY=`cat $SIGN_FILE`
if [ ! -f "$SIGN_FILE" ]; then
error "identity file $SIGN_FILE missing"
fi

IDENTITY=$(cat $SIGN_FILE)

if [ ${#IDENTITY} -ne 40 ]; then
error "SIGN FILE $SIGN_FILE invalid. key must have 40 chars" ;
fi
Expand All @@ -27,24 +32,16 @@ if [ ! -f "$KEYCHAIN_FILE" ]; then
error "keychain file $KEYCHAIN_FILE missing"
fi


if [ "X$PATH_TO_SIGN" == "X" ]; then
echo "you need to specify PATH_TO_SIGN"
exit 1
fi

IDENTITY="$(cat $IDENTITY_FILE)"

echo "Signing binaries in $PATH_TO_SIGN"
LIBS1=`find $PATH_TO_SIGN -type f -name "*.so"`
LIBS2=`find $PATH_TO_SIGN -type f -name "*.dylib"`
BINS=`find $PATH_TO_SIGN -type f ! -name "*.*"`
LIBS1=$(find "$PATH_TO_SIGN" -type f -name "*.so")
LIBS2=$(find "$PATH_TO_SIGN" -type f -name "*.dylib")
BINS=$(find "$PATH_TO_SIGN" -type f ! -name "*.*")
LIBS="$BINS $LIBS1 $LIBS2"

echo "This make take few minutes..."
for LIB in $LIBS; do
if file $LIB | grep -q Mach-O
then
codesign -s $IDENTITY -v --deep --keychain $KEYCHAIN_FILE $LIB
fi
sem -j+0 "codesign --force -s $IDENTITY --keychain $KEYCHAIN_FILE $LIB"
done
sem --wait

echo "Signing done"
2 changes: 1 addition & 1 deletion qgis_deps/upload_to_qgis2.bash
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
####################
# load configuration
if (( $# < 1 )); then
echo "sign_deps: $0 <path/to>/config/<my>.conf ..."
echo "upload_to_qgis2: $0 <path/to>/config/<my>.conf ..."
exit 1
fi
CONFIG_FILE=$1
Expand Down
1 change: 1 addition & 0 deletions scripts/install_brew_dev_packages.bash
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@ brew install astyle
brew install help2man
brew install autoconf
brew install automake
brew install parallel

pip3 install dmgbuild

0 comments on commit e6a9f3f

Please sign in to comment.