Truly independent web browser
Meta: Split the dynamically linked libraries into two shared lists
Jelle Raaijmakers7aeec41aefcd
diff --git a/Meta/CMake/dynamic-libraries.txt b/Meta/CMake/dynamic-libraries.txtnew file mode 100644index 00000000000..e82e344d8eb--- /dev/null+++ b/Meta/CMake/dynamic-libraries.txt@@ -0,0 +1,3 @@+# Libraries that builds link dynamically besides those in lgpl-libraries.txt, by the names of their vcpkg ports.+# Qt and Ladybird must share one ICU, as Ladybird hands the ICU data to it once per process.+icudiff --git a/Meta/CMake/lgpl-libraries.txt b/Meta/CMake/lgpl-libraries.txtnew file mode 100644index 00000000000..6973df13835--- /dev/null+++ b/Meta/CMake/lgpl-libraries.txt@@ -0,0 +1,11 @@+# Libraries under the (L)GPL that builds ship. Builds link them dynamically so that they can be relinked, and releases+# publish their source code. The names are those of the vcpkg ports, which the Flatpak modules share.+ffmpeg+gettext-libintl+libdwarf+libidn2+libunistring+qtbase+qtpositioning+qtserialport+qtsvgdiff --git a/Meta/CMake/licenses.cmake b/Meta/CMake/licenses.cmakeindex 5d2fc7e25bf..ce40aca89eb 100644--- a/Meta/CMake/licenses.cmake+++ b/Meta/CMake/licenses.cmake@@ -13,7 +13,7 @@ set(licenses_dependencies"${licenses_generator}""${LADYBIRD_SOURCE_DIR}/LICENSE""${LADYBIRD_SOURCE_DIR}/Cargo.lock"- "${LADYBIRD_SOURCE_DIR}/Meta/CMake/vcpkg/dynamic-ports.txt"+ "${LADYBIRD_SOURCE_DIR}/Meta/CMake/lgpl-libraries.txt")if (NOT "${VCPKG_INSTALLED_DIR}" STREQUAL "" AND NOT "${VCPKG_TARGET_TRIPLET}" STREQUAL "")diff --git a/Meta/CMake/vcpkg/distribution-triplets/distribution.cmake b/Meta/CMake/vcpkg/distribution-triplets/distribution.cmakeindex c368e9c3ff2..2b21c642119 100644--- a/Meta/CMake/vcpkg/distribution-triplets/distribution.cmake+++ b/Meta/CMake/vcpkg/distribution-triplets/distribution.cmake@@ -2,12 +2,19 @@ set(VCPKG_BUILD_TYPE release)set(VCPKG_LIBRARY_LINKAGE static)block(SCOPE_FOR VARIABLES PROPAGATE VCPKG_LIBRARY_LINKAGE VCPKG_HASH_ADDITIONAL_FILES)- set(dynamic_ports_file "${CMAKE_CURRENT_LIST_DIR}/../dynamic-ports.txt")- file(STRINGS "${dynamic_ports_file}" dynamic_ports REGEX "^[^#]")+ set(dynamic_library_files+ "${CMAKE_CURRENT_LIST_DIR}/../../lgpl-libraries.txt"+ "${CMAKE_CURRENT_LIST_DIR}/../../dynamic-libraries.txt"+ )+ set(dynamic_ports "")+ foreach (dynamic_library_file IN LISTS dynamic_library_files)+ file(STRINGS "${dynamic_library_file}" libraries REGEX "^[^#]")+ list(APPEND dynamic_ports ${libraries})+ endforeach()if (PORT IN_LIST dynamic_ports)set(VCPKG_LIBRARY_LINKAGE dynamic)# vcpkg hashes only the triplet file itself, so a cached static build would otherwise be reused.- list(APPEND VCPKG_HASH_ADDITIONAL_FILES "${dynamic_ports_file}")+ list(APPEND VCPKG_HASH_ADDITIONAL_FILES ${dynamic_library_files})endif()endblock()diff --git a/Meta/CMake/vcpkg/dynamic-ports.txt b/Meta/CMake/vcpkg/dynamic-ports.txtdeleted file mode 100644index cf2049f19de..00000000000--- a/Meta/CMake/vcpkg/dynamic-ports.txt+++ /dev/null@@ -1,12 +0,0 @@-# These ports are under the (L)GPL, so builds link them dynamically to allow relinking.-ffmpeg-gettext-libintl-libdwarf-libidn2-libunistring-qtbase-qtpositioning-qtserialport-qtsvg-# Qt and Ladybird must share one ICU, as Ladybird hands the ICU data to it once per process.-icudiff --git a/Meta/Utils/vcpkg_deps.py b/Meta/Utils/vcpkg_deps.pyindex 65b18ea1efd..d985f08c51e 100644--- a/Meta/Utils/vcpkg_deps.py+++ b/Meta/Utils/vcpkg_deps.py@@ -31,6 +31,10 @@ MANIFEST_FEATURE_OPTIONS = {"sparkle": {"LADYBIRD_ENABLE_UPDATE_CHECK": True, "LADYBIRD_ENABLE_SPARKLE": True},}+# The lists in Meta/CMake of the ports that distribution builds link dynamically. Keep in sync with+# Meta/CMake/vcpkg/distribution-triplets/distribution.cmake.+DYNAMIC_LIBRARY_LISTS = ("lgpl-libraries.txt", "dynamic-libraries.txt")+DEPEND_INFO_REGEX = re.compile(r"^([a-zA-Z0-9-]+)(?:\[([^]]*)\])?(:host)?:\s*(.*)$")@@ -294,7 +298,7 @@ def generate_build_files(overlay_triplets_dir(preset).parent / "base-triplets",):triplet_inputs.extend(sorted(str(f) for f in triplet_dir.glob("*.cmake")))- triplet_inputs.append(str(overlay_triplets_dir(preset).parent / "dynamic-ports.txt"))+ triplet_inputs.extend(str(LADYBIRD_SOURCE_DIR / "Meta" / "CMake" / name) for name in DYNAMIC_LIBRARY_LISTS)lines = ["ninja_required_version = 1.5",diff --git a/Meta/generate-licenses.py b/Meta/generate-licenses.pyindex 8cdcee40cf8..d18b8b96cdb 100755--- a/Meta/generate-licenses.py+++ b/Meta/generate-licenses.py@@ -41,7 +41,7 @@ SHIPPED_PORT_DIRECTORIES = {"bin", "Frameworks", "include", "lib"}LGPL_MARKER = "GNU LESSER GENERAL PUBLIC LICENSE"-DYNAMIC_PORTS_PATH = pathlib.PurePosixPath("Meta/CMake/vcpkg/dynamic-ports.txt")+LGPL_LIBRARIES_PATH = pathlib.PurePosixPath("Meta/CMake/lgpl-libraries.txt")# Release-tools publishes the source archives of the LGPL ports there, for every release that ships them.THIRD_PARTY_SOURCES_URL = "https://download.ladybird.org/third-party"@@ -178,8 +178,8 @@ def port_is_shipped(name: str, installed_files: list[str], triplet: str) -> boolreturn False-def read_dynamic_ports(source_dir: pathlib.Path) -> set[str]:- lines = read_text(source_dir / DYNAMIC_PORTS_PATH).splitlines()+def read_lgpl_libraries(source_dir: pathlib.Path) -> set[str]:+ lines = read_text(source_dir / LGPL_LIBRARIES_PATH).splitlines()return {line.strip() for line in lines if line.strip() and not line.startswith("#")}@@ -518,9 +518,9 @@ def generate(args: argparse.Namespace) -> str:lgpl_ports = [port for port in ports if LGPL_MARKER in port.copyright]- dynamic_ports = read_dynamic_ports(args.source_dir)- if statically_linked_lgpl_ports := [port.name for port in lgpl_ports if port.name not in dynamic_ports]:- raise RuntimeError(f"LGPL ports missing from {DYNAMIC_PORTS_PATH}: {', '.join(statically_linked_lgpl_ports)}")+ lgpl_libraries = read_lgpl_libraries(args.source_dir)+ if unlisted_lgpl_ports := [port.name for port in lgpl_ports if port.name not in lgpl_libraries]:+ raise RuntimeError(f"LGPL ports missing from {LGPL_LIBRARIES_PATH}: {', '.join(unlisted_lgpl_ports)}")introduction = ["Ladybird is distributed under the BSD 2-Clause License below. It includes the third-party software listed",