diff --git a/libs/ghostscript/.9.26/001-mingw-build.patch b/libs/ghostscript/.9.26/001-mingw-build.patch new file mode 100644 index 00000000..50a21a2b --- /dev/null +++ b/libs/ghostscript/.9.26/001-mingw-build.patch @@ -0,0 +1,599 @@ +--- a/base/gp_mswin.c ++++ b/base/gp_mswin.c +@@ -989,7 +989,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, +--- a/base/gp_mswin.h ++++ b/base/gp_mswin.h +@@ -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 */ +--- a/base/gs.mak ++++ b/base/gs.mak +@@ -520,6 +520,7 @@ + # save our set of makefile variables that are defined in every build (paths, etc.) + $(gconfigd_h) : $(ECHOGS_XE) $(GS_MAK) $(GLSRCDIR)$(D)version.mak $(MAKEDIRS) + $(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) +--- a/base/lib.mak ++++ b/base/lib.mak +@@ -62,7 +62,7 @@ + # We can't use $(CC_) for GLLCMS2CC because 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 + +--- /dev/null ++++ b/base/mingw-fp.sh +@@ -0,0 +1 @@ ++sed -i -e 's?\\?/?g' $1 +--- /dev/null ++++ b/base/mingw-fs.mak +@@ -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 +--- /dev/null ++++ b/base/mingwlib.mak +@@ -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 +--- a/base/time_.h ++++ b/base/time_.h +@@ -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 +--- a/base/unix-aux.mak ++++ b/base/unix-aux.mak +@@ -69,6 +69,13 @@ + $(UNIX_AUX_MAK) $(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) $(GLOBJ)gp_nxpsprn.$(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) $(UNIX_AUX_MAK) $(MAKEDIRS) +@@ -91,18 +98,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) $(UNIX_AUX_MAK) $(MAKEDIRS) + $(CCAUX_) $(GENOPTAUX) $(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 dependencies, ++# 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) $(UNIX_AUX_MAK) $(MAKEDIRS) + $(CCAUX_) $(GENOPTAUX) $(I_)$(GLSRCDIR)$(_I) $(I_)$(GLOBJ)$(_I) $(I_)$(ZSRCDIR)$(_I) $(GLSRC)mkromfs.c $(O_)$(MKROMFS_XE)_1 $(MKROMFS_OBJS_1) $(AUXEXTRALIBS) +--- a/base/unix-dll.mak ++++ b/base/unix-dll.mak +@@ -35,7 +35,12 @@ + # 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) + +@@ -52,12 +52,28 @@ + GPDLSOC=$(BINDIR)/$(GPDLSOC_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 + PCL_SONAME_BASE=lib$(PCL_SO_BASE) + XPS_SONAME_BASE=lib$(XPS_SO_BASE) + GPDL_SONAME_BASE=lib$(GPDL_SO_BASE) +@@ -140,13 +140,13 @@ + + # Create symbolic links to the Ghostscript interpreter library + +-$(GS_SO): $(GS_SO_MAJOR) $(UNIX_DLL_MAK) $(MAKEDIRS) ++$(GS_SO): $(GS_SO_MAJOR_MINOR) $(UNIX_DLL_MAK) $(MAKEDIRS) + $(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) $(UNIX_DLL_MAK) $(MAKEDIRS) +- $(RM_) $(GS_SO_MAJOR) +- ln -s $(GS_SONAME_MAJOR_MINOR) $(GS_SO_MAJOR) ++$(GS_SO_MAJOR_MINOR): $(GS_SO_MAJOR) $(UNIX_DLL_MAK) $(MAKEDIRS) ++ $(RM_) $(GS_SO_MAJOR_MINOR) ++ ln -s $(GS_SONAME_MAJOR) $(GS_SO_MAJOR_MINOR) + + $(PCL_SO): $(PCL_SO_MAJOR) $(UNIX_DLL_MAK) $(MAKEDIRS) + $(RM_) $(PCL_SO) +@@ -212,12 +212,12 @@ + + # Build the small Ghostscript loaders, with Gtk+ and without + $(GSSOC_XE): gs-so-links-subtarget $(PSSRC)dxmainc.c $(UNIX_DLL_MAK) $(MAKEDIRS) +- $(GLCC) $(GLO_)dxmainc.$(OBJ) $(C_) $(PSSRC)dxmainc.c +- $(GLCC) -L$(BINDIR) $(LDFLAGS) $(O_) $(GSSOC_XE) $(GLOBJ)dxmainc.$(OBJ) -l$(GS_SO_BASE) ++ $(GLCC) $(GLO_)$(SOC_LOADER_PLAIN).$(OBJ) $(C_) $(PSSRC)$(SOC_LOADER_PLAIN).c ++ $(GLCC) -L$(BINDIR) $(LDFLAGS) $(O_) $(GSSOC_XE) $(GLOBJ)$(SOC_LOADER_PLAIN).$(OBJ) -l$(GS_SONAME_LINK) + + $(GSSOX_XE): gs-so-links-subtarget $(PSSRC)$(SOC_LOADER).c $(UNIX_DLL_MAK) $(MAKEDIRS) + $(GLCC) $(SOC_CFLAGS) $(GLO_)$(SOC_LOADER).$(OBJ) $(C_) $(PSSRC)$(SOC_LOADER).c +- $(GLCC) -L$(BINDIR) $(LDFLAGS) $(O_) $(GSSOX_XE) $(GLOBJ)$(SOC_LOADER).$(OBJ) -l$(GS_SO_BASE) $(SOC_LIBS) ++ $(GLCC) -L$(BINDIR) $(LDFLAGS) $(O_) $(GSSOX_XE) $(GLOBJ)$(SOC_LOADER).$(OBJ) -l$(GS_SONAME_LINK) $(SOC_LIBS) + + $(PCLSOC_XE): gpcl6-so-links-subtarget $(UNIX_DLL_MAK) $(PLOBJ)$(REALMAIN_SRC).$(OBJ) $(MAKEDIRS) + $(GLCC) -L$(BINDIR) $(LDFLAGS) $(O_) $(PCLSOC_XE) $(PLOBJ)$(REALMAIN_SRC).$(OBJ) -l$(PCL_SO_BASE) +@@ -222,7 +222,7 @@ + SODEFS=\ + GS_DOT_O= \ + REALMAIN_OBJ= \ +- GS_XE=$(BINDIR)/$(GS_SONAME_MAJOR_MINOR) \ ++ GS_XE=$(BINDIR)/$(GS_SONAME_MAJOR)\ + GPCL_XE=$(BINDIR)/$(PCL_SONAME_MAJOR_MINOR) \ + GXPS_XE=$(BINDIR)/$(XPS_SONAME_MAJOR_MINOR) \ + GPDL_XE=$(BINDIR)/$(GPDL_SONAME_MAJOR_MINOR) \ +@@ -313,11 +313,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) $(GLSRC)gserrors.h $(DESTDIR)$(gsincludedir)gserrors.h +--- a/base/unix-gcc.mak ++++ b/base/unix-gcc.mak +@@ -79,7 +79,7 @@ + INSTALL_DATA = $(INSTALL) -m 644 + INSTALL_SHARED = + +-prefix = /usr/local ++prefix = /usr + exec_prefix = ${prefix} + bindir = ${exec_prefix}/bin + scriptdir = $(bindir) +@@ -98,7 +98,7 @@ + gssharedir = ${exec_prefix}/lib/ghostscript/$(GS_DOT_VERSION) + gsincludedir = ${prefix}/include/ghostscript/ + +-docdir=$(gsdatadir)/doc ++docdir=$(gsdatadir)/doc/ghostscript-$(GS_DOT_VERSION) + exdir=$(gsdatadir)/examples + GS_DOCDIR=$(docdir) + +--- a/base/unixhead.mak ++++ b/base/unixhead.mak +@@ -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 +--- a/configure.ac +@@ -492,6 +492,27 @@ + *BSD) + OBJDIR_BSDMAKEWORKAOROUND="notobj" + ;; ++ MINGW*) ++ MINGW_BUILD=1 ++ MINGW_PLATFORM=`uname` ++ MINGW_XTLIBS="-lwinspool" ++ LIBS="$LIBS $MINGW_XTLIBS" ++ ++ # 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(OBJDIR_BSDMAKE_WORKAROUND) + AC_CHECK_HEADER([sys/window.h]) +@@ -1767,12 +1788,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 +@@ -1805,9 +1855,15 @@ + SOC_LOADER="dxmainc" + fi + ++dnl set default SOC_LOADER_PLAIN as necessary ++if test "x$SOC_LOADER_PLAIN" = x; then ++ SOC_LOADER_PLAIN="dxmainc" ++fi ++ + AC_SUBST(SOC_CFLAGS) + AC_SUBST(SOC_LIBS) + AC_SUBST(SOC_LOADER) ++AC_SUBST(SOC_LOADER_PLAIN) + + dnl optional X11 for display devices + AC_PATH_XTRA +@@ -2433,6 +2489,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" +@@ -2502,6 +2572,12 @@ + *sparc*) + GCFLAGS="$GCFLAGS -DGS_USE_MEMORY_HEADER_ID=0" + ;; ++ MINGW*) ++ DYNAMIC_CFLAGS="-fPIC" ++ DYNAMIC_LDFLAGS="-fPIC -shared" ++ DYNAMIC_LIBS="" ++ DYNANIC_LIB_EXT="dll" ++ ;; + esac + + dnl -------------------------------------------------- +--- a/Makefile.in ++++ b/Makefile.in +@@ -60,6 +60,14 @@ + + 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 +@@ -433,7 +441,7 @@ + # Solaris may need -lnsl -lsocket -lposix4. + # (Libraries required by individual drivers are handled automatically.) + +-EXTRALIBS=$(XTRALIBS) @LIBS@ @DYNAMIC_LIBS@ @FONTCONFIG_LIBS@ @FT_LIBS@ @JPX_AUTOCONF_LIBS@ @EXPAT_LIBS@ ++EXTRALIBS=$(XTRALIBS) @LIBS@ @MINGW_XTLIBS@ @DYNAMIC_LIBS@ @FONTCONFIG_LIBS@ @FT_LIBS@ @JPX_AUTOCONF_LIBS@ @EXPAT_LIBS@ + AUXEXTRALIBS=@AUXEXTRALIBS@ @AUX_SHARED_ZLIB@ + + # Define the standard libraries to search at the end of linking. +@@ -484,9 +492,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 +@@ -637,7 +646,16 @@ + CC_LEAF=$(CC_) + + CCFLAGSAUX=$(GENOPTAUX) $(CAPOPTAUX) $(CFLAGSAUX) +-CCAUX_=$(CCAUX) $(CCFLAGSAUX) ++ ++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) $(CCFLAGSAUX) ++else ++ CCAUX_=$(CCAUX) $(CCFLAGSAUX) @AUX_SHARED_ZLIB@ ++endif + + # note gcc can't use -fomit-frame-pointer with -pg. + CC_LEAF_PG=$(CC_) +@@ -707,6 +726,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) +--- a/base/stat_.h ++++ b/base/stat_.h +@@ -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 __stat64 + # define struct_stat struct __stat64 + # define fstat _fstat64 diff --git a/libs/ghostscript/.9.26/002-ghostscript-sys-zlib.patch b/libs/ghostscript/.9.26/002-ghostscript-sys-zlib.patch new file mode 100644 index 00000000..19bce4d0 --- /dev/null +++ b/libs/ghostscript/.9.26/002-ghostscript-sys-zlib.patch @@ -0,0 +1,11 @@ +--- a/configure.ac ++++ b/configure.ac +@@ -912,7 +912,7 @@ + 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 --git a/libs/ghostscript/.9.26/003-libspectre.patch b/libs/ghostscript/.9.26/003-libspectre.patch new file mode 100644 index 00000000..b1c12016 --- /dev/null +++ b/libs/ghostscript/.9.26/003-libspectre.patch @@ -0,0 +1,10 @@ +--- a/psi/iapi.h ++++ b/psi/iapi.h +@@ -246,6 +246,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/ghostscript.py b/libs/ghostscript/ghostscript.py index 339ec425..84f6f3e2 100644 --- a/libs/ghostscript/ghostscript.py +++ b/libs/ghostscript/ghostscript.py @@ -1,167 +1,143 @@ import info class subinfo(info.infoclass): def setDependencies(self): self.runtimeDependencies["virtual/base"] = None self.runtimeDependencies["libs/zlib"] = None if CraftCore.compiler.isMinGW(): self.buildDependencies["dev-utils/msys"] = None self.runtimeDependencies["libs/lcms2"] = None self.runtimeDependencies["libs/freetype"] = None - self.runtimeDependencies["libs/libjpeg-turbo"] = None + self.runtimeDependencies["libs/openjpeg"] = None self.runtimeDependencies["libs/libpng"] = None self.runtimeDependencies["libs/tiff"] = 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.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.patchLevel['9.19'] = 1 - self.defaultTarget = '9.19' + self.patchToApply['9.26'] = [(".9.26", 1)] + 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.package.packageName = 'ghostscript' - self.subinfo.options.package.packSources = False - self.subinfo.options.configure.defiens = " --with-drivers=ALL --disable-cups --with-system-libtiff --with-jbig2dec --enable-openjpeg --enable-fontconfig --enable-freetype --disable-contrib --without-x" - self.subinfo.options.make.arg = "so" + #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.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] + for d in ["freetype", "jpeg", "libpng", "lcms", "lcms2", "tiff", "zlib", "openjpeg"]: utils.rmtree(os.path.join(self.sourceDir(), d)) return True - def make(self, dummyBuildType=None): - # Normal build first - if not super().make(dummyBuildType): - return False - - # Now build the library - buildDirectory = self.buildDir() - if not self.subinfo.options.useShadowBuild: - buildDirectory = self.sourceDir() - - if not self.shell.execute(self.sourceDir(), self.makeProgram, "so"): - print("while Make'ing. cmd: %s" % command) - return False - - return True - def install(self): - if not AutoToolsPackageBase.cleanImage(self): + if not super().install(): return False - os.makedirs(os.path.join(self.imageDir(), "bin")) - os.makedirs(os.path.join(self.imageDir(), "lib")) - os.makedirs(os.path.join(self.imageDir(), "include", "ghostscript")) - utils.copyDir(os.path.join(self.sourceDir(), "sobin"), os.path.join(self.imageDir(), "bin"), False) - utils.moveFile(os.path.join(self.imageDir(), "bin", "libgs.dll.a"), - os.path.join(self.imageDir(), "lib", "libgs.dll.a")) - 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) + 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") return True - if CraftCore.compiler.isGCCLike(): class Package(PackageMSys): pass else: class Package(PackageMSVC): pass