diff options
author | Vladimir Volovich <vvv@vsu.ru> | 2008-04-19 09:26:53 +0000 |
---|---|---|
committer | Vladimir Volovich <vvv@vsu.ru> | 2008-04-19 09:26:53 +0000 |
commit | 1377cd8f12dbd3c49673ee5a4f7705c65cd04b43 (patch) | |
tree | 436cd9bc798605b01b89028d3436a103f12df026 | |
parent | 9ca28f7a8de38c38f8a230fa0bb17c7ba18f9236 (diff) |
adapt the xindy and texindy perl scripts to work on woe32
git-svn-id: svn://tug.org/texlive/trunk@7509 c570f23f-e606-0410-a88d-b1316a301751
-rwxr-xr-x | Build/source/utils/xindy/user-commands/texindy | 26 | ||||
-rw-r--r-- | Build/source/utils/xindy/user-commands/xindy.in | 41 |
2 files changed, 51 insertions, 16 deletions
diff --git a/Build/source/utils/xindy/user-commands/texindy b/Build/source/utils/xindy/user-commands/texindy index 8e4d8f932d2..f0d85fd7777 100755 --- a/Build/source/utils/xindy/user-commands/texindy +++ b/Build/source/utils/xindy/user-commands/texindy @@ -364,6 +364,9 @@ if ( -f "$cmd_dir/xindy" && -x _ ) { $xindy = "$cmd_dir/xindy"; } elsif ( -f "$cmd_dir/xindy.pl" && -x _ ) { $xindy = "$cmd_dir/xindy.pl"; +} elsif ( -f "$ENV{SELFAUTOLOC}/xindy.texlua" ) { # woe32 + $xindy = "$ENV{SELFAUTOLOC}/xindy.texlua"; + $cmd_dir = $ENV{"SELFAUTOLOC"}; } else { die "$cmd: cannot locate xindy\n"; } @@ -387,10 +390,15 @@ unshift (@ARGV, map { ('-M', $_) } ($ENV{TEXINDY_AUTO_MODULE} || 'texindy', @modules)); unshift (@ARGV, '-I', $input_markup); -print "Calling xindy as: $cmd_dir/xindy @ARGV\n" if (grep /^script$/, @debug); +print "Calling xindy as: $xindy @ARGV\n" if (grep /^script$/, @debug); -exec $xindy, @ARGV; -die "$cmd: could not execute xindy: $!\n"; +if ($xindy =~ m,\.texlua$,) { + system("texlua", $xindy, @ARGV); + exit $? if $? != -1; +} else { + exec $xindy, @ARGV; +} +die "$cmd: could not execute $xindy: $!\n"; # ------------------------------------------------------------ @@ -461,22 +469,28 @@ sub output_xindy_release () { if ( -f "$cmd_dir/../VERSION" ) { $version_file = "$cmd_dir/../VERSION"; } else { + my $xindy_run; + if ($^O eq "MSWin32" || $^O eq "cygwin") { + $xindy_run = "xindy-lisp.exe"; + } else { + $xindy_run = "xindy.run"; + } # Where is the library directory? my $lib_dir; if ( $ENV{XINDY_LIBDIR} ) { $lib_dir = $ENV{XINDY_LIBDIR}; + } elsif ( -f "$cmd_dir/$xindy_run" ) { # texlive style + $lib_dir = $cmd_dir; } elsif ( '@libdir@' ne '@libdir' . '@' ) { # GNU configure at work? if ( -d '@libdir@/xindy' ) { # /usr style $lib_dir = '@libdir@/xindy'; } else { $lib_dir = '@libdir@'; # /opt style } - } elsif ( -f "$cmd_dir/../lib/xindy.run" ) { # /opt style + } elsif ( -f "$cmd_dir/../lib/$xindy_run" ) { # /opt style $lib_dir = "$cmd_dir/../lib"; } elsif ( -d "$cmd_dir/../lib/xindy" ) { # /usr style $lib_dir = "$cmd_dir/../lib/xindy"; - } elsif ( -f "$cmd_dir/xindy.run" ) { # texlive style - $lib_dir = $cmd_dir; } else { die "Cannot locate xindy library directory"; } diff --git a/Build/source/utils/xindy/user-commands/xindy.in b/Build/source/utils/xindy/user-commands/xindy.in index b180e66a743..997d5613eb1 100644 --- a/Build/source/utils/xindy/user-commands/xindy.in +++ b/Build/source/utils/xindy/user-commands/xindy.in @@ -286,25 +286,38 @@ BEGIN { # Determine environment. Where is our library directory, and our modules? use File::Basename; -our ($cmd_dir, $cmd, $lib_dir, $modules_dir); +our ($cmd_dir, $cmd, $xindy_run, $lib_dir, $modules_dir, $path_sep); BEGIN { $cmd_dir = dirname($0); $cmd = basename($0); + if ($^O eq "MSWin32" || $^O eq "cygwin") { + $xindy_run = "xindy-lisp.exe"; + $path_sep = ";"; + } else { + $xindy_run = "xindy.run"; + $path_sep = ":"; + } + # library directory if ( $ENV{XINDY_LIBDIR} ) { $lib_dir = $ENV{XINDY_LIBDIR}; - } elsif ( -f "$cmd_dir/xindy.run" ) { # texlive style + die "$cmd: Invalid XINDY_LIBDIR setting: cannot find $lib_dir/$xindy_run" if ! -f "$lib_dir/$xindy_run"; + } elsif ( -f "$cmd_dir/$xindy_run" ) { # texlive unix $lib_dir = $cmd_dir; + } elsif ( exists $ENV{"SELFAUTOLOC"} && -f "$ENV{SELFAUTOLOC}/$xindy_run" ) { # texlive woe32 + $lib_dir = $ENV{"SELFAUTOLOC"}; + $cmd_dir = $ENV{"SELFAUTOLOC"}; } elsif ( '@libdir@' ne '@libdir' . '@' ) { # GNU configure at work? if ( -d '@libdir@/xindy' ) { # /usr style $lib_dir = '@libdir@/xindy'; } else { $lib_dir = '@libdir@'; # /opt style } - } elsif ( -f "$cmd_dir/../lib/xindy.run" ) { # /opt style + die "$cmd: Cannot locate $lib_dir/$xindy_run" if ! -f "$lib_dir/$xindy_run"; + } elsif ( -f "$cmd_dir/../lib/$xindy_run" ) { # /opt style $lib_dir = "$cmd_dir/../lib"; - } elsif ( -d "$cmd_dir/../lib/xindy" ) { # /usr style + } elsif ( -f "$cmd_dir/../lib/xindy/$xindy_run" ) { # /usr style $lib_dir = "$cmd_dir/../lib/xindy"; } else { die "$cmd: Cannot locate xindy library directory"; @@ -590,7 +603,7 @@ sub filter_index ( $$ ) { # Construct final xindy expression, from options. sub xindy_expression () { - my ($logging, $tracing, $trace_level); + my ($logging, $tracing, $trace_level, $searchpath); # Determine language module of make-rules framework. Part of the # complexity below is from compatibility with the TLC2 @@ -658,16 +671,18 @@ sub xindy_expression () { $style_file = quotify($style_file); $outfile = quotify($outfile); + $raw_index = quotify($raw_index); $logging = ':logfile ' . quotify($logfile) if $logfile; $tracing = ':markup-trace :on' if $debug{markup}; $trace_level = ":trace-level $debug{trace_level}" if $debug{trace_level}; + $searchpath = quotify(join($path_sep, ".", $modules_dir, "$modules_dir/base")); my $exp = <<_EOT_ (progn - (searchpath ".:$modules_dir:$modules_dir/base") + (searchpath $searchpath) (xindy:startup :idxstyle $style_file - :rawindex "$raw_index" + :rawindex $raw_index :output $outfile $logging $tracing @@ -685,12 +700,18 @@ _EOT_ sub call_xindy ( $$ ) { my ($mem_file, $xindy_exp) = @_; - my @command = ("$lib_dir/xindy.run", '-q', + my @command = ("$lib_dir/$xindy_run", '-q', '-B', $lib_dir, '-M', $mem_file, '-E', 'iso-8859-1'); if ( $interactive ) { print "Proposed xindy expression:\n\n$xindy_exp\n" unless $quiet; } else { - push (@command, '-x', $xindy_exp); + #push (@command, '-x', $xindy_exp); + my ($output, $outfile) = tempfile(); + push (@temp_files, $outfile); + print $output $xindy_exp; + close ($output); + print "xindy startup file: $outfile\n" if $debug{script}; + push (@command, $outfile); } if ( $debug{script} ) { @@ -748,7 +769,7 @@ sub output_xindy_release () { sub quotify ( $ ) { my $s = shift; - $s =~ s:[\\\"]:\\&1:g ; # quote double-quote and backslash + $s =~ s:([\\\"]):\\$1:g ; # quote double-quote and backslash return "\"$s\""; } |