Skip to content

Commit

Permalink
bundlers/mac: Copy libc++ libs in bundle also when using homebrew
Browse files Browse the repository at this point in the history
  • Loading branch information
anlambert committed May 28, 2024
1 parent 7fd153b commit d5f9eb8
Showing 1 changed file with 30 additions and 6 deletions.
36 changes: 30 additions & 6 deletions bundlers/mac/mac_bundle.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ then
QT_BINARY_DIR=@_qt5Gui_install_prefix@/bin
fi

export PATH=${QT_BINARY_DIR}:${PATH}

if [ ! -d ${TALIPOT_DIR} ]
then
echo "Error : the specified Talipot installation directory does not exist"
Expand Down Expand Up @@ -71,8 +73,9 @@ cd "${DEST_DIR}/application"
cp "${SRC_DIR}/../../LICENSE" .

QT_LIB_DIR="@QT_QTCORE_LIBRARY@/.."
TALIPOT_APP=${DEST_DIR}/application/Talipot.app
echo 'Copying Resources'
cd "${DEST_DIR}/application/Talipot.app/Contents/Frameworks/"
cd "${TALIPOT_APP}/Contents/Frameworks/"
cp -r "${QT_LIB_DIR}/QtGui.framework/Resources/qt_menu.nib" ../Resources 2>/dev/null
cp "@QT_QTCLUCENE_LIBRARY@" . 2>/dev/null

Expand All @@ -82,15 +85,36 @@ cd ..
mv bin/talipot MacOS/Talipot
# run macdeployqt with Talipot Python dynamic modules (not processed by macdeployqt as
# they are suffixed by .so instead of .dylib)
${QT_BINARY_DIR}/macdeployqt ${DEST_DIR}/application/Talipot.app \
-executable=${DEST_DIR}/application/Talipot.app/Contents/lib/talipot/python/talipot/native/_talipot.so
mac_deploy_qt_opts=-executable=${TALIPOT_APP}/Contents/lib/talipot/python/talipot/native/_talipot.so
mac_deploy_qt_opts=" -executable=$(ls ${TALIPOT_APP}/Contents/lib/talipot/view/libGeographicView-*)"
if [ $(qmake -query QT_VERSION | cut -c1) -ge 6 ]
then
mac_deploy_qt_opts+=" -no-plugins"
fi

${QT_BINARY_DIR}/macdeployqt ${TALIPOT_APP} \
$mac_deploy_qt_opts

# ensure libc++* are present in bundle
LIB_CXX_DIR="/opt/local/libexec/llvm-${CLANG_VERSION}/lib"
LIB_CXX_DIR=$(echo "@CMAKE_SHARED_LINKER_FLAGS@" | cut -f1 -d" " | cut -c3-)
if [ -d ${LIB_CXX_DIR} ]
then
cp ${LIB_CXX_DIR}/libc++.1.dylib ${DEST_DIR}/application/Talipot.app/Contents/Frameworks/
cp ${LIB_CXX_DIR}/libc++abi.1.dylib ${DEST_DIR}/application/Talipot.app/Contents/Frameworks/
cp ${LIB_CXX_DIR}/libc++.1.dylib ${TALIPOT_APP}/Contents/Frameworks/
cp ${LIB_CXX_DIR}/libc++abi.1.dylib ${TALIPOT_APP}/Contents/Frameworks/
fi

if [ -f ${LIB_CXX_DIR}/../libunwind.1.dylib ]
then
cp ${LIB_CXX_DIR}/../libunwind.1.dylib ${TALIPOT_APP}/Contents/Frameworks/
fi

if [ $(qmake -query QT_VERSION | cut -c1) -ge 6 ]
then
mkdir ${TALIPOT_APP}/Contents/PlugIns
for plugins in iconengines imageformats networkinformation platforminputcontexts platforms position styles tls
do
cp -r ${QT_BINARY_DIR}/../share/qt/plugins/${plugins} ${TALIPOT_APP}/Contents/PlugIns
done
fi

mv MacOS/Talipot bin/talipot
Expand Down

0 comments on commit d5f9eb8

Please sign in to comment.