Skip to content

Truly independent web browser

Meta: Build the ICU data as a file instead of a library

Aliaksandr Kalenik3227c20e057f
diff --git a/Meta/CMake/vcpkg/overlay-ports/icu/create-data-list-directory.patch b/Meta/CMake/vcpkg/overlay-ports/icu/create-data-list-directory.patch
new file mode 100644
index 00000000000..3a4406df48b
--- /dev/null
+++ b/Meta/CMake/vcpkg/overlay-ports/icu/create-data-list-directory.patch
@@ -0,0 +1,14 @@
+diff --git a/source/data/Makefile.in b/source/data/Makefile.in
+index a362715..93ff397 100644
+--- a/source/data/Makefile.in
++++ b/source/data/Makefile.in
+@@ -234,8 +234,8 @@ else
+ build-local: $(SO_VERSION_DATA) $(PKGDATA_LIST)
+ echo timestamp > $@
+ $(PKGDATA_LIST): $(SRCLISTDEPS) $(ICUDATA_SOURCE_ARCHIVE)
+-ifneq ($(ICUDATA_SOURCE_IS_NATIVE_TARGET),YES)
+ $(MKINSTALLDIRS) $(OUTTMPDIR) $(BUILDDIR)
++ifneq ($(ICUDATA_SOURCE_IS_NATIVE_TARGET),YES)
+ @echo "Unpacking $(ICUDATA_SOURCE_ARCHIVE) and generating $@ (list of data files)"
+ @-$(RMV) $@
+ $(INVOKE) $(TOOLBINDIR)/icupkg -d $(BUILDDIR) --list -x \* $(ICUDATA_SOURCE_ARCHIVE) -o $@
diff --git a/Meta/CMake/vcpkg/overlay-ports/icu/portfile.cmake b/Meta/CMake/vcpkg/overlay-ports/icu/portfile.cmake
new file mode 100644
index 00000000000..f77f7fa3147
--- /dev/null
+++ b/Meta/CMake/vcpkg/overlay-ports/icu/portfile.cmake
@@ -0,0 +1,43 @@
+# NB: This is vcpkg's own icu port, which packages the ICU data as a file of its own and links a stub library in its
+# place. To update ICU, update the version in vcpkg.json here.
+set(CURRENT_PORT_DIR "${VCPKG_ROOT_DIR}/ports/icu")
+
+if (NOT VCPKG_TARGET_IS_ANDROID AND NOT VCPKG_TARGET_IS_EMSCRIPTEN)
+ set(ladybird_icu_data_stash "${CURRENT_BUILDTREES_DIR}/ladybird-icu-data")
+
+ # FIXME: Send the patch upstream. A shared build that ships the data as an archive writes its list of data files
+ # into a directory nothing creates.
+ set(ladybird_icu_patch "${CMAKE_CURRENT_LIST_DIR}/create-data-list-directory.patch")
+ macro(vcpkg_extract_source_archive)
+ _vcpkg_extract_source_archive(${ARGN} "${ladybird_icu_patch}")
+ endmacro()
+
+ macro(vcpkg_make_configure)
+ set(ladybird_icu_configure_arguments ${ARGN})
+ list(FIND ladybird_icu_configure_arguments OPTIONS ladybird_icu_options_index)
+ if (ladybird_icu_options_index EQUAL -1)
+ message(FATAL_ERROR "The icu port no longer passes OPTIONS to vcpkg_make_configure()")
+ endif()
+ math(EXPR ladybird_icu_options_index "${ladybird_icu_options_index} + 1")
+ list(INSERT ladybird_icu_configure_arguments ${ladybird_icu_options_index} --with-data-packaging=archive)
+ _vcpkg_make_configure(${ladybird_icu_configure_arguments})
+ endmacro()
+
+ # The port deletes share/ after installing, and the data file is installed there.
+ macro(vcpkg_make_install)
+ _vcpkg_make_install(${ARGN})
+ file(GLOB_RECURSE ladybird_icu_data_files "${CURRENT_PACKAGES_DIR}/share/icudt*.dat")
+ if (NOT ladybird_icu_data_files)
+ message(FATAL_ERROR "ICU installed no data file")
+ endif()
+ file(REMOVE_RECURSE "${ladybird_icu_data_stash}")
+ file(COPY ${ladybird_icu_data_files} DESTINATION "${ladybird_icu_data_stash}")
+ endmacro()
+endif()
+
+include("${CURRENT_PORT_DIR}/portfile.cmake")
+
+if (DEFINED ladybird_icu_data_stash)
+ file(GLOB ladybird_icu_data_files "${ladybird_icu_data_stash}/icudt*.dat")
+ file(INSTALL ${ladybird_icu_data_files} DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
+endif()
diff --git a/Meta/CMake/vcpkg/overlay-ports/icu/vcpkg.json b/Meta/CMake/vcpkg/overlay-ports/icu/vcpkg.json
new file mode 100644
index 00000000000..8a1f257e39d
--- /dev/null
+++ b/Meta/CMake/vcpkg/overlay-ports/icu/vcpkg.json
@@ -0,0 +1,31 @@
+{
+ "name": "icu",
+ "version": "78.3",
+ "port-version": 3,
+ "description": "Mature and widely used Unicode and localization library.",
+ "homepage": "https://icu.unicode.org/home",
+ "license": "ICU",
+ "dependencies": [
+ {
+ "name": "icu",
+ "host": true,
+ "features": [
+ "tools"
+ ]
+ },
+ {
+ "name": "vcpkg-cmake-get-vars",
+ "host": true
+ },
+ {
+ "name": "vcpkg-make",
+ "host": true
+ }
+ ],
+ "features": {
+ "tools": {
+ "description": "Build tools",
+ "supports": "!uwp"
+ }
+ }
+}
diff --git a/vcpkg.json b/vcpkg.json
index 41ce348e9ed..b35f8f51944 100644
--- a/vcpkg.json
+++ b/vcpkg.json
@@ -326,7 +326,7 @@
},
{
"name": "icu",
- "version": "78.3#2"
+ "version": "78.3#3"
},
{
"name": "libavif",