Skip to content
Snippets Groups Projects
Commit 606e8bec authored by Konstantin Pavlov's avatar Konstantin Pavlov
Browse files

contrib: harfbuzz: Restored a proper .pc file and fixed mac build

The .pc file provided in the upstream src/ only works with autotools,
since CMake does not replace the variables marked with %variable%.

Our own custom .pc file was introduced in
eed98c81, and then reverted in
d2a01fe3.  This patch restores previous
behaviour.

Additionally, upstream harfbuzz broke mac builds by restricting
framework checks to HG_IOS define which they set manually.  Reverted
that change to restore the previous behaviour.
parent 2cac4c33
No related branches found
No related tags found
No related merge requests found
Pipeline #15763 passed with stage
in 1 hour, 15 minutes, and 42 seconds
--- harfbuzz-2.0.0/CMakeLists.txt.orig 2020-03-29 16:57:36.480432086 +0200
+++ harfbuzz-2.0.0/CMakeLists.txt 2020-03-29 16:59:29.568430730 +0200
@@ -396,18 +396,21 @@
find_library(COREFOUNDATION CoreFoundation)
if (COREFOUNDATION)
list(APPEND THIRD_PARTY_LIBS ${COREFOUNDATION})
+ set(FRAMEWORK_FLAGS "${FRAMEWORK_FLAGS} -framework CoreText")
endif ()
mark_as_advanced(COREFOUNDATION)
diff -urN harfbuzz.bak/CMakeLists.txt harfbuzz/CMakeLists.txt
--- harfbuzz.bak/CMakeLists.txt 2020-04-01 22:11:59.430060242 +0300
+++ harfbuzz/CMakeLists.txt 2020-04-01 22:34:27.074188908 +0300
@@ -303,32 +303,26 @@
find_library(CORETEXT CoreText)
if (CORETEXT)
list(APPEND THIRD_PARTY_LIBS ${CORETEXT})
+ set(FRAMEWORK_FLAGS "${FRAMEWORK_FLAGS} -framework CoreFoundation")
endif ()
mark_as_advanced(CORETEXT)
list(APPEND project_headers ${PROJECT_SOURCE_DIR}/src/hb-coretext.h)
find_library(COREGRAPHICS CoreGraphics)
if (COREGRAPHICS)
list(APPEND THIRD_PARTY_LIBS ${COREGRAPHICS})
+ set(FRAMEWORK_FLAGS "${FRAMEWORK_FLAGS} -framework CoreGraphics")
endif ()
mark_as_advanced(COREGRAPHICS)
else ()
@@ -579,6 +582,18 @@
- if (HB_IOS)
- find_library(COREFOUNDATION CoreFoundation)
- if (COREFOUNDATION)
- list(APPEND THIRD_PARTY_LIBS ${COREFOUNDATION})
- endif ()
- mark_as_advanced(COREFOUNDATION)
-
- find_library(CORETEXT CoreText)
- if (CORETEXT)
- list(APPEND THIRD_PARTY_LIBS ${CORETEXT})
- endif ()
- mark_as_advanced(CORETEXT)
+ find_library(COREFOUNDATION CoreFoundation)
+ if (COREFOUNDATION)
+ list(APPEND THIRD_PARTY_LIBS ${COREFOUNDATION})
+ set(FRAMEWORK_FLAGS "${FRAMEWORK_FLAGS} -framework CoreText")
+ endif ()
+ mark_as_advanced(COREFOUNDATION)
- find_library(COREGRAPHICS CoreGraphics)
- if (COREGRAPHICS)
- list(APPEND THIRD_PARTY_LIBS ${COREGRAPHICS})
- endif ()
- mark_as_advanced(COREGRAPHICS)
- else ()
- find_library(APPLICATION_SERVICES_FRAMEWORK ApplicationServices)
- if (APPLICATION_SERVICES_FRAMEWORK)
- list(APPEND THIRD_PARTY_LIBS ${APPLICATION_SERVICES_FRAMEWORK})
- endif ()
+ find_library(CORETEXT CoreText)
+ if (CORETEXT)
+ list(APPEND THIRD_PARTY_LIBS ${CORETEXT})
+ set(FRAMEWORK_FLAGS "${FRAMEWORK_FLAGS} -framework CoreFoundation")
+ endif ()
+ mark_as_advanced(CORETEXT)
- mark_as_advanced(APPLICATION_SERVICES_FRAMEWORK)
+ find_library(COREGRAPHICS CoreGraphics)
+ if (COREGRAPHICS)
+ list(APPEND THIRD_PARTY_LIBS ${COREGRAPHICS})
+ set(FRAMEWORK_FLAGS "${FRAMEWORK_FLAGS} -framework CoreGraphics")
endif ()
+ mark_as_advanced(COREGRAPHICS)
endif ()
if (WIN32 AND HB_HAVE_GDI)
@@ -489,6 +483,18 @@
add_library(harfbuzz ${project_sources} ${project_extra_sources} ${project_headers})
target_link_libraries(harfbuzz ${THIRD_PARTY_LIBS})
......@@ -34,10 +63,26 @@
+endforeach()
+
+set(PRIVATE_LIBS "${PRIVATE_LIBS} ${FRAMEWORK_FLAGS}")
+configure_file("src/harfbuzz.pc.in" "src/harfbuzz.pc" @ONLY)
+install(FILES "${CMAKE_CURRENT_BINARY_DIR}/src/harfbuzz.pc"
+configure_file("harfbuzz-cmake.pc.in" "harfbuzz.pc" @ONLY)
+install(FILES "${CMAKE_CURRENT_BINARY_DIR}/harfbuzz.pc"
+ DESTINATION "${CMAKE_INSTALL_PREFIX}/lib/pkgconfig")
+
## Define harfbuzz-subset library
if (NOT HB_DISABLE_SUBSET)
if (HB_BUILD_SUBSET)
add_library(harfbuzz-subset ${subset_project_sources} ${subset_project_headers})
diff -urN harfbuzz.bak/harfbuzz-cmake.pc.in harfbuzz/harfbuzz-cmake.pc.in
--- harfbuzz.bak/harfbuzz-cmake.pc.in 1970-01-01 03:00:00.000000000 +0300
+++ harfbuzz/harfbuzz-cmake.pc.in 2020-04-01 22:12:10.638058586 +0300
@@ -0,0 +1,12 @@
+prefix=@CMAKE_INSTALL_PREFIX@
+exec_prefix=${prefix}
+libdir=${prefix}/lib
+includedir=${prefix}/include
+
+Name: harfbuzz
+Description: HarfBuzz text shaping library
+Version: @HB_VERSION@
+
+Libs: -L${libdir} -lharfbuzz -lm @PRIVATE_LIBS@
+Requires.private:
+Cflags: -I${includedir}/harfbuzz
......@@ -19,7 +19,8 @@ harfbuzz: harfbuzz-$(HARFBUZZ_VERSION).tar.xz .sum-harfbuzz
$(APPLY) $(SRC)/harfbuzz/harfbuzz-fix-freetype-detect.patch
#It does not search for CoreText Framework everywhere
$(APPLY) $(SRC)/harfbuzz/harfbuzz-fix-coretext-detection.patch
#Missing Frameworks in the pkgconfig file
#Missing Frameworks in the pkgconfig file and a proper .pc file
#The one in src/ does not work because it's autotools-specific
$(APPLY) $(SRC)/harfbuzz/harfbuzz-create-pkgconfig-file.patch
$(APPLY) $(SRC)/harfbuzz/0001-CMakeLists-Enable-big-objects-support-for-win64.patch
$(MOVE)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment