summaryrefslogtreecommitdiff
path: root/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104-PATCHES/patch-30-W32TeX
blob: 22065d49576e41bdc5d61df400f15386e4793840 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
diff -ur -x Makefile.in -x aclocal.m4 -x autoconf.h.in -x configure lcdf-typetools-2.104.orig/otftotfm/automatic.cc lcdf-typetools-2.104/otftotfm/automatic.cc
--- lcdf-typetools-2.104.orig/otftotfm/automatic.cc	2014-07-05 11:53:11.000000000 +0200
+++ lcdf-typetools-2.104/otftotfm/automatic.cc	2014-07-05 11:54:07.000000000 +0200
@@ -39,6 +39,10 @@
 #include <algorithm>
 
 #ifdef WIN32
+#ifdef _MSC_VER
+# include <io.h>
+# include <direct.h>
+#endif
 # define mkdir(dir, access) mkdir(dir)
 # define COPY_CMD "copy"
 # define CMD_SEP "&"
@@ -124,7 +128,18 @@
 static void
 find_writable_texdir(ErrorHandler *errh, const char *)
 {
+#if defined(W32TEX)
+// W32TeX does not have TEXMFVAR
+    char *p = kpsei_var_value("TEXMFVAR");
+    if (p == NULL) // W32TeX
+        look_for_writable_texdir("$TEXMFLOCAL", true);
+    else { // TeXLive
+        free (p);
+        look_for_writable_texdir("$TEXMFVAR", true);
+    }
+#else
     look_for_writable_texdir("$TEXMFVAR", true);
+#endif
     if (!writable_texdir)
 	look_for_writable_texdir("$VARTEXMF", false);
     if (!writable_texdir)
@@ -744,7 +759,16 @@
 	    if (slash >= 0)
 		filename = filename.substring(slash + 1);
             String redirect = verbose ? " 1>&2" : " >" DEV_NULL " 2>&1";
-	    String command = "updmap --nomkmap --enable Map " + shell_quote(filename) + redirect
+#if defined(W32TEX)
+// jtex_filetype is defined only in W32TeX
+	    char *p = kpsei_var_value("jtex_filetype");
+	    if (p != NULL) { // W32TeX
+		free(p);
+		String option = "--add ";
+	    } else // TeXLive
+#endif
+	    String option = "--enable Map ";
+	    String command = "updmap --nomkmap " + option  + shell_quote(filename) + redirect
                 + CMD_SEP " updmap" + redirect;
 	    int retval = mysystem(command.c_str(), errh);
 	    if (retval == 127)
diff -ur -x Makefile.in -x aclocal.m4 -x autoconf.h.in -x configure lcdf-typetools-2.104.orig/otftotfm/kpseinterface.c lcdf-typetools-2.104/otftotfm/kpseinterface.c
--- lcdf-typetools-2.104.orig/otftotfm/kpseinterface.c	2014-04-10 14:27:02.000000000 +0200
+++ lcdf-typetools-2.104/otftotfm/kpseinterface.c	2014-07-05 11:54:07.000000000 +0200
@@ -21,6 +21,9 @@
 #include <kpathsea/expand.h>
 #include <kpathsea/c-pathch.h>
 #include <kpathsea/tex-file.h>
+#ifdef W32TEX
+#include <kpathsea/variable.h>
+#endif
 #include "kpseinterface.h"
 
 int kpsei_env_sep_char = ENV_SEP;
@@ -86,3 +89,11 @@
 {
     kpathsea_debug = flags;
 }
+
+#ifdef W32TEX
+char*
+kpsei_var_value(const char *name)
+{
+  return kpse_var_value(name);
+}
+#endif
diff -ur -x Makefile.in -x aclocal.m4 -x autoconf.h.in -x configure lcdf-typetools-2.104.orig/otftotfm/kpseinterface.h lcdf-typetools-2.104/otftotfm/kpseinterface.h
--- lcdf-typetools-2.104.orig/otftotfm/kpseinterface.h	2013-09-17 15:27:20.000000000 +0200
+++ lcdf-typetools-2.104/otftotfm/kpseinterface.h	2014-07-05 11:54:07.000000000 +0200
@@ -13,6 +13,10 @@
 char* kpsei_find_file(const char* name, int format);
 void kpsei_set_debug_flags(unsigned flags);
 
+#ifdef W32TEX
+char* kpsei_var_value(const char *name);
+#endif
+
 #ifdef __cplusplus
 }
 #endif
diff -ur -x Makefile.in -x aclocal.m4 -x autoconf.h.in -x configure lcdf-typetools-2.104.orig/otftotfm/otftotfm.cc lcdf-typetools-2.104/otftotfm/otftotfm.cc
--- lcdf-typetools-2.104.orig/otftotfm/otftotfm.cc	2014-07-07 08:32:34.000000000 +0200
+++ lcdf-typetools-2.104/otftotfm/otftotfm.cc	2014-07-07 08:34:35.000000000 +0200
@@ -63,6 +63,9 @@
 #ifdef HAVE_FCNTL_H
 # include <fcntl.h>
 #endif
+#ifdef _MSC_VER
+# include <io.h>
+#endif
 
 using namespace Efont;