tenzir / public-roadmap

The public roadmap of Tenzir
https://docs.tenzir.com/roadmap
4 stars 0 forks source link

macOS Package #60

Open mavam opened 1 year ago

mavam commented 1 year ago

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

### Stories
- [ ] https://github.com/tenzir/issues/issues/1089
- [ ] https://github.com/tenzir/issues/issues/1144
- [ ] https://github.com/tenzir/issues/issues/1046
- [ ] Identify what's missing to complete this
mavam commented 11 months ago

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

mavam commented 11 months ago

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

dominiklohmann commented 9 months ago

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 commented 8 months ago

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

dominiklohmann commented 5 months ago

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