commit:     a6bf07acc01f5848f2b0b7c17b93e05611a651b5
Author:     Alfred Persson Forsberg <cat <AT> catcream <DOT> org>
AuthorDate: Thu Jun 16 18:54:32 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Jun 16 21:08:49 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a6bf07ac

media-libs/freeimage: fix build with musl 1.2.3

FreeImage relies on NULL being 0, while on musl for stdc++ >= 11 it is
defined as nullptr. This breaks the build for musl.
Returning FALSE here is correct.

Closes: https://bugs.gentoo.org/841973
Signed-off-by: Alfred Persson Forsberg <cat <AT> catcream.org>
Closes: https://github.com/gentoo/gentoo/pull/25926
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../files/freeimage-3.18.0-null-to-false.patch     | 22 ++++++++++++++++++++++
 media-libs/freeimage/freeimage-3.18.0-r8.ebuild    |  1 +
 2 files changed, 23 insertions(+)

diff --git a/media-libs/freeimage/files/freeimage-3.18.0-null-to-false.patch 
b/media-libs/freeimage/files/freeimage-3.18.0-null-to-false.patch
new file mode 100644
index 000000000000..3e8e13a40b3c
--- /dev/null
+++ b/media-libs/freeimage/files/freeimage-3.18.0-null-to-false.patch
@@ -0,0 +1,22 @@
+https://bugs.gentoo.org/841973
+
+See also:
+https://sourceforge.net/p/freeimage/mailman/message/37668470/
+https://git.alpinelinux.org/aports/commit/?id=9b938a7b38ea4b8d9a73f1bf0d90ee45bbfa9139
+
+diff --git a/Source/FreeImage/PluginPSD.cpp b/Source/FreeImage/PluginPSD.cpp
+index e5b5ffa..d9de81f 100644
+--- a/Source/FreeImage/PluginPSD.cpp
++++ b/Source/FreeImage/PluginPSD.cpp
+@@ -127,7 +127,7 @@ Load(FreeImageIO *io, fi_handle handle, int page, int 
flags, void *data) {
+ static BOOL DLL_CALLCONV
+ Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, 
void *data) {
+       if(!handle) {
+-              return NULL;
++              return FALSE;
+       }
+       try {
+               psdParser parser;
+-- 
+2.35.1
+

diff --git a/media-libs/freeimage/freeimage-3.18.0-r8.ebuild 
b/media-libs/freeimage/freeimage-3.18.0-r8.ebuild
index aef7915a1072..826ed42b593c 100644
--- a/media-libs/freeimage/freeimage-3.18.0-r8.ebuild
+++ b/media-libs/freeimage/freeimage-3.18.0-r8.ebuild
@@ -56,6 +56,7 @@ PATCHES=(
        "${FILESDIR}"/${PN}-3.18.0-openexr-3-imath.patch
        "${FILESDIR}"/${PN}-3.18.0-libraw-0.20.0.patch
        "${FILESDIR}"/${PN}-3.18.0-tiff-4.4.0.patch
+       "${FILESDIR}"/${PN}-3.18.0-null-to-false.patch
 )
 
 src_prepare() {

Reply via email to