package/libfreeimage: fix build with GCC 14.x

Take two patches from the Debian jxrlib package, and integrate them to
fix the build of the bundled jxrlib library found in the libfreeimage
package.

libfreeimage isn't exactly well maintained: its last version 3.18.0 is
quite old (July 2018), there's a fairly large number of tickets in the
bug tracker claiming to be CVE
reports (https://sourceforge.net/p/freeimage/bugs/), it is still using
SVN as the version control system.

However, it is used as an optional dependency for CEGUI, and a
mandatory dependency for Ogre. However, it no longer seems to be a
dependency for more recent versions of Ogre. But in any case it cannot
simply be dropped.

Fixes:

  https://autobuild.buildroot.net/results/452462285bf93b13f092fb41696952f415e75b2f/

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Julien Olivain <ju.o@free.fr>
This commit is contained in:
Thomas Petazzoni
2025-09-08 20:38:14 +02:00
committed by Julien Olivain
parent be466c265b
commit 21ea33c764
2 changed files with 69 additions and 0 deletions

View File

@@ -0,0 +1,40 @@
From 11383a017e8d040f1376c964d2b8769108204f0b Mon Sep 17 00:00:00 2001
From: YOKOTA Hiroshi <yokota.hgml@gmail.com>
Date: Thu, 25 Jul 2024 15:03:31 +0900
Subject: [PATCH] jxrlib: ftbfs with GCC-14
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Bug-Debian: https://bugs.debian.org/1075105
_byteswap_ulong() is defined in image/sys/strcodec.c
Upstream: Bug submitted at https://sourceforge.net/p/freeimage/bugs/389/
[Thomas: patch taken from https://sources.debian.org/patches/jxrlib/1.2~git20170615.f752187-5.3/0013-jxrlib-ftbfs-with-GCC-14.patch/]
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
----
/usr/bin/cc -DDISABLE_PERF_MEASUREMENT -D__ANSI__ -Djpegxr_EXPORTS -I"/<<PKGBUILDDIR>>/common/include" -I"/<<PKGBUILDDIR>>/image/sys" -I"/<<PKGBUILDDIR>>/jxrgluelib" -I"/<<PKGBUILDDIR>>/jxrtestlib" -g -O2 -Werror=implicit-function-declaration -ffile-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -Wall -Wextra -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -w -MD -MT CMakeFiles/jpegxr.dir/image/encode/strenc.c.o -MF CMakeFiles/jpegxr.dir/image/encode/strenc.c.o.d -o CMakeFiles/jpegxr.dir/image/encode/strenc.c.o -c "/<<PKGBUILDDIR>>/image/encode/strenc.c"
/<<PKGBUILDDIR>>/image/decode/segdec.c: In function _load4:
/<<PKGBUILDDIR>>/image/decode/segdec.c:68:12: error: implicit declaration of function _byteswap_ulong [-Wimplicit-function-declaration]
68 | return _byteswap_ulong(v);
| ^~~~~~~~~~~~~~~
---
Source/LibJXR/image/decode/segdec.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/Source/LibJXR/image/decode/segdec.c b/Source/LibJXR/image/decode/segdec.c
index 1299458..8050355 100644
--- a/Source/LibJXR/image/decode/segdec.c
+++ b/Source/LibJXR/image/decode/segdec.c
@@ -63,6 +63,7 @@ static U32 _FORCEINLINE _load4(void* pv)
v |= ((U32)((U16 *) pv)[1]) << 16;
return _byteswap_ulong(v);
#else // _M_IA64
+ U32 _byteswap_ulong(U32 bits); // from image/sys/strcodec.c
return _byteswap_ulong(*(U32*)pv);
#endif // _M_IA64
#endif // _BIG__ENDIAN_
--
2.51.0

View File

@@ -0,0 +1,29 @@
From 7b59b3757521d82406771cc47127aa70ffb26f3f Mon Sep 17 00:00:00 2001
From: YOKOTA Hiroshi <yokota.hgml@gmail.com>
Date: Thu, 25 Jul 2024 16:01:01 +0900
Subject: [PATCH] FTBFS fix for function prototype error
Bug-Debian: https://bugs.debian.org/1075105
Upstream: Bug submitted at https://sourceforge.net/p/freeimage/bugs/389/
[Thomas: patch taken from https://sources.debian.org/patches/jxrlib/1.2~git20170615.f752187-5.3/0015-FTBFS-fix-for-function-prototype-error.patch/]
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
Source/LibJXR/jxrgluelib/JXRGlueJxr.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/Source/LibJXR/jxrgluelib/JXRGlueJxr.c b/Source/LibJXR/jxrgluelib/JXRGlueJxr.c
index 2bf085a..182fc7f 100644
--- a/Source/LibJXR/jxrgluelib/JXRGlueJxr.c
+++ b/Source/LibJXR/jxrgluelib/JXRGlueJxr.c
@@ -28,6 +28,7 @@
//*@@@---@@@@******************************************************************
#include <limits.h>
#include <JXRGlue.h>
+#include <wchar.h>
static const char szHDPhotoFormat[] = "<dc:format>image/vnd.ms-photo</dc:format>";
--
2.51.0