[2/2] ghostscript: Addition of patch to fix freetype problem

Message ID 20210204125541.3970996-1-adolf.belka@ipfire.org
State Accepted
Commit f70fa093ec1e3b8da945dfbd74a636e896821929
Headers
Series [1/2] freetype: Update to 2.10.4 |

Commit Message

Adolf Belka Feb. 4, 2021, 12:55 p.m. UTC
  -Addition of patch to ghoscript as freetype version 2.10.3 and later
	have withdrawn a macro that ghostscript used. Confirmed that without
	the patch ghostscript failed to build due to the lack of the
	FT_CALLBACK_DEF() macro. The fix is to explicitly declare the
	callbacks file static.
- Update lfs to apply patch
- Add patch to src/patches

Signed-off-by: Adolf Belka <adolf.belka@ipfire.org>
---
 lfs/ghostscript                               |  3 +-
 ...K_DEF-with-Freetype-2.10.3-and-later.patch | 50 +++++++++++++++++++
 2 files changed, 52 insertions(+), 1 deletion(-)
 create mode 100644 src/patches/ghostscript-drop-use-of-FT_CALLBACK_DEF-with-Freetype-2.10.3-and-later.patch
  

Comments

Peter Müller Feb. 4, 2021, 5:17 p.m. UTC | #1
Hello Adolf,

thank you - this was the patch I was missing the other day. :-)

Reviewed-by: Peter Müller <peter.mueller@ipfire.org>

Thanks, and best regards,
Peter Müller

> -Addition of patch to ghoscript as freetype version 2.10.3 and later
> 	have withdrawn a macro that ghostscript used. Confirmed that without
> 	the patch ghostscript failed to build due to the lack of the
> 	FT_CALLBACK_DEF() macro. The fix is to explicitly declare the
> 	callbacks file static.
> - Update lfs to apply patch
> - Add patch to src/patches
> 
> Signed-off-by: Adolf Belka <adolf.belka@ipfire.org>
> ---
>  lfs/ghostscript                               |  3 +-
>  ...K_DEF-with-Freetype-2.10.3-and-later.patch | 50 +++++++++++++++++++
>  2 files changed, 52 insertions(+), 1 deletion(-)
>  create mode 100644 src/patches/ghostscript-drop-use-of-FT_CALLBACK_DEF-with-Freetype-2.10.3-and-later.patch
> 
> diff --git a/lfs/ghostscript b/lfs/ghostscript
> index edf019f5d..696f95b29 100644
> --- a/lfs/ghostscript
> +++ b/lfs/ghostscript
> @@ -32,7 +32,7 @@ DL_FROM    = $(URL_IPFIRE)
>  DIR_APP    = $(DIR_SRC)/$(THISAPP)
>  TARGET     = $(DIR_INFO)/$(THISAPP)
>  PROG       = ghostscript
> -PAK_VER    = 6
> +PAK_VER    = 7
>  
>  DEPS       = cups dbus libtiff
>  
> @@ -83,6 +83,7 @@ $(subst %,%_MD5,$(objects)) :
>  $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
>  	@$(PREBUILD)
>  	@rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar axf $(DIR_DL)/$(DL_FILE)
> +	cd $(DIR_APP) && patch -Np1 -i $(DIR_SRC)/src/patches/ghostscript-drop-use-of-FT_CALLBACK_DEF-with-Freetype-2.10.3-and-later.patch
>  	cd $(DIR_APP) && rm -rf expat freetype icclib jasper jpeg jpegxr \
>  		lcms lcms2 libpng openjpeg zlib cups/libs
>  	cd $(DIR_APP) && \
> diff --git a/src/patches/ghostscript-drop-use-of-FT_CALLBACK_DEF-with-Freetype-2.10.3-and-later.patch b/src/patches/ghostscript-drop-use-of-FT_CALLBACK_DEF-with-Freetype-2.10.3-and-later.patch
> new file mode 100644
> index 000000000..78014667d
> --- /dev/null
> +++ b/src/patches/ghostscript-drop-use-of-FT_CALLBACK_DEF-with-Freetype-2.10.3-and-later.patch
> @@ -0,0 +1,50 @@
> +From 41ef9a0bc36b9db7115fbe9623f989bfb47bbade Mon Sep 17 00:00:00 2001
> +From: Chris Liddell <chris.liddell@artifex.com>
> +Date: Tue, 20 Oct 2020 09:49:45 +0100
> +Subject: [PATCH] Bug 702985: drop use of FT_CALLBACK_DEF() def
> +
> +From 2.10.3, Freetype disappeared the FT_CALLBACK_DEF() macro, which is what
> +we used when defining our callbacks from Freetype.
> +
> +No guidance forthcoming from the Freetype developer who made those changes,
> +so change to explicitly declaring the callbacks file static.
> +
> +Should fix the reported build failures.
> +---
> + base/fapi_ft.c | 6 +++---
> + 1 file changed, 3 insertions(+), 3 deletions(-)
> +
> +diff --git a/base/fapi_ft.c b/base/fapi_ft.c
> +index 65fa6dcf4..21aef2f06 100644
> +--- a/base/fapi_ft.c
> ++++ b/base/fapi_ft.c
> +@@ -125,7 +125,7 @@ static void
> + delete_inc_int_info(gs_fapi_server * a_server,
> +                     FT_IncrementalRec * a_inc_int_info);
> + 
> +-FT_CALLBACK_DEF(void *)
> ++static void *
> + FF_alloc(FT_Memory memory, long size)
> + {
> +     gs_memory_t *mem = (gs_memory_t *) memory->user;
> +@@ -133,7 +133,7 @@ FF_alloc(FT_Memory memory, long size)
> +     return (gs_malloc(mem, size, 1, "FF_alloc"));
> + }
> + 
> +-FT_CALLBACK_DEF(void *)
> ++static void *
> +     FF_realloc(FT_Memory memory, long cur_size, long new_size, void *block)
> + {
> +     gs_memory_t *mem = (gs_memory_t *) memory->user;
> +@@ -153,7 +153,7 @@ FT_CALLBACK_DEF(void *)
> +     return (tmp);
> + }
> + 
> +-FT_CALLBACK_DEF(void)
> ++static void
> +     FF_free(FT_Memory memory, void *block)
> + {
> +     gs_memory_t *mem = (gs_memory_t *) memory->user;
> +-- 
> +2.17.1
> +
>
  
Adolf Belka Feb. 5, 2021, 8:29 a.m. UTC | #2
Hi Peter,

Whoops I forgot you had been working on freetype otherwise I would have let you know about the ghostscript patch once I found it.

Regards,
Adolf.

On 04/02/2021 18:17, Peter Müller wrote:
> Hello Adolf,
> 
> thank you - this was the patch I was missing the other day. :-)
> 
> Reviewed-by: Peter Müller <peter.mueller@ipfire.org>
> 
> Thanks, and best regards,
> Peter Müller
> 
>> -Addition of patch to ghoscript as freetype version 2.10.3 and later
>> 	have withdrawn a macro that ghostscript used. Confirmed that without
>> 	the patch ghostscript failed to build due to the lack of the
>> 	FT_CALLBACK_DEF() macro. The fix is to explicitly declare the
>> 	callbacks file static.
>> - Update lfs to apply patch
>> - Add patch to src/patches
>>
>> Signed-off-by: Adolf Belka <adolf.belka@ipfire.org>
>> ---
>>   lfs/ghostscript                               |  3 +-
>>   ...K_DEF-with-Freetype-2.10.3-and-later.patch | 50 +++++++++++++++++++
>>   2 files changed, 52 insertions(+), 1 deletion(-)
>>   create mode 100644 src/patches/ghostscript-drop-use-of-FT_CALLBACK_DEF-with-Freetype-2.10.3-and-later.patch
>>
>> diff --git a/lfs/ghostscript b/lfs/ghostscript
>> index edf019f5d..696f95b29 100644
>> --- a/lfs/ghostscript
>> +++ b/lfs/ghostscript
>> @@ -32,7 +32,7 @@ DL_FROM    = $(URL_IPFIRE)
>>   DIR_APP    = $(DIR_SRC)/$(THISAPP)
>>   TARGET     = $(DIR_INFO)/$(THISAPP)
>>   PROG       = ghostscript
>> -PAK_VER    = 6
>> +PAK_VER    = 7
>>   
>>   DEPS       = cups dbus libtiff
>>   
>> @@ -83,6 +83,7 @@ $(subst %,%_MD5,$(objects)) :
>>   $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
>>   	@$(PREBUILD)
>>   	@rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar axf $(DIR_DL)/$(DL_FILE)
>> +	cd $(DIR_APP) && patch -Np1 -i $(DIR_SRC)/src/patches/ghostscript-drop-use-of-FT_CALLBACK_DEF-with-Freetype-2.10.3-and-later.patch
>>   	cd $(DIR_APP) && rm -rf expat freetype icclib jasper jpeg jpegxr \
>>   		lcms lcms2 libpng openjpeg zlib cups/libs
>>   	cd $(DIR_APP) && \
>> diff --git a/src/patches/ghostscript-drop-use-of-FT_CALLBACK_DEF-with-Freetype-2.10.3-and-later.patch b/src/patches/ghostscript-drop-use-of-FT_CALLBACK_DEF-with-Freetype-2.10.3-and-later.patch
>> new file mode 100644
>> index 000000000..78014667d
>> --- /dev/null
>> +++ b/src/patches/ghostscript-drop-use-of-FT_CALLBACK_DEF-with-Freetype-2.10.3-and-later.patch
>> @@ -0,0 +1,50 @@
>> +From 41ef9a0bc36b9db7115fbe9623f989bfb47bbade Mon Sep 17 00:00:00 2001
>> +From: Chris Liddell <chris.liddell@artifex.com>
>> +Date: Tue, 20 Oct 2020 09:49:45 +0100
>> +Subject: [PATCH] Bug 702985: drop use of FT_CALLBACK_DEF() def
>> +
>> +From 2.10.3, Freetype disappeared the FT_CALLBACK_DEF() macro, which is what
>> +we used when defining our callbacks from Freetype.
>> +
>> +No guidance forthcoming from the Freetype developer who made those changes,
>> +so change to explicitly declaring the callbacks file static.
>> +
>> +Should fix the reported build failures.
>> +---
>> + base/fapi_ft.c | 6 +++---
>> + 1 file changed, 3 insertions(+), 3 deletions(-)
>> +
>> +diff --git a/base/fapi_ft.c b/base/fapi_ft.c
>> +index 65fa6dcf4..21aef2f06 100644
>> +--- a/base/fapi_ft.c
>> ++++ b/base/fapi_ft.c
>> +@@ -125,7 +125,7 @@ static void
>> + delete_inc_int_info(gs_fapi_server * a_server,
>> +                     FT_IncrementalRec * a_inc_int_info);
>> +
>> +-FT_CALLBACK_DEF(void *)
>> ++static void *
>> + FF_alloc(FT_Memory memory, long size)
>> + {
>> +     gs_memory_t *mem = (gs_memory_t *) memory->user;
>> +@@ -133,7 +133,7 @@ FF_alloc(FT_Memory memory, long size)
>> +     return (gs_malloc(mem, size, 1, "FF_alloc"));
>> + }
>> +
>> +-FT_CALLBACK_DEF(void *)
>> ++static void *
>> +     FF_realloc(FT_Memory memory, long cur_size, long new_size, void *block)
>> + {
>> +     gs_memory_t *mem = (gs_memory_t *) memory->user;
>> +@@ -153,7 +153,7 @@ FT_CALLBACK_DEF(void *)
>> +     return (tmp);
>> + }
>> +
>> +-FT_CALLBACK_DEF(void)
>> ++static void
>> +     FF_free(FT_Memory memory, void *block)
>> + {
>> +     gs_memory_t *mem = (gs_memory_t *) memory->user;
>> +--
>> +2.17.1
>> +
>>
  

Patch

diff --git a/lfs/ghostscript b/lfs/ghostscript
index edf019f5d..696f95b29 100644
--- a/lfs/ghostscript
+++ b/lfs/ghostscript
@@ -32,7 +32,7 @@  DL_FROM    = $(URL_IPFIRE)
 DIR_APP    = $(DIR_SRC)/$(THISAPP)
 TARGET     = $(DIR_INFO)/$(THISAPP)
 PROG       = ghostscript
-PAK_VER    = 6
+PAK_VER    = 7
 
 DEPS       = cups dbus libtiff
 
@@ -83,6 +83,7 @@  $(subst %,%_MD5,$(objects)) :
 $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
 	@$(PREBUILD)
 	@rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar axf $(DIR_DL)/$(DL_FILE)
+	cd $(DIR_APP) && patch -Np1 -i $(DIR_SRC)/src/patches/ghostscript-drop-use-of-FT_CALLBACK_DEF-with-Freetype-2.10.3-and-later.patch
 	cd $(DIR_APP) && rm -rf expat freetype icclib jasper jpeg jpegxr \
 		lcms lcms2 libpng openjpeg zlib cups/libs
 	cd $(DIR_APP) && \
diff --git a/src/patches/ghostscript-drop-use-of-FT_CALLBACK_DEF-with-Freetype-2.10.3-and-later.patch b/src/patches/ghostscript-drop-use-of-FT_CALLBACK_DEF-with-Freetype-2.10.3-and-later.patch
new file mode 100644
index 000000000..78014667d
--- /dev/null
+++ b/src/patches/ghostscript-drop-use-of-FT_CALLBACK_DEF-with-Freetype-2.10.3-and-later.patch
@@ -0,0 +1,50 @@ 
+From 41ef9a0bc36b9db7115fbe9623f989bfb47bbade Mon Sep 17 00:00:00 2001
+From: Chris Liddell <chris.liddell@artifex.com>
+Date: Tue, 20 Oct 2020 09:49:45 +0100
+Subject: [PATCH] Bug 702985: drop use of FT_CALLBACK_DEF() def
+
+From 2.10.3, Freetype disappeared the FT_CALLBACK_DEF() macro, which is what
+we used when defining our callbacks from Freetype.
+
+No guidance forthcoming from the Freetype developer who made those changes,
+so change to explicitly declaring the callbacks file static.
+
+Should fix the reported build failures.
+---
+ base/fapi_ft.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/base/fapi_ft.c b/base/fapi_ft.c
+index 65fa6dcf4..21aef2f06 100644
+--- a/base/fapi_ft.c
++++ b/base/fapi_ft.c
+@@ -125,7 +125,7 @@ static void
+ delete_inc_int_info(gs_fapi_server * a_server,
+                     FT_IncrementalRec * a_inc_int_info);
+ 
+-FT_CALLBACK_DEF(void *)
++static void *
+ FF_alloc(FT_Memory memory, long size)
+ {
+     gs_memory_t *mem = (gs_memory_t *) memory->user;
+@@ -133,7 +133,7 @@ FF_alloc(FT_Memory memory, long size)
+     return (gs_malloc(mem, size, 1, "FF_alloc"));
+ }
+ 
+-FT_CALLBACK_DEF(void *)
++static void *
+     FF_realloc(FT_Memory memory, long cur_size, long new_size, void *block)
+ {
+     gs_memory_t *mem = (gs_memory_t *) memory->user;
+@@ -153,7 +153,7 @@ FT_CALLBACK_DEF(void *)
+     return (tmp);
+ }
+ 
+-FT_CALLBACK_DEF(void)
++static void
+     FF_free(FT_Memory memory, void *block)
+ {
+     gs_memory_t *mem = (gs_memory_t *) memory->user;
+-- 
+2.17.1
+