From 00bd5c4aa5ab20dfeb466eeb4e246728de3040b2 Mon Sep 17 00:00:00 2001 From: Kai Pastor Date: Mon, 16 Dec 2024 17:08:15 +0100 Subject: [PATCH] [fontconfig] Add features, fix emscripten (#42699) --- ports/fontconfig/emscripten.diff | 13 ++++++++++ ports/fontconfig/portfile.cmake | 30 +++++++++++++++++------ ports/fontconfig/usage | 9 +++++-- ports/fontconfig/vcpkg.json | 42 ++++++++++++++++++++++++++------ versions/baseline.json | 2 +- versions/f-/fontconfig.json | 5 ++++ 6 files changed, 84 insertions(+), 17 deletions(-) create mode 100644 ports/fontconfig/emscripten.diff diff --git a/ports/fontconfig/emscripten.diff b/ports/fontconfig/emscripten.diff new file mode 100644 index 0000000000..da8ef2923d --- /dev/null +++ b/ports/fontconfig/emscripten.diff @@ -0,0 +1,13 @@ +diff --git a/meson.build b/meson.build +index 08d9532..37cc195 100644 +--- a/meson.build ++++ b/meson.build +@@ -289,7 +289,7 @@ if fc_cachedir in ['yes', 'no', 'default'] + endif + endif + +-if host_machine.system() != 'windows' ++if host_machine.system() != 'windows' and host_machine.system() != 'emscripten' + thread_dep = dependency('threads') + conf.set('HAVE_PTHREAD', 1) + deps += [thread_dep] diff --git a/ports/fontconfig/portfile.cmake b/ports/fontconfig/portfile.cmake index 9cf2635b8f..382a57a61f 100644 --- a/ports/fontconfig/portfile.cmake +++ b/ports/fontconfig/portfile.cmake @@ -6,20 +6,34 @@ vcpkg_from_gitlab( SHA512 daa6d1e6058e12c694d9e1512e09be957ff7f3fa375246b9d13eb0a8cf2f21e1512a5cabe93f270e96790e2c20420bf7422d213e43ab9749da3255286ea65a7c HEAD_REF master PATCHES + emscripten.diff no-etc-symlinks.patch libgetopt.patch fix-wasm-shared-memory-atomics.patch ) -vcpkg_add_to_path(PREPEND "${CURRENT_HOST_INSTALLED_DIR}/tools/gperf") +set(options "") +if("nls" IN_LIST FEATURES) + list(APPEND options "-Dnls=enabled") +else() + list(APPEND options "-Dnls=disabled") +endif() +if("tools" IN_LIST FEATURES) + list(APPEND options "-Dtools=enabled") +else() + list(APPEND options "-Dtools=disabled") +endif() vcpkg_configure_meson( SOURCE_PATH "${SOURCE_PATH}" OPTIONS + ${options} -Ddoc=disabled -Dcache-build=disabled -Diconv=enabled -Dtests=disabled + ADDITIONAL_BINARIES + "gperf = ['${CURRENT_HOST_INSTALLED_DIR}/tools/gperf/gperf${VCPKG_HOST_EXECUTABLE_SUFFIX}']" ) # https://www.freedesktop.org/software/fontconfig/fontconfig-user.html @@ -42,7 +56,7 @@ vcpkg_install_meson(ADD_BIN_TO_PATH) vcpkg_copy_pdbs() #Fix missing libintl static dependency -if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW) +if("nls" IN_LIST FEATURES AND VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW) if(NOT VCPKG_BUILD_TYPE) vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/fontconfig.pc" "-liconv" "-liconv -lintl" IGNORE_UNCHANGED) endif() @@ -83,11 +97,13 @@ if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") endforeach() endif() -vcpkg_copy_tools( - TOOL_NAMES fc-match fc-cat fc-list fc-pattern fc-query fc-scan fc-cache fc-validate fc-conflist - AUTO_CLEAN -) +if("tools" IN_LIST FEATURES) + vcpkg_copy_tools( + TOOL_NAMES fc-match fc-cat fc-list fc-pattern fc-query fc-scan fc-cache fc-validate fc-conflist + AUTO_CLEAN + ) +endif() configure_file("${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake.in" "${CURRENT_PACKAGES_DIR}/share/${PORT}/vcpkg-cmake-wrapper.cmake" @ONLY) file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") -file(INSTALL "${SOURCE_PATH}/COPYING" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) +vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/COPYING") diff --git a/ports/fontconfig/usage b/ports/fontconfig/usage index 9d14caf70d..b59bc482f7 100644 --- a/ports/fontconfig/usage +++ b/ports/fontconfig/usage @@ -1,4 +1,9 @@ fontconfig is compatible with built-in CMake targets: - find_package(Fontconfig REQUIRED) # since CMake 3.14 - target_link_libraries(main PRIVATE Fontconfig::Fontconfig) + find_package(Fontconfig REQUIRED) # since CMake 3.14 + target_link_libraries(main PRIVATE Fontconfig::Fontconfig) + +fontconfig provides pkg-config modules: + + # Font configuration and customization library + fontconfig diff --git a/ports/fontconfig/vcpkg.json b/ports/fontconfig/vcpkg.json index 81d0ad316c..18fe0b72b8 100644 --- a/ports/fontconfig/vcpkg.json +++ b/ports/fontconfig/vcpkg.json @@ -1,16 +1,18 @@ { "name": "fontconfig", "version": "2.15.0", - "port-version": 1, + "port-version": 2, "description": "Library for configuring and customizing font access.", "homepage": "https://www.freedesktop.org/wiki/Software/fontconfig", "license": "MIT", + "supports": "!uwp", "dependencies": [ "dirent", "expat", - "freetype", - "getopt", - "gettext", + { + "name": "freetype", + "default-features": false + }, { "name": "gperf", "host": true @@ -21,12 +23,38 @@ }, { "name": "libuuid", - "platform": "!windows & !osx & !mingw" + "platform": "!osx & !windows" + }, + { + "name": "pthread", + "platform": "!emscripten & !windows" }, - "pthread", { "name": "vcpkg-tool-meson", "host": true } - ] + ], + "features": { + "nls": { + "description": "Native languages support", + "dependencies": [ + { + "name": "gettext", + "host": true, + "default-features": false, + "features": [ + "tools" + ] + }, + "gettext-libintl" + ] + }, + "tools": { + "description": "Build tools", + "supports": "!emscripten", + "dependencies": [ + "getopt" + ] + } + } } diff --git a/versions/baseline.json b/versions/baseline.json index b54f632aa2..88855ed8a5 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -2886,7 +2886,7 @@ }, "fontconfig": { "baseline": "2.15.0", - "port-version": 1 + "port-version": 2 }, "foonathan-lexy": { "baseline": "2022.12.1", diff --git a/versions/f-/fontconfig.json b/versions/f-/fontconfig.json index 4a082f4689..be363b0682 100644 --- a/versions/f-/fontconfig.json +++ b/versions/f-/fontconfig.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "4e1bd69ece93d01f14f3f78da93cfeca0f7e8b5f", + "version": "2.15.0", + "port-version": 2 + }, { "git-tree": "443f2cc8005cd715e8786521c1c2cd990a1320a8", "version": "2.15.0",