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

[harfbuzz] Use meson and update to 2.7.0 #12860

Merged
merged 16 commits into from
Jan 25, 2021
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: 0 additions & 13 deletions ports/harfbuzz/0001-fix-cmake-export.patch

This file was deleted.

26 changes: 0 additions & 26 deletions ports/harfbuzz/0003-remove-broken-test.patch

This file was deleted.

18 changes: 0 additions & 18 deletions ports/harfbuzz/CONTROL

This file was deleted.

13 changes: 0 additions & 13 deletions ports/harfbuzz/find-package-freetype-2.patch

This file was deleted.

12 changes: 0 additions & 12 deletions ports/harfbuzz/fix_include.patch

This file was deleted.

30 changes: 0 additions & 30 deletions ports/harfbuzz/glib-cmake.patch

This file was deleted.

58 changes: 58 additions & 0 deletions ports/harfbuzz/harfbuzzConfig.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
if(TARGET harfbuzz)
return()
endif()

add_library(harfbuzz INTERFACE IMPORTED GLOBAL)
add_library(harfbuzz::harfbuzz ALIAS harfbuzz)

find_library(HARFBUZZ_LIBRARY_DEBUG NAMES harfbuzz PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug" PATH_SUFFIXES lib NO_DEFAULT_PATH)
if(HARFBUZZ_LIBRARY_DEBUG)
target_link_libraries(harfbuzz INTERFACE $<$<CONFIG:DEBUG>:${HARFBUZZ_LIBRARY_DEBUG}>)
endif()

find_library(HARFBUZZ_LIBRARY_RELEASE NAMES harfbuzz PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}" PATH_SUFFIXES lib NO_DEFAULT_PATH)
if(HARFBUZZ_LIBRARY_RELEASE)
target_link_libraries(harfbuzz INTERFACE $<$<NOT:$<CONFIG:DEBUG>>:${HARFBUZZ_LIBRARY_RELEASE}>)
endif()

set(HARFBUZZ_FEATURES @FEATURES@)

if(APPLE)
find_library(APPLICATIONSERVICES_LIBRARY ApplicationServices)
target_link_libraries(harfbuzz INTERFACE ${APPLICATIONSERVICES_LIBRARY})
endif()

find_package(freetype CONFIG REQUIRED)
target_link_libraries(harfbuzz INTERFACE freetype)

if ("graphite2" IN_LIST HARFBUZZ_FEATURES)
find_library(GRAPHITE2_LIBRARY_DEBUG NAMES graphite2 PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug" PATH_SUFFIXES lib NO_DEFAULT_PATH)
if(GRAPHITE2_LIBRARY_DEBUG)
target_link_libraries(harfbuzz INTERFACE $<$<CONFIG:DEBUG>:${GRAPHITE2_LIBRARY_DEBUG}>)
endif()

find_library(GRAPHITE2_LIBRARY_RELEASE NAMES graphite2 PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}" PATH_SUFFIXES lib NO_DEFAULT_PATH)
if(GRAPHITE2_LIBRARY_RELEASE)
target_link_libraries(harfbuzz INTERFACE $<$<NOT:$<CONFIG:DEBUG>>:${GRAPHITE2_LIBRARY_RELEASE}>)
endif()
endif()

if ("glib" IN_LIST HARFBUZZ_FEATURES)
vejmartin marked this conversation as resolved.
Show resolved Hide resolved
find_library(GLIB_LIBRARY_DEBUG NAMES glib glib-2.0 PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug" PATH_SUFFIXES lib NO_DEFAULT_PATH)
if(GLIB_LIBRARY_DEBUG)
target_link_libraries(harfbuzz INTERFACE $<$<CONFIG:DEBUG>:${GLIB_LIBRARY_DEBUG}>)
endif()

find_library(GLIB_LIBRARY_RELEASE NAMES glib glib-2.0 PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}" PATH_SUFFIXES lib NO_DEFAULT_PATH)
if(GLIB_LIBRARY_RELEASE)
target_link_libraries(harfbuzz INTERFACE $<$<NOT:$<CONFIG:DEBUG>>:${GLIB_LIBRARY_RELEASE}>)
endif()
endif()

if ("icu" IN_LIST HARFBUZZ_FEATURES)
find_package(ICU 61 COMPONENTS uc REQUIRED)
target_link_libraries(harfbuzz INTERFACE ICU::uc)
endif()

get_filename_component(_INSTALL_DIR "${CMAKE_CURRENT_LIST_DIR}/../../" ABSOLUTE)
target_include_directories(harfbuzz INTERFACE ${_INSTALL_DIR}/include/harfbuzz)
27 changes: 0 additions & 27 deletions ports/harfbuzz/icu.patch

This file was deleted.

65 changes: 23 additions & 42 deletions ports/harfbuzz/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,62 +1,43 @@
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO harfbuzz/harfbuzz
REF 9c98b2b9a9e43669c5e2b37eaa41b1e07de1ede3 # 2.7.2
SHA512 00b61034abce61370a7ff40bf5aa80bc1b3557d1f978ef91725fc30b34c4c00c682a3b9c99233e7e52d579b60694a1ba08714d5c9b01ad13e9fd76828facc720
REF 7236c7e29cef1c2d76c7a284c5081ff4d3aa1127 # 2.7.4
SHA512 d231a788ea4e52231d4c363c1eca76424cb82ed0952b5c24d0b082e88b3dddbda967e7fffe67fffdcb22c7ebfbf0ec923365eb4532be772f2e61fa7d29b51998
HEAD_REF master
PATCHES
0001-fix-cmake-export.patch
0002-fix-uwp-build.patch
0003-remove-broken-test.patch
# This patch is required for propagating the full list of static dependencies from freetype
find-package-freetype-2.patch
# This patch is required for propagating the full list of dependencies from glib
glib-cmake.patch
fix_include.patch
icu.patch
)

file(READ ${SOURCE_PATH}/CMakeLists.txt _contents)

if("${_contents}" MATCHES "include \\(FindFreetype\\)")
message(FATAL_ERROR "Harfbuzz's cmake must not directly include() FindFreetype.")
endif()

if("${_contents}" MATCHES "find_library\\(GLIB_LIBRARIES")
message(FATAL_ERROR "Harfbuzz's cmake must not directly find_library() glib.")
endif()

vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
icu HB_HAVE_ICU
graphite2 HB_HAVE_GRAPHITE2
glib HB_HAVE_GLIB
icu icu
graphite2 graphite
glib glib
)

vcpkg_configure_cmake(
string(REPLACE "=ON" "=enabled" FEATURE_OPTIONS "${FEATURE_OPTIONS}")
string(REPLACE "=OFF" "=disabled" FEATURE_OPTIONS "${FEATURE_OPTIONS}")

vcpkg_configure_meson(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS ${FEATURE_OPTIONS}
-DHB_HAVE_FREETYPE=ON
-DHB_BUILD_TESTS=OFF
OPTIONS_DEBUG
-DSKIP_INSTALL_HEADERS=ON
-Dfreetype=enabled
-Dgobject=disabled
-Dcairo=disabled
-Dfontconfig=disabled
-Dintrospection=disabled
-Ddocs=disabled
-Dtests=disabled
-Dbenchmark=disabled
)

vcpkg_install_cmake()
vcpkg_fixup_cmake_targets()

vcpkg_install_meson()
vcpkg_copy_pdbs()
vcpkg_fixup_pkgconfig()

if ("glib" IN_LIST FEATURES)
# Propagate dependency on glib downstream
file(READ "${CURRENT_PACKAGES_DIR}/share/harfbuzz/harfbuzzConfig.cmake" _contents)
file(WRITE "${CURRENT_PACKAGES_DIR}/share/harfbuzz/harfbuzzConfig.cmake" "
include(CMakeFindDependencyMacro)
find_dependency(unofficial-glib CONFIG)

${_contents}
")
endif()
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/lib/cmake")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/lib/cmake")
JackBoosY marked this conversation as resolved.
Show resolved Hide resolved
configure_file("${CMAKE_CURRENT_LIST_DIR}/harfbuzzConfig.cmake.in"
"${CURRENT_PACKAGES_DIR}/share/${PORT}/harfbuzzConfig.cmake" @ONLY)

# Handle copyright
file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
36 changes: 36 additions & 0 deletions ports/harfbuzz/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"name": "harfbuzz",
"version-string": "2.7.4",
"description": "HarfBuzz OpenType text shaping engine",
"homepage": "https://github.com/harfbuzz/harfbuzz",
"dependencies": [
{
"name": "freetype",
"default-features": false
},
{
"name": "gettext",
"platform": "osx"
}
],
"features": {
"glib": {
"description": "Glib Unicode callbacks support",
"dependencies": [
"glib"
]
},
"graphite2": {
"description": "Graphite2 shaper support",
"dependencies": [
"graphite2"
]
},
"icu": {
"description": "icu support for harfbuzz",
"dependencies": [
"icu"
]
}
}
}
Loading