Files
haikuports/media-gfx/gmic/patches/gmic-3.1.2.patchset
2022-06-14 14:56:00 +10:00

176 lines
5.2 KiB
Plaintext

From 976030a8b5fea9e717318a6005b6d65727af8e41 Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Thu, 12 May 2022 10:07:44 +1000
Subject: Fix build for Haiku
diff --git a/gmic-qt/CMakeLists.txt b/gmic-qt/CMakeLists.txt
index 96cea7c..c85c3d1 100644
--- a/gmic-qt/CMakeLists.txt
+++ b/gmic-qt/CMakeLists.txt
@@ -314,6 +314,10 @@ if (APPLE)
add_definitions(-mmacosx-version-min=10.9 -Wno-macro-redefined -Wno-deprecated-register)
endif()
+if (HAIKU)
+ add_definitions(-Dcimg_display=0)
+endif()
+
if (WIN32)
add_definitions(-Dcimg_display=2)
add_definitions(-DPSAPI_VERSION=1)
diff --git a/src/gmic.h b/src/gmic.h
index 003d2bd..4669002 100644
--- a/src/gmic.h
+++ b/src/gmic.h
@@ -51,6 +51,11 @@
#
*/
+#ifdef __HAIKU__
+#include <sys/types.h>
+#include <sys/stat.h>
+#endif
+
#ifndef gmic_version
#define gmic_version 312
--
2.36.1
From c874a0ffea157eb73a269f61bdbf0976876ac0c3 Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Thu, 12 May 2022 10:08:03 +1000
Subject: Add Haiku to detected OS
diff --git a/src/CImg.h b/src/CImg.h
index f956160..74c1b22 100644
--- a/src/CImg.h
+++ b/src/CImg.h
@@ -7157,6 +7157,8 @@ namespace cimg_library_suffixed {
static const char *const str = "Irix";
#elif defined(__MACOSX__) || defined(__APPLE__)
static const char *const str = "Mac OS";
+#elif defined(__HAIKU__)
+ static const char *const str = "Haiku";
#elif defined(unix) || defined(__unix) || defined(__unix__)
static const char *const str = "Generic Unix";
#elif defined(_MSC_VER) || defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || \
--
2.36.1
From 80e4abb099f8c1c0b1a646bb3e39e24fc62437f3 Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Thu, 12 May 2022 10:08:15 +1000
Subject: Fix save file with default quality
diff --git a/gmic-qt/src/Host/None/ImageDialog.cpp b/gmic-qt/src/Host/None/ImageDialog.cpp
index 973c0ae..73eb636 100644
--- a/gmic-qt/src/Host/None/ImageDialog.cpp
+++ b/gmic-qt/src/Host/None/ImageDialog.cpp
@@ -56,9 +56,6 @@ bool ImageView::save(const QString & filename, int quality)
if ((ext == "jpg" || ext == "jpeg") && (quality == -1)) {
quality = JpegQualityDialog::ask(dynamic_cast<QWidget *>(parent()), -1);
}
- if (quality == -1) {
- return false;
- }
if (!_image.save(filename, nullptr, quality)) {
QMessageBox::critical(this, tr("Error"), tr("Could not write image file %1").arg(filename));
return false;
--
2.36.1
From dc0f75dd0ca3c72845285ce7487c54fe4f8876cb Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Mon, 13 Jun 2022 20:26:15 +1000
Subject: Disable flto, use -O1 optimization
diff --git a/gmic-qt/CMakeLists.txt b/gmic-qt/CMakeLists.txt
index c85c3d1..f1aba07 100644
--- a/gmic-qt/CMakeLists.txt
+++ b/gmic-qt/CMakeLists.txt
@@ -293,7 +293,7 @@ if (UNIX)
if(ANDROID)
add_definitions(-Dcimg_display=0)
add_definitions(-D_IS_UNIX_)
- elseif(NOT APPLE)
+ elseif(NOT APPLE AND NOT HAIKU)
add_definitions(-Dcimg_display=1)
add_definitions(-D_IS_LINUX_)
add_definitions(-Dcimg_use_vt100)
diff --git a/src/Makefile b/src/Makefile
index 970558c..746239e 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -208,10 +208,11 @@ MANDATORY_LIBS += -Wl,--stack,16777216
endif
# Enable optimizations for 'cli'.
-FLTO = -flto
+#FLTO = -flto
OPT_CFLAGS =
ifdef IS_GCC
-OPT_CFLAGS += -Ofast -mtune=generic # $(FLTO)
+#OPT_CFLAGS += -Ofast -mtune=generic # $(FLTO)
+OPT_CFLAGS += -O1
OPT_LIBS = # $(FLTO)
endif
ifdef icpc
@@ -347,11 +348,16 @@ else
ifeq ($(OS),Darwin) # MacOSX
GMIC_STD_CFLAGS += $(X11_CFLAGS) $(OPENEXR_CFLAGS)
GMIC_STD_LIBS += $(X11_LIBS) $(OPENEXR_LIBS)
+else
+ifeq ($(OS),Haiku) # Haiku
+GMIC_STD_CFLAGS += $(OPENEXR_CFLAGS) -Dcimg_display=0
+GMIC_STD_LIBS += $(OPENEXR_LIBS)
else # Windows
GMIC_STD_CFLAGS += $(OPENMP_CFLAGS) $(GDI32_CFLAGS)
GMIC_STD_LIBS += $(OPENMP_LIBS) $(GDI32_LIBS)
endif
endif
+endif
#-------------------------------
# Define main Makefile entries.
--
2.36.1
From 87c7f2e3c4e251e06da2f1ae3dabc4333fb586f0 Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Tue, 14 Jun 2022 13:51:36 +1000
Subject: Use uint32* for tiff buffer
diff --git a/src/CImg.h b/src/CImg.h
index 74c1b22..694e744 100644
--- a/src/CImg.h
+++ b/src/CImg.h
@@ -54443,13 +54443,13 @@ namespace cimg_library_suffixed {
(samplesperpixel==1 || samplesperpixel==3 || samplesperpixel==4)) ||
(bitspersample==1 && samplesperpixel==1)) {
// Special case for unsigned color images.
- cimg_uint32 *const raster = (cimg_uint32*)_TIFFmalloc(nx*ny*sizeof(cimg_uint32));
+ uint32 *const raster = (uint32*)_TIFFmalloc(nx*ny*sizeof(uint32));
if (!raster) {
_TIFFfree(raster); TIFFClose(tif);
throw CImgException(_cimg_instance
"load_tiff(): Failed to allocate memory (%s) for file '%s'.",
cimg_instance,
- cimg::strbuffersize(nx*ny*sizeof(cimg_uint32)),filename);
+ cimg::strbuffersize(nx*ny*sizeof(uint32)),filename);
}
TIFFReadRGBAImage(tif,nx,ny,raster,0);
switch (spectrum) {
--
2.36.1