[vlc-commits] contrib: harfbuzz: Restored a proper .pc file and fixed mac build

Konstantin Pavlov git at videolan.org
Sun Apr 5 14:40:37 CEST 2020


vlc | branch: master | Konstantin Pavlov <thresh at videolan.org> | Wed Apr  1 21:02:43 2020 +0300| [606e8bec5237781fc7e1370fe38ad61c52167bb4] | committer: Konstantin Pavlov

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
eed98c815bd28020c856d65b83602bbd8c067e3e, and then reverted in
d2a01fe376d438eeb42795ecb2cfcd13458f1572.  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.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=606e8bec5237781fc7e1370fe38ad61c52167bb4
---

 .../harfbuzz/harfbuzz-create-pkgconfig-file.patch  | 97 ++++++++++++++++------
 contrib/src/harfbuzz/rules.mak                     |  3 +-
 2 files changed, 73 insertions(+), 27 deletions(-)

diff --git a/contrib/src/harfbuzz/harfbuzz-create-pkgconfig-file.patch b/contrib/src/harfbuzz/harfbuzz-create-pkgconfig-file.patch
index a93334d656..166a9e67ee 100644
--- a/contrib/src/harfbuzz/harfbuzz-create-pkgconfig-file.patch
+++ b/contrib/src/harfbuzz/harfbuzz-create-pkgconfig-file.patch
@@ -1,28 +1,57 @@
---- 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
diff --git a/contrib/src/harfbuzz/rules.mak b/contrib/src/harfbuzz/rules.mak
index 09e7ccc5da..542ae64c47 100644
--- a/contrib/src/harfbuzz/rules.mak
+++ b/contrib/src/harfbuzz/rules.mak
@@ -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)



More information about the vlc-commits mailing list