Skip to content

Commit

Permalink
continue working on bundler
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterPetrik committed Apr 3, 2020
1 parent eb6a1b1 commit dfe60cf
Show file tree
Hide file tree
Showing 12 changed files with 113 additions and 28 deletions.
42 changes: 38 additions & 4 deletions qgis_build/qgis_build.bash
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ CORES=$(sysctl -n hw.ncpu)


# TODO replace with something configurable
# TODO use MACOSX_DEPLOYMENT_TARGET
export QGIS_VERSION=3.13
export QGIS_SOURCE_DIR=~/Projects/mesh/QGIS
export QGIS_BUILD_DIR=$ROOT_OUT_PATH/../qgis-${QGIS_VERSION}-deps-${RELEASE_VERSION}/build
Expand All @@ -60,11 +61,44 @@ try cd $QGIS_BUILD_DIR
PATH=$ROOT_OUT_PATH/stage/bin:$PATH \
cmake -DQGIS_MAC_DEPS_DIR=$ROOT_OUT_PATH/stage \
-DCMAKE_PREFIX_PATH=$QT_BASE/clang_64 \
-DQGIS_MACAPP_BUNDLE=0 \
-DQGIS_MACAPP_BUNDLE=-1 \
-DWITH_3D=TRUE \
-DWITH_BINDINGS=TRUE \
-DENABLE_TESTS=FALSE \
-DCMAKE_OSX_DEPLOYMENT_TARGET=$MACOSX_DEPLOYMENT_TARGET \
-DCMAKE_INSTALL_PREFIX:PATH=$QGIS_INSTALL_DIR\
$QGIS_SOURCE_DIR

# -DWITH_QT5SERIALPORT=FALSE \
$QGIS_SOURCE_DIR > cmake.configure 2>&1

cat cmake.configure

targets=(
libgdal.dylib
libgeos_c.dylib
libproj.dylib
)
for i in ${targets[*]}
do
if grep -q /usr/local/lib/$i cmake.configure
then
error "CMake configured QGIS build with /usr/local/lib/$i.dylib string -- we should be using qgis_deps version of this library"
fi
done

targets=(
libz
libssl
libcrypto
libpq
libxml2
libsqlite3
)
for i in ${targets[*]}
do
if grep -q /usr/lib/$i cmake.configure
then
error "CMake configured QGIS build with /usr/lib/$i.dylib string -- we should be using qgis_deps version of this library"
fi
done

try cd $QGIS_BUILD_DIR
try make -j ${CORES}
Expand Down
17 changes: 12 additions & 5 deletions qgis_bundle/qgis_bundle.bash
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ done
export STAGE_PATH=$ROOT_OUT_PATH/stage
export RECIPES_PATH=$DIR/recipes

export DEPS_ROOT_DIR=$STAGE_PATH
export DEPS_FRAMEWORKS_DIR=$STAGE_PATH/Frameworks
export DEPS_SHARE_DIR=$STAGE_PATH/share
export DEPS_BIN_DIR=$STAGE_PATH/bin
Expand Down Expand Up @@ -89,6 +90,9 @@ export BUNDLE_PLUGINS_DIR=$BUNDLE_MACOS_DIR/PlugIns
export BUNDLE_LIB_DIR=$BUNDLE_MACOS_DIR/lib
export BUNDLE_PYTHON_SITE_PACKAGES_DIR=$BUNDLE_RESOURCES_DIR/python

export RPATH_LIB_DIR=@rpath


# COMMANDS
RSYNCDIR="rsync -r"
CP=cp
Expand Down Expand Up @@ -202,6 +206,7 @@ run_final_check() {
info "Running final check in the ${BUNDLE_DIR}"

# libs
info "Check libraries"
cd ${BUNDLE_DIR}
LIBS1=`find . -type f -name "*.so"`
LIBS2=`find . -type f -name "*.dylib"`
Expand All @@ -210,6 +215,7 @@ run_final_check() {
check_binary_linker_links $lib
done

info "Check binaries"
# frameworks (Mach-O without binaries)
LIBS=`find . -type f ! -name "*.*"`
for lib in $LIBS; do
Expand All @@ -219,12 +225,13 @@ run_final_check() {
fi
done

info "Check other files"
# all other files
#if grep -rni $STAGE_PATH $STAGE_PATH
#then
# grep -rni $STAGE_PATH $STAGE_PATH
# error "Some scripts reference absolute STAGE_PATH dir $STAGE_PATH"
#fi
if grep -rni $BUNDLE_DIR .
then
grep -rni $STAGE_PATH $STAGE_PATH
error "Some scripts reference absolute BUNDLE_DIR dir $BUNDLE_DIR"
fi
}

function run() {
Expand Down
4 changes: 2 additions & 2 deletions qgis_bundle/recipes/gdal/recipe.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ function check_gdal() {
}

function bundle_gdal() {
: # install_name_tool -id "@rpath/libgdal.dylib" ${STAGE_PATH}/lib/libgdal.dylib
try rsync -av $DEPS_SHARE_DIR/gdal $BUNDLE_RESOURCES_DIR/
}

function postbundle_gdal() {
:
: # install_name_tool -id "@rpath/libgdal.dylib" ${STAGE_PATH}/lib/libgdal.dylib
}

function add_config_info_gdal() {
Expand Down
4 changes: 2 additions & 2 deletions qgis_bundle/recipes/proj/recipe.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ function check_proj() {
}

function bundle_proj() {
: # install_name_tool -id "@rpath/libproj.dylib" ${STAGE_PATH}/lib/libproj.dylib
try rsync -av $DEPS_SHARE_DIR/proj $BUNDLE_RESOURCES_DIR/
}

function postbundle_proj() {
:
: # install_name_tool -id "@rpath/libproj.dylib" ${STAGE_PATH}/lib/libproj.dylib
}

function add_config_info_proj() {
Expand Down
12 changes: 8 additions & 4 deletions qgis_bundle/recipes/qgis/recipe.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,14 @@ function bundle_qgis() {
try cp -av $QGIS_CONTENTS_DIR/MacOS/lib/libqgis_app.* $BUNDLE_LIB_DIR
try cp -av $QGIS_CONTENTS_DIR/MacOS/lib/libqgispython.* $BUNDLE_LIB_DIR

try cp -avR $QGIS_CONTENTS_DIR/PlugIns/ $BUNDLE_PLUGINS_DIR
try cp -avR $QGIS_CONTENTS_DIR/Resources/ $BUNDLE_RESOURCES_DIR

try rsync -av $QGIS_CONTENTS_DIR/Frameworks/ $BUNDLE_FRAMEWORKS_DIR/ --exclude Headers
try rsync -av $QGIS_CONTENTS_DIR/PlugIns/ $BUNDLE_PLUGINS_DIR/
try rsync -av $QGIS_CONTENTS_DIR/Resources/ $BUNDLE_RESOURCES_DIR/

try rsync -av $QGIS_CONTENTS_DIR/Frameworks/qgis_analysis.framework $BUNDLE_FRAMEWORKS_DIR/ --exclude Header
try rsync -av $QGIS_CONTENTS_DIR/Frameworks/qgis_core.framework $BUNDLE_FRAMEWORKS_DIR/ --exclude Headers
try rsync -av $QGIS_CONTENTS_DIR/Frameworks/qgis_gui.framework $BUNDLE_FRAMEWORKS_DIR/ --exclude Headers
try rsync -av $QGIS_CONTENTS_DIR/Frameworks/qgis_native.framework $BUNDLE_FRAMEWORKS_DIR/ --exclude Headers
try rsync -av $QGIS_CONTENTS_DIR/Frameworks/qgisgrass7.framework $BUNDLE_FRAMEWORKS_DIR/ --exclude Headers
}

function postbundle_qgis() {
Expand Down
6 changes: 5 additions & 1 deletion qgis_bundle/recipes/qscintilla/recipe.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,18 @@

function check_qscintilla() {
env_var_exists VERSION_qscintilla
env_var_exists LINK_libqscintilla2_qt5
}

function bundle_qscintilla() {
try cp -av $DEPS_LIB_DIR/libqscintilla2* $BUNDLE_LIB_DIR/
: # install_name_tool -id "@rpath/libqscintilla.dylib" ${STAGE_PATH}/lib/libqscintilla.dylib
}

function postbundle_qscintilla() {
:
install_name_tool -id $RPATH_LIB_DIR/$LINK_libqscintilla2_qt5 $BUNDLE_LIB_DIR/$LINK_libqscintilla2_qt5

try install_name_tool -change $DEPS_LIB_DIR/$LINK_libqscintilla2_qt5 $RPATH_LIB_DIR/$LINK_libqscintilla2_qt5 $BUNDLE_PLUGINS_DIR/qgis/libgeometrycheckerplugin.so
}

function add_config_info_qscintilla() {
Expand Down
10 changes: 10 additions & 0 deletions qgis_bundle/recipes/qt/recipe.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,16 @@ function bundle_qt() {
try rsync -av $QT_ROOT_DIR/lib/QtPositioning.framework $BUNDLE_FRAMEWORKS_DIR/ --exclude Headers
try rsync -av $QT_ROOT_DIR/lib/QtBluetooth.framework $BUNDLE_FRAMEWORKS_DIR/ --exclude Headers
try rsync -av $QT_ROOT_DIR/lib/Qt3DLogic.framework $BUNDLE_FRAMEWORKS_DIR/ --exclude Headers
try rsync -av $QT_ROOT_DIR/lib/QtSql.framework $BUNDLE_FRAMEWORKS_DIR/ --exclude Headers
try rsync -av $QT_ROOT_DIR/lib/QtConcurrent.framework $BUNDLE_FRAMEWORKS_DIR/ --exclude Headers
try rsync -av $QT_ROOT_DIR/lib/QtSerialBus.framework $BUNDLE_FRAMEWORKS_DIR/ --exclude Headers
try rsync -av $QT_ROOT_DIR/lib/QtGamepad.framework $BUNDLE_FRAMEWORKS_DIR/ --exclude Headers
try rsync -av $QT_ROOT_DIR/lib/QtNetwork.framework $BUNDLE_FRAMEWORKS_DIR/ --exclude Headers
try rsync -av $QT_ROOT_DIR/lib/QtXmlPatterns.framework $BUNDLE_FRAMEWORKS_DIR/ --exclude Headers
try rsync -av $QT_ROOT_DIR/lib/QtSvg.framework $BUNDLE_FRAMEWORKS_DIR/ --exclude Headers
try rsync -av $QT_ROOT_DIR/lib/QtMultimediaWidgets.framework $BUNDLE_FRAMEWORKS_DIR/ --exclude Headers
try rsync -av $QT_ROOT_DIR/lib/QtSensors.framework $BUNDLE_FRAMEWORKS_DIR/ --exclude Headers
try rsync -av $QT_ROOT_DIR/lib/QtTextToSpeech.framework $BUNDLE_FRAMEWORKS_DIR/ --exclude Headers

# try rsync -av $QT_ROOT_DIR/lib/QtNetworkAuth.framework $BUNDLE_FRAMEWORKS_DIR/ --exclude Headers
# try rsync -av $QT_ROOT_DIR/lib/QtVirtualKeyboard.framework $BUNDLE_FRAMEWORKS_DIR/ --exclude Headers
Expand Down
4 changes: 3 additions & 1 deletion qgis_bundle/recipes/qwt/recipe.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ function check_qwt() {
}

function bundle_qwt() {
: # install_name_tool -id "@rpath/libqwt.dylib" ${STAGE_PATH}/lib/libqwt.dylib
try rsync -av $DEPS_LIB_DIR/qwt.framework $BUNDLE_FRAMEWORKS_DIR/ --exclude Headers

# install_name_tool -id "@rpath/libqwt.dylib" ${STAGE_PATH}/lib/libqwt.dylib
}

function postbundle_qwt() {
Expand Down
9 changes: 7 additions & 2 deletions qgis_bundle/recipes/saga/recipe.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,16 @@ function check_saga() {
}

function bundle_saga() {
: # install_name_tool -id "@rpath/libsaga.dylib" ${STAGE_PATH}/lib/libsaga.dylib
try mkdir -p $BUNDLE_RESOURCES_DIR/saga/toolchains
try rsync -av $DEPS_SHARE_DIR/saga/toolchains/ $BUNDLE_RESOURCES_DIR/saga/toolchains/

try rsync -av $DEPS_LIB_DIR/saga/ $BUNDLE_LIB_DIR/saga/ --exclude=*.la

try cp -v $DEPS_BIN_DIR/saga_cmd $BUNDLE_BIN_DIR/
}

function postbundle_saga() {
:
: # install_name_tool -id "@rpath/libsaga.dylib" ${STAGE_PATH}/lib/libsaga.dylib
}

function add_config_info_saga() {
Expand Down
22 changes: 20 additions & 2 deletions qgis_deps/distribute.sh
Original file line number Diff line number Diff line change
Expand Up @@ -372,11 +372,28 @@ function check_linked_rpath() {
done
}

function verify_binary() {
BINARY=$1
cd ${STAGE_PATH}/

if [ ! -f "$BINARY" ]; then
error "Missing library: ${STAGE_PATH}/${BINARY}... Maybe you updated the library version in the receipt?"
fi

LIB_ARCHS=`lipo -archs $BINARY`
if [[ $LIB_ARCHS != *"$ARCH"* ]]; then
error "Binary $BINARY was not successfully build for $ARCH, but ${LIB_ARCHS}"
fi

check_linked_rpath $BINARY
}

# TODO remove this function!
function verify_lib() {
cd ${STAGE_PATH}/

if [ ! -f "lib/$1" ]; then
debug "Missing library: ${STAGE_PATH}/lib/$1"
debug "Missing library: ${STAGE_PATH}/lib/$1"
fi

LIB_ARCHS=`lipo -archs lib/$1`
Expand All @@ -387,6 +404,7 @@ function verify_lib() {
check_linked_rpath lib/$1
}

# TODO remove this function!
function verify_bin() {
cd ${STAGE_PATH}/

Expand Down Expand Up @@ -878,7 +896,7 @@ function run() {
run_prebuild
run_build
run_postbuild
run_final_check
# run_final_check
run_create_config_file
info "All done !"
}
Expand Down
8 changes: 6 additions & 2 deletions qgis_deps/recipes/qscintilla/recipe.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ DESC_qscintilla="Port to Qt of the Scintilla editing component"
# keep in SYNC with python_qscintilla receipt
VERSION_qscintilla=2.11.4

# full link version of the library
LINK_libqscintilla2_qt5=libqscintilla2_qt5.15.dylib

# dependencies of this recipe
DEPS_qscintilla=()

Expand Down Expand Up @@ -46,7 +49,7 @@ function prebuild_qscintilla() {

function shouldbuild_qscintilla() {
# If lib is newer than the sourcecode skip build
if [ "${STAGE_PATH}/lib/libqscintilla2_qt5.dylib" -nt $BUILD_qscintilla/.patched ]; then
if [ "${STAGE_PATH}/lib/${LINK_libqscintilla2_qt5}" -nt $BUILD_qscintilla/.patched ]; then
DO_BUILD=0
fi
}
Expand All @@ -68,11 +71,12 @@ function build_qscintilla() {

# function called after all the compile have been done
function postbuild_qscintilla() {
verify_lib "libqscintilla2_qt5.dylib"
verify_binary lib/$LINK_libqscintilla2_qt5
}

# function to append information to config file
function add_config_info_qscintilla() {
append_to_config_file "# qscintilla-${VERSION_qscintilla}: ${DESC_qscintilla}"
append_to_config_file "export VERSION_qscintilla=${VERSION_qscintilla}"
append_to_config_file "export LINK_libqscintilla2_qt5=${LINK_libqscintilla2_qt5}"
}
3 changes: 0 additions & 3 deletions qgis_deps/recipes/saga/recipe.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,7 @@ function build_saga() {
# function called after all the compile have been done
function postbuild_saga() {
verify_lib "libsaga_api.dylib"

verify_bin saga_cmd

run_final_check
}

# function to append information to config file
Expand Down

0 comments on commit dfe60cf

Please sign in to comment.