Skip to content

Commit

Permalink
Merge pull request #25347 from martyngigg/macos-gatekeeper-workbench
Browse files Browse the repository at this point in the history
Fix workbench startup script on macOS under Gatekeeper
  • Loading branch information
DanNixon committed Mar 25, 2019
2 parents be4120f + 2868f97 commit de25931
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 21 deletions.
4 changes: 3 additions & 1 deletion Framework/Kernel/src/NetworkProxyOSX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,9 @@ ProxyInfo findHttpProxy(const std::string &targetURLString,
ProxyInfo httpProxy;
CFDictionaryRef dict = SCDynamicStoreCopyProxies(nullptr);
if (!dict) {
logger.debug("NetworkProxyOSX SCDynamicStoreCopyProxies returned NULL");
logger.debug("NetworkProxyOSX SCDynamicStoreCopyProxies returned NULL. No "
"proxy information retrieved");
return httpProxy;
}

// Query the proxy pac first.
Expand Down
4 changes: 3 additions & 1 deletion MantidPlot/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -845,6 +845,7 @@ set_target_properties ( MantidPlot PROPERTIES FOLDER "Qt4" )
# Custom Info.plist file for OS X
###########################################################################
if( APPLE )
set ( MAC_BUNDLE_EXECUTABLE Mantid_osx_launcher )
# Setting the CFBundleIdentifer attribute on OS X 10.6 (SL) and before
# causes problems with trying to install the package on the same
# machine as it was built. It tries to relocate the package to the build directory
Expand All @@ -860,7 +861,8 @@ if( APPLE )
else()
set ( MAC_BUNDLE_IDENTIFIER "" )
endif()

set ( MAC_BUNDLE_ICON MantidPlot.icns )
set ( MAC_BUNDLE_NAME MantidPlot )
configure_file ( ${CMAKE_CURRENT_SOURCE_DIR}/../installers/MacInstaller/Info.plist.in
${CMAKE_CURRENT_BINARY_DIR}/Info.plist
@ONLY )
Expand Down
11 changes: 8 additions & 3 deletions buildconfig/CMake/Packaging/osx/MantidWorkbench_osx_launcher
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
#!/usr/bin/env bash

INSTALLDIR=$(cd "$(dirname "$0")"; pwd)
PLUGIN_DIR=$INSTALLDIR/../PlugIns
cd $INSTALLDIR
QT_PLUGIN_PATH=$PLUGIN_DIR ./workbench-script $* || /usr/bin/python ../../scripts/ErrorReporter/error_dialog_app.py --exitcode=$? --directory=$INSTALLDIR --qtdir=$PLUGIN_DIR --application=workbench

# On first launch of quarantined apps launchd passes a command line parameter of the form -psn_0_XXXXXX
# to the application. We discard this otherwise workbench's argparse will choke on it.
# https://stackoverflow.com/questions/10242115/os-x-strange-psn-command-line-parameter-when-launched-from-finder
if [[ "${1}" == -psn_* ]]; then
shift 1
fi
env PYTHONPATH=${INSTALLDIR}:${PYTHONPATH} env QT_PLUGIN_PATH=$PLUGIN_DIR ${INSTALLDIR}/workbench-script $* || /usr/bin/python $INSTALLDIR/../../scripts/ErrorReporter/error_dialog_app.py --exitcode=$? --directory=$INSTALLDIR --qtdir=$PLUGIN_DIR --application=workbench
6 changes: 3 additions & 3 deletions installers/MacInstaller/Info.plist.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>Mantid_osx_launcher</string>
<string>@MAC_BUNDLE_EXECUTABLE@</string>
<key>CFBundleGetInfoString</key>
<string>@VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_PATCH@</string>
<key>CFBundleIconFile</key>
<string>MantidPlot.icns</string>
<string>@MAC_BUNDLE_ICON@</string>
<key>CFBundleIdentifier</key>
<string>@MAC_BUNDLE_IDENTIFIER@</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleLongVersionString</key>
<string>@VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_PATCH@</string>
<key>CFBundleName</key>
<string>MantidPlot</string>
<string>@MAC_BUNDLE_NAME@</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
Expand Down
38 changes: 25 additions & 13 deletions qt/applications/workbench/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,19 +58,31 @@ else()
endif()

# Install MantidWorkbench for OSX
if ( APPLE )
if( APPLE )
set ( MAC_BUNDLE_EXECUTABLE MantidWorkbench )
if (OSX_VERSION VERSION_GREATER 10.7 OR OSX_VERSION VERSION_EQUAL 10.7)
set ( MAC_BUNDLE_IDENTIFIER "org.mantidproject.MantidWorkbench" )
else()
set ( MAC_BUNDLE_IDENTIFIER "" )
endif()
set ( MAC_BUNDLE_ICON MantidWorkbench.icns )
set ( MAC_BUNDLE_NAME MantidWorkbench )
configure_file ( ${CMAKE_CURRENT_SOURCE_DIR}/../../../installers/MacInstaller/Info.plist.in
${CMAKE_CURRENT_BINARY_DIR}/Info.plist
@ONLY )

configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/make_package.rb.in
${CMAKE_CURRENT_BINARY_DIR}/make_package.rb
@ONLY )
install ( FILES ${CMAKE_CURRENT_BINARY_DIR}/make_package.rb DESTINATION MantidWorkbench.app/ )
install ( CODE "
set ( bundle \${CMAKE_INSTALL_PREFIX}/MantidWorkbench.app )
execute_process(COMMAND chmod +x ./make_package.rb WORKING_DIRECTORY \${bundle})
execute_process(COMMAND ./make_package.rb WORKING_DIRECTORY \${bundle} RESULT_VARIABLE install_name_tool_result)
if(NOT install_name_tool_result EQUAL 0)
message(FATAL_ERROR \"Package script failed!!!\n\")
endif()
")
configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/make_package.rb.in
${CMAKE_CURRENT_BINARY_DIR}/make_package.rb
@ONLY )
install ( FILES ${CMAKE_CURRENT_BINARY_DIR}/make_package.rb DESTINATION MantidWorkbench.app/ )
install ( FILES ${CMAKE_CURRENT_BINARY_DIR}/Info.plist DESTINATION MantidWorkbench.app/Contents/ )
install ( CODE "
set ( bundle \${CMAKE_INSTALL_PREFIX}/MantidWorkbench.app )
execute_process(COMMAND chmod +x ./make_package.rb WORKING_DIRECTORY \${bundle})
execute_process(COMMAND ./make_package.rb WORKING_DIRECTORY \${bundle} RESULT_VARIABLE install_name_tool_result)
if(NOT install_name_tool_result EQUAL 0)
message(FATAL_ERROR \"Package script failed!!!\n\")
endif()
")

endif()

0 comments on commit de25931

Please sign in to comment.