summary refs log tree commit diff
path: root/pkgs/misc/drivers/utsushi/patches/absolute-path-to-convert.patch
blob: 2bc9422b061e790079192716030b7a80f4c0ef20 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
Index: utsushi-0.57.0/configure.ac
===================================================================
--- utsushi-0.57.0.orig/configure.ac
+++ utsushi-0.57.0/configure.ac
@@ -221,6 +221,9 @@ AS_IF([test xno != x$enable_code_coverag
      [AC_MSG_ERROR([code coverage support requires a GNU C/C++ compiler])])
   ])
 AM_PROG_AR
+AC_PATH_PROG([AWK],[awk])
+AC_DEFINE_UNQUOTED([AWK], ["$AWK"],
+  [Path to awk.])
 
 PKG_PROG_PKG_CONFIG
 
@@ -379,27 +382,31 @@ AM_CONDITIONAL([have_libmagick_pp], [tes
 AS_IF([test xno != "x$with_magick"],
    AS_CASE("x$with_magick",
      [xGraphicsMagick],
-       [AC_CHECK_PROGS([MAGICK_CONVERT], [gm])
-        AS_IF([test xgm != x$MAGICK_CONVERT],
+       [[AC_PATH_PROG(MAGICK_CONVERT, gm)]
+        AS_IF([test x == x$MAGICK_CONVERT],
           [AC_MSG_ERROR([$with_magick requested but not found])])
         AC_DEFINE([HAVE_GRAPHICS_MAGICK], [1])
-        MAGICK_CONVERT="gm convert"
+        HAVE_MAGICK=1
+        MAGICK_CONVERT="$MAGICK_CONVERT convert"
        ],
      [xImageMagick],
-       [AC_CHECK_PROGS([MAGICK_CONVERT], [convert])
-        AS_IF([test xconvert != x$MAGICK_CONVERT],
+       [[AC_PATH_PROG(MAGICK_CONVERT, convert)]
+        AS_IF([test x == x$MAGICK_CONVERT],
           [AC_MSG_ERROR([$with_magick requested but not found])])
         AC_DEFINE([HAVE_IMAGE_MAGICK], [1])
+        HAVE_MAGICK=1
        ],
      [xyes|xcheck],
-       [AC_CHECK_PROGS([MAGICK_CONVERT], [gm convert])
+       [[AC_PATH_PROGS([MAGICK_CONVERT], [gm convert])]
         AS_CASE(x$MAGICK_CONVERT,
-          [xgm],
+          [x*gm],
             [AC_DEFINE([HAVE_GRAPHICS_MAGICK], [1])
-             MAGICK_CONVERT="gm convert"
+             HAVE_MAGICK=1
+             MAGICK_CONVERT="$MAGICK_CONVERT convert"
             ],
-          [xconvert],
+          [x*convert],
             [AC_DEFINE([HAVE_IMAGE_MAGICK], [1])
+            HAVE_MAGICK=1
             ],
           [dnl default case
            AS_IF([test xcheck != "x$with_magick"],
@@ -410,7 +417,7 @@ AS_IF([test xno != "x$with_magick"],
       AC_MSG_ERROR([unknown value: --with-magick=$with_magick])
      ]))
 AC_DEFINE_UNQUOTED([MAGICK_CONVERT], ["$MAGICK_CONVERT"])
-AM_CONDITIONAL([have_magick], [test x != "x$MAGICK_CONVERT"])
+AM_CONDITIONAL([have_magick], [test x != "x$HAVE_MAGICK"])
 
 AS_IF([test xno != "x$with_gtkmm"],
   [PKG_CHECK_MODULES([LIBGTKMM], [gtkmm-2.4 >= 2.20],
Index: utsushi-0.57.0/filters/magick.cpp
===================================================================
--- utsushi-0.57.0.orig/filters/magick.cpp
+++ utsushi-0.57.0/filters/magick.cpp
@@ -81,19 +81,18 @@ chomp (char *str)
 }
 
 bool
-magick_version_before_(const char *magick, const char *cutoff)
+magick_version_before_(const char *cutoff)
 {
   FILE *fp = NULL;
   int errc = 0;
 
-  if (0 == strcmp ("GraphicsMagick", magick))
-    fp = popen ("gm convert -version"
-                "| awk '/^GraphicsMagick/{print $2}'", "r");
-  if (fp) errc = errno;
-
-  if (0 == strcmp ("ImageMagick", magick))
-    fp  = popen ("convert -version"
-                 "| awk '/^Version:/{print $3}'", "r");
+#if HAVE_GRAPHICS_MAGICK
+  fp = popen (MAGICK_CONVERT " -version"
+                "| " AWK " '/^GraphicsMagick/{print $2}'", "r");
+#elif HAVE_IMAGE_MAGICK
+  fp  = popen (MAGICK_CONVERT " -version"
+                 "| " AWK " '/^Version:/{print $3}'", "r");
+#endif
   if (fp) errc = errno;
 
   if (fp)
@@ -106,42 +105,32 @@ magick_version_before_(const char *magic
 
       if (version)
         {
-          log::debug ("found %1%-%2%") % magick % version;
+          log::debug ("found " MAGICK_CONVERT "version %1%") % version;
           return (0 > strverscmp (version, cutoff));
         }
     }
 
   if (errc)
-    log::alert ("failure checking %1% version: %2%")
-      % magick
+    log::alert ("failure checking " MAGICK_CONVERT " version: %1%")
       % strerror (errc);
 
   return false;
 }
 
 bool
-graphics_magick_version_before_(const char *cutoff)
-{
-  return magick_version_before_("GraphicsMagick", cutoff);
-}
-
-bool
-image_magick_version_before_(const char *cutoff)
-{
-  return magick_version_before_("ImageMagick", cutoff);
-}
-
-bool
 auto_orient_is_usable ()
 {
   static int usable = -1;
 
   if (-1 == usable)
     {
-      if (HAVE_GRAPHICS_MAGICK)         // version -auto-orient was added
-        usable = !graphics_magick_version_before_("1.3.18");
-      if (HAVE_IMAGE_MAGICK)            // version known to work
-        usable = !image_magick_version_before_("6.7.8-9");
+#if HAVE_GRAPHICS_MAGICK
+      // version -auto-orient was added
+      usable = !magick_version_before_("1.3.18");
+#elif HAVE_IMAGE_MAGICK
+      // version known to work
+      usable = !magick_version_before_("6.7.8-9");
+#endif
       if (-1 == usable)
         usable = false;
       usable = (usable ? 1 : 0);
@@ -392,7 +381,7 @@ magick::arguments (const context& ctx)
   if (color_correction_)
     {
       if (HAVE_IMAGE_MAGICK
-          && !image_magick_version_before_("6.6.1-0"))
+          && !magick_version_before_("6.6.1-0"))
         argv += " -color-matrix";
       else
         argv += " -recolor";
@@ -416,7 +405,7 @@ magick::arguments (const context& ctx)
       size_t mat_size = ((HAVE_IMAGE_MAGICK) ? 6 : 5);
 
       if (HAVE_IMAGE_MAGICK
-          && !image_magick_version_before_("6.6.1-0"))
+          && !magick_version_before_("6.6.1-0"))
         argv += " -color-matrix";
       else
         argv += " -recolor";