summaryrefslogtreecommitdiff
path: root/Build/source/utils/xindy-new/xindy/user-commands/texindy.in
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/utils/xindy-new/xindy/user-commands/texindy.in')
-rw-r--r--Build/source/utils/xindy-new/xindy/user-commands/texindy.in49
1 files changed, 36 insertions, 13 deletions
diff --git a/Build/source/utils/xindy-new/xindy/user-commands/texindy.in b/Build/source/utils/xindy-new/xindy/user-commands/texindy.in
index 1774614638e..1c6424641ec 100644
--- a/Build/source/utils/xindy-new/xindy/user-commands/texindy.in
+++ b/Build/source/utils/xindy-new/xindy/user-commands/texindy.in
@@ -307,7 +307,7 @@ BEGIN {
use File::Basename;
use Cwd;
-our ($isW32, $isTL, $lib_dir);
+our ($isW32, $isTL);
our $xindy;
our ($cmd_dir, $cmd);
BEGIN {
@@ -320,7 +320,7 @@ BEGIN {
if ($isTL) {
if ($isW32) {
- $xindy = "$cmd_dir/../../../bin/win32/xindy.exe";
+ $xindy = "$cmd_dir/xindy.pl";
} else {
die "$cmd: not a symlink as required for TeX Live" unless -l $0;
$r0 = $0;
@@ -335,12 +335,12 @@ BEGIN {
}
$xindy = "$lcmd_dir/xindy";
}
- $lib_dir = "$cmd_dir/../../xindy";
- } elsif ($isW32) {
- # FIXME: For win32 we should have a wrapper script,
- # FIXME: e.g., 'xindy.bat' invoking 'perl xindy'
- die "$cmd: not yet implemented";
+ $cmd_dir = Cwd::realpath("$cmd_dir/../../xindy/modules");
+ die "Cannot locate xindy modules directory" unless -f "$cmd_dir/../VERSION";
} else {
+ # FIXME: For win32 there should be wrapper scripts 'xindy.bat' or 'xindy.cmd'
+ # FIXME: invoking 'perl xindy' and similar for texindy.
+ # FIXME: When calling xindy from texindy we bypass this wrapper.
$xindy = "$cmd_dir/xindy";
}
die "$cmd: cannot locate xindy\n" unless -f $xindy && ($isW32 || -x $xindy);
@@ -415,8 +415,21 @@ push (@opt, '-I', $input_markup);
print "Calling xindy as: $xindy @opt @ARGV\n" if (grep /^script$/, @debug);
-exec $xindy, @opt, @ARGV;
-die "$cmd: could not execute xindy: $!\n";
+# FIXME: There ought to be be a subroutine call_xindy used here and in output_version.
+
+if ($isW32) {
+ system ($^X, $xindy, @opt, @ARGV);
+ if ($? == -1) {
+ die "$cmd: could not execute xindy: $!\n";
+ } elsif ($? & 127) {
+ die "xindy died with signal " . ($? & 127) ."\n";
+ } else {
+ exit ($? >> 8);
+ }
+} else {
+ exec $xindy, @opt, @ARGV;
+ die "$cmd: could not execute xindy: $!\n";
+}
# ------------------------------------------------------------
@@ -477,16 +490,26 @@ sub output_version () {
print "$cmd script version: $VERSION\n";
my @xindy_cmd = ($xindy, '--internal-version');
push (@xindy_cmd, qw(-d script --foobar)) if grep(/^script$/, @debug);
- exec @xindy_cmd;
+ if ($isW32) {
+ system ($^X, @xindy_cmd);
+ if ($? == -1) {
+ die "$cmd: could not execute xindy: $!\n";
+ } elsif ($? & 127) {
+ die "xindy died with signal " . ($? & 127) ."\n";
+ } else {
+ exit ($? >> 8);
+ }
+ } else {
+ exec @xindy_cmd;
+ die "$cmd: could not execute xindy: $!\n";
+ }
}
sub output_xindy_release () {
my $version = 'unknown';
my $version_file;
- if ( $isTL && -f "$lib_dir/VERSION" ) {
- $version_file = "$lib_dir/VERSION";
- } elsif ( -f "$cmd_dir/../VERSION" ) {
+ if ( -f "$cmd_dir/../VERSION" ) {
$version_file = "$cmd_dir/../VERSION";
} else {
# Where is the library directory?