summaryrefslogtreecommitdiffstats
path: root/375.patch
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2021-02-22 11:20:54 +0100
committerRemi Collet <remi@remirepo.net>2021-02-22 11:20:54 +0100
commit2ffb12fa2aa3209b78bfaf5b7c9c7854ec620656 (patch)
tree2c9dc678e04d532f157199be88cfed66c9c7332a /375.patch
parent20085ef9b7d532733489f9be43b2db4efd08f261 (diff)
build against ImageMagick6 and new soname
Diffstat (limited to '375.patch')
-rw-r--r--375.patch90
1 files changed, 90 insertions, 0 deletions
diff --git a/375.patch b/375.patch
new file mode 100644
index 0000000..80d138d
--- /dev/null
+++ b/375.patch
@@ -0,0 +1,90 @@
+From 8e305b0035df336620f66d0ca4bb2a162a4977ed Mon Sep 17 00:00:00 2001
+From: Remi Collet <remi@remirepo.net>
+Date: Mon, 25 Jan 2021 08:39:31 +0100
+Subject: [PATCH 1/2] call omp_pause_resource_all when available
+
+---
+ config.m4 | 2 ++
+ imagick.c | 8 ++++++++
+ 2 files changed, 10 insertions(+)
+
+diff --git a/config.m4 b/config.m4
+index 15260dc..dfb73a1 100644
+--- a/config.m4
++++ b/config.m4
+@@ -58,6 +58,8 @@ IM_FIND_IMAGEMAGICK([6.2.4], [$PHP_IMAGICK])
+
+ LIBS=$old_LIBS
+
++ PHP_CHECK_FUNC(omp_pause_resource_all, gomp)
++
+ PHP_SUBST(IMAGICK_SHARED_LIBADD)
+ AC_DEFINE(HAVE_IMAGICK,1,[ ])
+ PHP_NEW_EXTENSION(imagick, imagick_file.c imagick_class.c imagickdraw_class.c imagickpixel_class.c imagickpixeliterator_class.c imagick_helpers.c imagick.c imagickkernel_class.c shim_im6_to_im7.c, $ext_shared,, $IM_IMAGEMAGICK_CFLAGS)
+diff --git a/imagick.c b/imagick.c
+index cd7f98e..5822b36 100644
+--- a/imagick.c
++++ b/imagick.c
+@@ -35,6 +35,10 @@
+ /* For the countable interface */
+ #include "ext/spl/spl_iterators.h"
+
++#if HAVE_OMP_PAUSE_RESOURCE_ALL
++#include <omp.h>
++#endif
++
+ ZEND_DECLARE_MODULE_GLOBALS(imagick)
+
+ #ifdef IMAGICK_WITH_KERNEL
+@@ -3953,6 +3957,9 @@ PHP_MSHUTDOWN_FUNCTION(imagick)
+
+ MagickWandTerminus();
+
++#if HAVE_OMP_PAUSE_RESOURCE_ALL
++ omp_pause_resource_all(omp_pause_hard);
++#else
+ // Sleep for a bit to hopefully allow OpenMP to
+ // shut down the threads it created, and avoid a segfault
+ // This hack won't be needed once everyone is compiling ImageMagick
+@@ -3960,6 +3967,7 @@ PHP_MSHUTDOWN_FUNCTION(imagick)
+ for (i = 0; i < 100 && i < IMAGICK_G(shutdown_sleep_count); i += 1) {
+ usleep(1000);
+ }
++#endif
+
+ #if defined(ZTS) && defined(PHP_WIN32)
+ tsrm_mutex_free(imagick_mutex);
+
+From 071d6441ba02664e50cf021f8653b8e4d3014608 Mon Sep 17 00:00:00 2001
+From: Remi Collet <remi@remirepo.net>
+Date: Mon, 25 Jan 2021 15:15:14 +0100
+Subject: [PATCH 2/2] improve check
+
+---
+ config.m4 | 13 ++++++++++++-
+ 1 file changed, 12 insertions(+), 1 deletion(-)
+
+diff --git a/config.m4 b/config.m4
+index dfb73a1..b92db01 100644
+--- a/config.m4
++++ b/config.m4
+@@ -58,7 +58,18 @@ IM_FIND_IMAGEMAGICK([6.2.4], [$PHP_IMAGICK])
+
+ LIBS=$old_LIBS
+
+- PHP_CHECK_FUNC(omp_pause_resource_all, gomp)
++ AC_MSG_CHECKING(omp_pause_resource_all usability)
++ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
++ #include <omp.h>
++ ]],[[
++ omp_pause_resource_all(omp_pause_hard);
++ ]])],[
++ AC_MSG_RESULT(yes)
++ PHP_CHECK_FUNC(omp_pause_resource_all, gomp)
++ PHP_ADD_LIBRARY(gomp,, GMAGICK_SHARED_LIBADD)
++ ],[
++ AC_MSG_RESULT(no)
++ ])
+
+ PHP_SUBST(IMAGICK_SHARED_LIBADD)
+ AC_DEFINE(HAVE_IMAGICK,1,[ ])