You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
mxe/src/ghostscript-1-fixes.patch

151 lines
5.0 KiB

This file is part of MXE. See LICENSE.md for licensing information.
Contains ad hoc patches for cross building.
diff --git a/configure.ac b/configure.ac
index 1111111..2222222 100644
--- a/configure.ac
+++ b/configure.ac
@@ -146,9 +148,16 @@ if test x"$CCAUX" != x"" ; then
echo $AUXFLAGS_MAK_LINE06 >> $AUXFLAGS_MAK.in
echo $AUXFLAGS_MAK_LINE07 >> $AUXFLAGS_MAK.in
- ../$0 CC="$CCAUX" CFLAGS="$CFLAGSAUX" LDFLAGS="$LDFLAGSAUX" CCAUX= CFLAGSAUX= CFLAGSAUX= MAKEFILE=$AUXFLAGS_MAK --host= --build= --without-libtiff --disable-contrib --disable-fontconfig --disable-dbus --disable-freetype --disable-fapi --disable-cups --disable-openjpeg --disable-gtk --with-libiconv=no --without-libidn --without-libpaper --without-pdftoraster --without-ijs --without-luratech --without-jbig2dec --without-x --with-drivers=""
+ if test "$0" = "./configure" ; then
+ basedir=".."
+ configure="../configure"
+ else
+ basedir="$(basename "$0")"
+ configure="$0"
+ fi
+ "$configure" CC="$CCAUX" CFLAGS="$CFLAGSAUX" LDFLAGS="$LDFLAGSAUX" CCAUX= CFLAGSAUX= CFLAGSAUX= MAKEFILE=$AUXFLAGS_MAK --host= --build= --without-libtiff --disable-contrib --disable-fontconfig --disable-dbus --disable-freetype --disable-fapi --disable-cups --disable-openjpeg --disable-gtk --with-libiconv=no --without-libidn --without-libpaper --without-pdftoraster --without-ijs --without-luratech --without-jbig2dec --without-x --with-drivers=""
status=$?
- cp config.log ../configaux.log
+ cp config.log "$basedir/configaux.log"
if test $status -eq 0 ; then
CCAUX=$(grep CCAUX $AUXFLAGS_MAK | sed "s/CCAUX=//g")
GCFLAGSAUXTMP=$(grep GCFLAGSAUX $AUXFLAGS_MAK | sed "s/GCFLAGSAUX=//g")
@@ -974,7 +983,7 @@ if test x"$enable_fapi" != xno; then
if $PKGCONFIG --atleast-version=12.0.6 freetype2; then
AC_MSG_RESULT(yes)
FT_CFLAGS="$CFLAGS `$PKGCONFIG --cflags freetype2`"
- FT_LIBS="`$PKGCONFIG --libs freetype2`"
+ FT_LIBS="`$PKGCONFIG --libs-only-l freetype2`"
FT_BRIDGE=1
SHARE_FT=1
else
@@ -2323,12 +2323,6 @@
GS_DYNAMIC_LDFLAGS="-shared -Wl,\$(LD_SET_DT_SONAME)\$(LDFLAGS_SO_PREFIX)\$(GS_SONAME_MAJOR)"
PCL_DYNAMIC_LDFLAGS="-shared -Wl,\$(LD_SET_DT_SONAME)\$(LDFLAGS_SO_PREFIX)\$(PCL_SONAME_MAJOR)"
XPS_DYNAMIC_LDFLAGS="-shared -Wl,\$(LD_SET_DT_SONAME)\$(LDFLAGS_SO_PREFIX)\$(XPS_SONAME_MAJOR)"
- if test $ac_cv_prog_gcc = yes; then
- # GCC high level flag
- DYNAMIC_LIBS="-rdynamic"
- else
- DYNAMIC_LIBS=""
- fi
SO_LIB_EXT=".so"
else
case `uname` in
@@ -2337,12 +2331,6 @@
GS_DYNAMIC_LDFLAGS="-shared -Wl,\$(LD_SET_DT_SONAME)\$(LDFLAGS_SO_PREFIX)\$(GS_SONAME_MAJOR)"
PCL_DYNAMIC_LDFLAGS="-shared -Wl,\$(LD_SET_DT_SONAME)\$(LDFLAGS_SO_PREFIX)\$(PCL_SONAME_MAJOR)"
XPS_DYNAMIC_LDFLAGS="-shared -Wl,\$(LD_SET_DT_SONAME)\$(LDFLAGS_SO_PREFIX)\$(XPS_SONAME_MAJOR)"
- if test $ac_cv_prog_gcc = yes; then
- # GCC high level flag
- DYNAMIC_LIBS="-rdynamic"
- else
- DYNAMIC_LIBS=""
- fi
SO_LIB_EXT=".so"
;;
MINGW*|MSYS*)
diff --git a/psi/iapi.h b/psi/iapi.h
index 1111111..2222222 100644
--- a/psi/iapi.h
+++ b/psi/iapi.h
@@ -68,6 +68,11 @@
# define GSDLLEXPORT
# endif
# endif
+# ifdef __MINGW32__
+/* export stdcall functions as "name" instead of "_name@ordinal" */
+# undef GSDLLAPI
+# define GSDLLAPI
+# endif
# ifndef GSDLLAPI
# define GSDLLAPI __stdcall
# endif
diff --git a/psi/iapi.c b/psi/iapi.c
index 1111111..2222222 100644
--- a/psi/iapi.c
+++ b/psi/iapi.c
@@ -17,6 +17,9 @@
/* Public Application Programming Interface to Ghostscript interpreter */
+#ifdef __WIN32__
+#include "windows_.h"
+#endif
#include "string_.h"
#include "ierrors.h"
#include "gscdefs.h"
@@ -42,6 +45,57 @@ static const int gsapi_instance_max = 1;
#endif
+/* A function to decode the next codepoint of the supplied args from the
+ * local windows codepage, or -1 for EOF.
+ */
+
+#ifdef __WIN32__
+int
+gp_local_arg_encoding_get_codepoint(FILE *file, const char **astr)
+{
+ int len;
+ int c;
+ char arg[3];
+ wchar_t unicode[2];
+ char utf8[4];
+
+ if (file) {
+ c = fgetc(file);
+ if (c == EOF)
+ return EOF;
+ } else if (**astr) {
+ c = *(*astr)++;
+ if (c == 0)
+ return EOF;
+ } else {
+ return EOF;
+ }
+
+ arg[0] = c;
+ if (IsDBCSLeadByte(c)) {
+ if (file) {
+ c = fgetc(file);
+ if (c == EOF)
+ return EOF;
+ } else if (**astr) {
+ c = *(*astr)++;
+ if (c == 0)
+ return EOF;
+ }
+ arg[1] = c;
+ len = 2;
+ } else {
+ len = 1;
+ }
+
+ /* Convert the string (unterminated in, unterminated out) */
+ len = MultiByteToWideChar(CP_ACP, 0, arg, len, unicode, 2);
+
+ return unicode[0];
+}
+#endif /* __WIN32__ */
+
+
/* Return revision numbers and strings of Ghostscript. */
/* Used for determining if wrong GSDLL loaded. */
/* This may be called before any other function. */