File t1lib-5.1.2-relocatable.patch of Package mingw32-t1lib
--- t1lib-5.1.2/lib/t1lib/parseAFM.h 2007-12-23 16:49:42.000000000 +0100
+++ t1lib-5.1.2/lib/t1lib/parseAFM.h 2009-06-16 13:00:02.000000000 +0200
@@ -111,7 +111,12 @@
#define T1LIB_FALSE 0
#define EOL '\n' /* end-of-line indicator */
#define MAX_NAME 4096 /* max length for identifiers */
+
+#ifndef _WIN32
#define BOOL int
+#else
+#include <windows.h>
+#endif
#define FLAGS int
--- t1lib-5.1.2/lib/t1lib/t1env.c 2007-12-23 16:49:42.000000000 +0100
+++ t1lib-5.1.2/lib/t1lib/t1env.c 2009-06-16 13:10:23.000000000 +0200
@@ -35,15 +35,17 @@
#include <string.h>
#if defined(_MSC_VER)
# include <io.h>
-# include <sys/types.h>
-# include <sys/stat.h>
#else
# include <unistd.h>
#endif
#include <sys/types.h>
#include <sys/stat.h>
#include <ctype.h>
-
+#ifdef _WIN32
+#include <windows.h>
+#include <shlobj.h>
+#include <mbstring.h>
+#endif
#include "../type1/types.h"
#include "parseAFM.h"
@@ -237,6 +239,65 @@
return;
}
+#ifdef _WIN32
+
+#include <windows.h>
+#include <shlobj.h>
+#include <mbstring.h>
+
+/* search for data relative to where we are installed */
+
+static HMODULE hmodule;
+
+BOOL WINAPI
+DllMain (HINSTANCE hinstDLL,
+ DWORD fdwReason,
+ LPVOID lpvReserved)
+{
+ switch (fdwReason)
+ {
+ case DLL_PROCESS_ATTACH:
+ hmodule = hinstDLL;
+ break;
+ }
+
+ return TRUE;
+}
+
+static char *
+get_t1lib_global_config_dir (void)
+{
+ static char retval[1000];
+ static int beenhere = 0;
+
+ unsigned char *p;
+
+ if (beenhere)
+ return retval;
+
+ if (!GetModuleFileName (hmodule, (CHAR *) retval, sizeof(retval) - 10))
+ return GLOBAL_CONFIG_DIR;
+
+ p = _mbsrchr ((const unsigned char *) retval, '\\');
+ *p = '\0';
+ p = _mbsrchr ((const unsigned char *) retval, '\\');
+ if (p) {
+ if (stricmp ((const char *) (p+1), "bin") == 0)
+ *p = '\0';
+ }
+ strcat (retval, "\\share\\t1lib");
+
+ beenhere = 1;
+
+ return retval;
+}
+
+#undef GLOBAL_CONFIG_DIR
+#define GLOBAL_CONFIG_DIR get_t1lib_global_config_dir ()
+
+
+#endif
+
/* ScanConfigFile(): Read a configuration file and scan and save the
environment strings used for searching pfa/pfb-, afm- and encoding
--- t1lib-5.1.2/lib/t1lib/t1set.c 2007-12-23 16:49:42.000000000 +0100
+++ t1lib-5.1.2/lib/t1lib/t1set.c 2009-06-16 13:08:18.000000000 +0200
@@ -1313,6 +1313,7 @@
}
+#define byte my_byte
void fill(dest, h, w, area, byte, bit, wordsize)
register char *dest; /* destination bitmap */
@@ -1389,6 +1390,8 @@
*/
}
+#undef byte
+
#define ALLONES 0xFF
void fillrun(register char *p, pel x0, pel x1, int bit)
--- t1lib-5.1.2/lib/type1/types.h 2007-12-23 16:49:42.000000000 +0100
+++ t1lib-5.1.2/lib/type1/types.h 2009-06-16 12:53:54.000000000 +0200
@@ -21,6 +21,12 @@
typedef int LONG; /* 32 bits */
typedef unsigned long ULONG; /* 32 bits */
typedef double DOUBLE; /* 64 bits */
+#elif defined(_WIN32)
+typedef unsigned short USHORT; /* 16 bits */
+typedef short SHORT; /* 16 bits */
+typedef long LONG; /* 32 bits */
+typedef unsigned long ULONG; /* 32 bits */
+typedef double DOUBLE; /* 64 bits */
#else /* default: WORD32 */
typedef unsigned short USHORT; /* 16 bits */
typedef short SHORT; /* 16 bits */
diff -u -r t1lib-5.1.2/lib/type1/util.h t1lib-5.1.2/lib/type1/util.h
--- t1lib-5.1.2/lib/type1/util.h 2007-12-23 16:49:42.000000000 +0100
+++ t1lib-5.1.2/lib/type1/util.h 2009-06-16 12:55:33.000000000 +0200
@@ -32,8 +32,12 @@
#include "types.h"
#ifndef boolean
+#ifdef _WIN32
+typedef unsigned char boolean;
+#else
typedef int boolean;
#endif
+#endif
#ifndef TRUE
#define TRUE (1)
--- t1lib-5.1.2/type1afm/Makefile.in 2007-12-23 16:49:43.000000000 +0100
+++ t1lib-5.1.2/type1afm/Makefile.in 2009-06-16 13:28:52.000000000 +0200
@@ -66,11 +66,11 @@
T1LIB = ../lib/libt1.la
-all: type1afm
+all: type1afm@EXEEXT@
-type1afm: $(OBJS) ../lib/t1lib.h
+type1afm@EXEEXT@: $(OBJS) ../lib/t1lib.h
$(LIBTOOL) --mode=link \
- $(CC) -o type1afm $(LDFLAGS) $(OBJS) $(T1LIB) $(LDLIBS)
+ $(CC) -o type1afm@EXEEXT@ $(LDFLAGS) $(OBJS) $(T1LIB) $(LDLIBS)
.SUFFIXES: .lo
.c.lo:
@@ -83,18 +83,18 @@
gcc -MM *.c | sed 's/\.o:/.lo:/g' > .dependencies
clean: dummy
- $(RM) type1afm *.o *.lo .libs/* *~ \#*\# *.log *.bak
+ $(RM) type1afm@EXEEXT@ *.o *.lo .libs/* *~ \#*\# *.log *.bak
-rmdir .libs
install: dummy
$(MKINSTALLDIRS) $(DESTDIR)$(bindir)
$(LIBTOOL) --mode=install \
- $(INSTALL_PROGRAM) type1afm $(DESTDIR)$(bindir)/type1afm
+ $(INSTALL_PROGRAM) type1afm@EXEEXT@ $(DESTDIR)$(bindir)/type1afm@EXEEXT@
uninstall: dummy
$(LIBTOOL) --mode=uninstall \
- $(RM) $(DESTDIR)$(bindir)/type1afm
+ $(RM) $(DESTDIR)$(bindir)/type1afm@EXEEXT@
dummy: