graphicsmagick (1.3.12-1) direct (non packaging) changes

Summary

 magick/GraphicsMagick-config.1  |    4 ++--
 magick/GraphicsMagick-config.in |    4 ++--
 magick/effect.c                 |    8 ++++----
 magick/static.c                 |   13 +++++++++++++
 magick/utility.c                |   36 ++++++++++++++++++++++++++++--------
 5 files changed, 49 insertions(+), 16 deletions(-)

    
download this patch

Patch contents

--- graphicsmagick-1.3.12.orig/magick/effect.c
+++ graphicsmagick-1.3.12/magick/effect.c
@@ -2382,7 +2382,7 @@
       return ((Image *) NULL);
     }
   {
-#if defined(HAVE_OPENMP)
+#if defined(HAVE_OPENMP) && !defined(sparc)
 #  pragma omp parallel for schedule(dynamic) shared(row_count, status)
 #endif
     for (y=0; y < (long) median_image->rows; y++)
@@ -2436,7 +2436,7 @@
             if (!SyncImagePixelsEx(median_image,exception))
               thread_status=MagickFail;
           }
-#if defined(HAVE_OPENMP)
+#if defined(HAVE_OPENMP) && !defined(sparc)
 #  pragma omp critical (GM_MedianFilterImage)
 #endif
         {
@@ -3353,7 +3353,7 @@
       return ((Image *) NULL);
     }
 
-#if defined(HAVE_OPENMP)
+#if defined(HAVE_OPENMP) && !defined(sparc)
 #  pragma omp parallel for schedule(dynamic) shared(row_count, status)
 #endif
   for (y=0; y < (long) noise_image->rows; y++)
@@ -3408,7 +3408,7 @@
           if (!SyncImagePixelsEx(noise_image,exception))
             thread_status=MagickFail;
         }
-#if defined(HAVE_OPENMP)
+#if defined(HAVE_OPENMP) && !defined(sparc)
 #  pragma omp critical (GM_ReduceNoiseImage)
 #endif
       {
--- graphicsmagick-1.3.12.orig/magick/static.c
+++ graphicsmagick-1.3.12/magick/static.c
@@ -408,3 +408,16 @@
   UnregisterYUVImage();
 #endif /* !defined(BuildMagickModules) */
 }
+
+#define AddStub(module) \
+  MagickExport void Register##module##Image(void) { return; } \
+  MagickExport void Unregister##module##Image(void) { return; }
+
+/* Add stub definitions to ensure ABI doesn't change whether certain libs
+   are available or not. */
+#if !defined(BuildMagickModules)
+/* So far we only care about DPS. Other should be added as necessary. */
+# if !defined(HasDPS)
+AddStub(DPS)
+# endif
+#endif /* !defined(BuildMagickModules) */
--- graphicsmagick-1.3.12.orig/magick/utility.c
+++ graphicsmagick-1.3.12/magick/utility.c
@@ -1331,32 +1331,52 @@
       some other systems use compatible schemes.
     */
     int
-      length;
+      length,
+      ret;
 
     long
       pid;
 
     char 
-      link_path[MaxTextExtent],
-      real_path[PATH_MAX+1];
+      link_path[MaxTextExtent];
+
+    char *
+      real_path = NULL;
+
+    struct stat
+      linkbuf;
 
     pid=(long) getpid();
     /* Linux format */
     FormatString(link_path,"/proc/%ld/exe",pid);
-    length=readlink(link_path, real_path, PATH_MAX);
-    if (length == -1)
+    ret = lstat(link_path, &linkbuf);
+    if (ret == 0) 
+      {
+        real_path = malloc(linkbuf.st_size + 1);
+        length=readlink(link_path, real_path, linkbuf.st_size);
+      }
+    if ((ret != 0) || (length == -1))
       {
         /* Try FreeBSD format */
         FormatString(link_path,"/proc/%ld/file",pid);
-        length=readlink(link_path, real_path, PATH_MAX);
+        ret = lstat(link_path, &linkbuf);
+        if (ret == 0)
+          {
+	    real_path = realloc(real_path, linkbuf.st_size + 1);
+            length=readlink(link_path, real_path, linkbuf.st_size);
+          }
       }
-    if ((length > 0) && (length <= PATH_MAX))
+    if ((ret == 0) && (length > 0) && (length <= linkbuf.st_size))
       {
         real_path[length]=0;
         if (strlcpy(path,real_path,MaxTextExtent) < MaxTextExtent)
           if (IsAccessible(path))
-            return(MagickPass);
+            {
+              free(real_path);
+              return(MagickPass);
+            }
       }
+    free(real_path);
   }
 #endif
   return(MagickFail);
--- graphicsmagick-1.3.12.orig/magick/GraphicsMagick-config.in
+++ graphicsmagick-1.3.12/magick/GraphicsMagick-config.in
@@ -30,13 +30,13 @@
       echo @PACKAGE_VERSION@
       ;;
     --cflags)
-      echo '@CFLAGS@'
+      echo ''
       ;;
     --cppflags)
       echo '@MAGICK_API_CPPFLAGS@'
       ;;
     --ldflags)
-      echo '@MAGICK_API_LDFLAGS@'
+      echo '-L@libdir@'
       ;;
     --libs)
       echo '@MAGICK_API_LIBS@'
--- graphicsmagick-1.3.12.orig/magick/GraphicsMagick-config.1
+++ graphicsmagick-1.3.12/magick/GraphicsMagick-config.1
@@ -38,8 +38,8 @@
 .SH OPTIONS
 .TP
 .B --cflags
-Print the compiler flags that were used to compile 
-.BR libMagick .
+Print the compiler flags that are needed to use the GraphicsMagick C interface.
+(Usually empty.)
 .TP
 .B --cppflags
 Print the preprocessor flags that are needed to find the