summaryrefslogtreecommitdiff
path: root/Build/source
diff options
context:
space:
mode:
authorPeter Breitenlohner <peb@mppmu.mpg.de>2009-03-04 17:56:23 +0000
committerPeter Breitenlohner <peb@mppmu.mpg.de>2009-03-04 17:56:23 +0000
commit2e62f31ca5853fdd1e587f8c45d09cc6a45ce40b (patch)
tree82bb7716f043ff0bf7dc70d25597b6aac05153fd /Build/source
parent44167180edb89f78e62c9105af13218390561c52 (diff)
part 1 of mingw32 patches from Taco
git-svn-id: svn://tug.org/texlive/trunk@12307 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source')
-rw-r--r--Build/source/texk/kpathsea/ChangeLog12
-rw-r--r--Build/source/texk/kpathsea/c-ctype.h2
-rw-r--r--Build/source/texk/kpathsea/c-stat.h4
-rw-r--r--Build/source/texk/kpathsea/config.h8
-rw-r--r--Build/source/texk/kpathsea/mingw32.h65
-rw-r--r--Build/source/texk/kpathsea/progname.c16
-rw-r--r--Build/source/texk/kpathsea/progname.h5
-rw-r--r--Build/source/texk/kpathsea/xopendir.c2
8 files changed, 103 insertions, 11 deletions
diff --git a/Build/source/texk/kpathsea/ChangeLog b/Build/source/texk/kpathsea/ChangeLog
index 921156ab2c7..7a3f67c9c46 100644
--- a/Build/source/texk/kpathsea/ChangeLog
+++ b/Build/source/texk/kpathsea/ChangeLog
@@ -1,3 +1,15 @@
+2009-03-04 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ Part 1 of patches from Taco Hoekwater for __MINGW32__
+ * mingw32.h: new.
+ * c-ctype.h, c-stat.h: do not #include <oldnames.h>.
+ * config.h: #include <kpathsea/mingw32.h>, not <win32lib.h>
+ * progname.c: do #include <kpathsea/mingw32.h>.
+ * xopendir.c: do build xopendir for __MINGW32__.
+
+ * progname.c, progname.h: changed static function selfdir()
+ into exported function kpse_selfdir() for use in luatex.
+
2009-02-28 Karl Berry <karl@tug.org>
* texmf.cnf (shell_escape_commands): add pstopdf and convert per
diff --git a/Build/source/texk/kpathsea/c-ctype.h b/Build/source/texk/kpathsea/c-ctype.h
index 793f617be84..005943d5cb0 100644
--- a/Build/source/texk/kpathsea/c-ctype.h
+++ b/Build/source/texk/kpathsea/c-ctype.h
@@ -23,7 +23,9 @@
/* Be sure we have `isascii'. */
#ifdef WIN32
+#ifndef __MINGW32__
#include <oldnames.h>
+#endif
#else
#ifndef isascii
#define isascii(c) 1
diff --git a/Build/source/texk/kpathsea/c-stat.h b/Build/source/texk/kpathsea/c-stat.h
index d15f6eeaa1a..8d7210b3cf5 100644
--- a/Build/source/texk/kpathsea/c-stat.h
+++ b/Build/source/texk/kpathsea/c-stat.h
@@ -22,9 +22,9 @@
#include <kpathsea/systypes.h>
#include <sys/stat.h>
-#ifdef WIN32
+#if defined (WIN32) && !defined (__MINGW32__)
#include <oldnames.h>
-#endif /* WIN32 */
+#endif
/* POSIX predicates for testing file attributes. */
diff --git a/Build/source/texk/kpathsea/config.h b/Build/source/texk/kpathsea/config.h
index 283581b500b..f4b6a93020f 100644
--- a/Build/source/texk/kpathsea/config.h
+++ b/Build/source/texk/kpathsea/config.h
@@ -55,9 +55,9 @@
#define DEV_NULL "/dev/null"
#endif
-#ifdef WIN32
+#if defined (WIN32) && !defined (__STDC__)
#define __STDC__ 1
-#endif /* not WIN32 */
+#endif
/* System dependencies that are figured out by `configure'. */
#include <kpathsea/c-auto.h>
@@ -82,8 +82,12 @@
but before "lib.h". FP.
*/
#ifdef WIN32
+#ifdef __MINGW32__
+#include <kpathsea/mingw32.h>
+#else
#include <win32lib.h>
#endif
+#endif
#include <kpathsea/debug.h> /* Runtime tracing. */
#include <kpathsea/lib.h> /* STREQ, etc. */
diff --git a/Build/source/texk/kpathsea/mingw32.h b/Build/source/texk/kpathsea/mingw32.h
new file mode 100644
index 00000000000..3bb7c4be362
--- /dev/null
+++ b/Build/source/texk/kpathsea/mingw32.h
@@ -0,0 +1,65 @@
+#ifndef _MINGW32_H_
+#define _MINGW32_H_
+
+#include <stdlib.h>
+/* The embedded rndnpc.h defines boolean as 'unsigned char',
+ and we do not want that.
+ This should be safe as long as we don't use npc ourselves. */
+#define boolean saved_boolean
+#include <windows.h>
+#include <winerror.h>
+#include <winnt.h>
+#undef boolean
+#include <dirent.h>
+#include <direct.h>
+#include <fcntl.h>
+#include <ctype.h>
+
+#define ftello ftello64
+#define fseeko fseeko64
+
+#ifndef MAXPATHLEN
+#define MAXPATHLEN _MAX_PATH
+#endif
+
+#ifndef MAX_PIPES
+#define MAX_PIPES 128
+#endif
+
+/* On DOS, it's good to allow both \ and / between directories. */
+#ifndef IS_DIR_SEP
+#define IS_DIR_SEP(ch) ((ch) == '/' || (ch) == '\\')
+#endif
+#ifndef IS_DEVICE_SEP
+#define IS_DEVICE_SEP(ch) ((ch) == ':')
+#endif
+#ifndef NAME_BEGINS_WITH_DEVICE
+#define NAME_BEGINS_WITH_DEVICE(name) (*(name) && IS_DEVICE_SEP((name)[1]))
+#endif
+/* On win32, UNC names are authorized */
+#ifndef IS_UNC_NAME
+#define IS_UNC_NAME(name) (strlen(name)>=3 && IS_DIR_SEP(*name) \
+ && IS_DIR_SEP(*(name+1)) && isalnum(*(name+2)))
+#endif
+
+typedef struct volume_info_data {
+ struct volume_info_data * next;
+
+ /* time when info was obtained */
+ DWORD timestamp;
+
+ /* actual volume info */
+ char * root_dir;
+ DWORD serialnum;
+ DWORD maxcomp;
+ DWORD flags;
+ char * name;
+ char * type;
+} volume_info_data;
+
+void init_user_info (void);
+BOOL win32_get_long_filename (char *, char *, int);
+void set_home_warning (void);
+BOOL look_for_cmd(const char *, char **, char **);
+
+#endif
diff --git a/Build/source/texk/kpathsea/progname.c b/Build/source/texk/kpathsea/progname.c
index 253d54bd2db..5aee83ca7a0 100644
--- a/Build/source/texk/kpathsea/progname.c
+++ b/Build/source/texk/kpathsea/progname.c
@@ -28,6 +28,10 @@
#include <kpathsea/c-pathmx.h>
#endif
+#ifdef __MINGW32__
+#include <kpathsea/mingw32.h>
+#endif
+
#if defined(__i386_pc_gnu__)
#ifndef _S_ISUID
#define _S_ISUID 04000 /* Set user ID on execution. */
@@ -351,8 +355,8 @@ remove_dots P1C(string, dir)
/* Return directory ARGV0 comes from. Check PATH if ARGV0 is not
absolute. */
-static string
-selfdir P1C(const_string, argv0)
+string
+kpse_selfdir P1C(const_string, argv0)
{
string ret = NULL;
string self = NULL;
@@ -483,8 +487,8 @@ kpse_set_program_name P2C(const_string, argv0, const_string, progname)
}
}
/* Win95 always gives the short filename for argv0, not the long one.
- There is only this way to catch it. It makes all the selfdir stuff
- useless for win32. */
+ There is only this way to catch it. It makes all the kpse_selfdir
+ stuff useless for win32. */
{
char short_path[PATH_MAX], path[PATH_MAX], *fp;
@@ -565,10 +569,10 @@ kpse_set_program_name P2C(const_string, argv0, const_string, progname)
#endif
/* We need to find SELFAUTOLOC *before* removing the ".exe" suffix from
- the program_name, otherwise the PATH search inside selfdir will fail,
+ the program_name, otherwise the PATH search inside kpse_selfdir will fail,
since `prog' doesn't exists as a file, there's `prog.exe' instead. */
#ifndef WIN32
- sdir = selfdir (program_invocation_name);
+ sdir = kpse_selfdir (program_invocation_name);
#endif
/* SELFAUTODIR is actually the parent of the invocation directory,
and SELFAUTOPARENT the grandparent. This is how teTeX did it. */
diff --git a/Build/source/texk/kpathsea/progname.h b/Build/source/texk/kpathsea/progname.h
index d46bc56e435..afcb461c455 100644
--- a/Build/source/texk/kpathsea/progname.h
+++ b/Build/source/texk/kpathsea/progname.h
@@ -26,6 +26,11 @@ extern KPSEDLL string program_invocation_name;
extern KPSEDLL string program_invocation_short_name;
extern KPSEDLL string kpse_program_name;
+/* Return directory ARGV0 comes from. Check PATH if ARGV0 is not
+ absolute. */
+
+extern KPSEDLL string selfdir P1H(const_string argv0);
+
/* Set the first two variables above (if they're not predefined) to a copy
of ARGV0 and everything in ARGV0 after the last directory separator,
respectively. Set kpse_program_name to a copy of PROGNAME or the
diff --git a/Build/source/texk/kpathsea/xopendir.c b/Build/source/texk/kpathsea/xopendir.c
index d1e7f103789..caa4a2642d0 100644
--- a/Build/source/texk/kpathsea/xopendir.c
+++ b/Build/source/texk/kpathsea/xopendir.c
@@ -20,7 +20,7 @@
#include <kpathsea/xopendir.h>
-#ifndef WIN32
+#if !defined(WIN32) || defined(__MINGW32__)
DIR *
xopendir P1C(string, dirname)
{