Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fontconfig] Add features, fix emscripten #42699

Merged
merged 6 commits into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions ports/fontconfig/emscripten.diff
Original file line number Diff line number Diff line change
@@ -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]
30 changes: 23 additions & 7 deletions ports/fontconfig/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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()
Expand Down Expand Up @@ -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")
9 changes: 7 additions & 2 deletions ports/fontconfig/usage
Original file line number Diff line number Diff line change
@@ -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
42 changes: 35 additions & 7 deletions ports/fontconfig/vcpkg.json
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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"
]
}
}
}
2 changes: 1 addition & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -2890,7 +2890,7 @@
},
"fontconfig": {
"baseline": "2.15.0",
"port-version": 1
"port-version": 2
},
"foonathan-lexy": {
"baseline": "2022.12.1",
Expand Down
5 changes: 5 additions & 0 deletions versions/f-/fontconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "4e1bd69ece93d01f14f3f78da93cfeca0f7e8b5f",
"version": "2.15.0",
"port-version": 2
},
{
"git-tree": "443f2cc8005cd715e8786521c1c2cd990a1320a8",
"version": "2.15.0",
Expand Down