# HG changeset patch
# User John Donoghue
# Date 1424095271 18000
#      Mon Feb 16 09:01:11 2015 -0500
# Node ID 50f11d9380459b3d92a698e16038581cc6dc33fa
# Parent  1a2fec9962a70cfee51fcad4e65af4bc00154ed5
ghostscript: simplify patches

* src/mingw-ghostscript-1-win.patch: change patch to just define the binary character when mingw.

* src/gnu-linux-ghostscript-configure.patch: removed old patch file.

* dist-files.mk: remove ref to src/gnu-linux-ghostscript-configure.patch.

diff -r 1a2fec9962a7 -r 50f11d938045 dist-files.mk
--- a/dist-files.mk	Thu Feb 05 16:04:09 2015 -0500
+++ b/dist-files.mk	Mon Feb 16 09:01:11 2015 -0500
@@ -133,7 +133,6 @@
   glpk-1-fixes.patch \
   glpk.mk \
   gmp.mk \
-  gnu-linux-ghostscript-configure.patch \
   gnuplot-1-fixes.patch \
   gnuplot-2-win64.patch \
   gnuplot-3-iconv.patch \
diff -r 1a2fec9962a7 -r 50f11d938045 src/gnu-linux-ghostscript-configure.patch
--- a/src/gnu-linux-ghostscript-configure.patch	Thu Feb 05 16:04:09 2015 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +0,0 @@
-diff -ur a/base/configure.ac b/base/configure.ac
---- a/base/configure.ac	2013-02-14 02:58:13.000000000 -0500
-+++ b/base/configure.ac	2014-07-08 09:44:59.470110783 -0400
-@@ -819,46 +819,11 @@
- AC_SUBST(LIBPNGDIR)
- #AC_SUBST(PNGDEVS)
- 
--WHICHLCMS=
--
--AC_ARG_WITH([lcms], AC_HELP_STRING([--with-lcms],
--    [try to use LittleCMS 1.x instead of the default of LittleCMS 2.x]))
--
--if test x$with_lcms != xyes; then
--  AC_MSG_CHECKING([for local lcms2 library source])
--  LCMS2DIR=lcms2
--  if test -f $LCMS2DIR/include/lcms2.h; then
--        AC_MSG_RESULT([yes])
--        SHARELCMS=0
--        WHICHLCMS=lcms2
--  else
--    AC_MSG_RESULT([no])
--    AC_MSG_CHECKING([for system lcms2 library])
--    AC_CHECK_LIB(lcms2, cmsGetTransformOutputFormat, [
--           AC_CHECK_HEADERS([lcms2.h], [LCMS2DIR="";SHARELCMS=1;WHICHLCMS=lcms2])
--         ])
--    if test x$WHICHLCMS = x; then
--      AC_MSG_WARN([lcms2 not found, or too old])
--    fi
--  fi
--fi
--
--if test x$WHICHLCMS = x; then
--  AC_MSG_CHECKING([for local lcms library source])
--  LCMSDIR=lcms
--  SHARELCMS=0
--  if test -f $LCMSDIR/include/lcms.h; then
--        AC_MSG_RESULT([yes])
--        SHARELCMS=0
--        WHICHLCMS=lcms
--  else
--
--    AC_MSG_ERROR([LittleCMS source not found!])
--    #AC_CHECK_LIB(lcms, cmsCreateXYZProfile, [
--    #          AC_CHECK_HEADERS([lcms.h], [SHARELCMS=1;LCMSDIR=""])
--    #        ])
--  fi
--fi
-+AC_MSG_NOTICE([unconditionally using installed lcms library])
-+SHARELCMS=1
-+WHICHLCMS=lcms2
-+LCMSDIR=
-+LCMS2DIR=
- 
- AC_SUBST(SHARELCMS)
- AC_SUBST(WHICHLCMS)
diff -r 1a2fec9962a7 -r 50f11d938045 src/mingw-ghostscript-1-win.patch
--- a/src/mingw-ghostscript-1-win.patch	Thu Feb 05 16:04:09 2015 -0500
+++ b/src/mingw-ghostscript-1-win.patch	Mon Feb 16 09:01:11 2015 -0500
@@ -1,34 +1,15 @@
-diff -ur ghostscript-9.15.orig/base/gp_unifs.c ghostscript-9.15/base/gp_unifs.c
---- ghostscript-9.15.orig/base/gp_unifs.c	2015-02-15 10:31:35.198127593 -0500
-+++ ghostscript-9.15/base/gp_unifs.c	2015-02-15 13:11:28.950483663 -0500
-@@ -80,6 +80,14 @@
-     int prefix_length = strlen(prefix);
-     int len = gp_file_name_sizeof - prefix_length - 8;
-     FILE *fp;
-+#ifdef __MINGW32__
-+    // add 'b' to ensure in binary mode
-+    char tmpmode[32];
-+ 
-+    strcpy(tmpmode, mode);
-+    strcat(tmpmode,"b");
-+    mode = tmpmode;
+diff -ur ghostscript-9.15.orig/base/gp_unifn.c ghostscript-9.15/base/gp_unifn.c
+--- ghostscript-9.15.orig/base/gp_unifn.c	2015-02-16 07:47:31.050998971 -0500
++++ ghostscript-9.15/base/gp_unifn.c	2015-02-16 07:48:50.582467223 -0500
+@@ -25,7 +25,11 @@
+ 
+ /* Define the string to be concatenated with the file mode */
+ /* for opening files without end-of-line conversion. */
++#if (defined(__MINGW32__) && __MINGW32__ == 1) || (defined(__CYGWIN__) && __CYGWIN__ == 1)
++const char gp_fmode_binary_suffix[] = "b";
++#else
+ const char gp_fmode_binary_suffix[] = "";
 +#endif
  
-     if (gp_file_name_is_absolute(prefix, prefix_length))
-         *fname = 0;
-@@ -148,6 +156,15 @@
- FILE *
- gp_fopen(const char *fname, const char *mode)
- {
-+#ifdef __MINGW32__
-+    // add 'b' to ensure in binary mode
-+    char tmpmode[32];
-+ 
-+    strcpy(tmpmode, mode);
-+    strcat(tmpmode,"b");
-+    mode = tmpmode;
-+#endif
-+
-     return fopen(fname, mode);
- }
- 
+ /* Define the file modes for binary reading or writing. */
+ #if (defined(__MINGW32__) && __MINGW32__ == 1) || (defined(__CYGWIN__) && __CYGWIN__ == 1)
