Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

macOS Package #60

Open
3 of 4 tasks
mavam opened this issue Jun 30, 2023 · 5 comments
Open
3 of 4 tasks

macOS Package #60

mavam opened this issue Jun 30, 2023 · 5 comments
Labels
feature New functionality packaging Relating to the build scaffold

Comments

@mavam
Copy link
Member

mavam commented Jun 30, 2023

We would like to offer our macOS users a binary package.

Stories

@dominiklohmann dominiklohmann changed the title MacOS Package macOS Package Jun 30, 2023
@mavam mavam added maintenance Tasks for keeping up the infrastructure ci Continuous integration and delivery labels Jul 12, 2023
@mavam
Copy link
Member Author

mavam commented Jul 27, 2023

We had a user request in our Discord for a macOS M1 package: https://discord.com/channels/1072605116978442320/1125678521444995112/1134037168923357204

@mavam
Copy link
Member Author

mavam commented Aug 10, 2023

Another user wanted to try Tenzir on a Mac but didn't like/want Docker, preventing them to get started immediately.

@mavam mavam added packaging Relating to the build scaffold feature New functionality and removed maintenance Tasks for keeping up the infrastructure ci Continuous integration and delivery labels Sep 15, 2023
@dominiklohmann
Copy link
Member

dominiklohmann commented Sep 19, 2023

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.

Image

However, to be able to ship this we'd need three more changes still:

  1. We need to create this in CI on an arm64 macOS machine (and ideally also on an Intel machine)
  2. We need to either bundle all shared library dependencies or link against them statically
  3. We need to submit a Homebrew cask and get our package accepted

@rdettai
Copy link

rdettai commented Oct 16, 2023

Note: it would be great to enable the check for MacOS in the CI once this is made available!

@dominiklohmann
Copy link
Member

We've moved this back to the backlog, and will continue working on this at a later point in time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New functionality packaging Relating to the build scaffold
Projects
None yet
Development

No branches or pull requests

3 participants