aboutsummaryrefslogtreecommitdiff
path: root/libraries/FreeImage
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/FreeImage')
-rw-r--r--libraries/FreeImage/FreeImage.SlackBuild3
-rw-r--r--libraries/FreeImage/cross_platform_byteswap_fix.patch22
-rw-r--r--libraries/FreeImage/gcc-version-fix-includes.patch46
3 files changed, 71 insertions, 0 deletions
diff --git a/libraries/FreeImage/FreeImage.SlackBuild b/libraries/FreeImage/FreeImage.SlackBuild
index 2c1411efae..c6dfe5fe06 100644
--- a/libraries/FreeImage/FreeImage.SlackBuild
+++ b/libraries/FreeImage/FreeImage.SlackBuild
@@ -63,6 +63,9 @@ find -L . \
\( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
+patch -p1 < $CWD/gcc-version-fix-includes.patch
+patch -p1 < $CWD/cross_platform_byteswap_fix.patch
+
CFLAGS="$SLKCFLAGS -fexceptions -fvisibility=hidden -DNO_LCMS" \
CXXFLAGS="$SLKCFLAGS -fexceptions -fvisibility=hidden -Wno-ctor-dtor-privacy -std=c++14" \
make INSTALLDIR=$PKG/usr/lib${LIBDIRSUFFIX} DESTDIR=$PKG
diff --git a/libraries/FreeImage/cross_platform_byteswap_fix.patch b/libraries/FreeImage/cross_platform_byteswap_fix.patch
new file mode 100644
index 0000000000..9ae51e7217
--- /dev/null
+++ b/libraries/FreeImage/cross_platform_byteswap_fix.patch
@@ -0,0 +1,22 @@
+diff -up FreeImage/Source/LibJXR/image/decode/segdec.c.orig FreeImage/Source/LibJXR/image/decode/segdec.c
+--- FreeImage/Source/LibJXR/image/decode/segdec.c.orig 2024-08-18 02:32:53.595421505 -0500
++++ FreeImage/Source/LibJXR/image/decode/segdec.c 2024-08-18 02:33:41.184788298 -0500
+@@ -29,6 +29,18 @@
+ #include "strcodec.h"
+ #include "decode.h"
+
++// Conditional definition of _byteswap_ulong for cross-platform compatibility
++#ifdef _MSC_VER
++ #include <intrin.h> // Use the Microsoft-specific function on MSVC
++#else
++ #include <stdint.h> // Standard header for fixed-width integers
++
++ // Define the Microsoft-specific function for non-MSVC compilers
++ static inline uint32_t _byteswap_ulong(uint32_t x) {
++ return __builtin_bswap32(x); // GCC/Clang built-in function for Linux
++ }
++#endif
++
+ #ifdef MEM_TRACE
+ #define TRACE_MALLOC 1
+ #define TRACE_NEW 0
diff --git a/libraries/FreeImage/gcc-version-fix-includes.patch b/libraries/FreeImage/gcc-version-fix-includes.patch
new file mode 100644
index 0000000000..1f0d8bfee1
--- /dev/null
+++ b/libraries/FreeImage/gcc-version-fix-includes.patch
@@ -0,0 +1,46 @@
+diff -up FreeImage/Source/ZLib/gzlib.c.orig FreeImage/Source/ZLib/gzlib.c
+--- FreeImage/Source/ZLib/gzlib.c.orig 2024-08-18 15:22:03.585726491 -0500
++++ FreeImage/Source/ZLib/gzlib.c 2024-08-18 15:22:29.764924485 -0500
+@@ -4,6 +4,7 @@
+ */
+
+ #include "gzguts.h"
++#include <unistd.h>
+
+ #if defined(_WIN32) && !defined(__BORLANDC__) && !defined(__MINGW32__)
+ # define LSEEK _lseeki64
+diff -up FreeImage/Source/ZLib/gzread.c.orig FreeImage/Source/ZLib/gzread.c
+--- FreeImage/Source/ZLib/gzread.c.orig 2024-08-18 15:22:41.952016662 -0500
++++ FreeImage/Source/ZLib/gzread.c 2024-08-18 15:23:11.521240308 -0500
+@@ -4,6 +4,7 @@
+ */
+
+ #include "gzguts.h"
++#include <unistd.h>
+
+ /* Local functions */
+ local int gz_load OF((gz_statep, unsigned char *, unsigned, unsigned *));
+diff -up FreeImage/Source/ZLib/gzwrite.c.orig FreeImage/Source/ZLib/gzwrite.c
+--- FreeImage/Source/ZLib/gzwrite.c.orig 2024-08-18 15:23:24.238336499 -0500
++++ FreeImage/Source/ZLib/gzwrite.c 2024-08-18 15:23:41.145464386 -0500
+@@ -4,6 +4,7 @@
+ */
+
+ #include "gzguts.h"
++#include <unistd.h>
+
+ /* Local functions */
+ local int gz_init OF((gz_statep));
+
+diff -up FreeImage/Source/LibJXR/jxrgluelib/JXRGlueJxr.c.orig FreeImage/Source/LibJXR/jxrgluelib/JXRGlueJxr.c
+--- FreeImage/Source/LibJXR/jxrgluelib/JXRGlueJxr.c.orig 2024-08-18 15:32:17.325371341 -0500
++++ FreeImage/Source/LibJXR/jxrgluelib/JXRGlueJxr.c 2024-08-18 15:32:44.343575960 -0500
+@@ -28,7 +28,7 @@
+ //*@@@---@@@@******************************************************************
+ #include <limits.h>
+ #include <JXRGlue.h>
+-
++#include <wchar.h>
+
+ static const char szHDPhotoFormat[] = "<dc:format>image/vnd.ms-photo</dc:format>";
+ const U32 IFDEntryTypeSizes[] = { 0, 1, 1, 2, 4, 8, 1, 1, 2, 4, 8, 4, 8 };