Skip to content

Commit

Permalink
[freetype] add pkgconfig and add dependency on brotli
Browse files Browse the repository at this point in the history
  • Loading branch information
Neumann-A committed Jul 17, 2020
1 parent 750ca3f commit 4fa1623
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 27 deletions.
22 changes: 0 additions & 22 deletions ports/freetype/0002-Add-CONFIG_INSTALL_PATH-option.patch

This file was deleted.

4 changes: 2 additions & 2 deletions ports/freetype/CONTROL
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Source: freetype
Version: 2.10.2
Port-Version: 1
Build-Depends: zlib
Port-Version: 2
Build-Depends: zlib, brotli
Homepage: https://www.freetype.org/
Description: A library to render fonts.
Default-Features: bzip2, png
Expand Down
20 changes: 20 additions & 0 deletions ports/freetype/pkgconfig.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 65839ac58..54f2ce8ec 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -517,7 +517,6 @@ endif ()

if (NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL)
# Generate the pkg-config file
- if (UNIX)
file(READ "${PROJECT_SOURCE_DIR}/builds/unix/freetype2.in" FREETYPE2_PC_IN)

string(REPLACE ";" ", " PKG_CONFIG_REQUIRED_PRIVATE "${PKG_CONFIG_REQUIRED_PRIVATE}")
@@ -551,7 +550,6 @@ if (NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL)
FILES ${PROJECT_BINARY_DIR}/freetype2.pc
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
COMPONENT pkgconfig)
- endif ()

install(
TARGETS freetype
16 changes: 13 additions & 3 deletions ports/freetype/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ vcpkg_extract_source_archive_ex(
REF ${FT_VERSION}
PATCHES
0001-Fix-install-command.patch
0002-Add-CONFIG_INSTALL_PATH-option.patch
0003-Fix-UWP.patch
pkgconfig.patch
)

vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
Expand All @@ -28,13 +28,22 @@ vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS
-DCONFIG_INSTALL_PATH=share/freetype
-DFT_WITH_ZLIB=ON # Force system zlib.
${FEATURE_OPTIONS}
-DFT_WITH_BROTLI=ON
-DCMAKE_DISABLE_FIND_PACKAGE_HarfBuzz=ON
${FEATURE_OPTIONS}
${OPTIONS}
)

vcpkg_install_cmake()
vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake)
find_library(FREETYPE_DEBUG NAMES freetyped PATHS "${CURRENT_PACKAGES_DIR}/debug/lib/" NO_DEFAULT_PATH)
if(EXISTS "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/freetype2.pc" AND FREETYPE_DEBUG)
file(READ "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/freetype2.pc" _contents)
string(REPLACE "-lfreetype" "-lfreetyped" _contents "${_contents}")
file(WRITE "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/freetype2.pc" "${_contents}")
endif()
vcpkg_fixup_pkgconfig()

file(RENAME ${CURRENT_PACKAGES_DIR}/include/freetype2/freetype ${CURRENT_PACKAGES_DIR}/include/freetype)
file(RENAME ${CURRENT_PACKAGES_DIR}/include/freetype2/ft2build.h ${CURRENT_PACKAGES_DIR}/include/ft2build.h)
Expand Down Expand Up @@ -63,6 +72,7 @@ endif()
string(REPLACE "\${_IMPORT_PREFIX}/include/freetype2" "\${_IMPORT_PREFIX}/include;\${_IMPORT_PREFIX}/include/freetype" CONFIG_MODULE "${CONFIG_MODULE}")
file(WRITE ${CURRENT_PACKAGES_DIR}/share/freetype/freetype-config.cmake "${CONFIG_MODULE}")

file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)

file(COPY
Expand Down

0 comments on commit 4fa1623

Please sign in to comment.