Open mavam opened 1 year ago
We had a user request in our Discord for a macOS M1 package: https://discord.com/channels/1072605116978442320/1125678521444995112/1134037168923357204
Another user wanted to try Tenzir on a Mac but didn't like/want Docker, preventing them to get started immediately.
Since we want to ship a closed-source binary package, our best option here is to go with productbuild
.
I managed to set up a small proof-of-concept with this diff:
diff --git a/cmake/TenzirPackage.cmake b/cmake/TenzirPackage.cmake
index d60f750063..be228c1c33 100644
--- a/cmake/TenzirPackage.cmake
+++ b/cmake/TenzirPackage.cmake
@@ -62,8 +62,8 @@ endif ()
set(CPACK_PACKAGE_DIRECTORY "package")
set(CPACK_VERBATIM_VARIABLES ON)
-set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
-set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/README.md")
+# productbuild requires .rtf or .html files for these :/
+# set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
+# set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/README.md")
set(CPACK_INSTALLED_DIRECTORIES "/var/lib/tenzir" "/var/log/tenzir")
set(CPACK_DEBIAN_PACKAGE_RELEASE "1")
@@ -101,6 +101,7 @@ set(CPACK_COMPONENTS_GROUPING ALL_COMPONENTS_IN_ONE)
# https://cmake.org/cmake/help/latest/module/CPackComponent.html#variable:CPACK_%3CGENNAME%3E_COMPONENT_INSTALL
set(CPACK_DEB_COMPONENT_INSTALL ON)
set(CPACK_ARCHIVE_COMPONENT_INSTALL ON)
+set(CPACK_PRODUCTBUILD_COMPONENT_INSTALL ON)
# Set up CPack as configured above. Note that the calls to cpack_add_component
# must come _after_ the CPack include, while the variables must be set _before_
And then the following commands:
export MACOSX_DEPLOYMENT_TARGET="$(sw_vers --productVersion)"
cmake -B build -D CMAKE_BUILD_TYPE=Release -D CPACK_GENERATOR=productbuild -D CMAKE_INSTALL_PREFIX=/opt/tenzir
cmake --build build --target package
This creates a package that can be installed locally. I verified that the package is portable and works as expected.
However, to be able to ship this we'd need three more changes still:
Note: it would be great to enable the check for MacOS in the CI once this is made available!
We've moved this back to the backlog, and will continue working on this at a later point in time.
We would like to offer our macOS users a binary package.