diff --git a/Makefile.am b/Makefile.am index 3f09133c2c..d130c43062 100644 --- a/Makefile.am +++ b/Makefile.am @@ -372,7 +372,7 @@ if HAVE_GTK wireshark_gtk_LDFLAGS = -export-dynamic endif if HAVE_Qt -wireshark_LDFLAGS = -export-dynamic +wireshark_LDFLAGS = -export-dynamic @Qt_LDFLAGS@ endif endif diff --git a/configure.ac b/configure.ac index 86558eeaba..7b7a8b72fd 100644 --- a/configure.ac +++ b/configure.ac @@ -1625,7 +1625,7 @@ if test "x$enable_wireshark" = "xyes"; then fi if test "x$with_qt" != "xno"; then # - # Qt was specified; Make sure we have a C++ compiler. + # Qt was specified; make sure we have a C++ compiler. # if test -z "$CXX"; then AC_MSG_ERROR(Need a working C++ compiler to build Wireshark with Qt) @@ -1663,6 +1663,26 @@ if test "x$enable_wireshark" = "xyes"; then AC_SUBST(MOC) AC_WIRESHARK_QT_TOOL_CHECK(RCC, rcc, "$qt_version") AC_SUBST(RCC) + + # + # On Darwin, find where the Qt frameworks are + # located, and add that to the rpath, just in + # case this is Qt 5.5 or later and the frameworks + # have an install name that begins with @rpath + # and aren't installed in a frameworks directory + # that's searched by default. + # + case "$host_os" in + darwin*) + if test $qt_version -le 4 + then + Qt_LDFLAGS="-Wl,-rpath,"`$PKG_CONFIG --libs QtCore | sed -e 's/-F//' -e 's/ -framework.*//'` + else + Qt_LDFLAGS="-Wl,-rpath,"`$PKG_CONFIG --libs Qt${qt_version}Core | sed -e 's/-F//' -e 's/ -framework.*//'` + fi + ;; + esac + AC_SUBST(Qt_LDFLAGS) ], [ case "$with_qt" in diff --git a/packaging/macosx/osx-app.sh b/packaging/macosx/osx-app.sh index 6fcd043ec2..c58a24b6b5 100755 --- a/packaging/macosx/osx-app.sh +++ b/packaging/macosx/osx-app.sh @@ -178,6 +178,21 @@ elif [ ! -d "$bundle" ] ; then exit 1 fi +if [ "$ui_toolkit" = "qt" ] ; then + for i in 5 "" + do + qt_frameworks_dir=`pkg-config --libs Qt${i}Core | sed -e 's/-F//' -e 's/ -framework.*//'` + if [ ! -z "$qt_frameworks_dir" ] ; then + # found it + break; + fi + done + if [ -z "$qt_frameworks_dir" ] ; then + echo "Can't find the Qt frameworks directory" >&2 + exit 1 + fi +fi + # Package paths pkgexec="$bundle/Contents/MacOS" pkgres="$bundle/Contents/Resources" @@ -468,6 +483,12 @@ fi if [ "$ui_toolkit" = "qt" ] ; then macdeployqt "$bundle" -verbose=3 || exit 1 + + # + # The build process added to the Wireshark binary an rpath entry + # pointing to the directory containing the Qt frameworks; remove + # that entry from the Wireshark binary in the package. + /usr/bin/install_name_tool -delete_rpath "$qt_frameworks_dir" $pkgbin/Wireshark fi # NOTE: we must rpathify *all* files, *including* plugins for GTK+ etc.,