Re: build of libharfbuzz0-shlibs-2.6.8-2 failed

Derek Homeier <[email protected]> Thu, 10 Oct 2024 00:43:54 +0200
Newsgroups gmane.os.apple.fink.general
Message-ID <[email protected]>
On 9 Oct 2024, at 9:51 PM, [email protected] wrote:
> 
> In the failed build directory, can you edit the file util/helper-cairo.cc at line 155 and delete the "(cairo_destroy_func_t)" part at the beginning. This would leave just "hb_font_destroy))" after all the indentations. Make sure you leave the 2 closing parentheses at the end. I don't know if this change will work, but it follows the same pattern from the previous upstream patch in src/hb-ft.cc.
> 
Still seems to remember its type:

g++ -std=gnu++11 -DHAVE_CONFIG_H -I. -I..  -DHB_DISABLE_DEPRECATED -I../src/ -I../src/ -I/opt/sw3/include/glib-2.0 -I/opt/sw3/lib/glib-2.0/include -I/opt/sw3/include/freetype2 -I/opt/sw3/include/cairo -I/opt/sw3/include/freetype2  -I/opt/sw3/include  -fno-rtti -g -O2 -fno-exceptions -fno-threadsafe-statics -fvisibility-inlines-hidden  -MT helper-cairo.o -MD -MP -MF .deps/helper-cairo.Tpo -c -o helper-cairo.o helper-cairo.cc
helper-cairo.cc:152:7: error: no matching function for call to 'cairo_scaled_font_set_user_data'
  152 |   if (cairo_scaled_font_set_user_data (scaled_font,
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/sw3/include/cairo/cairo.h:1592:1: note: candidate function not viable: no known conversion from 'void (hb_font_t *)' to 'cairo_destroy_func_t' (aka 'void (*)(void *)') for 4th argument
 1592 | cairo_scaled_font_set_user_data (cairo_scaled_font_t         *scaled_font,
      | ^
 1593 |                                  const cairo_user_data_key_t *key,
 1594 |                                  void                        *user_data,
 1595 |                                  cairo_destroy_func_t         destroy);

I have found the related change in upstream 7.0.0, which is removing the hb_font_destroy call altogether in
https://github.com/harfbuzz/harfbuzz/commit/ab8b9b4
so tried to apply that as well. There is a second change in the same commit (no pull request or discussion of
the change as far as I can see) apparently linking a hb_blob_destroy in helper-cairo-ft.hh, but since that file
does not even exist in 2.6.8 (or anything containing a similar function), I’ve no idea how to implement it there.

With that somewhat aggressive surgery, the package does build, and reactivating the test suite, passes all tests except check-symbols.py:

Checking that ./.libs/libharfbuzz.dylib does not expose internal symbols
Checking that ./.libs/libharfbuzz.dylib has the same symbol list as ./harfbuzz.def
***  
---  
***************

*** 201,207 ****

  hb_ft_font_set_funcs
  hb_ft_font_set_load_flags
  hb_ft_font_unlock_face
- hb_glib_blob_create
  hb_glib_get_unicode_funcs
  hb_glib_script_from_script
  hb_glib_script_to_script
--- 201,206 ——

But that function is sitting inside an #if GLIB_CHECK_VERSION(2,31,10) block in hb-glib.cc <http://hb-glib.cc/>
and Fink has glib2 2.28.8, so seems unrelated and inevitable.

Cheers,
					Derek

_______________________________________________
Fink-users mailing list
[email protected]
List archive:
https://sourceforge.net/p/fink/mailman/fink-users/
Subscription management:
https://lists.sourceforge.net/lists/listinfo/fink-users
libharfbuzz0-shlibs.info (application/octet-stream, 3 KB) - not displayed
libharfbuzz0-shlibs.patch (application/octet-stream, 3.9 KB)
diff -ruN harfbuzz-2.7.0-orig/src/hb-subset-cff1.cc harfbuzz-2.7.0/src/hb-subset-cff1.cc
--- harfbuzz-2.7.0-orig/src/hb-subset-cff1.cc	2020-07-25 03:10:57.000000000 -0500
+++ harfbuzz-2.7.0/src/hb-subset-cff1.cc	2023-01-16 05:04:07.000000000 -0600
@@ -402,12 +402,11 @@
   void plan_subset_encoding (const OT::cff1::accelerator_subset_t &acc, hb_subset_plan_t *plan)
   {
     const Encoding *encoding = acc.encoding;
-    unsigned int  size0, size1, supp_size;
+    unsigned int  size0, size1;
     hb_codepoint_t  code, last_code = CFF_UNDEF_CODE;
     hb_vector_t<hb_codepoint_t> supp_codes;
 
     subset_enc_code_ranges.resize (0);
-    supp_size = 0;
     supp_codes.init ();
 
     subset_enc_num_codes = plan->num_output_glyphs () - 1;
@@ -443,7 +442,6 @@
 	  code_pair_t pair = { supp_codes[i], sid };
 	  subset_enc_supp_codes.push (pair);
 	}
-	supp_size += SuppEncoding::static_size * supp_codes.length;
       }
     }
     supp_codes.fini ();
From d88269c827895b38f99f7cf741fa60210d4d5169 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <[email protected]>
Date: Fri, 28 Oct 2022 22:17:15 +0300
Subject: [PATCH] freetype: Fix function signatures to match without casts

Clang 16 has got a new stricter warning for casts of function types
(see https://github.com/llvm/llvm-project/commit/1aad641c793090b4d036c03e737df2ebe2c32c57).

This new warning gets included as part of the existing error
diagnostic setting of -Wcast-function-type.

This fixes errors like these:

../src/hb-ft.cc:1011:34: error: cast from 'void (*)(FT_Face)' (aka 'void (*)(FT_FaceRec_ *)') to 'FT_Generic_Finalizer' (aka 'void (*)(void *)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]
    ft_face->generic.finalizer = (FT_Generic_Finalizer) hb_ft_face_finalize;
                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
---
 src/hb-ft.cc | 30 ++++++++++++++++++------------
 1 file changed, 18 insertions(+), 12 deletions(-)

diff -ruN harfbuzz-2.7.0-orig/src/hb-ft.cc harfbuzz-2.7.0/src/hb-ft.cc
--- harfbuzz-2.7.0-orig/src/hb-ft.cc	2020-06-16 03:10:57.000000000 -0500
+++ harfbuzz-2.7.0/src/hb-ft.cc	2024-10-09 23:33:47.000000000 -0600
@@ -728,8 +728,9 @@ hb_ft_face_create_referenced (FT_Face ft_face)
 }
 
 static void
-hb_ft_face_finalize (FT_Face ft_face)
+hb_ft_face_finalize (void *arg)
 {
+  FT_Face ft_face = (FT_Face) arg;
   hb_face_destroy ((hb_face_t *) ft_face->generic.data);
 }
 
@@ -761,7 +762,7 @@ hb_ft_face_create_cached (FT_Face ft_face)
       ft_face->generic.finalizer (ft_face);
 
     ft_face->generic.data = hb_ft_face_create (ft_face, nullptr);
-    ft_face->generic.finalizer = (FT_Generic_Finalizer) hb_ft_face_finalize;
+    ft_face->generic.finalizer = hb_ft_face_finalize;
   }
 
   return hb_face_reference ((hb_face_t *) ft_face->generic.data);
@@ -947,8 +948,9 @@ get_ft_library ()
 }
 
 static void
-_release_blob (FT_Face ft_face)
+_release_blob (void *arg)
 {
+  FT_Face ft_face = (FT_Face) arg;
   hb_blob_destroy ((hb_blob_t *) ft_face->generic.data);
 }
 
@@ -1030,7 +1032,7 @@ hb_ft_font_set_funcs (hb_font_t *font)
 
 
   ft_face->generic.data = blob;
-  ft_face->generic.finalizer = (FT_Generic_Finalizer) _release_blob;
+  ft_face->generic.finalizer = _release_blob;
 
   _hb_ft_font_set_funcs (font, ft_face, true);
   hb_ft_font_set_load_flags (font, FT_LOAD_DEFAULT | FT_LOAD_NO_HINTING);
diff -ruN harfbuzz-2.7.0-orig/util/helper-cairo.cc harfbuzz-2.7.0/util/helper-cairo.cc
--- harfbuzz-2.7.0-orig/util/helper-cairo.cc	2020-06-16 03:10:57.000000000 -0500
+++ harfbuzz-2.7.0/util/helper-cairo.cc	2024-10-09 23:33:47.000000000 -0600
@@ -148,13 +148,6 @@
   cairo_font_options_destroy (font_options);
   cairo_font_face_destroy (cairo_face);
 
-  static cairo_user_data_key_t key;
-  if (cairo_scaled_font_set_user_data (scaled_font,
-				       &key,
-				       (void *) font,
-				       (cairo_destroy_func_t) hb_font_destroy))
-    hb_font_destroy (font);
-
   return scaled_font;
 }