]>
Commit | Line | Data |
---|---|---|
1e59de90 TL |
1 | set(FONTCONFIG_VERSION 2.13.1) |
2 | ||
3 | if(NOT VCPKG_TARGET_IS_MINGW AND VCPKG_TARGET_IS_WINDOWS) | |
4 | set(PATCHES fix_def_dll_name.patch) | |
5 | endif() | |
6 | ||
7 | vcpkg_from_gitlab( | |
8 | GITLAB_URL https://gitlab.freedesktop.org | |
9 | OUT_SOURCE_PATH SOURCE_PATH | |
10 | REPO fontconfig/fontconfig | |
11 | REF 844d8709a1f3ecab45015b24b72dd775c13b2421 #v2.13.1 | |
12 | SHA512 fed0cf46f5dca9cb1e03475d7a8d7efdab06c7180fe0c922fb30cadfa91e1efe1f6a6e36d2fdb742a479cb09c05b0aefb5da5658bf2e01a32b7ac88ee8ff0b58 | |
13 | HEAD_REF master # branch name | |
14 | PATCHES remove_tests.patch | |
15 | build.patch | |
16 | build2.patch | |
17 | disable-install-data.patch | |
18 | macos_arm_fccache.patch | |
19 | ${PATCHES} | |
20 | ) | |
21 | ||
22 | vcpkg_find_acquire_program(GPERF) | |
23 | get_filename_component(GPERF_PATH ${GPERF} DIRECTORY) | |
24 | vcpkg_add_to_path(${GPERF_PATH}) | |
25 | ||
26 | vcpkg_configure_make( | |
27 | AUTOCONFIG | |
28 | COPY_SOURCE | |
29 | SOURCE_PATH ${SOURCE_PATH} | |
30 | OPTIONS | |
31 | --disable-docs | |
32 | ${OPTIONS} | |
33 | ac_cv_type_pid_t=yes | |
34 | --enable-iconv | |
35 | "--with-libiconv=${CURRENT_INSTALLED_DIR}" | |
36 | "--with-libiconv-includes=${CURRENT_INSTALLED_DIR}/include" | |
37 | OPTIONS_DEBUG | |
38 | "--with-libiconv-lib=${CURRENT_INSTALLED_DIR}/debug/lib" | |
39 | ${OPT_DBG} | |
40 | OPTIONS_RELEASE | |
41 | "--with-libiconv-lib=${CURRENT_INSTALLED_DIR}/lib" | |
42 | ${OPT_REL} | |
43 | ADD_BIN_TO_PATH | |
44 | ADDITIONAL_MSYS_PACKAGES xz findutils gettext gettext-devel # for autopoint | |
45 | ) | |
46 | ||
47 | vcpkg_install_make(ADD_BIN_TO_PATH) | |
48 | vcpkg_copy_pdbs() | |
49 | #Fix missing libintl static dependency | |
50 | if(NOT VCPKG_TARGET_IS_MINGW AND VCPKG_TARGET_IS_WINDOWS) | |
51 | if(NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug") | |
52 | vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/fontconfig.pc" "-liconv" "-liconv -lintl") | |
53 | endif() | |
54 | vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/lib/pkgconfig/fontconfig.pc" "-liconv" "-liconv -lintl") | |
55 | endif() | |
56 | vcpkg_fixup_pkgconfig() | |
57 | ||
58 | # Fix paths in debug pc file. | |
59 | set(_file "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/fontconfig.pc") | |
60 | if(EXISTS "${_file}") | |
61 | file(READ "${_file}" _contents) | |
62 | string(REPLACE "/etc" "/../etc" _contents "${_contents}") | |
63 | string(REPLACE "/var" "/../var" _contents "${_contents}") | |
64 | file(WRITE "${_file}" "${_contents}") | |
65 | endif() | |
66 | ||
67 | # Make path to cache in fonts.conf relative | |
68 | set(_file "${CURRENT_PACKAGES_DIR}/etc/fonts/fonts.conf") | |
69 | if(EXISTS "${_file}") | |
70 | file(READ "${_file}" _contents) | |
71 | string(REPLACE "${CURRENT_INSTALLED_DIR}/var/cache/fontconfig" "./../../var/cache/fontconfig" _contents "${_contents}") | |
72 | string(REPLACE "/var" "/../var" _contents "${_contents}") | |
73 | file(WRITE "${_file}" "${_contents}") | |
74 | endif() | |
75 | ||
76 | file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/var" | |
77 | "${CURRENT_PACKAGES_DIR}/debug/share" | |
78 | "${CURRENT_PACKAGES_DIR}/debug/etc") | |
79 | ||
80 | if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) | |
81 | if(VCPKG_TARGET_IS_WINDOWS) | |
82 | set(DEFINE_FC_PUBLIC "#define FcPublic __declspec(dllimport)") | |
83 | else() | |
84 | set(DEFINE_FC_PUBLIC "#define FcPublic __attribute__((visibility(\"default\")))") | |
85 | endif() | |
86 | foreach(HEADER fcfreetype.h fontconfig.h) | |
87 | vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/fontconfig/${HEADER}" | |
88 | "#define FcPublic" | |
89 | "${DEFINE_FC_PUBLIC}" | |
90 | ) | |
91 | endforeach() | |
92 | endif() | |
93 | ||
94 | file(INSTALL "${SOURCE_PATH}/COPYING" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) | |
95 | ||
96 | ||
97 | # Build the fontconfig cache | |
98 | if(NOT VCPKG_TARGET_IS_WINDOWS) | |
99 | set(ENV{FONTCONFIG_PATH} "${CURRENT_PACKAGES_DIR}/etc/fonts") | |
100 | set(ENV{FONTCONFIG_FILE} "${CURRENT_PACKAGES_DIR}/etc/fonts/fonts.conf") | |
101 | vcpkg_execute_required_process(COMMAND "${CURRENT_PACKAGES_DIR}/tools/${PORT}/bin/fc-cache${VCPKG_TARGET_EXECUTABLE_SUFFIX}" --verbose | |
102 | WORKING_DIRECTORY "${CURRENT_PACKAGES_DIR}/tools/${PORT}/bin" | |
103 | LOGNAME fc-cache-${TARGET_TRIPLET}) | |
104 | endif() | |
105 | ||
106 | if(VCPKG_TARGET_IS_WINDOWS) | |
107 | # Unnecessary make rule creating the fontconfig cache dir on windows. | |
108 | file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}LOCAL_APPDATA_FONTCONFIG_CACHE") | |
109 | endif() | |
110 | ||
111 | if(NOT VCPKG_TARGET_IS_LINUX) | |
112 | set(VCPKG_TARGET_IS_LINUX 0) # To not leave empty AND statements in the wrapper | |
113 | endif() | |
114 | configure_file("${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake.in" "${CURRENT_PACKAGES_DIR}/share/${PORT}/vcpkg-cmake-wrapper.cmake" @ONLY) |