Commit 9dec032b authored by Guillaume Pasero's avatar Guillaume Pasero

Merge branch 'bugfix-macos-pkg' into develop

parents caa90697 442f70c4
......@@ -28,9 +28,12 @@ EXE_FILES=$(find "$OUT_DIR/bin" -type f -exec file {} \; | grep -i "Mach-O*.*ex
for lib_file in $LIBRARY_FILES $EXE_FILES; do
#echo "adding rpath to $OUT_DIR/$lib_file"
if [ -f "$lib_file" ]; then
#echo "$INSTALL_NAME_TOOL -add_rpath $OUT_DIR/lib $lib_file"
$INSTALL_NAME_TOOL "-add_rpath" "$OUT_DIR/lib" "$lib_file"
fi
lib_file_original_rpaths=$(otool -l "$lib_file" | grep -A 3 "LC_RPATH" | grep -oE 'path .* \(offset' | cut -d ' ' -f 2)
for original_rpath in $lib_file_original_rpaths; do
$INSTALL_NAME_TOOL "-delete_rpath" "$original_rpath" "$lib_file"
done
$INSTALL_NAME_TOOL "-add_rpath" "$OUT_DIR/lib" "$lib_file"
fi
done
......@@ -50,12 +53,15 @@ if [ "$I_AM_XDK" = false ] ; then
OTB_APP_FILES=$(find "$OUT_DIR/lib/otb/applications" -maxdepth 1 -type f)
# run install_name_tool
for app_file in $OTB_APP_FILES; do
#echo "adding rpath to $app_file"
if [ -f "$app_file" ]; then
$INSTALL_NAME_TOOL "-add_rpath" "$OUT_DIR/lib" "$app_file"
fi
#echo "adding rpath to $app_file"
if [ -f "$app_file" ]; then
$INSTALL_NAME_TOOL "-rpath" "@ORIGINAL_RPATH_TO_REPLACE@" "$OUT_DIR/lib" "$app_file"
fi
done
if [ -f "$OUT_DIR/lib/python/_otbApplication.so" ]; then
$INSTALL_NAME_TOOL "-rpath" "@ORIGINAL_RPATH_TO_REPLACE@" "$OUT_DIR/lib" "$OUT_DIR/lib/python/_otbApplication.so"
fi
rm -fr "Mapla.app"
rm -fr "Monteveridi.app"
......
......@@ -184,7 +184,11 @@ macro(macro_super_package)
file(APPEND ${CMAKE_BINARY_DIR}/make_symlinks
"${make_symlink_cmd}\n")
endforeach()
if(APPLE)
set(ORIGINAL_RPATH_TO_REPLACE ${DEPENDENCIES_INSTALL_DIR}/lib)
endif()
configure_file(${PACKAGE_SUPPORT_FILES_DIR}/${PKGSETUP_IN_FILENAME}
${CMAKE_BINARY_DIR}/pkgsetup @ONLY)
......
......@@ -241,6 +241,13 @@ function(is_file_executable2 file_var result_var)
return()
endif()
# detect shared libraries on Mac OSX
# where "file" gives "Mach-O 64-bit x86_64 bundle"
if("${file_ov}" MATCHES "mach-o.*bundle")
set(${result_var} 1 PARENT_SCOPE)
return()
endif()
endif(APPLE)
endfunction()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment