[vlc-devel] [PATCH] contrib: harfbuzz: Revert back to autotools

Hugo Beauzée-Luyssen hugo at beauzee.fr
Tue Apr 7 10:38:03 CEST 2020


Their CMakeLists.txt uses an agglomerated build, which requires us to
enable big-obj support. However, on older version of binutils, this will
cause objcopy to crash when extracting debug symbols
---
 ...Enable-big-objects-support-for-win64.patch | 31 -------
 .../harfbuzz-create-pkgconfig-file.patch      | 88 -------------------
 .../harfbuzz-fix-coretext-detection.patch     | 23 -----
 .../harfbuzz-fix-freetype-detect.patch        | 36 --------
 contrib/src/harfbuzz/rules.mak                | 21 ++---
 5 files changed, 5 insertions(+), 194 deletions(-)
 delete mode 100644 contrib/src/harfbuzz/0001-CMakeLists-Enable-big-objects-support-for-win64.patch
 delete mode 100644 contrib/src/harfbuzz/harfbuzz-create-pkgconfig-file.patch
 delete mode 100644 contrib/src/harfbuzz/harfbuzz-fix-coretext-detection.patch
 delete mode 100644 contrib/src/harfbuzz/harfbuzz-fix-freetype-detect.patch

diff --git a/contrib/src/harfbuzz/0001-CMakeLists-Enable-big-objects-support-for-win64.patch b/contrib/src/harfbuzz/0001-CMakeLists-Enable-big-objects-support-for-win64.patch
deleted file mode 100644
index eb0a556b27..0000000000
--- a/contrib/src/harfbuzz/0001-CMakeLists-Enable-big-objects-support-for-win64.patch
+++ /dev/null
@@ -1,31 +0,0 @@
-From d36fe71173f213307de41711415f56861c71e62c Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Hugo=20Beauz=C3=A9e-Luyssen?= <hugo at beauzee.fr>
-Date: Mon, 30 Mar 2020 16:06:18 +0200
-Subject: [PATCH] CMakeLists: Enable big objects support for win64
-
----
- CMakeLists.txt | 8 ++++++++
- 1 file changed, 8 insertions(+)
-
-diff --git a/CMakeLists.txt b/CMakeLists.txt
-index 2cdfd4b3..6442d9b6 100644
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -499,6 +499,14 @@ if (UNIX OR MINGW)
-   endif()
- endif ()
- 
-+if (MINGW)
-+  if(${CMAKE_SIZEOF_VOID_P} EQUAL 8)
-+    CHECK_CXX_COMPILER_FLAG("-Wa,-mbig-obj" COMPILER_SUPPORTS_BIG_OBJ)
-+    if (COMPILER_SUPPORTS_BIG_OBJ)
-+      set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wa,-mbig-obj")
-+    endif()
-+  endif()
-+endif()
- 
- ## Define harfbuzz-gobject library
- if (HB_HAVE_GOBJECT)
--- 
-2.20.1
-
diff --git a/contrib/src/harfbuzz/harfbuzz-create-pkgconfig-file.patch b/contrib/src/harfbuzz/harfbuzz-create-pkgconfig-file.patch
deleted file mode 100644
index ac6e8d0146..0000000000
--- a/contrib/src/harfbuzz/harfbuzz-create-pkgconfig-file.patch
+++ /dev/null
@@ -1,88 +0,0 @@
-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 @@
- 
-   list(APPEND project_headers ${PROJECT_SOURCE_DIR}/src/hb-coretext.h)
- 
--  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 CoreFoundation")
-+  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 CoreText")
-+  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})
- 
-+## harfbuzz pc file
-+foreach(LIB ${THIRD_PARTY_LIBS})
-+  if(NOT IS_ABSOLUTE ${LIB})
-+    set(PRIVATE_LIBS "${PRIVATE_LIBS} -l${LIB}")
-+  endif()
-+endforeach()
-+
-+set(PRIVATE_LIBS "${PRIVATE_LIBS} ${FRAMEWORK_FLAGS}")
-+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 (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/harfbuzz-fix-coretext-detection.patch b/contrib/src/harfbuzz/harfbuzz-fix-coretext-detection.patch
deleted file mode 100644
index ee7337a5cb..0000000000
--- a/contrib/src/harfbuzz/harfbuzz-fix-coretext-detection.patch
+++ /dev/null
@@ -1,23 +0,0 @@
---- harfbuzz-2.6.0/CMakeLists.txt.orig	2020-03-29 18:34:37.596362257 +0200
-+++ harfbuzz-2.6.0/CMakeLists.txt	2020-03-29 18:34:53.984362061 +0200
-@@ -287,6 +287,20 @@
-   # Apple Advanced Typography
-   add_definitions(-DHAVE_CORETEXT)
- 
-+  set(CMAKE_FIND_ROOT_PATH ${CMAKE_IOS_DEVELOPER_ROOT} ${CMAKE_OSX_SYSROOT}
-+    ${CMAKE_PREFIX_PATH} CACHE string  "appleOS find search path root" FORCE)
-+  # Default to searching for frameworks first.
-+  set(CMAKE_FIND_FRAMEWORK FIRST)
-+  # Set up the default search directories for frameworks.
-+  set(CMAKE_SYSTEM_FRAMEWORK_PATH
-+    ${CMAKE_OSX_SYSROOT}/System/Library/Frameworks
-+    ${CMAKE_OSX_SYSROOT}/System/Library/PrivateFrameworks
-+    ${CMAKE_OSX_SYSROOT}/Developer/Library/Frameworks)
-+  # Only search the specified iOS SDK, not the remainder of the host filesystem.
-+  set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY)
-+  set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
-+  set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
-+
-   list(APPEND project_headers ${PROJECT_SOURCE_DIR}/src/hb-coretext.h)
- 
-   if (HB_IOS)
diff --git a/contrib/src/harfbuzz/harfbuzz-fix-freetype-detect.patch b/contrib/src/harfbuzz/harfbuzz-fix-freetype-detect.patch
deleted file mode 100644
index ee3a2bfba5..0000000000
--- a/contrib/src/harfbuzz/harfbuzz-fix-freetype-detect.patch
+++ /dev/null
@@ -1,36 +0,0 @@
---- harfbuzz-2.6.0/CMakeLists.txt.orig	2019-07-26 23:23:47.000000000 +0200
-+++ harfbuzz-2.6.0/CMakeLists.txt	2020-03-29 18:32:04.608364093 +0200
-@@ -201,6 +201,14 @@
- 
- ## Find and include needed header folders and libraries
- if (HB_HAVE_FREETYPE)
-+  find_package(PkgConfig)
-+  pkg_check_modules(PC_FREETYPE2 QUIET freetype2)
-+
-+  if (PC_FREETYPE2_FOUND)
-+    include_directories(AFTER ${PC_FREETYPE2_STATIC_INCLUDE_DIRS})
-+    list(APPEND THIRD_PARTY_LIBS ${PC_FREETYPE2_STATIC_LIBRARIES})
-+    add_definitions(${PC_FREETYPE2_STATIC_CFLAGS})
-+  else ()
-   include (FindFreetype)
-   if (NOT FREETYPE_FOUND)
-     message(FATAL_ERROR "HB_HAVE_FREETYPE was set, but we failed to find it. Maybe add a CMAKE_PREFIX_PATH= to your Freetype2 install prefix")
-@@ -208,13 +216,15 @@
- 
-   list(APPEND THIRD_PARTY_LIBS ${FREETYPE_LIBRARIES})
-   include_directories(AFTER ${FREETYPE_INCLUDE_DIRS})
--  add_definitions(-DHAVE_FREETYPE=1)
--
--  list(APPEND project_headers ${PROJECT_SOURCE_DIR}/src/hb-ft.h)
- 
-   # So check_funcs can find its headers
-   set (CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${FREETYPE_INCLUDE_DIRS})
-   set (CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${FREETYPE_LIBRARIES})
-+  endif ()
-+
-+  add_definitions(-DHAVE_FREETYPE=1)
-+
-+  list(APPEND project_headers ${PROJECT_SOURCE_DIR}/src/hb-ft.h)
- 
-   check_funcs(FT_Get_Var_Blend_Coordinates FT_Set_Var_Blend_Coordinates FT_Done_MM_Var)
- endif ()
diff --git a/contrib/src/harfbuzz/rules.mak b/contrib/src/harfbuzz/rules.mak
index 542ae64c47..759dd8748d 100644
--- a/contrib/src/harfbuzz/rules.mak
+++ b/contrib/src/harfbuzz/rules.mak
@@ -15,25 +15,14 @@ $(TARBALLS)/harfbuzz-$(HARFBUZZ_VERSION).tar.xz:
 harfbuzz: harfbuzz-$(HARFBUZZ_VERSION).tar.xz .sum-harfbuzz
 	$(UNPACK)
 	$(APPLY) $(SRC)/harfbuzz/harfbuzz-aarch64.patch
-	#It uses Cmake builtin to detect freetype instead of Pkg-Config
-	$(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 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)
 
 DEPS_harfbuzz = freetype2 $(DEPS_freetype2)
 
 .harfbuzz: harfbuzz toolchain.cmake
-	cd $< && mkdir -p build && cd build && $(HOSTVARS_PIC) $(CMAKE) \
-		-DBUILD_SHARED_LIBS:BOOL=OFF \
-		-DHB_HAVE_FREETYPE:BOOL=ON \
-		-DHB_BUILD_TESTS=OFF \
-		-DHB_BUILD_UTILS=OFF \
-		-DHB_HAVE_GLIB=OFF \
-		.. && $(MAKE)
-	cd $< && cd build && $(MAKE) install
+	$(RECONF)
+	cd $< && $(HOSTVARS_PIC) ./configure $(HOSTCONF) \
+		--with-freetype \
+		--without-glib
+	cd $< && $(MAKE) install
 	touch $@
-- 
2.20.1



More information about the vlc-devel mailing list