diff options
author | Peter Breitenlohner <peb@mppmu.mpg.de> | 2009-12-14 10:41:43 +0000 |
---|---|---|
committer | Peter Breitenlohner <peb@mppmu.mpg.de> | 2009-12-14 10:41:43 +0000 |
commit | 5af6aa827e18c4e49a6f610fbb6f90877c0debc0 (patch) | |
tree | 8a94b0277a9876d584cb6202a8e4f02841208448 /Build/source/utils/xindy-new/xindy | |
parent | 724ecc90c82152ebcfe55ff0bff8e4823b778225 (diff) |
xindy-new: simplify perl scripts
git-svn-id: svn://tug.org/texlive/trunk@16403 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/utils/xindy-new/xindy')
4 files changed, 25 insertions, 38 deletions
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(); |