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
|
Determine lib_dir and modules_dir in the xindy perl script.
Also implement symlinks, e.g., in /usr/local/bin/ for
standalone version.
ToDo:
Modify call_xindy() to use "$xindy_run" if it exists.
diff -ur -x Makefile.in -x autom4te.cache xindy.orig/user-commands/xindy.in xindy/user-commands/xindy.in
--- xindy.orig/user-commands/xindy.in 2009-12-03 01:27:06.000000000 +0100
+++ xindy/user-commands/xindy.in 2009-12-09 11:50:09.000000000 +0100
@@ -286,10 +286,58 @@
# Determine environment. Where is our library directory, and our modules?
use File::Basename;
+use Cwd;
+our ($isW32, $r0, $xindy_run);
our ($cmd_dir, $cmd, $lib_dir, $modules_dir);
BEGIN {
- $cmd_dir = dirname($0);
- $cmd = basename($0);
+ $isW32 = ($^O =~ /^MSWin/i) ? 1 : 0;
+ $r0 = Cwd::realpath($0);
+ $cmd = basename($r0);
+
+ # FIXME: make two subroutines for TL2010 and !TL2010 part
+
+ if ($cmd eq "xindy.pl") { # TL2010
+
+ $r0 = $0;
+ my $rcmd_dir = dirname($0);
+ $cmd = basename($0);
+
+ if ($isW32) {
+ $cmd_dir = "$rcmd_dir/../../../bin/win32";
+ } else {
+ die "$cmd: not a symlink as required for TeX Live" unless -l $0;
+ $cmd_dir = $rcmd_dir;
+ my $rcmd = $cmd;
+ # Follow symlinks, but remember last one
+ while (-l $r0) {
+ $cmd_dir = $rcmd_dir;
+ $cmd = $rcmd;
+ $r0 = readlink($r0);
+ $r0 = "$cmd_dir/$r0" unless $r0 =~ m,^[\\/],; # relative link
+ $rcmd_dir = dirname($r0);
+ $rcmd = basename($r0);
+ }
+ # Now $cmd_dir/$cmd -> $r0 = $rcmd_dir/$rcmd (not a symlink).
+ }
+
+ $modules_dir = Cwd::realpath("$rcmd_dir/../../xindy/modules");
+ die "$cmd: Cannot locate xindy modules directory" unless -d $modules_dir;
+
+ $lib_dir = $cmd_dir;
+
+ if ($isW32 || $^O eq "cygwin") {
+ $xindy_run = "$lib_dir/xindy-lisp.exe";
+ } else {
+ $xindy_run = "$lib_dir/xindy.run";
+ }
+ # FIXME: what I really want to do is 'undefine' or 'delete'
+ $xindy_run = "" unless -e $xindy_run;
+
+ # FIXME: modify call_xindy() to use "$xindy_run" if it exists
+
+ } else { # !TL2010
+
+ $cmd_dir = dirname($r0);
# library directory
if ( $ENV{XINDY_LIBDIR} ) {
@@ -316,6 +364,7 @@
} else {
die "$cmd: Cannot locate xindy modules directory";
}
+ } # !TL2010
}
@@ -324,6 +373,7 @@
use Getopt::Long qw(:config bundling);
use File::Temp qw(tempfile tmpnam);
use File::Spec;
+use POSIX qw(uname);
# Check arguments, store them in proper variables.
@@ -368,7 +418,17 @@
$outfile, $logfile, $language, @codepages, @modules, $input_markup,
$interactive, $mem_file);
$input_markup = 'latex';
+
$mem_file = "$lib_dir/xindy.mem";
+if ($^O eq 'darwin' && ! -e $mem_file) { # support universal binary on mac
+ my @uname = POSIX::uname();
+ if ($uname[4] eq 'Power Macintosh') {
+ $mem_file = "$lib_dir/xindy-ppc.mem";
+ } else {
+ $mem_file = "$lib_dir/xindy-i386.mem";
+ }
+}
+die "$cmd: Cannot locate $mem_file" unless -e $mem_file;
my @orig_argv = @ARGV;
parse_options();
@@ -711,7 +771,9 @@
sub output_xindy_release () {
my $version = 'unknown';
my $version_file;
- if ( -f "$cmd_dir/../VERSION" ) {
+ if ( -f "$modules_dir/../VERSION" ) {
+ $version_file = "$modules_dir/../VERSION";
+ } elsif ( -f "$cmd_dir/../VERSION" ) {
$version_file = "$cmd_dir/../VERSION";
} elsif ( -f "$lib_dir/VERSION" ) {
$version_file = "$lib_dir/VERSION";
|