Skip to content

Truly independent web browser

Meta: Mark a Linux package with its format

Jelle Raaijmakers31ba1c5eeb12
diff --git a/Meta/CMake/cpack_package_format.cmake b/Meta/CMake/cpack_package_format.cmake
new file mode 100644
index 00000000000..39e6ad26a38
--- /dev/null
+++ b/Meta/CMake/cpack_package_format.cmake
@@ -0,0 +1,5 @@
+# Runs while CPack packages, once the files of the package are staged. A Linux package says which kind it is, so that
+# the browser in it can tell how to update it: the same build can also end up in an archive.
+set(marker "${CPACK_TEMPORARY_DIRECTORY}/Browser${CPACK_PACKAGING_INSTALL_PREFIX}/${CPACK_LADYBIRD_RESOURCE_DIRECTORY}/package-format")
+file(WRITE "${marker}" "${CPACK_GENERATOR}\n")
+file(CHMOD "${marker}" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
diff --git a/Meta/CMake/cpack_project_config.cmake b/Meta/CMake/cpack_project_config.cmake
index b806a281284..420680248e6 100644
--- a/Meta/CMake/cpack_project_config.cmake
+++ b/Meta/CMake/cpack_project_config.cmake
@@ -6,6 +6,7 @@ if (CPACK_GENERATOR MATCHES "^(DEB|RPM)$")
set(CPACK_COMPONENT_LADYBIRD_RUNTIME_GROUP Browser)
set(CPACK_COMPONENT_LADYBIRD_SYSTEMINTEGRATION_GROUP Browser)
set(CPACK_COMPONENT_LADYBIRD_SYSTEMSYMBOLS_GROUP DebugSymbols)
+ set(CPACK_PRE_BUILD_SCRIPTS "${CMAKE_CURRENT_LIST_DIR}/cpack_package_format.cmake")
endif()
# A Linux package links the Qt of the distribution version that built it, so its version names that distribution
diff --git a/Meta/CMake/packaging.cmake b/Meta/CMake/packaging.cmake
index 28d165c6212..fa11d061fd2 100644
--- a/Meta/CMake/packaging.cmake
+++ b/Meta/CMake/packaging.cmake
@@ -28,6 +28,7 @@ set(CPACK_PACKAGE_DESCRIPTION
"Ladybird is a truly independent web browser, using a novel engine based on web standards.")
set(CPACK_PROJECT_CONFIG_FILE "${CMAKE_CURRENT_LIST_DIR}/cpack_project_config.cmake")
set(CPACK_LADYBIRD_PACKAGE_INSTALL_PREFIX "${LADYBIRD_PACKAGE_INSTALL_PREFIX}")
+set(CPACK_LADYBIRD_RESOURCE_DIRECTORY "${CMAKE_INSTALL_DATADIR}/Lagom")
# The Linux packages are the browser itself and its debug symbols, named like the debug packages of Debian and Fedora.
set(CPACK_DEB_COMPONENT_INSTALL ON)