From 46b86ffcfcc5959ed351da252dfea4ae1208d8f9 Mon Sep 17 00:00:00 2001 From: Andrew Kaster Date: Sun, 13 Aug 2023 22:23:46 -0600 Subject: [PATCH] Ladybird: Add install rules to make app bundle on macOS relocatable We were still missing the resources and the libraries inside the actual bundle directory. Do it at install time to not make a mess of all the rules. The gn build lists all the libraries in a massive list, which is quite a pain. We can over-copy a few libraries like this to make the install script a bit easier to follow. --- Ladybird/cmake/InstallRules.cmake | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/Ladybird/cmake/InstallRules.cmake b/Ladybird/cmake/InstallRules.cmake index da24a6425df..58d0c76b158 100644 --- a/Ladybird/cmake/InstallRules.cmake +++ b/Ladybird/cmake/InstallRules.cmake @@ -106,3 +106,24 @@ install(FILES DESTINATION "${CMAKE_INSTALL_DATADIR}/res/ladybird" COMPONENT ladybird_Runtime ) + +if (APPLE) + # Fixup the app bundle and copy: + # - Libraries from lib/ to ladybird.app/Contents/lib + # - Resources from share/res/ to ladybird.app/Contents/Resources/res + install(CODE " + set(res_dir \${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATADIR}/res) + if (IS_ABSOLUTE ${CMAKE_INSTALL_DATADIR}) + set(res_dir ${CMAKE_INSTALL_DATADIR}/res) + endif() + set(lib_dir \${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}) + if (IS_ABSOLUTE ${CMAKE_INSTALL_LIBDIR}) + set(lib_dir ${CMAKE_INSTALL_LIBDIR}) + endif() + + set(contents_dir \${CMAKE_INSTALL_PREFIX}/bundle/ladybird.app/Contents) + file(COPY \${res_dir} DESTINATION \${contents_dir}/Resources) + file(COPY \${lib_dir} DESTINATION \${contents_dir}) + " + COMPONENT ladybird_Runtime) +endif()