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.
This commit is contained in:
Andrew Kaster 2023-08-13 22:23:46 -06:00 committed by Andrew Kaster
parent ea0e07ec8f
commit 46b86ffcfc
Notes: sideshowbarker 2024-07-16 22:14:49 +09:00

View File

@ -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()