From 5af6aa827e18c4e49a6f610fbb6f90877c0debc0 Mon Sep 17 00:00:00 2001 From: Peter Breitenlohner Date: Mon, 14 Dec 2009 10:41:43 +0000 Subject: xindy-new: simplify perl scripts git-svn-id: svn://tug.org/texlive/trunk@16403 c570f23f-e606-0410-a88d-b1316a301751 --- .../xindy-new/xindy-2.4-pre2-PATCHES/ChangeLog | 13 ++- .../patch-20-TL-install-dirs | 3 +- .../xindy-2.4-pre2-PATCHES/patch-22-TL-xindy_pl | 111 +++++++++++++-------- .../xindy-2.4-pre2-PATCHES/patch-23-drop-v2 | 30 +----- .../patch-24-TL-use-xindy_run | 53 ---------- .../patch-25-subst-in-texindy | 4 +- .../xindy-2.4-pre2-PATCHES/patch-26-TL-texindy_pl | 4 +- .../xindy-2.4-pre2-PATCHES/patch-27-check-exist | 11 -- .../xindy-new/xindy/user-commands/Makefile.am | 1 + .../xindy-new/xindy/user-commands/Makefile.in | 1 + .../utils/xindy-new/xindy/user-commands/texindy.in | 4 +- .../utils/xindy-new/xindy/user-commands/xindy.in | 57 ++++------- 12 files changed, 109 insertions(+), 183 deletions(-) delete mode 100644 Build/source/utils/xindy-new/xindy-2.4-pre2-PATCHES/patch-24-TL-use-xindy_run delete mode 100644 Build/source/utils/xindy-new/xindy-2.4-pre2-PATCHES/patch-27-check-exist (limited to 'Build') diff --git a/Build/source/utils/xindy-new/xindy-2.4-pre2-PATCHES/ChangeLog b/Build/source/utils/xindy-new/xindy-2.4-pre2-PATCHES/ChangeLog index 0b0acc1599f..5a231c28690 100644 --- a/Build/source/utils/xindy-new/xindy-2.4-pre2-PATCHES/ChangeLog +++ b/Build/source/utils/xindy-new/xindy-2.4-pre2-PATCHES/ChangeLog @@ -1,16 +1,19 @@ +2009-12-12 Peter Breitenlohner + + * patch-20-TL-install-dirs: Declare install-links as PHONY. + * patch-22-TL-xindy_pl: Simplify the environment setup (for TL). + 2009-12-11 Peter Breitenlohner + * patch-22-TL-xindy_pl: Verify input files exist (from TL2008). * patch-26-TL-texindy_pl (new): Adapt texindy perl script for use in TL, using code from Tomasz M. Trzeciak. - * patch-27-check-exist (new): Check existence of input files - (from TL2008). 2009-12-10 Peter Breitenlohner - * patch-24-TL-use-xindy_run (new): Invoke either 'xindy.run' - (actually 'lisp.run') or 'clisp'. + * patch-22-TL-xindy_pl: Invoke either 'xindy.run' or 'clisp'. * patch-25-subst-in-texindy (new): Except for TL, substitute - the value of $(libdir) also in texindy and adapt Makefile.am. + @libdir@ also in texindy and adapt Makefile.am. 2009-12-09 Peter Breitenlohner diff --git a/Build/source/utils/xindy-new/xindy-2.4-pre2-PATCHES/patch-20-TL-install-dirs b/Build/source/utils/xindy-new/xindy-2.4-pre2-PATCHES/patch-20-TL-install-dirs index 3a85a482205..55c9fedbd66 100644 --- a/Build/source/utils/xindy-new/xindy-2.4-pre2-PATCHES/patch-20-TL-install-dirs +++ b/Build/source/utils/xindy-new/xindy-2.4-pre2-PATCHES/patch-20-TL-install-dirs @@ -43,7 +43,7 @@ diff -ur -x Makefile.in -x autom4te.cache xindy.orig/src/Makefile.am xindy/src/M diff -ur -x Makefile.in -x autom4te.cache xindy.orig/user-commands/Makefile.am xindy/user-commands/Makefile.am --- xindy.orig/user-commands/Makefile.am 2009-12-03 01:31:28.000000000 +0100 +++ xindy/user-commands/Makefile.am 2009-12-08 22:55:09.000000000 +0100 -@@ -20,10 +20,46 @@ +@@ -20,10 +20,47 @@ ## Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, ## Boston, MA 02110-1301 USA. @@ -67,6 +67,7 @@ diff -ur -x Makefile.in -x autom4te.cache xindy.orig/user-commands/Makefile.am x + *) echo "strange directory '$(bindir)' for linked scripts" >&2; \ + exit 1;; \ + esac ++.PHONY: install-links +install-links: + @cd $(DESTDIR)$(bindir) && \ + for f in $(scripts); do \ diff --git a/Build/source/utils/xindy-new/xindy-2.4-pre2-PATCHES/patch-22-TL-xindy_pl b/Build/source/utils/xindy-new/xindy-2.4-pre2-PATCHES/patch-22-TL-xindy_pl index 9aadba65dc4..3437f278320 100644 --- a/Build/source/utils/xindy-new/xindy-2.4-pre2-PATCHES/patch-22-TL-xindy_pl +++ b/Build/source/utils/xindy-new/xindy-2.4-pre2-PATCHES/patch-22-TL-xindy_pl @@ -3,82 +3,74 @@ Also implement symlinks, e.g., in /usr/local/bin/ for standalone version. - ToDo: - Modify call_xindy() to use "$xindy_run" if it exists. + Drop xindy.v2 backwards compatibility. + + Invoke either 'xindy.run' or 'clisp'. + + Verify existence of input files. 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 @@ ++++ xindy/user-commands/xindy.in 2009-12-12 17:57:03.000000000 +0100 +@@ -286,11 +286,47 @@ # Determine environment. Where is our library directory, and our modules? use File::Basename; +use Cwd; -+our ($isW32, $r0, $xindy_run); ++our ($isW32, $clisp); 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 ++ $clisp = ($isW32 || $^O eq "cygwin") ? 'clisp.exe' : 'clisp'; + -+ if ($cmd eq "xindy.pl") { # TL2010 ++ my $r0 = Cwd::realpath($0); ++ $cmd_dir = dirname($r0); + $cmd = basename($0); + ++ if (basename($r0) =~ /\.pl$/) { # TL2010 + -+ $r0 = $0; -+ my $rcmd_dir = dirname($0); -+ $cmd = basename($0); ++ # modules directory ++ $modules_dir = Cwd::realpath("$cmd_dir/../../xindy/modules"); ++ die "$cmd: Cannot locate xindy modules directory" unless -d $modules_dir; + + if ($isW32) { -+ $cmd_dir = "$rcmd_dir/../../../bin/win32"; ++ $cmd_dir = "$cmd_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 ++ # Follow symlinks and determine $cmd_dir such that ++ # $cmd_dir/xindy -> $r0 = XINDY_SCRIPTDIR/xindy.pl ++ $r0 = $0; + while (-l $r0) { -+ $cmd_dir = $rcmd_dir; -+ $cmd = $rcmd; ++ $cmd_dir = dirname($r0); + $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; -+ ++ # library directory + $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 ++ # clisp runtime ++ my $xindy_run = ($isW32 || $^O eq "cygwin") ++ ? "$lib_dir/xindy-lisp.exe" : "$lib_dir/xindy.run"; ++ $clisp = $xindy_run if -e $xindy_run; + + } else { # !TL2010 + -+ $cmd_dir = dirname($r0); - # library directory if ( $ENV{XINDY_LIBDIR} ) { -@@ -316,6 +364,7 @@ + $lib_dir = $ENV{XINDY_LIBDIR}; +@@ -316,6 +352,8 @@ } else { die "$cmd: Cannot locate xindy modules directory"; } ++ + } # !TL2010 } -@@ -324,6 +373,7 @@ +@@ -324,14 +362,10 @@ use Getopt::Long qw(:config bundling); use File::Temp qw(tempfile tmpnam); use File::Spec; @@ -86,7 +78,15 @@ diff -ur -x Makefile.in -x autom4te.cache xindy.orig/user-commands/xindy.in xind # Check arguments, store them in proper variables. -@@ -368,7 +418,17 @@ +-# +-# Do also something for backward compatibility: Check if this is an +-# old-style call. If it is, we have two arguments at the end, and the +-# second-to-last has the extension ".xdy". Then, call the old driver +-# script with the original arguments... + + sub usage ( ;$ ) + { +@@ -368,17 +402,21 @@ $outfile, $logfile, $language, @codepages, @modules, $input_markup, $interactive, $mem_file); $input_markup = 'latex'; @@ -100,11 +100,38 @@ diff -ur -x Makefile.in -x autom4te.cache xindy.orig/user-commands/xindy.in xind + $mem_file = "$lib_dir/xindy-i386.mem"; + } +} -+die "$cmd: Cannot locate $mem_file" unless -e $mem_file; ++die "$cmd: Cannot locate $mem_file" unless -e $mem_file; my @orig_argv = @ARGV; parse_options(); -@@ -711,7 +771,9 @@ + +-if ( @ARGV == 2 ) { +- if ( $ARGV[0] =~ /\.xdy$/ ) { +- exec "$cmd_dir/xindy.v2", @orig_argv; +- } +-} +- + + # This script creates temporary files. Whenever a file is created, its + # name is added to @temp_files. In an END handler, the temporary files +@@ -400,6 +438,7 @@ + + our $raw_index = File::Spec->devnull; + unless ( $interactive ) { ++ for my $f (@ARGV) { die "$cmd: input file $f does not exist" unless -f $f } + $raw_index = create_raw_index(); # processes @ARGV + my $filter_cmd = ''; + if ( $input_markup eq 'latex' ) { +@@ -674,7 +713,7 @@ + sub call_xindy ( $$ ) { + my ($mem_file, $xindy_exp) = @_; + +- my @command = ('clisp', '-M', $mem_file, '-E', 'iso-8859-1'); ++ my @command = ($clisp, '-M', $mem_file, '-E', 'iso-8859-1'); + if ( $interactive ) { + print "Proposed xindy expression:\n\n$xindy_exp\n" unless $quiet; + } else { +@@ -711,7 +750,9 @@ sub output_xindy_release () { my $version = 'unknown'; my $version_file; diff --git a/Build/source/utils/xindy-new/xindy-2.4-pre2-PATCHES/patch-23-drop-v2 b/Build/source/utils/xindy-new/xindy-2.4-pre2-PATCHES/patch-23-drop-v2 index 88e87149858..f930bea00ee 100644 --- a/Build/source/utils/xindy-new/xindy-2.4-pre2-PATCHES/patch-23-drop-v2 +++ b/Build/source/utils/xindy-new/xindy-2.4-pre2-PATCHES/patch-23-drop-v2 @@ -3,7 +3,7 @@ diff -ur -x Makefile.in -x autom4te.cache xindy.orig/user-commands/Makefile.am xindy/user-commands/Makefile.am --- xindy.orig/user-commands/Makefile.am 2009-12-08 22:55:09.000000000 +0100 +++ xindy/user-commands/Makefile.am 2009-12-09 14:17:56.000000000 +0100 -@@ -55,18 +55,19 @@ +@@ -56,18 +56,19 @@ xindy: xindy.in cat $(srcdir)/xindy.in >xindy else !TEXLIVE_BUILD @@ -29,31 +29,3 @@ diff -ur -x Makefile.in -x autom4te.cache xindy.orig/user-commands/Makefile.am x -CLEANFILES = xindy xindy.v2 +CLEANFILES = xindy -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-09 11:50:09.000000000 +0100 -+++ xindy/user-commands/xindy.in 2009-12-09 12:25:35.000000000 +0100 -@@ -377,11 +377,6 @@ - - - # Check arguments, store them in proper variables. --# --# Do also something for backward compatibility: Check if this is an --# old-style call. If it is, we have two arguments at the end, and the --# second-to-last has the extension ".xdy". Then, call the old driver --# script with the original arguments... - - sub usage ( ;$ ) - { -@@ -433,12 +428,6 @@ - my @orig_argv = @ARGV; - parse_options(); - --if ( @ARGV == 2 ) { -- if ( $ARGV[0] =~ /\.xdy$/ ) { -- exec "$cmd_dir/xindy.v2", @orig_argv; -- } --} -- - - # This script creates temporary files. Whenever a file is created, its - # name is added to @temp_files. In an END handler, the temporary files diff --git a/Build/source/utils/xindy-new/xindy-2.4-pre2-PATCHES/patch-24-TL-use-xindy_run b/Build/source/utils/xindy-new/xindy-2.4-pre2-PATCHES/patch-24-TL-use-xindy_run deleted file mode 100644 index 1429f46549d..00000000000 --- a/Build/source/utils/xindy-new/xindy-2.4-pre2-PATCHES/patch-24-TL-use-xindy_run +++ /dev/null @@ -1,53 +0,0 @@ - Invoke either 'xindy.run' or 'clisp'. - -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-09 12:25:35.000000000 +0100 -+++ xindy/user-commands/xindy.in 2009-12-10 10:57:20.000000000 +0100 -@@ -287,13 +287,19 @@ - - use File::Basename; - use Cwd; --our ($isW32, $r0, $xindy_run); -+our ($isW32, $r0, $clisp); - our ($cmd_dir, $cmd, $lib_dir, $modules_dir); - BEGIN { - $isW32 = ($^O =~ /^MSWin/i) ? 1 : 0; - $r0 = Cwd::realpath($0); - $cmd = basename($r0); - -+ if ($isW32 || $^O eq "cygwin") { -+ $clisp = "clisp.exe"; -+ } else { -+ $clisp = "clisp"; -+ } -+ - # FIXME: make two subroutines for TL2010 and !TL2010 part - - if ($cmd eq "xindy.pl") { # TL2010 -@@ -325,15 +331,13 @@ - - $lib_dir = $cmd_dir; - -+ my $xindy_run; - 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 -+ $clisp = $xindy_run if -e $xindy_run; - - } else { # !TL2010 - -@@ -723,7 +727,7 @@ - sub call_xindy ( $$ ) { - my ($mem_file, $xindy_exp) = @_; - -- my @command = ('clisp', '-M', $mem_file, '-E', 'iso-8859-1'); -+ my @command = ($clisp, '-M', $mem_file, '-E', 'iso-8859-1'); - if ( $interactive ) { - print "Proposed xindy expression:\n\n$xindy_exp\n" unless $quiet; - } else { diff --git a/Build/source/utils/xindy-new/xindy-2.4-pre2-PATCHES/patch-25-subst-in-texindy b/Build/source/utils/xindy-new/xindy-2.4-pre2-PATCHES/patch-25-subst-in-texindy index e06800308be..62b6b633c94 100644 --- a/Build/source/utils/xindy-new/xindy-2.4-pre2-PATCHES/patch-25-subst-in-texindy +++ b/Build/source/utils/xindy-new/xindy-2.4-pre2-PATCHES/patch-25-subst-in-texindy @@ -23,9 +23,9 @@ diff -ur -x Makefile.in -x autom4te.cache xindy.orig/user-commands/Makefile.am x done case "$(bindir)" in \ */bin) $(MAKE) $(AM_MAKEFLAGS) REL=.. install-links;; \ -@@ -40,34 +39,34 @@ - exit 1;; \ +@@ -41,34 +40,34 @@ esac + .PHONY: install-links install-links: - @cd $(DESTDIR)$(bindir) && \ + @cd "$(DESTDIR)$(bindir)" && \ diff --git a/Build/source/utils/xindy-new/xindy-2.4-pre2-PATCHES/patch-26-TL-texindy_pl b/Build/source/utils/xindy-new/xindy-2.4-pre2-PATCHES/patch-26-TL-texindy_pl index 2e7fc76ce0c..8c82f13b165 100644 --- a/Build/source/utils/xindy-new/xindy-2.4-pre2-PATCHES/patch-26-TL-texindy_pl +++ b/Build/source/utils/xindy-new/xindy-2.4-pre2-PATCHES/patch-26-TL-texindy_pl @@ -21,7 +21,7 @@ diff -ur -x Makefile.in -x autom4te.cache xindy.orig/user-commands/texindy.in xi + $isW32 = ($^O =~ /^MSWin/i) ? 1 : 0; + my $r0 = Cwd::realpath($0); + $cmd_dir = dirname($r0); -+ $isTL = (basename($r0) =~ /\.pl/) ? 1 : 0; ++ $isTL = (basename($r0) =~ /\.pl$/) ? 1 : 0; + $cmd = basename($0); + @@ -45,7 +45,7 @@ diff -ur -x Makefile.in -x autom4te.cache xindy.orig/user-commands/texindy.in xi + $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: For MSWin 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"; diff --git a/Build/source/utils/xindy-new/xindy-2.4-pre2-PATCHES/patch-27-check-exist b/Build/source/utils/xindy-new/xindy-2.4-pre2-PATCHES/patch-27-check-exist deleted file mode 100644 index 076326feb72..00000000000 --- a/Build/source/utils/xindy-new/xindy-2.4-pre2-PATCHES/patch-27-check-exist +++ /dev/null @@ -1,11 +0,0 @@ -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-10 10:57:20.000000000 +0100 -+++ xindy/user-commands/xindy.in 2009-12-11 11:13:31.000000000 +0100 -@@ -453,6 +453,7 @@ - - our $raw_index = File::Spec->devnull; - unless ( $interactive ) { -+ for my $f (@ARGV) { die "$cmd: input file $f does not exist" unless -f $f } - $raw_index = create_raw_index(); # processes @ARGV - my $filter_cmd = ''; - if ( $input_markup eq 'latex' ) { diff --git a/Build/source/utils/xindy-new/xindy/user-commands/Makefile.am b/Build/source/utils/xindy-new/xindy/user-commands/Makefile.am index 502eab1cbaf..e5689dde16f 100644 --- a/Build/source/utils/xindy-new/xindy/user-commands/Makefile.am +++ b/Build/source/utils/xindy-new/xindy/user-commands/Makefile.am @@ -38,6 +38,7 @@ install-exec-hook: *) echo "strange directory '$(bindir)' for linked scripts" >&2; \ exit 1;; \ esac +.PHONY: install-links install-links: @cd "$(DESTDIR)$(bindir)" && \ for f in $(scripts); do \ diff --git a/Build/source/utils/xindy-new/xindy/user-commands/Makefile.in b/Build/source/utils/xindy-new/xindy/user-commands/Makefile.in index aafa3a51ca9..c32123e1ff7 100644 --- a/Build/source/utils/xindy-new/xindy/user-commands/Makefile.in +++ b/Build/source/utils/xindy-new/xindy/user-commands/Makefile.in @@ -473,6 +473,7 @@ uninstall-man: uninstall-man1 @TEXLIVE_BUILD_TRUE@ *) echo "strange directory '$(bindir)' for linked scripts" >&2; \ @TEXLIVE_BUILD_TRUE@ exit 1;; \ @TEXLIVE_BUILD_TRUE@ esac +@TEXLIVE_BUILD_TRUE@.PHONY: install-links @TEXLIVE_BUILD_TRUE@install-links: @TEXLIVE_BUILD_TRUE@ @cd "$(DESTDIR)$(bindir)" && \ @TEXLIVE_BUILD_TRUE@ for f in $(scripts); do \ 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 34f0e6dc103..c6c91029313 100644 --- a/Build/source/utils/xindy-new/xindy/user-commands/texindy.in +++ b/Build/source/utils/xindy-new/xindy/user-commands/texindy.in @@ -314,7 +314,7 @@ BEGIN { $isW32 = ($^O =~ /^MSWin/i) ? 1 : 0; my $r0 = Cwd::realpath($0); $cmd_dir = dirname($r0); - $isTL = (basename($r0) =~ /\.pl/) ? 1 : 0; + $isTL = (basename($r0) =~ /\.pl$/) ? 1 : 0; $cmd = basename($0); @@ -338,7 +338,7 @@ BEGIN { $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: For MSWin 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"; diff --git a/Build/source/utils/xindy-new/xindy/user-commands/xindy.in b/Build/source/utils/xindy-new/xindy/user-commands/xindy.in index 050ab797eca..9e8c207b2c0 100644 --- a/Build/source/utils/xindy-new/xindy/user-commands/xindy.in +++ b/Build/source/utils/xindy-new/xindy/user-commands/xindy.in @@ -287,62 +287,46 @@ BEGIN { use File::Basename; use Cwd; -our ($isW32, $r0, $clisp); +our ($isW32, $clisp); our ($cmd_dir, $cmd, $lib_dir, $modules_dir); BEGIN { $isW32 = ($^O =~ /^MSWin/i) ? 1 : 0; - $r0 = Cwd::realpath($0); - $cmd = basename($r0); + $clisp = ($isW32 || $^O eq "cygwin") ? 'clisp.exe' : 'clisp'; - if ($isW32 || $^O eq "cygwin") { - $clisp = "clisp.exe"; - } else { - $clisp = "clisp"; - } - - # FIXME: make two subroutines for TL2010 and !TL2010 part + my $r0 = Cwd::realpath($0); + $cmd_dir = dirname($r0); + $cmd = basename($0); - if ($cmd eq "xindy.pl") { # TL2010 + if (basename($r0) =~ /\.pl$/) { # TL2010 - $r0 = $0; - my $rcmd_dir = dirname($0); - $cmd = basename($0); + # modules directory + $modules_dir = Cwd::realpath("$cmd_dir/../../xindy/modules"); + die "$cmd: Cannot locate xindy modules directory" unless -d $modules_dir; if ($isW32) { - $cmd_dir = "$rcmd_dir/../../../bin/win32"; + $cmd_dir = "$cmd_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 + # Follow symlinks and determine $cmd_dir such that + # $cmd_dir/xindy -> $r0 = XINDY_SCRIPTDIR/xindy.pl + $r0 = $0; while (-l $r0) { - $cmd_dir = $rcmd_dir; - $cmd = $rcmd; + $cmd_dir = dirname($r0); $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; - + # library directory $lib_dir = $cmd_dir; - my $xindy_run; - if ($isW32 || $^O eq "cygwin") { - $xindy_run = "$lib_dir/xindy-lisp.exe"; - } else { - $xindy_run = "$lib_dir/xindy.run"; - } - $clisp = $xindy_run if -e $xindy_run; + # clisp runtime + my $xindy_run = ($isW32 || $^O eq "cygwin") + ? "$lib_dir/xindy-lisp.exe" : "$lib_dir/xindy.run"; + $clisp = $xindy_run if -e $xindy_run; } else { # !TL2010 - $cmd_dir = dirname($r0); - # library directory if ( $ENV{XINDY_LIBDIR} ) { $lib_dir = $ENV{XINDY_LIBDIR}; @@ -368,6 +352,7 @@ BEGIN { } else { die "$cmd: Cannot locate xindy modules directory"; } + } # !TL2010 } @@ -427,7 +412,7 @@ if ($^O eq 'darwin' && ! -e $mem_file) { # support universal binary on mac $mem_file = "$lib_dir/xindy-i386.mem"; } } -die "$cmd: Cannot locate $mem_file" unless -e $mem_file; +die "$cmd: Cannot locate $mem_file" unless -e $mem_file; my @orig_argv = @ARGV; parse_options(); -- cgit v1.2.3