Skip to content

Commit 69bcc2b

Browse files
authored
Merge pull request #1661 from SCIInstitute/package_fix
Package fix
2 parents 4cd8b0c + 2b66a26 commit 69bcc2b

File tree

5 files changed

+68
-25
lines changed

5 files changed

+68
-25
lines changed

src/CMake/Modules/CPack.Description.plist.in

Lines changed: 0 additions & 12 deletions
This file was deleted.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?xml version="1.0" encoding="utf-8" standalone="no"?>
2+
<installer-gui-script minSpecVersion="1">
3+
<title>@CPACK_PACKAGE_NAME@</title>
4+
<allowed-os-versions>
5+
<os-version min="@OSX_MINIMUM_OS_VERSION@"/>
6+
</allowed-os-versions>
7+
<license file="@CPACK_RESOURCE_FILE_LICENSE@" mime-type="text/plain"/>
8+
<welcome file="@CPACK_RESOURCE_FILE_WELCOME@" mime-type="text/plain"/>
9+
<pkg-ref id="edu.utah.sci.@CPACK_PACKAGE_NAME@"/>
10+
<options customize="never" require-scripts="false"/>
11+
<choices-outline>
12+
<line choice="default">
13+
<line choice="edu.utah.sci.@CPACK_PACKAGE_NAME@"/>
14+
</line>
15+
</choices-outline>
16+
<choice id="default"/>
17+
<choice id="edu.utah.sci.@CPACK_PACKAGE_NAME@" visible="false">
18+
<pkg-ref id="edu.utah.sci.@CPACK_PACKAGE_NAME@"/>
19+
</choice>
20+
<pkg-ref id="edu.utah.sci.@CPACK_PACKAGE_NAME@" version="0" onConclusion="none">@[email protected]</pkg-ref>
21+
</installer-gui-script>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/usr/bin/env bash
2+
3+
scirunbuild_dir=@CMAKE_BINARY_DIR@
4+
productbuild_dir=@PKG_BUILD_DIR@
5+
productroot_dir=@PKG_ROOT_DIR@
6+
7+
if [[ ! -e $productroot_dir ]]; then
8+
echo "$productroot_dir does not exist"
9+
exit 1
10+
fi
11+
12+
@PKGBUILD_EXE@ --analyze --root $productroot_dir $scirunbuild_dir/@[email protected]
13+
@PKGBUILD_EXE@ --identifier edu.utah.sci.@CPACK_PACKAGE_NAME@ --root $productroot_dir \
14+
--component-plist $scirunbuild_dir/@[email protected] \
15+
--install-location /Applications $scirunbuild_dir/@[email protected]
16+
@PRODUCTBUILD_EXE@ --distribution $scirunbuild_dir/CPack.Distribution.dist \
17+
--package-path $productroot_dir $productbuild_dir/tmp.pkg
18+
# Tip: pkgutil --expand can be used to debug package building
19+
@PKGUTIL_EXE@ --expand $productbuild_dir/tmp.pkg $productbuild_dir/tmp
20+
@PKGUTIL_EXE@ --flatten $productbuild_dir/tmp $scirunbuild_dir/@[email protected]
21+
rm -f $scirunbuild_dir/@[email protected] $scirunbuild_dir/@[email protected]
22+
rm -Rf $productbuild_dir/tmp

src/CMakeLists.txt

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -948,26 +948,36 @@ SET(CPACK_RESOURCE_FILE_WELCOME ${PACKAGING_WELCOME})
948948
SET(CPACK_PACKAGE_VERSION_MAJOR "${SCIRUN_VERSION_MAJOR}")
949949
SET(CPACK_PACKAGE_VERSION_MINOR "${SCIRUN_VERSION_MINOR}")
950950
SET(CPACK_PACKAGE_VERSION_PATCH "${SCIRUN_VERSION_PATCH}")
951+
SET(CPACK_PACKAGE_VERSION "${SCIRUN_VERSION_MAJOR}.${SCIRUN_VERSION_MINOR}.${SCIRUN_VERSION_PATCH}")
951952

952-
SET(CPACK_PACKAGE_INSTALL_DIRECTORY "${APPLICATION_NAME} ${SCIRUN_VERSION_MAJOR}.${SCIRUN_VERSION_MINOR}")
953+
SET(CPACK_PACKAGE_INSTALL_DIRECTORY "${APPLICATION_NAME}_${SCIRUN_VERSION_MAJOR}.${SCIRUN_VERSION_MINOR}")
953954

954955

955956
# other platform settings will be built up from here
956957
IF(APPLE)
957-
958-
SET(CPACK_PACKAGE_DEFAULT_LOCATION "/Applications/")
959-
SET(CPACK_TOPLEVEL_TAG "")
960-
961-
IF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
958+
SET(CPACK_GENERATOR "productbuild;TGZ")
959+
SET(CPACK_TOPLEVEL_TAG "")
960+
IF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
962961
SET(CPACK_INSTALL_PREFIX "/" CACHE PATH "Install path prefix, prepended onto install directories." FORCE)
963962
SET(CMAKE_INSTALL_PREFIX "/" CACHE PATH "Install path prefix, prepended onto install directories." FORCE)
964-
ENDIF()
965-
966-
SET(CPACK_PACKAGING_INSTALL_PREFIX "/")
967-
SET(CPACK_STRIP_FILES TRUE)
968-
SET(CPACK_SOURCE_STRIP_FILES TRUE)
969-
SET(CPACK_PACKAGE_EXECUTABLES "${APPLICATION_NAME}.app" "${APPLICATION_NAME}")
970-
963+
ENDIF()
964+
# productbuild packaging repair hack
965+
# call repair_package.sh after running package target in build
966+
# Tip: can inspect packages using the pkgutil --expand command
967+
IF(CPACK_GENERATOR MATCHES "productbuild")
968+
# make sure there are paths to packaging tools
969+
FIND_PROGRAM(PKGBUILD_EXE pkgbuild)
970+
FIND_PROGRAM(PRODUCTBUILD_EXE productbuild)
971+
FIND_PROGRAM(PKGUTIL_EXE pkgutil)
972+
SET(PKG_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-Darwin")
973+
SET(PKG_BUILD_DIR "${CMAKE_BINARY_DIR}/_CPack_Packages/productbuild/${PKG_FILE_NAME}")
974+
SET(PKG_ROOT_DIR "${PKG_BUILD_DIR}/Applications")
975+
976+
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/CMake/Modules/CPack.Distribution.dist.in
977+
${CMAKE_BINARY_DIR}/CPack.Distribution.dist)
978+
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/CMake/scripts/repair_package.sh.in
979+
${CMAKE_BINARY_DIR}/repair_package.sh)
980+
ENDIF()
971981
ELSEIF(WIN32 AND NOT UNIX)
972982

973983
# There is a bug in NSIS that does not handle full unix paths properly. Make

src/Main/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,9 +189,11 @@ IF(APPLE)
189189
"Interface_Modules_Render"
190190
"Interface_Modules_Python"
191191
"Interface_Modules_Visualization"
192+
"Interface_Modules_Math"
192193
"Core_ConsoleApplication"
193194
"Modules_Factory"
194195
"Modules_Python"
196+
"Modules_Math"
195197
)
196198

197199
FOREACH(lib ${SCIRUN_LIBS})

0 commit comments

Comments
 (0)