mirror of
https://github.com/chris2511/xca.git
synced 2026-09-12 19:51:05 +05:00
Close #640: Fix mysql on Mac OSX
Replace the @rpath/libmariadb.3.dylib by "$INSTALL_DIR"/lib/libmariadb.3.dylib in the self compiled plugin "libqsqlmysql.dylib" after installation in the QTDIR plugin directory. This provokes macdeployqt to install libmariadb.3.dylib to take libmariadb.3.dylib into account and also install it and resolve all referenced library paths. Finally the absolute path will be replaced by the @rpath when creating the xca.app. Add tests for my HOME dir inside the installed binaries to detect errors in the future.
This commit is contained in:
parent
caaea326a8
commit
58b2d713a1
@ -218,11 +218,20 @@ if(APPLE)
|
||||
RESOURCE "${APP_RESOURCES}"
|
||||
)
|
||||
find_program(MACDEPLOYQT_EXECUTABLE macdeployqt HINTS ${_qt_bin_dir})
|
||||
find_program(INSTALL_NAME_TOOL install_name_tool HINTS ${_qt_bin_dir})
|
||||
|
||||
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
|
||||
COMMAND ${MACDEPLOYQT_EXECUTABLE} $<TARGET_FILE_DIR:${PROJECT_NAME}>/../..
|
||||
-always-overwrite ${APPSTORE}
|
||||
COMMENT "Running macdeployqt..."
|
||||
)
|
||||
foreach(installdir ${CMAKE_PREFIX_PATH})
|
||||
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
|
||||
COMMAND test ! -e $<TARGET_FILE_DIR:${PROJECT_NAME}>/../PlugIns/sqldrivers/libqsqlmysql.dylib ||
|
||||
${INSTALL_NAME_TOOL} -change ${installdir}/lib/libmariadb.3.dylib @rpath/libmariadb.3.dylib
|
||||
$<TARGET_FILE_DIR:${PROJECT_NAME}>/../PlugIns/sqldrivers/libqsqlmysql.dylib
|
||||
)
|
||||
endforeach()
|
||||
if (PROVISIONPROFILE)
|
||||
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
|
||||
COMMAND cmake -E copy ${PROVISIONPROFILE}
|
||||
@ -236,7 +245,6 @@ if(APPLE)
|
||||
--force -s ${APPLE_DEVELOPER_CERT}
|
||||
$<TARGET_FILE_DIR:${PROJECT_NAME}>/../..
|
||||
COMMENT "Running codesign for ${APPLE_DEVELOPER_CERT} ..."
|
||||
DEPENDS ${PROJECT_SOURCE_DIR}/misc/entitlement${APPSTORE}.plist
|
||||
)
|
||||
endif()
|
||||
|
||||
|
||||
@ -95,12 +95,15 @@ do_qsqlmysql()
|
||||
|
||||
cmake --build $SQL_BUILD -j$JOBS -v
|
||||
cmake --install $SQL_BUILD
|
||||
install_name_tool -change @rpath/libmariadb.3.dylib\
|
||||
# Replace @rpath name by full path in the installed file,
|
||||
# to trigger macdeployqt to pick up this library.
|
||||
# This is a hack, but it works. we need to revert it
|
||||
# after macdeployqt has run.
|
||||
install_name_tool -change @rpath/libmariadb.3.dylib \
|
||||
"$INSTALL_DIR"/lib/libmariadb.3.dylib \
|
||||
$QT_DIR/plugins/sqldrivers/libqsqlmysql.dylib
|
||||
|
||||
file $QT_DIR/plugins/sqldrivers/libqsqlmysql.dylib
|
||||
file $SQL_BUILD/plugins/sqldrivers/libqsqlmysql.dylib
|
||||
otool -L $QT_DIR/plugins/sqldrivers/libqsqlmysql.dylib
|
||||
}
|
||||
|
||||
@ -126,7 +129,6 @@ do_openssl
|
||||
# -qt_internal_force_macos_intel_arch(QMYSQLDriverPlugin)
|
||||
do_qsqlmysql
|
||||
|
||||
|
||||
cmake -B "$BUILDDIR" "$XCA_DIR" \
|
||||
-DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" \
|
||||
-DCMAKE_PREFIX_PATH="$QT_DIR/lib/cmake;$INSTALL_DIR" \
|
||||
@ -156,3 +158,5 @@ read xca_version < "$BUILDDIR_APPSTORE"/PKGVERSION.txt
|
||||
cmake --build "$BUILDDIR_APPSTORE" -j$JOBS
|
||||
productbuild --component "$BUILDDIR_APPSTORE/xca.app" /Applications \
|
||||
--sign "3rd Party Mac Developer Installer" "$BUILDDIR_APPSTORE/xca-${xca_version}-appstore.pkg"
|
||||
|
||||
find "${BUILDDIR_APPSTORE}/xca.app" "${BUILDDIR}/xca.app" -name "*.dylib" | xargs otool -L | grep -E "/Applications/\|$HOME"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user