Subject: bug#33771: 27.0.50; Error building Harfbuzz branch on Debian testing

From: Eli Zaretskii <[email-masked]>
Date: Sun, 16 Dec 2018 21:52:34 +0200

> From: Philipp <[email-masked]>
> Date: Sun, 16 Dec 2018 19:57:54 +0100
> 
> 
> Got the following compiler error when trying to compile the Harfbuzz
> branch:
> 
>   CC       ftfont.o
> ftfont.c: In function ‘ftfont_shape’:
> ftfont.c:2952:7: error: unknown type name ‘OTF’
>        OTF *otf = ftfont_get_otf (ftfont_info);
>        ^~~

You are building without libotf?

> ftfont.c:2952:18: warning: implicit declaration of function ‘ftfont_get_otf’; did you mean ‘ftfont_get_cache’? [-Wimplicit-function-declaration]
>        OTF *otf = ftfont_get_otf (ftfont_info);
>                   ^~~~~~~~~~~~~~
>                   ftfont_get_cache
> ftfont.c:2952:18: warning: nested extern declaration of ‘ftfont_get_otf’ [-Wnested-externs]
> ftfont.c:2952:18: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
> ftfont.c:2954:14: warning: implicit declaration of function ‘ftfont_shape_by_flt’; did you mean ‘ftfont_shape_by_hb’? [-Wimplicit-function-declaration]
>        return ftfont_shape_by_flt (lgstring, font, ftfont_info->ft_size->face,
>               ^~~~~~~~~~~~~~~~~~~
>               ftfont_shape_by_hb
> ftfont.c:2954:14: warning: nested extern declaration of ‘ftfont_shape_by_flt’ [-Wnested-externs]
> ftfont.c:2954:14: error: incompatible types when returning type ‘int’ but ‘Lisp_Object {aka struct Lisp_Object}’ was expected
>        return ftfont_shape_by_flt (lgstring, font, ftfont_info->ft_size->face,
>               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>        otf, &ftfont_info->matrix);
>        ~~~~~~~~~~~~~~~~~~~~~~~~~~
> ftfont.c:2957:1: warning: control reaches end of non-void function [-Wreturn-type]
>  }
>  ^
> Makefile:386: recipe for target 'ftfont.o' failed
> make[1]: *** [ftfont.o] Error 1

Does the below fix the problem?

diff --git a/src/ftfont.c b/src/ftfont.c
index bc98896..bbdc936 100644
--- a/src/ftfont.c
+++ b/src/ftfont.c
@@ -2931,7 +2931,7 @@ ftfont_shape_by_hb (Lisp_Object lgstring, FT_Face ft_face, hb_font_t *hb_font,
 
 #endif /* HAVE_HARFBUZZ */
 
-#if defined HAVE_M17N_FLT || defined HAVE_HARFBUZZ
+#if defined HAVE_LIBOTF && (defined HAVE_M17N_FLT || defined HAVE_HARFBUZZ)
 
 Lisp_Object
 ftfont_shape (Lisp_Object lgstring)
@@ -2956,7 +2956,7 @@ ftfont_shape (Lisp_Object lgstring)
     }
 }
 
-#endif /* defined HAVE_M17N_FLT || defined HAVE_HARFBUZZ */
+#endif /* HAVE_LIBOTF && (HAVE_M17N_FLT || defined HAVE_HARFBUZZ) */
 
 static const char *const ftfont_booleans [] = {
   ":antialias",
@@ -3037,7 +3037,7 @@ static struct font_driver const ftfont_driver =
 #ifdef HAVE_LIBOTF
   .otf_capability = ftfont_otf_capability,
 #endif
-#if defined HAVE_M17N_FLT || defined HAVE_HARFBUZZ
+#if defined HAVE_LIBOTF && (defined HAVE_M17N_FLT || defined HAVE_HARFBUZZ)
   .shape = ftfont_shape,
 #endif
 #ifdef HAVE_OTF_GET_VARIATION_GLYPHS