diff --git a/libs/ghostscript/ghostscript-9.18-20151217.diff b/libs/ghostscript/ghostscript-9.18-20151217.diff deleted file mode 100644 index f16a2eae..00000000 --- a/libs/ghostscript/ghostscript-9.18-20151217.diff +++ /dev/null @@ -1,124 +0,0 @@ -diff -Nrub -x '*~' -x '*\.orig' -x'*\.o' ghostscript-9.18.orig/base/gscdef.c ghostscript-9.18/base/gscdef.c ---- ghostscript-9.18.orig/base/gscdef.c 2015-10-05 10:21:11.000000000 +0200 -+++ ghostscript-9.18/base/gscdef.c 2015-12-17 20:29:06.241525800 +0100 -@@ -81,7 +81,7 @@ - const char *const gs_doc_directory = GS_DOCDIR; - - /* Define the default library search path. */ --const char *const gs_lib_default_path = GS_LIB_DEFAULT; -+const char *const gs_lib_default_path = "..\\share\\ghostscript\\9.18\\Resource\\Init;..\\share\\ghostscript\\9.18\\lib;..\\share\\ghostscript\\9.18\\Resource\\Font;..\\share\\ghostscript\\fonts;..\\share\\fonts\\default\\ghostscript;..\\share\\fonts\\default\\Type1;..\\share\\fonts\\default\\TrueType;..\\msys\\usr\\lib\\DPS\\outline\\base;..\\msys\\usr\\openwin\\lib\\X11\\fonts\\Type1;..\\msys\\usr\\openwin\\lib\\X11\\fonts\\TrueType"; - - /* Define the interpreter initialization file. */ - const char *const gs_init_file = GS_INIT; -diff -Nrub -x '*~' -x '*\.orig' -x'*\.o' ghostscript-9.18.orig/contrib/eplaser/gdevescv.c ghostscript-9.18/contrib/eplaser/gdevescv.c ---- ghostscript-9.18.orig/contrib/eplaser/gdevescv.c 2015-10-05 10:21:11.000000000 +0200 -+++ ghostscript-9.18/contrib/eplaser/gdevescv.c 2015-12-17 17:12:44.188606100 +0100 -@@ -60,7 +60,6 @@ - - #include "math_.h" - #include /* for abs() */ --#include /* for uname(2) */ - #include /* for toupper(3) */ - - #include "time_.h" -@@ -820,13 +819,8 @@ - get_sysname ( void ) - { - char *result = NULL; -- struct utsname utsn; - -- if (0 == uname (&utsn)) -- { -- result = strdup (utsn.sysname); -- } -- return result; -+ return strdup("mingw"); - } - - /* EPSON printer model name translation. -diff -Nrub -x '*~' -x '*\.orig' -x'*\.o' ghostscript-9.18.orig/contrib/pcl3/eprn/pagecount.c ghostscript-9.18/contrib/pcl3/eprn/pagecount.c ---- ghostscript-9.18.orig/contrib/pcl3/eprn/pagecount.c 2015-10-05 10:21:11.000000000 +0200 -+++ ghostscript-9.18/contrib/pcl3/eprn/pagecount.c 2015-12-17 20:14:09.981262600 +0100 -@@ -61,12 +61,12 @@ - - static int lock_file(const char *filename, FILE *f, int lock_type) - { -+#if 0 - int - fd, - rc, - tries; - struct flock cmd; -- - /* Obtain file descriptor */ - fd = fileno(f); - if (fd == -1) { -@@ -94,6 +94,9 @@ - } - - return 0; -+#else -+ return -1; -+#endif - } - - /****************************************************************************** -@@ -151,11 +154,11 @@ - } - - /* Lock the file for reading (shared lock) */ -- if (lock_file(filename, f, F_RDLCK) != 0) { -+/* if (lock_file(filename, f, F_RDLCK) != 0) { - fclose(f); - return 1; - } -- -+*/ - /* Read the contents */ - if (read_count(filename, f, count) != 0) { - fclose(f); -@@ -204,11 +207,11 @@ - } - - /* Lock the file for writing (exclusively) */ -- if (lock_file(filename, f, F_WRLCK) != 0) { -+/* if (lock_file(filename, f, F_WRLCK) != 0) { - fclose(f); - return 1; - } -- -+*/ - /* Reposition on the beginning. fopen() with "a" as above opens the file at - EOF. */ - if (fseek(f, 0L, SEEK_SET) != 0) { -diff -Nrub -x '*~' -x '*\.orig' -x'*\.o' ghostscript-9.18.orig/ijs/ijs_exec_unix.c ghostscript-9.18/ijs/ijs_exec_unix.c ---- ghostscript-9.18.orig/ijs/ijs_exec_unix.c 2015-10-05 10:21:11.000000000 +0200 -+++ ghostscript-9.18/ijs/ijs_exec_unix.c 2015-12-17 20:18:02.538564100 +0100 -@@ -22,6 +22,9 @@ - * SOFTWARE. - **/ - -+#ifdef _WIN32 -+#include "ijs_exec_win.c" -+#else - #include "unistd_.h" - #include - #include -@@ -101,3 +104,4 @@ - - return 0; - } -+#endif -\ No newline at end of file -diff -Nrub -x '*~' -x '*\.orig' -x'*\.o' ghostscript-9.18.orig/psi/iapi.c ghostscript-9.18/psi/iapi.c ---- ghostscript-9.18.orig/psi/iapi.c 2015-10-05 10:21:12.000000000 +0200 -+++ ghostscript-9.18/psi/iapi.c 2015-12-17 20:46:30.924278200 +0100 -@@ -325,7 +325,7 @@ - * format (in this case whatever codepage is set) to utf8 format. At - * the moment, all the other OS we care about provide utf8 anyway. - */ -- gs_main_inst_arg_decode(get_minst_from_memory(ctx->memory), gp_local_arg_encoding_get_codepoint); -+ gs_main_inst_arg_decode(get_minst_from_memory(ctx->memory), NULL/*gp_local_arg_encoding_get_codepoint*/); - #else - gs_main_inst_arg_decode(get_minst_from_memory(ctx->memory), NULL); - #endif /* WIN32 */ diff --git a/libs/ghostscript/ghostscript-exports-fix.diff b/libs/ghostscript/ghostscript-exports-fix.diff deleted file mode 100644 index 69c7ef4a..00000000 --- a/libs/ghostscript/ghostscript-exports-fix.diff +++ /dev/null @@ -1,12 +0,0 @@ -diff -Nrub -x '*~' -x '*\.orig' -x'*\.o' ghostscript-9.19/psi/iapi.h.orig ghostscript-9.19/psi/iapi.h ---- ghostscript-9.19/psi/iapi.h.orig 2016-03-23 11:22:48.000000000 +0300 -+++ ghostscript-9.19/psi/iapi.h 2017-08-31 21:12:46.699912800 +0300 -@@ -50,7 +50,7 @@ - extern "C" { - #endif - --#if defined(_WINDOWS_) || defined(__WINDOWS__) -+#if defined(_WIN32) || defined(__WINDOWS__) - # ifndef _Windows - # define _Windows - # endif diff --git a/libs/ghostscript/ghostscript-sys-zlib.patch b/libs/ghostscript/ghostscript-sys-zlib.patch deleted file mode 100644 index d632fcbb..00000000 --- a/libs/ghostscript/ghostscript-sys-zlib.patch +++ /dev/null @@ -1,25 +0,0 @@ -diff -up ghostscript-9.12/configure.ac.sys-zlib ghostscript-9.12/configure.ac ---- ghostscript-9.12/configure.ac.sys-zlib 2014-03-26 11:48:54.983972222 +0000 -+++ ghostscript-9.12/configure.ac 2014-03-26 11:49:36.807230531 +0000 -@@ -854,7 +854,7 @@ AC_MSG_CHECKING([for local zlib source]) - dnl zlib is needed for language level 3, and libpng - # we must define ZLIBDIR regardless because png.mak does a -I$(ZLIBDIR) - # this seems a harmless default --ZLIBDIR=src -+ZLIBDIR=$includedir - AUX_SHARED_ZLIB= - - if test -d $srcdir/zlib; then -diff -up ghostscript-9.12/configure.sys-zlib ghostscript-9.12/configure ---- ghostscript-9.12/configure.sys-zlib 2014-03-26 11:49:45.547284521 +0000 -+++ ghostscript-9.12/configure 2014-03-26 11:49:56.171350127 +0000 -@@ -6254,7 +6254,7 @@ fi - $as_echo_n "checking for local zlib source... " >&6; } - # we must define ZLIBDIR regardless because png.mak does a -I$(ZLIBDIR) - # this seems a harmless default --ZLIBDIR=src -+ZLIBDIR=$includedir - AUX_SHARED_ZLIB= - - if test -d $srcdir/zlib; then - diff --git a/libs/ghostscript/ghostscript.py b/libs/ghostscript/ghostscript.py index 1777d0c6..c6c59f78 100644 --- a/libs/ghostscript/ghostscript.py +++ b/libs/ghostscript/ghostscript.py @@ -1,149 +1,140 @@ import info class subinfo(info.infoclass): def setDependencies(self): self.runtimeDependencies["virtual/base"] = None self.runtimeDependencies["libs/zlib"] = None if not CraftCore.compiler.isMSVC(): self.buildDependencies["dev-utils/msys"] = None self.runtimeDependencies["libs/lcms2"] = None self.runtimeDependencies["libs/freetype"] = None self.runtimeDependencies["libs/openjpeg"] = None self.runtimeDependencies["libs/libpng"] = None self.runtimeDependencies["libs/tiff"] = None self.runtimeDependencies["libs/fontconfig"] = None def setTargets(self): self.svnTargets['master'] = 'git://git.ghostscript.com/ghostpdl.git' - for ver in ['9.19', '9.21']: - self.targets[ - ver] = "https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs%s/ghostscript-%s.tar.gz" % ( - ver.replace(".", ""), ver) - self.targetInstSrc[ver] = 'ghostscript-%s' % ver - self.targetDigestUrls[ver] = ([ - "https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs%s/SHA1SUMS" % ver.replace( - ".", "")], CraftHash.HashAlgorithm.SHA1) for ver in ['9.26']: ver2 = ver.replace(".", "") + self.patchToApply['9.26'] = [] self.targets[ver] = f"https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs{ver2}/ghostscript-{ver}.tar.xz" self.targetInstSrc[ver] = f"ghostscript-{ver}" self.targetDigestUrls[ver] = ([f"https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs{ver2}/SHA512SUMS" ], CraftHash.HashAlgorithm.SHA512) if CraftCore.compiler.isMinGW(): - self.patchToApply['9.19'] = [ - # ("mingw-build.patch", 1),# origin: https://github.com/Alexpux/MINGW-packages/tree/master/mingw-w64-ghostscript - # ("ghostscript-sys-zlib.patch", 1),# origin: https://github.com/Alexpux/MINGW-packages/tree/master/mingw-w64-ghostscript - ("ghostscript-9.18-20151217.diff", 1), - ("ghostscript-exports-fix.diff", 1), - ("libspectre.patch", 1) - # origin: https://github.com/Alexpux/MINGW-packages/tree/master/mingw-w64-ghostscript - ] - else: - self.patchToApply['9.19'] = [("ghostscript-exports-fix.diff", 1)] + self.patchToApply['9.26'] += [(".9.26", 1)] + if CraftCore.compiler.isMacOS: + self.patchToApply['9.26'] += [("mac.diff", 1)] self.patchLevel['9.19'] = 1 - self.patchToApply['9.26'] = [(".9.26", 1)] - self.patchLevel['9.26'] = 1 + self.patchLevel['9.26'] = 2 self.defaultTarget = '9.26' from Package.CMakePackageBase import * class PackageMSVC(CMakePackageBase): def __init__(self): CMakePackageBase.__init__(self) def configure(self): return True def make(self): self.enterSourceDir() extraArgs = [] if CraftCore.compiler.isX64(): extraArgs.append("WIN64=") # because ghostscript doesn't know about msvc2015, it guesses wrong on this. But, # because of where we are, rc /should/ be in the path, so we'll just use that. if CraftCore.compiler.isMSVC(): extraArgs.append("RCOMP=rc.exe") if CraftCore.compiler.isMSVC2017(): # work-around: https://bugs.ghostscript.com/show_bug.cgi?id=698426 vcInstallDir = os.environ['VCINSTALLDIR'].rstrip('\\') extraArgs+= ["MSVC_VERSION=15", f"DEVSTUDIO=\"{vcInstallDir}\""] utils.system(["nmake", "-f", "psi\\msvc.mak"] + extraArgs) return True def install(self): src = self.sourceDir() dst = self.imageDir() if not os.path.isdir(dst): os.mkdir(dst) if not os.path.isdir(os.path.join(dst, "bin")): os.mkdir(os.path.join(dst, "bin")) if not os.path.isdir(os.path.join(dst, "lib")): os.mkdir(os.path.join(dst, "lib")) if not os.path.isdir(os.path.join(dst, "include")): os.mkdir(os.path.join(dst, "include")) if not os.path.isdir(os.path.join(dst, "include", "ghostscript")): os.mkdir(os.path.join(dst, "include", "ghostscript")) if CraftCore.compiler.isX64(): _bit = "64" else: _bit = "32" utils.copyFile(os.path.join(src, "bin", "gsdll%s.dll" % _bit), os.path.join(dst, "bin"), False) utils.copyFile(os.path.join(src, "bin", "gsdll%s.lib" % _bit), os.path.join(dst, "lib"), False) utils.copyFile(os.path.join(src, "bin", "gswin%s.exe" % _bit), os.path.join(dst, "bin"), False) utils.copyFile(os.path.join(src, "bin", "gswin%sc.exe" % _bit), os.path.join(dst, "bin"), False) utils.copyFile(os.path.join(self.sourceDir(), "psi", "iapi.h"), os.path.join(self.imageDir(), "include", "ghostscript", "iapi.h"), False) utils.copyFile(os.path.join(self.sourceDir(), "psi", "ierrors.h"), os.path.join(self.imageDir(), "include", "ghostscript", "ierrors.h"), False) utils.copyFile(os.path.join(self.sourceDir(), "devices", "gdevdsp.h"), os.path.join(self.imageDir(), "include", "ghostscript", "gdevdsp.h"), False) utils.copyFile(os.path.join(self.sourceDir(), "base", "gserrors.h"), os.path.join(self.imageDir(), "include", "ghostscript", "gserrors.h"), False) utils.copyDir(os.path.join(self.sourceDir(), "lib"), os.path.join(self.imageDir(), "lib"), False) return True from Package.AutoToolsPackageBase import * class PackageMSys(AutoToolsPackageBase): def __init__(self): AutoToolsPackageBase.__init__(self) #self.subinfo.options.make.supportsMultijob = False - self.subinfo.options.configure.args += " --with-drivers=ALL --disable-cups --with-system-libtiff --with-jbig2dec --enable-openjpeg --enable-fontconfig --enable-freetype --disable-contrib --without-x" + self.subinfo.options.configure.args += " --with-drivers=ALL --disable-cups" \ + " --without-x --disable-contrib --enable-freetype" \ + " --with-jbig2dec --enable-openjpeg --disable-gtk --enable-fontconfig" + + if not CraftCore.compiler.isMacOS: + self.subinfo.options.configure.args += " --with-system-libtiff" + self.subinfo.options.make.args = "so all" self.subinfo.options.install.args = "install-so install" self.subinfo.options.useShadowBuild = False def unpack(self): if not AutoToolsPackageBase.unpack(self): return False - for d in ["freetype", "jpeg", "libpng", "lcms", "lcms2", "tiff", "zlib", "openjpeg"]: + forceSystemLibs = ["freetype", "jpeg", "libpng", "lcms", "lcms2", "zlib", "openjpeg"] + if not CraftCore.compiler.isMacOS: + forceSystemLibs += ["tiff"] + for d in forceSystemLibs: utils.rmtree(os.path.join(self.sourceDir(), d)) return True def install(self): if not super().install(): return False if CraftCore.compiler.isLinux: # only the sym links get installed... return utils.copyFile(f"{self.buildDir()}/sobin/libgs.so.9", f"{self.installDir()}/lib/libgs.so.9") - elif CraftCore.compiler.isMacOS: - # only the sym links get installed... - return utils.copyFile(f"{self.buildDir()}/sobin/libgs.dylib.9", f"{self.installDir()}/lib/libgs.dylib.9") return True if CraftCore.compiler.isGCCLike(): class Package(PackageMSys): pass else: class Package(PackageMSVC): pass diff --git a/libs/ghostscript/libspectre.patch b/libs/ghostscript/libspectre.patch deleted file mode 100644 index 18a19f60..00000000 --- a/libs/ghostscript/libspectre.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ghostscript-9.14-orig/psi/iapi.h 2014-03-26 13:53:47.000000000 +0100 -+++ ghostscript-9.14/psi/iapi.h 2014-08-09 13:56:25.245374500 +0200 -@@ -229,6 +229,7 @@ - int argc, char **argv); - - #ifdef __WIN32__ -+#include - GSDLLEXPORT int GSDLLAPI gsapi_init_with_argsA(void *instance, - int argc, char **argv); - diff --git a/libs/ghostscript/mac.diff b/libs/ghostscript/mac.diff new file mode 100644 index 00000000..473bd652 --- /dev/null +++ b/libs/ghostscript/mac.diff @@ -0,0 +1,43 @@ +diff --git i/base/unix-dll.mak w/base/unix-dll.mak +index f50c09c00adb..8855133b400c 100644 +--- i/base/unix-dll.mak ++++ w/base/unix-dll.mak +@@ -89,18 +89,33 @@ GPDL_SONAME_MAJOR_MINOR=$(GPDL_SONAME_BASE)$(GS_SOEXT)$(SO_LIB_VERSION_SEPARATOR + # similar linkers it must containt the trailing "=" + # LDFLAGS_SO=-shared -Wl,$(LD_SET_DT_SONAME)$(LDFLAGS_SO_PREFIX)$(GS_SONAME_MAJOR) + + + # MacOS X +-#GS_SOEXT=dylib +-#GS_SONAME=$(GS_SONAME_BASE).$(GS_SOEXT) +-#GS_SONAME_MAJOR=$(GS_SONAME_BASE).$(GS_VERSION_MAJOR).$(GS_SOEXT) +-#GS_SONAME_MAJOR_MINOR=$(GS_SONAME_BASE).$(GS_VERSION_MAJOR).$(GS_VERSION_MINOR).$(GS_SOEXT) ++GS_SOEXT=dylib ++GS_SONAME=$(GS_SONAME_BASE).$(GS_SOEXT) ++GS_SONAME_MAJOR=$(GS_SONAME_BASE).$(GS_VERSION_MAJOR).$(GS_SOEXT) ++GS_SONAME_MAJOR_MINOR=$(GS_SONAME_BASE).$(GS_VERSION_MAJOR).$(GS_VERSION_MINOR).$(GS_SOEXT) + #LDFLAGS_SO=-dynamiclib -flat_namespace +-#LDFLAGS_SO_MAC=-dynamiclib -install_name $(GS_SONAME_MAJOR_MINOR) ++GS_LDFLAGS_SO=-dynamiclib -install_name $(GS_SONAME_MAJOR_MINOR) + #LDFLAGS_SO=-dynamiclib -install_name $(FRAMEWORK_NAME) + ++PCL_SONAME=$(PCL_SONAME_BASE).$(GS_SOEXT) ++PCL_SONAME_MAJOR=$(PCL_SONAME_BASE).$(GS_VERSION_MAJOR).$(GS_SOEXT) ++PCL_SONAME_MAJOR_MINOR=$(PCL_SONAME_BASE).$(GS_VERSION_MAJOR).$(GS_VERSION_MINOR).$(GS_SOEXT) ++PCL_LDFLAGS_SO=-dynamiclib -install_name $(PCL_SONAME_MAJOR_MINOR) ++ ++XPS_SONAME=$(XPS_SONAME_BASE).$(GS_SOEXT) ++XPS_SONAME_MAJOR=$(XPS_SONAME_BASE).$(GS_VERSION_MAJOR).$(GS_SOEXT) ++XPS_SONAME_MAJOR_MINOR=$(XPS_SONAME_BASE).$(GS_VERSION_MAJOR).$(GS_VERSION_MINOR).$(GS_SOEXT) ++XPS_LDFLAGS_SO=-dynamiclib -install_name $(XPS_SONAME_MAJOR_MINOR) ++ ++GPDL_SONAME=$(GPDL_SONAME_BASE).$(GS_SOEXT) ++GPDL_SONAME_MAJOR=$(GPDL_SONAME_BASE).$(GS_VERSION_MAJOR).$(GS_SOEXT) ++GPDL_SONAME_MAJOR_MINOR=$(GPDL_SONAME_BASE).$(GS_VERSION_MAJOR).$(GS_VERSION_MINOR).$(GS_SOEXT) ++GPDL_LDFLAGS_SO=-dynamiclib -install_name $(GPDL_SONAME_MAJOR_MINOR) ++ + GS_SO=$(BINDIR)/$(GS_SONAME) + GS_SO_MAJOR=$(BINDIR)/$(GS_SONAME_MAJOR) + GS_SO_MAJOR_MINOR=$(BINDIR)/$(GS_SONAME_MAJOR_MINOR) + + PCL_SO=$(BINDIR)/$(PCL_SONAME) diff --git a/libs/ghostscript/mingw-build.patch b/libs/ghostscript/mingw-build.patch index 94b1827a..107e4066 100644 --- a/libs/ghostscript/mingw-build.patch +++ b/libs/ghostscript/mingw-build.patch @@ -1,616 +1,616 @@ -diff -Naur ghostscript-9.10-orig/base/gp_mswin.c ghostscript-9.10/base/gp_mswin.c +iff -Naur ghostscript-9.10-orig/base/gp_mswin.c ghostscript-9.10/base/gp_mswin.c --- ghostscript-9.10-orig/base/gp_mswin.c 2013-08-30 14:37:28.000000000 +0400 +++ ghostscript-9.10/base/gp_mswin.c 2014-01-22 20:16:23.009800000 +0400 @@ -866,7 +866,7 @@ /* ------------------------- _snprintf -----------------------------*/ -#if defined(_MSC_VER) && _MSC_VER>=1900 /* VS 2014 and later have (finally) snprintf */ +#if (defined(_MSC_VER) && _MSC_VER>=1900) || defined(__MINGW64_VERSION_MAJOR) /* VS 2014 and later have (finally) snprintf */ # define STDC99 #else /* Microsoft Visual C++ 2005 doesn't properly define snprintf, diff -Naur ghostscript-9.10-orig/base/gp_mswin.h ghostscript-9.10/base/gp_mswin.h --- ghostscript-9.10-orig/base/gp_mswin.h 2013-08-30 14:37:28.000000000 +0400 +++ ghostscript-9.10/base/gp_mswin.h 2014-01-22 17:21:46.232600000 +0400 @@ -56,4 +56,13 @@ #endif /* !defined(RC_INVOKED) */ +// in gp_mswin.c, mswin_popen is called +// before it is implemented, so we must +// provide a prototype (at least with GCC) to +// avoid implicit definition with the wrong return type + +#ifdef __GNUC__ +FILE *mswin_popen(const char *cmd, const char *mode); +#endif + #endif /* gp_mswin_INCLUDED */ diff -Naur ghostscript-9.10-orig/base/gs.mak ghostscript-9.10/base/gs.mak --- ghostscript-9.10-orig/base/gs.mak 2013-08-30 14:37:28.000000000 +0400 +++ ghostscript-9.10/base/gs.mak 2014-01-22 17:21:46.248200000 +0400 @@ -440,6 +440,7 @@ # save our set of makefile variables that are defined in every build (paths, etc.) $(gconfigd_h) : $(ECHOGS_XE) $(GS_MAK) $(TOP_MAKEFILES) $(GLSRCDIR)$(D)version.mak $(EXP)$(ECHOGS_XE) -w $(gconfigd_h) -x 23 define -s -u GS_LIB_DEFAULT -x 2022 $(GS_LIB_DEFAULT) -x 22 + $(MINGW_FONTPATH_PATCH_OR_EMPTY_COMMAND) $(EXP)$(ECHOGS_XE) -a $(gconfigd_h) -x 23 define -s -u GS_DEV_DEFAULT -x 2022 $(GS_DEV_DEFAULT) -x 22 $(EXP)$(ECHOGS_XE) -a $(gconfigd_h) -x 23 define -s -u GS_CACHE_DIR -x 2022 $(GS_CACHE_DIR) -x 22 $(EXP)$(ECHOGS_XE) -a $(gconfigd_h) -x 23 define -s -u SEARCH_HERE_FIRST -s $(SEARCH_HERE_FIRST) diff -Naur ghostscript-9.10-orig/base/lib.mak ghostscript-9.10/base/lib.mak --- ghostscript-9.10-orig/base/lib.mak 2013-08-30 14:37:28.000000000 +0400 +++ ghostscript-9.10/base/lib.mak 2014-01-23 06:33:46.689000000 +0400 @@ -41,13 +41,13 @@ # We can't use $(CC_) for GLLCMSCC becuase that includes /Za on # msvc builds, and lcms configures itself to depend on msvc extensions # (inline asm, including windows.h) when compiled under msvc. -GLLCMSCC=$(CC) $(LCMS_CFLAGS) $(CFLAGS) $(I_)$(GLI_) $(II)$(LCMSSRCDIR)$(D)include$(_I) $(GLF_) +GLLCMSCC=$(CC) $(LCMS_CFLAGS) $(CFLAGS) $(I_)$(GLI_) $(GLF_) lcms_h=$(LCMSSRCDIR)$(D)include$(D)lcms.h icc34_h=$(GLSRC)icc34.h # We can't use $(CC_) for GLLCMS2CC becuase that includes /Za on # msvc builds, and lcms configures itself to depend on msvc extensions # (inline asm, including windows.h) when compiled under msvc. -GLLCMS2CC=$(CC) $(LCMS2_CFLAGS) $(CFLAGS) $(I_)$(GLI_) $(II)$(LCMS2SRCDIR)$(D)include$(_I) $(GLF_) +GLLCMS2CC=$(CC) $(LCMS2_CFLAGS) $(CFLAGS) $(I_)$(GLI_) $(GLF_) lcms2_h=$(LCMS2SRCDIR)$(D)include$(D)lcms2.h lcms2_plugin_h=$(LCMS2SRCDIR)$(D)include$(D)lcms2_plugin.h diff -Naur ghostscript-9.10-orig/base/mingw-fp.sh ghostscript-9.10/base/mingw-fp.sh --- ghostscript-9.10-orig/base/mingw-fp.sh 1970-01-01 03:00:00.000000000 +0300 +++ ghostscript-9.10/base/mingw-fp.sh 2014-01-22 22:30:58.082800000 +0400 @@ -0,0 +1 @@ +sed -i -e 's?\\?/?g' $1 diff -Naur ghostscript-9.10-orig/base/mingw-fs.mak ghostscript-9.10/base/mingw-fs.mak --- ghostscript-9.10-orig/base/mingw-fs.mak 1970-01-01 03:00:00.000000000 +0300 +++ ghostscript-9.10/base/mingw-fs.mak 2014-01-22 17:21:46.248200000 +0400 @@ -0,0 +1,34 @@ +# MSys/MinGW file- and operating-system section +# adapted from winplat.mak + +# Define the name of this makefile. + +MINGW_FS_MAK=$(GLSRC)mingw-fs.mak + +# Define generic Windows-specific modules. + +mingw-fs_=$(GLOBJ)gp_ntfs.$(OBJ) $(GLOBJ)gp_win32.$(OBJ) +$(GLD)mingw-fs.dev : $(MINGW_FS_MAK) $(ECHOGS_XE) $(mingw-fs_) + $(SETMOD) $(GLD)mingw-fs $(mingw-fs_) + +$(GLOBJ)gp_ntfs.$(OBJ): $(GLSRC)gp_ntfs.c $(AK)\ + $(dos__h) $(memory__h) $(stdio__h) $(string__h) $(windows__h)\ + $(gp_h) $(gpmisc_h) $(gsmemory_h) $(gsstruct_h) $(gstypes_h) $(gsutil_h) + $(GLCC) $(GLO_)gp_ntfs.$(OBJ) $(C_) $(GLSRC)gp_ntfs.c + +$(GLOBJ)gp_win32.$(OBJ): $(GLSRC)gp_win32.c $(AK)\ + $(dos__h) $(malloc__h) $(stdio__h) $(string__h) $(windows__h)\ + $(gp_h) $(gsmemory_h) $(gstypes_h) + $(GLCC) $(GLO_)gp_win32.$(OBJ) $(C_) $(GLSRC)gp_win32.c + +# Define the Windows thread / synchronization module. + +winsync_=$(GLOBJ)gp_wsync.$(OBJ) +$(GLD)winsync.dev : $(MINGW_FS_MAK) $(ECHOGS_XE) $(winsync_) + $(SETMOD) $(GLD)winsync $(winsync_) + $(ADDMOD) $(GLD)winsync -replace $(GLD)nosync + +$(GLOBJ)gp_wsync.$(OBJ): $(GLSRC)gp_wsync.c $(AK)\ + $(dos__h) $(malloc__h) $(stdio__h) $(string__h) $(windows__h)\ + $(gp_h) $(gsmemory_h) $(gstypes_h) + $(GLCC) $(GLO_)gp_wsync.$(OBJ) $(C_) $(GLSRC)gp_wsync.c diff -Naur ghostscript-9.10-orig/base/mingwlib.mak ghostscript-9.10/base/mingwlib.mak --- ghostscript-9.10-orig/base/mingwlib.mak 1970-01-01 03:00:00.000000000 +0300 +++ ghostscript-9.10/base/mingwlib.mak 2014-01-22 17:21:46.248200000 +0400 @@ -0,0 +1,76 @@ +# Common makefile section for MSys/MinGW +# adapted from winlib.mak + +# Define the files to be removed by `make clean'. +# nmake expands macros when encountered, not when used, +# so this must precede the !include statements. + +BEGINFILES=$(GLGENDIR)\ccf32.tr\ + $(GLOBJDIR)\*.res $(GLOBJDIR)\*.ico\ + $(BINDIR)\$(GSDLL).dll $(BINDIR)\$(GSCONSOLE).exe\ + $(BINDIR)\setupgs.exe $(BINDIR)\uninstgs.exe\ + $(GLOBJDIR)\cups\*.h\ + $(BEGINFILES2) + +# -------------------------------- Library -------------------------------- # + +# The MSys/MinGW Win32 platform + +mingw32__=$(GLOBJ)gp_mswin.$(OBJ) $(GLOBJ)gp_wgetv.$(OBJ) $(GLOBJ)gp_wpapr.$(OBJ) \ + $(GLOBJ)gp_stdia.$(OBJ) $(GLOBJ)gp_wutf8.$(OBJ) +mingw32_inc=$(GLD)nosync.dev $(GLD)mingw-fs.dev + +$(GLGEN)mingw32_.dev: $(mingw32__) $(ECHOGS_XE) $(mingw32_inc) + $(SETMOD) $(GLGEN)mingw32_ $(mingw32__) + $(ADDMOD) $(GLGEN)mingw32_ -include $(mingw32_inc) + +$(GLOBJ)gp_mswin.$(OBJ): $(GLSRC)gp_mswin.c $(AK) $(gp_mswin_h) \ + $(ctype__h) $(dos__h) $(malloc__h) $(memory__h) $(pipe__h) \ + $(stdio__h) $(string__h) $(windows__h) $(winspool_h)\ + $(gx_h) $(gp_h) $(gpcheck_h) $(gpmisc_h) $(gserrors_h) $(gsexit_h) + $(GLCC) $(GLO_)gp_mswin.$(OBJ) $(C_) $(GLSRC)gp_mswin.c + +$(GLOBJ)gp_wutf8.$(OBJ): $(GLSRC)gp_wutf8.c $(windows__h) + $(GLCC) $(GLO_)gp_wutf8.$(OBJ) $(C_) $(GLSRC)gp_wutf8.c + +$(GLOBJ)gp_wgetv.$(OBJ): $(GLSRC)gp_wgetv.c $(AK) $(gscdefs_h) + $(GLCC) $(GLO_)gp_wgetv.$(OBJ) $(C_) $(GLSRC)gp_wgetv.c + +$(GLOBJ)gp_wpapr.$(OBJ): $(GLSRC)gp_wpapr.c $(AK) $(gp_h) + $(GLCC) $(GLO_)gp_wpapr.$(OBJ) $(C_) $(GLSRC)gp_wpapr.c + +# Define MS-Windows handles (file system) as a separable feature. + +mshandle_=$(GLOBJ)gp_mshdl.$(OBJ) +$(GLD)mshandle.dev: $(ECHOGS_XE) $(mshandle_) + $(SETMOD) $(GLD)mshandle $(mshandle_) + $(ADDMOD) $(GLD)mshandle -iodev handle + +$(GLOBJ)gp_mshdl.$(OBJ): $(GLSRC)gp_mshdl.c $(AK)\ + $(ctype__h) $(errno__h) $(stdio__h) $(string__h)\ + $(gsmemory_h) $(gstypes_h) $(gxiodev_h) $(gserrors_h) + $(GLCC) $(GLO_)gp_mshdl.$(OBJ) $(C_) $(GLSRC)gp_mshdl.c + +# Define MS-Windows printer (file system) as a separable feature. + +msprinter_=$(GLOBJ)gp_msprn.$(OBJ) +$(GLD)msprinter.dev: $(ECHOGS_XE) $(msprinter_) + $(SETMOD) $(GLD)msprinter $(msprinter_) + $(ADDMOD) $(GLD)msprinter -iodev printer + +$(GLOBJ)gp_msprn.$(OBJ): $(GLSRC)gp_msprn.c $(AK)\ + $(ctype__h) $(errno__h) $(stdio__h) $(string__h)\ + $(gsmemory_h) $(gstypes_h) $(gxiodev_h) + $(GLCC) $(GLO_)gp_msprn.$(OBJ) $(C_) $(GLSRC)gp_msprn.c + +# Define MS-Windows polling as a separable feature +# because it is not needed by the gslib. +mspoll_=$(GLOBJ)gp_mspol.$(OBJ) +$(GLD)mspoll.dev: $(ECHOGS_XE) $(mspoll_) + $(SETMOD) $(GLD)mspoll $(mspoll_) + +$(GLOBJ)gp_mspol.$(OBJ): $(GLSRC)gp_mspol.c $(AK)\ + $(gx_h) $(gp_h) $(gpcheck_h) + $(GLCC) $(GLO_)gp_mspol.$(OBJ) $(C_) $(GLSRC)gp_mspol.c + +# end of mingwlib.mak diff -Naur ghostscript-9.10-orig/base/time_.h ghostscript-9.10/base/time_.h --- ghostscript-9.10-orig/base/time_.h 2013-08-30 14:37:28.000000000 +0400 +++ ghostscript-9.10/base/time_.h 2014-01-22 22:04:50.786200000 +0400 @@ -78,7 +78,7 @@ #endif /* Some System V environments, and Posix environments, need . */ -#if defined(HAVE_SYS_TIMES_H) && HAVE_SYS_TIMES_H == 1 +#if defined(HAVE_SYS_TIMES_H) && HAVE_SYS_TIMES_H == 1 && !defined(__MINGW32__) # include # define use_times_for_usertime 1 /* Posix 1003.1b-1993 section 4.8.1.5 says that diff -Naur ghostscript-9.10-orig/base/unix-aux.mak ghostscript-9.10/base/unix-aux.mak --- ghostscript-9.10-orig/base/unix-aux.mak 2013-08-30 14:37:28.000000000 +0400 +++ ghostscript-9.10/base/unix-aux.mak 2014-01-22 20:08:25.945400000 +0400 @@ -66,6 +66,13 @@ $(MAKEDIRS) $(GLCC) $(GLO_)gp_sysv.$(OBJ) $(C_) $(GLSRC)gp_sysv.c +# the MINGW platform / build environment, joining unix for the ride +mingw__=$(GLOBJ)gp_wgetv.$(OBJ) $(GLOBJ)gp_wpapr.$(OBJ) $(GLOBJ)gp_win32.$(OBJ) $(GLOBJ)gp_mswin.$(OBJ) $(GLOBJ)gp_ntfs.$(OBJ) $(GLOBJ)gp_stdia.$(OBJ) $(GLOBJ)gp_wutf8.$(OBJ) +$(GLGEN)mingw_.dev: $(mingw__) $(GLD)nosync.dev $(GLD)smd5.dev + $(SETMOD) $(GLGEN)mingw_ $(mingw__) -include $(GLD)nosync + $(ADDMOD) $(GLGEN)mingw_ -include $(GLD)smd5 + + # -------------------------- Auxiliary programs --------------------------- # $(ECHOGS_XE): $(GLSRC)echogs.c $(AK) $(stdpre_h) $(MAKEDIRS) @@ -88,18 +95,31 @@ # To get GS to use the system zlib, you remove/hide the gs/zlib directory # which means that the mkromfs build can't find the zlib source it needs. # So it's split into two targets, one using the zlib source directly..... -MKROMFS_OBJS_0=$(MKROMFS_ZLIB_OBJS) $(AUX)gpmisc.$(OBJ) $(AUX)gp_getnv.$(OBJ) \ - $(AUX)gscdefs.$(OBJ) $(AUX)gp_unix.$(OBJ) $(AUX)gp_unifs.$(OBJ) $(AUX)gp_unifn.$(OBJ) \ - $(AUX)gp_stdia.$(OBJ) $(AUX)gsutil.$(OBJ) $(AUX)memento.$(OBJ) +ifeq ($(MINGW_BUILD), 1) + MKROMFS_OBJS_0=$(MKROMFS_ZLIB_OBJS) $(AUX)gpmisc.$(OBJ) $(AUX)gp_getnv.$(OBJ) \ + $(AUX)gscdefs.$(OBJ) $(AUX)gp_ntfs.$(OBJ) $(AUX)gp_mswin.$(OBJ) \ + $(AUX)gp_stdia.$(OBJ) $(AUX)gsutil.$(OBJ) $(AUX)memento.$(OBJ) +else + MKROMFS_OBJS_0=$(MKROMFS_ZLIB_OBJS) $(AUX)gpmisc.$(OBJ) $(AUX)gp_getnv.$(OBJ) \ + $(AUX)gscdefs.$(OBJ) $(AUX)gp_unix.$(OBJ) $(AUX)gp_unifs.$(OBJ) $(AUX)gp_unifn.$(OBJ) \ + $(AUX)gp_stdia.$(OBJ) $(AUX)gsutil.$(OBJ) $(AUX)memento.$(OBJ) +endif $(MKROMFS_XE)_0: $(GLSRC)mkromfs.c $(MKROMFS_COMMON_DEPS) $(MKROMFS_OBJS_0) $(MAKEDIRS) $(CCAUX_) $(GENOPT) $(CFLAGS) $(I_)$(GLSRCDIR)$(_I) $(I_)$(GLOBJ)$(_I) $(I_)$(ZSRCDIR)$(_I) $(GLSRC)mkromfs.c $(O_)$(MKROMFS_XE)_0 $(MKROMFS_OBJS_0) $(AUXEXTRALIBS) # .... and one using the zlib library linked via the command line -MKROMFS_OBJS_1=$(AUX)gscdefs.$(OBJ) \ - $(AUX)gpmisc.$(OBJ) $(AUX)gp_getnv.$(OBJ) \ - $(AUX)gp_unix.$(OBJ) $(AUX)gp_unifs.$(OBJ) $(AUX)gp_unifn.$(OBJ) \ - $(AUX)gp_stdia.$(OBJ) $(AUX)gsutil.$(OBJ) +# (here two, MINGW has a different set of runtimeDependencies, +# most notably gp_ntfs and gp_wutf8) +ifeq ($(MINGW_BUILD), 1) + MKROMFS_OBJS_1=$(GLOBJ)gp_ntfs.$(OBJ) $(GLOBJ)gp_wutf8.$(OBJ) \ + $(GLOBJ)gpmisc.$(OBJ) $(GLOBJ)gp_wgetv.$(OBJ) $(GLOBJ)gscdefs.$(OBJ) +else + MKROMFS_OBJS_1=$(AUX)gscdefs.$(OBJ) \ + $(AUX)gpmisc.$(OBJ) $(AUX)gp_getnv.$(OBJ) \ + $(AUX)gp_unix.$(OBJ) $(AUX)gp_unifs.$(OBJ) $(AUX)gp_unifn.$(OBJ) \ + $(AUX)gp_stdia.$(OBJ) $(AUX)gsutil.$(OBJ) +endif $(MKROMFS_XE)_1: $(GLSRC)mkromfs.c $(MKROMFS_COMMON_DEPS) $(MKROMFS_OBJS_1) $(MAKEDIRS) $(CCAUX_) $(GENOPT) $(CFLAGS) $(I_)$(GLSRCDIR)$(_I) $(I_)$(GLOBJ)$(_I) $(I_)$(ZSRCDIR)$(_I) $(GLSRC)mkromfs.c $(O_)$(MKROMFS_XE)_1 $(MKROMFS_OBJS_1) $(AUXEXTRALIBS) diff -Naur ghostscript-9.10-orig/base/unix-dll.mak ghostscript-9.10/base/unix-dll.mak --- ghostscript-9.10-orig/base/unix-dll.mak 2013-08-30 14:37:28.000000000 +0400 +++ ghostscript-9.10/base/unix-dll.mak 2014-01-22 23:27:18.357000000 +0400 @@ -33,17 +33,38 @@ # Shared object names # simple loader (no support for display device) -GSSOC_XENAME=$(GS_SO_BASE)c$(XE) +ifeq ($(MINGW_WITH_WINLIB_NAMES), 1) + GSSOC_XENAME=gswin$(MINGW_PLATFORM_BITS)c$(XE) +else + GSSOC_XENAME=$(GS_SO_BASE)c$(XE) +endif + GSSOC_XE=$(BINDIR)/$(GSSOC_XENAME) GSSOC=$(BINDIR)/$(GSSOC_XENAME) # loader suporting display device using Gtk+ -GSSOX_XENAME=$(GS_SO_BASE)x$(XE) +ifeq ($(MINGW_WITH_WINLIB_NAMES), 1) + GSSOX_XENAME=gswin$(MINGW_PLATFORM_BITS)$(XE) +else + GSSOX_XENAME=$(GS_SO_BASE)x$(XE) +endif + GSSOX_XE=$(BINDIR)/$(GSSOX_XENAME) GSSOX=$(BINDIR)/$(GSSOX_XENAME) -# shared library -GS_SONAME_BASE=lib$(GS_SO_BASE) +# shared library: handle unix and mingw library names +ifeq ($(MINGW_BUILD), 1) + ifeq ($(MINGW_WITH_WINLIB_NAMES), 1) + GS_SONAME_BASE=gsdll$(MINGW_PLATFORM_BITS) + GS_SONAME_LINK=$(GS_SONAME_BASE) + else + GS_SONAME_BASE=lib$(GS_SO_BASE) + GS_SONAME_LINK=lib$(GS_SO_BASE) + endif +else + GS_SONAME_BASE=lib$(GS_SO_BASE) + GS_SONAME_LINK=$(GS_SO_BASE) +endif # GNU/Linux GS_SOEXT=$(SO_LIB_EXT) @@ -101,30 +122,30 @@ # Create symbolic links to the Ghostscript interpreter library -$(GS_SO): $(GS_SO_MAJOR) +$(GS_SO): $(GS_SO_MAJOR_MINOR) $(RM_) $(GS_SO) - ln -s $(GS_SONAME_MAJOR_MINOR) $(GS_SO) + ln -s $(GS_SONAME_MAJOR) $(GS_SO) -$(GS_SO_MAJOR): $(GS_SO_MAJOR_MINOR) - $(RM_) $(GS_SO_MAJOR) - ln -s $(GS_SONAME_MAJOR_MINOR) $(GS_SO_MAJOR) +$(GS_SO_MAJOR_MINOR): $(GS_SO_MAJOR) + $(RM_) $(GS_SO_MAJOR_MINOR) + ln -s $(GS_SONAME_MAJOR) $(GS_SO_MAJOR_MINOR) so-links-subtarget: $(GS_SO) $(NO_OP) # Build the small Ghostscript loaders, with Gtk+ and without $(GSSOC_XE): so-links-subtarget $(PSSRC)$(SOC_LOADER) - $(GLCC) -g -o $(GSSOC_XE) $(PSSRC)dxmainc.c \ - -L$(BINDIR) -l$(GS_SO_BASE) + $(GLCC) -g -o $(GSSOC_XE) $(PSSRC)$(SOC_LOADER_PLAIN) \ + -L$(BINDIR) -l$(GS_SONAME_LINK) $(GSSOX_XE): so-links-subtarget $(PSSRC)$(SOC_LOADER) $(GLCC) -g $(SOC_CFLAGS) -o $(GSSOX_XE) $(PSSRC)$(SOC_LOADER) \ - -L$(BINDIR) -l$(GS_SO_BASE) $(SOC_LIBS) + -L$(BINDIR) -l$(GS_SONAME_LINK) $(SOC_LIBS) # ------------------------- Recursive make targets ------------------------- # SODEFS=\ - GS_XE=$(BINDIR)/$(GS_SONAME_MAJOR_MINOR)\ + GS_XE=$(BINDIR)/$(GS_SONAME_MAJOR)\ DISPLAY_DEV=$(DD)display.dev\ STDIO_IMPLEMENTATION=c\ BUILDDIRPREFIX=$(BUILDDIRPREFIX) @@ -158,11 +179,17 @@ -mkdir -p $(DESTDIR)$(gsincludedir) $(INSTALL_PROGRAM) $(GSSOC) $(DESTDIR)$(bindir)/$(GSSOC_XENAME) $(INSTALL_PROGRAM) $(GSSOX) $(DESTDIR)$(bindir)/$(GSSOX_XENAME) - $(INSTALL_PROGRAM) $(BINDIR)/$(GS_SONAME_MAJOR_MINOR) $(DESTDIR)$(libdir)/$(GS_SONAME_MAJOR_MINOR) - $(RM_) $(DESTDIR)$(libdir)/$(GS_SONAME) - ln -s $(GS_SONAME_MAJOR_MINOR) $(DESTDIR)$(libdir)/$(GS_SONAME) - $(RM_) $(DESTDIR)$(libdir)/$(GS_SONAME_MAJOR) - ln -s $(GS_SONAME_MAJOR_MINOR) $(DESTDIR)$(libdir)/$(GS_SONAME_MAJOR) + @if test "$(MINGW_BUILD)" = "1" ; then \ + $(INSTALL_PROGRAM) $(BINDIR)/$(GS_SONAME_MAJOR) $(DESTDIR)$(bindir)/$(GS_SONAME_MAJOR) ; \ + $(INSTALL_PROGRAM) $(BINDIR)/$(GS_SONAME_LINK).dll.a $(DESTDIR)$(libdir)/$(GS_SONAME_LINK).dll.a ; \ + else \ + $(INSTALL_PROGRAM) $(BINDIR)/$(GS_SONAME_MAJOR) $(DESTDIR)$(libdir)/$(GS_SONAME_MAJOR) ; \ + $(RM_) $(DESTDIR)$(libdir)/$(GS_SONAME) ; \ + ln -s $(GS_SONAME_MAJOR) $(DESTDIR)$(libdir)/$(GS_SONAME) ; \ + $(RM_) $(DESTDIR)$(libdir)/$(GS_SONAME_MAJOR) ; \ + ln -s $(GS_SONAME_MAJOR) $(DESTDIR)$(libdir)/$(GS_SONAME_MAJOR_MINOR) ; \ + fi + $(INSTALL_DATA) $(GLSRCDIR)/gserrors.h $(DESTDIR)$(gsincludedir)gserrors.h $(INSTALL_DATA) $(PSSRC)iapi.h $(DESTDIR)$(gsincludedir)iapi.h $(INSTALL_DATA) $(PSSRC)ierrors.h $(DESTDIR)$(gsincludedir)ierrors.h $(INSTALL_DATA) $(DEVSRC)gdevdsp.h $(DESTDIR)$(gsincludedir)gdevdsp.h diff -Naur ghostscript-9.10-orig/base/unix-gcc.mak ghostscript-9.10/base/unix-gcc.mak --- ghostscript-9.10-orig/base/unix-gcc.mak 2013-08-30 14:37:28.000000000 +0400 +++ ghostscript-9.10/base/unix-gcc.mak 2014-01-22 22:02:03.959800000 +0400 @@ -57,7 +57,7 @@ INSTALL_DATA = $(INSTALL) -m 644 INSTALL_SHARED = -prefix = /usr/local +prefix = /usr exec_prefix = ${prefix} bindir = ${exec_prefix}/bin scriptdir = $(bindir) @@ -71,7 +71,7 @@ gssharedir = $(libdir)/ghostscript/$(GS_DOT_VERSION) gsincludedir = $(includedir)/ghostscript/ -docdir=$(gsdatadir)/doc +docdir=$(gsdatadir)/doc/ghostscript-$(GS_DOT_VERSION) exdir=$(gsdatadir)/examples GS_DOCDIR=$(docdir) diff -Naur ghostscript-9.10-orig/base/unixhead.mak ghostscript-9.10/base/unixhead.mak --- ghostscript-9.10-orig/base/unixhead.mak 2013-08-30 14:37:28.000000000 +0400 +++ ghostscript-9.10/base/unixhead.mak 2014-01-22 20:26:04.888400000 +0400 @@ -22,7 +22,12 @@ # Define the platform name. For a "stock" System V platform, # use sysv_ instead of unix_. -GSPLATFORM=unix_ +# select platform: unix or mingw +ifeq ($(MINGW_BUILD), 1) + GSPLATFORM=mingw_ +else + GSPLATFORM=unix_ +endif # Define the syntax for command, object, and executable files. @@ -65,3 +70,9 @@ # Define the compilation rules and flags. BEGINFILES= + +ifeq ($(MINGW_BUILD), 1) + MINGW_FONTPATH_PATCH_OR_EMPTY_COMMAND=$(SH) $(GLSRCDIR)/mingw-fp.sh $(gconfigd_h) +else + MINGW_FONTPATH_PATCH_OR_EMPTY_COMMAND= +endif diff -Naur ghostscript-9.10-orig/configure.ac ghostscript-9.10/configure.ac --- ghostscript-9.10-orig/configure.ac 2013-08-30 14:37:29.000000000 +0400 +++ ghostscript-9.10/configure.ac 2014-01-22 19:17:58.671800000 +0400 @@ -180,6 +180,26 @@ CC_DBG_FLAGS_TO_TRY="-g -O0" fi ;; + MINGW*) + MINGW_BUILD=1 + MINGW_PLATFORM=`uname` + MINGW_XTLIBS="-lwinspool" + + # inner MINGW case statement: 32/64 bits + case $MINGW_PLATFORM in + MINGW32*) + MINGW_PLATFORM_BITS=32 + ;; + MINGW64*) + MINGW_PLATFORM_BITS=64 + ;; + esac + + AC_SUBST(MINGW_BUILD) + AC_SUBST(MINGW_PLATFORM) + AC_SUBST(MINGW_PLATFORM_BITS) + AC_SUBST(MINGW_XTLIBS) + ;; esac AC_SUBST(SET_DT_SONAME) @@ -1403,12 +1423,41 @@ AC_SUBST(SHARE_JPX) AC_SUBST(JPXDEVS) +dnl checks for MinGW shared object name and gdi must precede the gtk checks +dnl check whether MinGW should use the MSVC dll names +AC_ARG_WITH([winlib-names], AC_HELP_STRING([--with-winlib-names], + [MSys/MinGW only: dll and executable names should be gsdll32.dll (gsdll64.dll), gswin32.exe (gswin64.exe), and gswin32c.exe (gswin64c.exe)]), + [], [with_winlib_names=no]) +if test "x$with_winlib_names" = "xyes"; then + MINGW_WITH_WINLIB_NAMES=1 +fi + +dnl check whether MinGW should use the gdi-based (dwmain.c, dwmainc.c) front end +AC_ARG_WITH([gdi], AC_HELP_STRING([--with-gdi], + [MSys/MinGW only: use the gdi-based Shared Object loaders (dwmain.c & dwmainc.c; implies --with-winlib-names=yes): not yet implemented]), + [], [with_gdi=no]) +if test "x$with_gdi" = "xyes"; then + MINGW_WITH_WINLIB_NAMES=1 + MINGW_WITH_GDI=1 + # SOC_LOADER value will be set after the initial gtk test +fi + +AC_SUBST(MINGW_WITH_WINLIB_NAMES) +AC_SUBST(MINGW_WITH_GDI) + dnl check if we can/should build the gtk loader AC_ARG_ENABLE([gtk], AC_HELP_STRING([--disable-gtk], [Do not build the gtk loader])) SOC_CFLAGS="" SOC_LIBS="" -SOC_LOADER="" +SOC_LOADER="" # default may not be set before the gtk+-2.0 test +SOC_LOADER_PLAIN="" + +if test "x$with_gdi" = "xyes"; then + AC_MSG_WARN([the gdi front end under MSys/MinGW is not yet implemented]) + enable_gtk=yes # try to use gtk+ instead +fi + if test "x$enable_gtk" != "xno"; then # Try GTK+ 3.x first... if test "x$PKGCONFIG" != x; then @@ -1441,9 +1490,15 @@ SOC_LOADER="dxmainc.c" fi +dnl set default SOC_LOADER_PLAIN as necessary +if test "x$SOC_LOADER_PLAIN" = x; then + SOC_LOADER_PLAIN="dxmainc.c" +fi + AC_SUBST(SOC_CFLAGS) AC_SUBST(SOC_LIBS) AC_SUBST(SOC_LOADER) +AC_SUBST(SOC_LOADER_PLAIN) dnl look for omni implementation AC_ARG_WITH([omni], AC_HELP_STRING([--with-omni], @@ -1920,6 +1975,12 @@ DYNAMIC_LIBS="" SO_LIB_EXT=".so" ;; + MINGW*) + DYNAMIC_CFLAGS="-fPIC" + DYNAMIC_LDFLAGS="-fPIC -shared" + DYNAMIC_LIBS="" + DYNANIC_LIB_EXT="dll" + ;; esac AC_ARG_ENABLE([dynamic], AC_HELP_STRING([--enable-dynamic], @@ -1992,6 +2053,20 @@ fi dnl Fix "fontpath" variable... +if test $MINGW_BUILD = 1; then + # Add a reference to the Windows Fonts directory. + # This must take place priot to the test below, + # as it is also our way to avoid inclusion + # of the various unix font directories. + # Since gs uses here a colon as delimiter, + # we must refer to %windir% as /c/Windows + if test "x$fontpath" = "x"; then + fontpath="/c/Windows/Fonts" + else + fontpath="${fontpath}:/c/Windows/Fonts" + fi +fi + if test "x$fontpath" = "x"; then # These font directories are used by various Linux distributions... fontpath="$datadir/fonts/default/ghostscript" diff -Naur ghostscript-9.10-orig/Makefile.in ghostscript-9.10/Makefile.in --- ghostscript-9.10-orig/Makefile.in 2013-08-30 14:37:29.000000000 +0400 +++ ghostscript-9.10/Makefile.in 2014-01-22 22:30:09.450000000 +0400 @@ -38,6 +38,14 @@ PSOBJDIR=./$(BUILDDIRPREFIX)@OBJDIR_BSDMAKE_WORKAROUND@ CONTRIBDIR=@srcdir@/contrib +# ------ MINGW options ------ # + +MINGW_BUILD=@MINGW_BUILD@ +MINGW_PLATFORM=@MINGW_PLATFORM@ +MINGW_PLATFORM_BITS=@MINGW_PLATFORM_BITS@ +MINGW_WITH_WINLIB_NAMES=@MINGW_WITH_WINLIB_NAMES@ +MINGW_WITH_GDI=@MINGW_WITH_GDI@ + # Do not edit the next group of lines. include $(GLSRCDIR)/version.mak @@ -387,8 +404,8 @@ # Solaris may need -lnsl -lsocket -lposix4. # (Libraries required by individual drivers are handled automatically.) -EXTRALIBS=$(XTRALIBS) @LIBS@ @DYNAMIC_LIBS@ @FONTCONFIG_LIBS@ @FT_LIBS@ -AUXEXTRALIBS=$(XTRALIBS) @LIBS@ @DYNAMIC_LIBS@ @FONTCONFIG_LIBS@ @FT_LIBS@ @AUX_SHARED_ZLIB@ +EXTRALIBS=$(XTRALIBS) @LIBS@ @MINGW_XTLIBS@ @DYNAMIC_LIBS@ @FONTCONFIG_LIBS@ @FT_LIBS@ +AUXEXTRALIBS=$(XTRALIBS) @LIBS@ @MINGW_XTLIBS@ @DYNAMIC_LIBS@ @FONTCONFIG_LIBS@ @FT_LIBS@ @AUX_SHARED_ZLIB@ # Define the standard libraries to search at the end of linking. # Most platforms require -lpthread for the POSIX threads library; @@ -438,9 +455,10 @@ RM=rm -f # ------ Dynamic loader options ------- # -SOC_CFLAGS = @SOC_CFLAGS@ -SOC_LIBS = @SOC_LIBS@ -SOC_LOADER = @SOC_LOADER@ +SOC_CFLAGS = @SOC_CFLAGS@ +SOC_LIBS = @SOC_LIBS@ +SOC_LOADER = @SOC_LOADER@ +SOC_LOADER_PLAIN = @SOC_LOADER_PLAIN@ # on virtually every Unix-a-like system, this is "so", # but Apple just had to be different, so it's now set @@ -568,7 +586,17 @@ CCFLAGS=$(GENOPT) $(CAPOPT) $(CFLAGS) CC_=$(CC) $(CCFLAGS) -CCAUX_=$(CCAUX) $(CFLAGS) + +ifeq ($(MINGW_BUILD), 1) + # adding -lz to the compilation flags seems to be an error: + # if not always, then at least under MSys/MinGW, + # compiled against the system's zlib, + # and having no zlib sub-folder (see also: unixaux.mak) + CCAUX_=$(CCAUX) $(CFLAGS) +else + CCAUX_=$(CCAUX) $(CFLAGS) @AUX_SHARED_ZLIB@ +endif + CC_LEAF=$(CC_) # note gcc can't use -fomit-frame-pointer with -pg. CC_LEAF_PG=$(CC_) @@ -622,6 +650,12 @@ @CONTRIBINCLUDE@ @CUPSINCLUDE@ +# conditionally include the two .mak files that are only needed with a MINGW build +ifeq ($(MINGW_BUILD), 1) + include $(GLSRCDIR)/mingw-fs.mak + include $(GLSRCDIR)/mingwlib.mak +endif + # Clean up after the autotools scripts distclean : clean config-clean soclean pgclean debugclean mementoclean -$(RM_) -r $(BINDIR) $(GLOBJDIR) $(PSOBJDIR) $(AUXDIR) --- ghostscript-9.18/base/stat_.h.orig 2015-10-13 10:13:06.284676300 +0300 +++ ghostscript-9.18/base/stat_.h 2015-10-13 10:13:24.677192400 +0300 @@ -43,7 +43,7 @@ * Microsoft C uses _stat instead of stat, * for both the function name and the structure name. */ -#ifdef _MSC_VER +#if defined(_MSC_VER) || defined(__MINGW32__) # define stat _stat #define struct_stat struct _stat #else