summaryrefslogtreecommitdiff
path: root/Build/source/utils/xindy/TLpatches/patch-01-xindy-script
blob: 226395213dff3755c5a0931958dded6f4a8b7689 (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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
diff -ur xindy-2.5.1.orig/user-commands/xindy.1 xindy-2.5.1/user-commands/xindy.1
--- xindy-2.5.1.orig/user-commands/xindy.1	Fri May 30 05:26:05 2014
+++ xindy-2.5.1/user-commands/xindy.1	Fri Apr 14 06:50:56 2017
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.27 (Pod::Simple 3.28)
+.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.28)
 .\"
 .\" Standard preamble:
 .\" ========================================================================
@@ -133,7 +133,7 @@
 .\" ========================================================================
 .\"
 .IX Title "xindy 1"
-.TH xindy 1 "2014-05-29" "Release 2.5.1" "xindy"
+.TH xindy 1 "2015-08-15" "Release 2.5.1" "xindy"
 .\" For nroff, turn off justification.  Always turn off hyphenation; it makes
 .\" way too many mistakes in technical documents.
 .if n .ad l
@@ -165,7 +165,7 @@
 .Ve
 .SH "DESCRIPTION"
 .IX Header "DESCRIPTION"
-\&\fBxindy\fR is the formatter-indepedent command of xindy, the flexible
+\&\fBxindy\fR is the formatter-independent command of xindy, the flexible
 indexing system. It takes a raw index as input, and produces a merged,
 sorted and tagged index. Merging, sorting, and tagging is controlled
 by xindy style files.
@@ -432,7 +432,7 @@
 Joachim Schrod
 .SH "LEGALESE"
 .IX Header "LEGALESE"
-Copyright (c) 2004\-2014 by Joachim Schrod.
+Copyright (C) 2004\-2014 by Joachim Schrod.
 .PP
 \&\fBxindy\fR is free software; you can redistribute it and/or modify it
 under the terms of the \s-1GNU\s0 General Public License as published by the
diff -ur xindy-2.5.1.orig/user-commands/xindy.in xindy-2.5.1/user-commands/xindy.in
--- xindy-2.5.1.orig/user-commands/xindy.in	Sun May 11 22:45:44 2014
+++ xindy-2.5.1/user-commands/xindy.in	Mon Mar 27 15:19:32 2017
@@ -353,6 +353,7 @@
 
 use Cwd;
 use File::Basename;
+use File::Glob qw(bsd_glob);
 use File::Spec;
 use File::Temp qw(tempfile tmpnam);
 use Getopt::Long qw(:config bundling);
@@ -394,7 +395,7 @@
 # FIXME: In standalone installations, modules are still placed in lib
 # directory. This is not conformant to FHS.
 
-if ( $is_TL ) { # TeX Live and MikTeX
+if ( $is_TL ) { # TeX Live, MiKTeX, or W32TeX
 
     $modules_dir = Cwd::realpath("$cmd_dir/../../xindy/modules");
     die "$cmd: Cannot locate xindy modules directory"  unless -d $modules_dir;
@@ -402,8 +403,12 @@
     if ( $is_w32 ) {
        if ( -d "$cmd_dir/../../../bin/win32" ) {	# TeX Live
 	   $cmd_dir = "$cmd_dir/../../../bin/win32";
-       } elsif ( -d "$cmd_dir/../../miktex/bin" ) {	# MikTeX
-	   $cmd_dir = "$cmd_dir/../../miktex/bin";
+       } elsif ( -d "$cmd_dir/../../miktex/bin/x64/internal" ) {	# MiKTeX 64-bit
+	   $cmd_dir = "$cmd_dir/../../miktex/bin/x64/internal";
+       } elsif ( -d "$cmd_dir/../../miktex/bin/internal" ) {	# MiKTeX 32-bit
+	   $cmd_dir = "$cmd_dir/../../miktex/bin/internal";
+       } elsif ( -d "$cmd_dir/../../../../bin" ) {	# W32TeX
+	   $cmd_dir = "$cmd_dir/../../../../bin";
        } else {
 	   die "$cmd: Cannot locate bin directory";
        }
@@ -626,7 +631,11 @@
 	    usage(1);
 	}
 	my ($name, $path, $suffix) = fileparse ($ARGV[0], '\.[^\.]+');
+        if ($path eq ".\\") {
+	   $outfile = "$name.ind";
+        } else {
 	$outfile = "$path$name.ind";
+        }
     }
 
     # FIXME: xindy wants a log file. Really?
@@ -706,6 +715,7 @@
     my $output = tmpnam();
     push (@temp_files, $output);
     $output=quotify($output);
+    $filter=quotify($filter);
     print "Running filter: $filter <$input >$output\n"  if $verbose;
     system "$filter <$input >$output";
     print "filtered xindy input file: $output\n"  if $debug{script};
@@ -732,6 +742,9 @@
     #
     # FIXME: I didn't see all languages. What's on with gypsy and
     # hausa?
+    if ( !$language ) {
+        $language = "general";
+    }
     if ( $language ) {
 	# If there is no language directory, this might be a variant.
 	# Language names and variants are separated by hyphens. The
@@ -762,7 +775,7 @@
 	@codepages = qw(latin cp iso8859 ascii utf8)  unless @codepages;
 	my @styles;
 	foreach my $cp ( @codepages ) {
-	    @styles = glob("$lang_dir/$variant$cp*-lang.xdy");
+	    @styles = bsd_glob("$lang_dir/$variant$cp*-lang.xdy");
 	    last  if @styles;
 	}
 	unless ( @styles ) {
@@ -790,7 +803,21 @@
 	push (@temp_files, $style_file);
 	$style_file=quotify($style_file);
 	foreach my $module ( @modules ) {
-	    print $sf "(require \"$module\")\n";
+	    if (($module =~ /\//) || ($module =~ /\\/)) {
+    # If $module contains directory separators, the module must be a system
+    # module. So we don't call kpsewhich.
+		print $sf "(require \"$module\")\n";
+	    } else {
+    # Here we call kpsewhich to search for a module. Thus modules can be under
+    # (anytexmf)/xindy/modules/
+		my $fnmodule=`kpsewhich -progname=xindy -format=othertext $module`;
+		if ($fnmodule) {
+		   chomp($fnmodule);
+		   print $sf "(require \"$fnmodule\")\n";
+		} else {
+		   print $sf "(require \"$module\")\n";
+		}
+	    }
 	}
 	close ($sf);
     }