aboutsummaryrefslogtreecommitdiff
path: root/vcpkg/ports/fontconfig
diff options
context:
space:
mode:
Diffstat (limited to 'vcpkg/ports/fontconfig')
-rw-r--r--vcpkg/ports/fontconfig/emscripten.diff13
-rw-r--r--vcpkg/ports/fontconfig/fix-wasm-shared-memory-atomics.patch14
-rw-r--r--vcpkg/ports/fontconfig/libgetopt.patch130
-rw-r--r--vcpkg/ports/fontconfig/no-etc-symlinks.patch19
-rw-r--r--vcpkg/ports/fontconfig/portfile.cmake109
-rw-r--r--vcpkg/ports/fontconfig/usage9
-rw-r--r--vcpkg/ports/fontconfig/vcpkg-cmake-wrapper.cmake.in44
-rw-r--r--vcpkg/ports/fontconfig/vcpkg.json60
8 files changed, 398 insertions, 0 deletions
diff --git a/vcpkg/ports/fontconfig/emscripten.diff b/vcpkg/ports/fontconfig/emscripten.diff
new file mode 100644
index 0000000..da8ef29
--- /dev/null
+++ b/vcpkg/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/vcpkg/ports/fontconfig/fix-wasm-shared-memory-atomics.patch b/vcpkg/ports/fontconfig/fix-wasm-shared-memory-atomics.patch
new file mode 100644
index 0000000..d94d109
--- /dev/null
+++ b/vcpkg/ports/fontconfig/fix-wasm-shared-memory-atomics.patch
@@ -0,0 +1,14 @@
+diff --git a/meson.build b/meson.build
+index 8e78700..95bae59 100644
+--- a/meson.build
++++ b/meson.build
+@@ -112,6 +112,9 @@ check_alignofs = [
+ ]
+
+ add_project_arguments('-DHAVE_CONFIG_H', language: 'c')
++if cc.get_id() == 'clang' and host_machine.cpu_family() == 'wasm'
++ add_project_arguments('-matomics', '-mbulk-memory', language: 'c')
++endif
+
+ c_args = []
+
diff --git a/vcpkg/ports/fontconfig/libgetopt.patch b/vcpkg/ports/fontconfig/libgetopt.patch
new file mode 100644
index 0000000..db43016
--- /dev/null
+++ b/vcpkg/ports/fontconfig/libgetopt.patch
@@ -0,0 +1,130 @@
+diff --git a/fc-cache/meson.build b/fc-cache/meson.build
+index 5e40fac..3c3e46b 100644
+--- a/fc-cache/meson.build
++++ b/fc-cache/meson.build
+@@ -1,6 +1,7 @@
+ fccache = executable('fc-cache', ['fc-cache.c', fcstdint_h, alias_headers, ft_alias_headers],
+ include_directories: [incbase, incsrc],
+ link_with: [libfontconfig],
++ dependencies: [getopt_dep],
+ c_args: c_args,
+ install: true,
+ )
+diff --git a/fc-cat/meson.build b/fc-cat/meson.build
+index f26e4b8..476c0f9 100644
+--- a/fc-cat/meson.build
++++ b/fc-cat/meson.build
+@@ -1,6 +1,7 @@
+ fccat = executable('fc-cat', ['fc-cat.c', fcstdint_h, alias_headers, ft_alias_headers],
+ include_directories: [incbase, incsrc],
+ link_with: [libfontconfig],
++ dependencies: [getopt_dep],
+ c_args: c_args,
+ install: true,
+ )
+diff --git a/fc-conflist/meson.build b/fc-conflist/meson.build
+index f543cf9..f06640b 100644
+--- a/fc-conflist/meson.build
++++ b/fc-conflist/meson.build
+@@ -1,6 +1,7 @@
+ fcconflist = executable('fc-conflist', ['fc-conflist.c', fcstdint_h, alias_headers, ft_alias_headers],
+ include_directories: [incbase, incsrc],
+ link_with: [libfontconfig],
++ dependencies: [getopt_dep],
+ c_args: c_args,
+ install: true,
+ )
+diff --git a/fc-list/meson.build b/fc-list/meson.build
+index 2f679d5..4b0fb62 100644
+--- a/fc-list/meson.build
++++ b/fc-list/meson.build
+@@ -1,6 +1,7 @@
+ fclist = executable('fc-list', ['fc-list.c', fcstdint_h, alias_headers, ft_alias_headers],
+ include_directories: [incbase, incsrc],
+ link_with: [libfontconfig],
++ dependencies: [getopt_dep],
+ c_args: c_args,
+ install: true,
+ )
+diff --git a/fc-match/meson.build b/fc-match/meson.build
+index aca8bc8..cab4f09 100644
+--- a/fc-match/meson.build
++++ b/fc-match/meson.build
+@@ -1,6 +1,7 @@
+ fcmatch = executable('fc-match', ['fc-match.c', fcstdint_h, alias_headers, ft_alias_headers],
+ include_directories: [incbase, incsrc],
+ link_with: [libfontconfig],
++ dependencies: [getopt_dep],
+ c_args: c_args,
+ install: true,
+ )
+diff --git a/fc-pattern/meson.build b/fc-pattern/meson.build
+index 07de245..b957c67 100644
+--- a/fc-pattern/meson.build
++++ b/fc-pattern/meson.build
+@@ -1,6 +1,7 @@
+ fcpattern = executable('fc-pattern', ['fc-pattern.c', fcstdint_h, alias_headers, ft_alias_headers],
+ include_directories: [incbase, incsrc],
+ link_with: [libfontconfig],
++ dependencies: [getopt_dep],
+ c_args: c_args,
+ install: true,
+ )
+diff --git a/fc-query/meson.build b/fc-query/meson.build
+index d0f2dd4..940b021 100644
+--- a/fc-query/meson.build
++++ b/fc-query/meson.build
+@@ -1,7 +1,7 @@
+ fcquery = executable('fc-query', ['fc-query.c', fcstdint_h, alias_headers, ft_alias_headers],
+ include_directories: [incbase, incsrc],
+ link_with: [libfontconfig],
+- dependencies: [freetype_dep],
++ dependencies: [freetype_dep, getopt_dep],
+ c_args: c_args,
+ install: true,
+ )
+diff --git a/fc-scan/meson.build b/fc-scan/meson.build
+index 4de2134..c5b2b67 100644
+--- a/fc-scan/meson.build
++++ b/fc-scan/meson.build
+@@ -1,7 +1,7 @@
+ fcscan = executable('fc-scan', ['fc-scan.c', fcstdint_h, alias_headers, ft_alias_headers],
+ include_directories: [incbase, incsrc],
+ link_with: [libfontconfig],
+- dependencies: [freetype_dep],
++ dependencies: [freetype_dep, getopt_dep],
+ c_args: c_args,
+ install: true,
+ )
+diff --git a/fc-validate/meson.build b/fc-validate/meson.build
+index e2b956e..8902d59 100644
+--- a/fc-validate/meson.build
++++ b/fc-validate/meson.build
+@@ -1,7 +1,7 @@
+ fcvalidate = executable('fc-validate', ['fc-validate.c', fcstdint_h, alias_headers, ft_alias_headers],
+ include_directories: [incbase, incsrc],
+ link_with: [libfontconfig],
+- dependencies: [freetype_dep],
++ dependencies: [freetype_dep, getopt_dep],
+ c_args: c_args,
+ install: true,
+ )
+diff --git a/meson.build b/meson.build
+index f616600..6d82a16 100644
+--- a/meson.build
++++ b/meson.build
+@@ -202,6 +202,14 @@ if cc.links(files('meson-cc-tests/solaris-atomic-operations.c'), name: 'Solaris
+ conf.set('HAVE_SOLARIS_ATOMIC_OPS', 1)
+ endif
+
++if host_machine.system() == 'windows'
++ conf.set('HAVE_GETOPT', 1)
++ conf.set('HAVE_GETOPT_LONG', 1)
++ getopt_dep = cc.find_library('getopt', required: false)
++else
++ getopt_dep = dependency('', required: false)
++endif
++
+
+ # Check iconv support
+ iconv_dep = []
diff --git a/vcpkg/ports/fontconfig/no-etc-symlinks.patch b/vcpkg/ports/fontconfig/no-etc-symlinks.patch
new file mode 100644
index 0000000..774640c
--- /dev/null
+++ b/vcpkg/ports/fontconfig/no-etc-symlinks.patch
@@ -0,0 +1,19 @@
+--- a/conf.d/link_confs.py 2022-03-24 04:13:59.000982000 +0900
++++ b/conf.d/link_confs.py 2022-03-24 04:14:46.271964000 +0900
+@@ -4,6 +4,7 @@
+ import sys
+ import argparse
+ import platform
++import shutil
+ from pathlib import PurePath
+
+ if __name__=='__main__':
+@@ -32,7 +33,7 @@
+ except FileNotFoundError:
+ pass
+ try:
+- os.symlink(os.path.relpath(src, start=args.confpath), dst)
++ shutil.copyfile(src, dst)
+ except NotImplementedError:
+ # Not supported on this version of Windows
+ break
diff --git a/vcpkg/ports/fontconfig/portfile.cmake b/vcpkg/ports/fontconfig/portfile.cmake
new file mode 100644
index 0000000..382a57a
--- /dev/null
+++ b/vcpkg/ports/fontconfig/portfile.cmake
@@ -0,0 +1,109 @@
+vcpkg_from_gitlab(
+ GITLAB_URL https://gitlab.freedesktop.org
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO fontconfig/fontconfig
+ REF ${VERSION}
+ SHA512 daa6d1e6058e12c694d9e1512e09be957ff7f3fa375246b9d13eb0a8cf2f21e1512a5cabe93f270e96790e2c20420bf7422d213e43ab9749da3255286ea65a7c
+ HEAD_REF master
+ PATCHES
+ emscripten.diff
+ no-etc-symlinks.patch
+ libgetopt.patch
+ fix-wasm-shared-memory-atomics.patch
+)
+
+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
+# Adding OPTIONS for e.g. baseconfig-dir etc. won't work since meson will try to install into those dirs!
+# Since adding OPTIONS does not work use a replacement in the generated config.h instead
+set(replacement "")
+if(VCPKG_TARGET_IS_WINDOWS)
+ set(replacement "**invalid-fontconfig-dir-do-not-use**")
+endif()
+set(configfile "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/config.h")
+vcpkg_replace_string("${configfile}" "${CURRENT_PACKAGES_DIR}" "${replacement}")
+vcpkg_replace_string("${configfile}" "#define FC_TEMPLATEDIR \"/share/fontconfig/conf.avail\"" "#define FC_TEMPLATEDIR \"/usr/share/fontconfig/conf.avail\"" IGNORE_UNCHANGED)
+if(NOT VCPKG_BUILD_TYPE)
+ set(configfile "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/config.h")
+ vcpkg_replace_string("${configfile}" "${CURRENT_PACKAGES_DIR}/debug" "${replacement}")
+ vcpkg_replace_string("${configfile}" "#define FC_TEMPLATEDIR \"/share/fontconfig/conf.avail\"" "#define FC_TEMPLATEDIR \"/usr/share/fontconfig/conf.avail\"" IGNORE_UNCHANGED)
+endif()
+
+vcpkg_install_meson(ADD_BIN_TO_PATH)
+
+vcpkg_copy_pdbs()
+#Fix missing libintl static dependency
+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()
+ vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/lib/pkgconfig/fontconfig.pc" "-liconv" "-liconv -lintl" IGNORE_UNCHANGED)
+endif()
+vcpkg_fixup_pkgconfig()
+
+# Fix paths in debug pc file.
+set(_file "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/fontconfig.pc")
+if(EXISTS "${_file}")
+ file(READ "${_file}" _contents)
+ string(REPLACE "/etc" "/../etc" _contents "${_contents}")
+ string(REPLACE "/var" "/../var" _contents "${_contents}")
+ file(WRITE "${_file}" "${_contents}")
+endif()
+
+# Make path to cache in fonts.conf relative
+set(_file "${CURRENT_PACKAGES_DIR}/etc/fonts/fonts.conf")
+if(EXISTS "${_file}")
+ vcpkg_replace_string("${_file}" "${CURRENT_PACKAGES_DIR}/var/cache/fontconfig" "./../../var/cache/fontconfig" IGNORE_UNCHANGED)
+endif()
+
+file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/var"
+ "${CURRENT_PACKAGES_DIR}/debug/share"
+ "${CURRENT_PACKAGES_DIR}/debug/etc")
+
+if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
+ if(VCPKG_TARGET_IS_WINDOWS)
+ set(DEFINE_FC_PUBLIC "#define FcPublic __declspec(dllimport)")
+ else()
+ set(DEFINE_FC_PUBLIC "#define FcPublic __attribute__((visibility(\"default\")))")
+ endif()
+ foreach(HEADER IN ITEMS fcfreetype.h fontconfig.h)
+ vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/fontconfig/${HEADER}"
+ "#define FcPublic"
+ "${DEFINE_FC_PUBLIC}"
+ )
+ endforeach()
+endif()
+
+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}")
+vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/COPYING")
diff --git a/vcpkg/ports/fontconfig/usage b/vcpkg/ports/fontconfig/usage
new file mode 100644
index 0000000..b59bc48
--- /dev/null
+++ b/vcpkg/ports/fontconfig/usage
@@ -0,0 +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)
+
+fontconfig provides pkg-config modules:
+
+ # Font configuration and customization library
+ fontconfig
diff --git a/vcpkg/ports/fontconfig/vcpkg-cmake-wrapper.cmake.in b/vcpkg/ports/fontconfig/vcpkg-cmake-wrapper.cmake.in
new file mode 100644
index 0000000..0e11e1c
--- /dev/null
+++ b/vcpkg/ports/fontconfig/vcpkg-cmake-wrapper.cmake.in
@@ -0,0 +1,44 @@
+_find_package(${ARGS})
+if("@VCPKG_LIBRARY_LINKAGE@" STREQUAL "static")
+ if(NOT TARGET Fontconfig::Fontconfig)
+ # Simplify wrapper for case of vendored FindFontconfig.cmake
+ add_library(Fontconfig::Fontconfig UNKNOWN IMPORTED)
+ endif()
+ include(SelectLibraryConfigurations)
+ find_library(Fontconfig_LIBRARY_DEBUG NAMES fontconfig fontconfigd NAMES_PER_DIR PATH_SUFFIXES lib PATHS "${_INSTALLED_DIR}/debug" NO_DEFAULT_PATH)
+ find_library(Fontconfig_LIBRARY_RELEASE NAMES fontconfig NAMES_PER_DIR PATH_SUFFIXES lib PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}" NO_DEFAULT_PATH)
+ select_library_configurations(Fontconfig)
+ set_target_properties(Fontconfig::Fontconfig PROPERTIES
+ IMPORTED_CONFIGURATIONS "Release"
+ IMPORTED_LOCATION_RELEASE "${Fontconfig_LIBRARY_RELEASE}"
+ )
+ if(Fontconfig_LIBRARY_DEBUG)
+ set_property(TARGET Fontconfig::Fontconfig APPEND PROPERTY IMPORTED_CONFIGURATIONS "Debug")
+ set_target_properties(Fontconfig::Fontconfig PROPERTIES IMPORTED_LOCATION_DEBUG "${Fontconfig_LIBRARY_DEBUG}")
+ endif()
+ find_package(Freetype)
+ if(Freetype_FOUND)
+ list(APPEND Fontconfig_LIBRARIES "${FREETYPE_LIBRARIES}")
+ if(TARGET Freetype::Freetype)
+ set_property(TARGET Fontconfig::Fontconfig APPEND PROPERTY INTERFACE_LINK_LIBRARIES "\$<LINK_ONLY:Freetype::Freetype>")
+ else()
+ # TODO link FREETYPE_LIBRARIES transformed for $<CONFIG:...>.
+ endif()
+ endif()
+ find_package(EXPAT)
+ if(EXPAT_FOUND)
+ list(APPEND Fontconfig_LIBRARIES "${EXPAT_LIBRARIES}")
+ if(TARGET EXPAT::EXPAT)
+ set_property(TARGET Fontconfig::Fontconfig APPEND PROPERTY INTERFACE_LINK_LIBRARIES "\$<LINK_ONLY:EXPAT::EXPAT>")
+ else()
+ # TODO link EXPAT_LIBRARIES transformed for $<CONFIG:...>.
+ endif()
+ endif()
+ if(NOT WIN32)
+ find_package(Iconv)
+ if(Iconv_FOUND)
+ list(APPEND Fontconfig_LIBRARIES "${Iconv_LIBRARIES}")
+ set_property(TARGET Fontconfig::Fontconfig APPEND PROPERTY INTERFACE_LINK_LIBRARIES "\$<LINK_ONLY:Iconv::Iconv>")
+ endif()
+ endif()
+endif()
diff --git a/vcpkg/ports/fontconfig/vcpkg.json b/vcpkg/ports/fontconfig/vcpkg.json
new file mode 100644
index 0000000..c43e69b
--- /dev/null
+++ b/vcpkg/ports/fontconfig/vcpkg.json
@@ -0,0 +1,60 @@
+{
+ "name": "fontconfig",
+ "version": "2.15.0",
+ "port-version": 4,
+ "description": "Library for configuring and customizing font access.",
+ "homepage": "https://www.freedesktop.org/wiki/Software/fontconfig",
+ "license": "MIT",
+ "supports": "!uwp",
+ "dependencies": [
+ "dirent",
+ "expat",
+ {
+ "name": "freetype",
+ "default-features": false
+ },
+ {
+ "name": "gperf",
+ "host": true
+ },
+ {
+ "name": "libiconv",
+ "platform": "!windows"
+ },
+ {
+ "name": "libuuid",
+ "platform": "!osx & !windows"
+ },
+ {
+ "name": "pthread",
+ "platform": "!emscripten & !windows"
+ },
+ {
+ "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"
+ ]
+ }
+ }
+}