aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--auto.def21
-rw-r--r--jim-file.c21
-rw-r--r--jimsh.c9
-rwxr-xr-xmake-bootstrap-jim6
4 files changed, 50 insertions, 7 deletions
diff --git a/auto.def b/auto.def
index 1e1c495..0de7b5b 100644
--- a/auto.def
+++ b/auto.def
@@ -66,10 +66,23 @@ cc-check-functions backtrace geteuid mkstemp realpath strptime gettimeofday
cc-check-functions regcomp waitpid sigaction sys_signame sys_siglist
cc-check-functions syslog opendir readlink sleep usleep pipe inet_ntop getaddrinfo
-switch -glob -- [get-define host] {
- *-*-ming* {
+define TCL_LIBRARY [get-define prefix]/lib/jim
+
+lassign [split [get-define host] -] host_cpu host_vendor host_os
+# Scrub revision from the host_os
+regsub -all {[0-9.]} $host_os {} host_os
+
+switch -glob -- $host_os {
+ mingw* {
# We provide our own implementation of dlopen for mingw32
define-feature dlopen-compat
+ define TCL_PLATFORM_OS $host_os
+ define TCL_PLATFORM_PLATFORM windows
+ }
+ default {
+ # Note that cygwin is considered a unix platform
+ define TCL_PLATFORM_OS $host_os
+ define TCL_PLATFORM_PLATFORM unix
}
}
@@ -335,10 +348,6 @@ foreach e $ext {
}
}
-define TCL_LIBRARY [get-define prefix]/lib/jim
-define TCL_PLATFORM_OS [exec uname -s]
-define TCL_PLATFORM_PLATFORM unix
-
make-autoconf-h jim-config.h {HAVE_LONG_LONG* JIM_UTF8}
make-autoconf-h jimautoconf.h {HAVE_* jim_ext_* TCL_PLATFORM_* TCL_LIBRARY USE_* JIM_*}
make-template Makefile.in
diff --git a/jim-file.c b/jim-file.c
index 4b65aa8..ea69b5a 100644
--- a/jim-file.c
+++ b/jim-file.c
@@ -188,6 +188,12 @@ static int file_cmd_dirname(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
else if (p == path) {
Jim_SetResultString(interp, "/", -1);
}
+#if defined(__MINGW32__)
+ else if (p[-1] == ':') {
+ /* z:/dir => z:/ */
+ Jim_SetResultString(interp, path, p - path + 1);
+ }
+#endif
else {
Jim_SetResultString(interp, path, p - path);
}
@@ -273,6 +279,12 @@ static int file_cmd_join(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
/* Absolute component, so go back to the start */
last = newname;
}
+#if defined(__MINGW32__)
+ else if (strchr(part, ':')) {
+ /* Absolute compontent on mingw, so go back to the start */
+ last = newname;
+ }
+#endif
/* Add a slash if needed */
if (last != newname) {
@@ -847,6 +859,15 @@ static int Jim_PwdCmd(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
Jim_SetResultString(interp, "Failed to get pwd", -1);
return JIM_ERR;
}
+#if defined(__MINGW32__)
+ {
+ /* Try to keep backlashes out of paths */
+ char *p = cwd;
+ while ((p = strchr(p, '\\')) != NULL) {
+ *p++ = '/';
+ }
+ }
+#endif
Jim_SetResultString(interp, cwd, -1);
diff --git a/jimsh.c b/jimsh.c
index 96d24c9..9ca1099 100644
--- a/jimsh.c
+++ b/jimsh.c
@@ -30,7 +30,12 @@
static const char jimsh_init[] = \
"proc _init {} {\n"
"\trename _init {}\n"
+/* XXX This is a big ugly */
+#if defined(__MINGW32__)
+"\tlappend p {*}[split [env JIMLIB {}] {;}]\n"
+#else
"\tlappend p {*}[split [env JIMLIB {}] :]\n"
+#endif
"\tlappend p {*}$::auto_path\n"
"\tlappend p [file dirname [info nameofexecutable]]\n"
"\tset ::auto_path $p\n"
@@ -44,6 +49,10 @@ static const char jimsh_init[] = \
"\t\t}\n"
"\t}\n"
"}\n"
+/* XXX This is a big ugly */
+#if defined(__MINGW32__)
+"set jim_argv0 [string map {\\\\ /} $jim_argv0]\n"
+#endif
"_init\n";
static void JimSetArgv(Jim_Interp *interp, int argc, char *const argv[])
diff --git a/make-bootstrap-jim b/make-bootstrap-jim
index 4f492f8..92a1037 100755
--- a/make-bootstrap-jim
+++ b/make-bootstrap-jim
@@ -59,10 +59,14 @@ done
# Can we make a bootstrap jimsh work even on mingw32?
cat <<EOF
-#if defined(__MINGW32__) || defined(__MINGW64__)
+#if defined(__MINGW32__)
+#define TCL_PLATFORM_OS "windows"
+#define TCL_PLATFORM_PLATFORM "mingw"
#define HAVE_MKDIR_ONE_ARG
#define HAVE_SYSTEM
#else
+#define TCL_PLATFORM_OS "unknown"
+#define TCL_PLATFORM_PLATFORM "unix"
#define HAVE_VFORK
#define HAVE_WAITPID
#endif