diff options
author | Vladimir Volovich <vvv@vsu.ru> | 2008-04-18 05:44:51 +0000 |
---|---|---|
committer | Vladimir Volovich <vvv@vsu.ru> | 2008-04-18 05:44:51 +0000 |
commit | 56be380dc44a23b63c47a1f77b9622d452018e83 (patch) | |
tree | 853ca1384cc6d23f8094fe8453ad9aed91b64903 /Master | |
parent | a70e6f5fc1e57dc430e6ae02aa5d146b954cd817 (diff) |
added Reihard's texlua wrappers for xindy's perl scripts
git-svn-id: svn://tug.org/texlive/trunk@7484 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rwxr-xr-x | Master/bin/win32/texindy.texlua | 92 | ||||
-rwxr-xr-x | Master/bin/win32/xindy.texlua | 92 |
2 files changed, 184 insertions, 0 deletions
diff --git a/Master/bin/win32/texindy.texlua b/Master/bin/win32/texindy.texlua new file mode 100755 index 00000000000..16e4e7ea55b --- /dev/null +++ b/Master/bin/win32/texindy.texlua @@ -0,0 +1,92 @@ +#! /usr/bin/env texlua +--*-Lua-*- +-- $Id$ + +-- Copyright (C) 2007 Reinhard Kotucha, Norbert Preining. +-- You may freely use, modify and/or distribute this file. + +-- Wrapper for scripts. + +function fixwin(args_unix) + if os.type == 'windows' then + local args_win={} -- new table + args_win[0]=args_unix[1] + for i=1, #args_unix do + args_win[i]='"'..args_unix[i]..'"' + end + return args_win + else + return args_unix + end +end + +if string.find(arg[0], '/') then -- UNIX path + filename=select(1, string.gsub(arg[0], '.*/', '')) +elseif string.find(arg[0], '\\') then -- Windows path + filename=select(1, string.gsub(arg[0], '.*\\', '')) +else -- no path + filename=arg[0] +end + +basename=select(1, string.gsub(filename, '\.texlua$', '')) + +sys=false + +if string.find(basename, '-sys$') then + basename=select(1, string.gsub(basename, '-sys$', '')) + sys=true +end + +kpse.set_program_name(filename, basename) +TEXDIR=kpse.var_value('SELFAUTOPARENT') +BINDIR=kpse.var_value('SELFAUTOLOC') + +perlbin=TEXDIR..'/tlpkg/tlperl/bin/perl.exe' + +os.setenv('PATH', TEXDIR..'/tlpkg/tlgs/bin;'.. + TEXDIR..'/tlpkg/installer;'.. + os.getenv('PATH')) + +os.setenv('WGETRC', TEXDIR..'/tlpkg/installer/wgetrc') +os.setenv('PERL5LIB', TEXDIR..'/tlpkg/tlperl/lib') +os.setenv('GS_LIB', TEXDIR..'/tlpkg/tlgs/lib') + +if sys then + os.setenv('TEXMFVAR', kpse.var_value('TEXMFSYSVAR')) + os.setenv('TEXMFCONFIG', kpse.var_value('TEXMFSYSCONFIG')) + os.setenv('TEX_SYS_PROG', 'true') +end + +if sys and lfs.isfile(BINDIR..'/'..basename..'.exe') then + command={BINDIR..'/'..basename..'.exe'} +elseif lfs.isfile(BINDIR..'/'..basename..'-bin.exe') then + command={BINDIR..'/'..basename..'-bin.exe'} +elseif lfs.isfile(BINDIR..'/'..basename..'.pl') then + script=BINDIR..'/'..basename..'.pl' + command={perlbin, script} +elseif kpse.find_file(basename..'.pl', 'texmfscripts') then + script=kpse.find_file(basename..'.pl', 'texmfscripts') + command={perlbin, script} +elseif kpse.find_file(basename..'.texlua', 'texmfscripts') then + script=kpse.find_file(basename..'.texlua', 'texmfscripts') + command={'texlua', script} +else + io.stderr:write(filename..'.texlua: '..basename.. + ': No appropriate script found.\n') +end + +for i=1, #arg do + command[#command+1]=arg[i] +end + +command=fixwin(command) + +--[[ Prepend an additional hyphen to activate this code. +for i=0, #command do + print (command[i]) +end +os.exit(ret) +--]] + +ret=os.spawn(command) +os.exit(ret) diff --git a/Master/bin/win32/xindy.texlua b/Master/bin/win32/xindy.texlua new file mode 100755 index 00000000000..16e4e7ea55b --- /dev/null +++ b/Master/bin/win32/xindy.texlua @@ -0,0 +1,92 @@ +#! /usr/bin/env texlua +--*-Lua-*- +-- $Id$ + +-- Copyright (C) 2007 Reinhard Kotucha, Norbert Preining. +-- You may freely use, modify and/or distribute this file. + +-- Wrapper for scripts. + +function fixwin(args_unix) + if os.type == 'windows' then + local args_win={} -- new table + args_win[0]=args_unix[1] + for i=1, #args_unix do + args_win[i]='"'..args_unix[i]..'"' + end + return args_win + else + return args_unix + end +end + +if string.find(arg[0], '/') then -- UNIX path + filename=select(1, string.gsub(arg[0], '.*/', '')) +elseif string.find(arg[0], '\\') then -- Windows path + filename=select(1, string.gsub(arg[0], '.*\\', '')) +else -- no path + filename=arg[0] +end + +basename=select(1, string.gsub(filename, '\.texlua$', '')) + +sys=false + +if string.find(basename, '-sys$') then + basename=select(1, string.gsub(basename, '-sys$', '')) + sys=true +end + +kpse.set_program_name(filename, basename) +TEXDIR=kpse.var_value('SELFAUTOPARENT') +BINDIR=kpse.var_value('SELFAUTOLOC') + +perlbin=TEXDIR..'/tlpkg/tlperl/bin/perl.exe' + +os.setenv('PATH', TEXDIR..'/tlpkg/tlgs/bin;'.. + TEXDIR..'/tlpkg/installer;'.. + os.getenv('PATH')) + +os.setenv('WGETRC', TEXDIR..'/tlpkg/installer/wgetrc') +os.setenv('PERL5LIB', TEXDIR..'/tlpkg/tlperl/lib') +os.setenv('GS_LIB', TEXDIR..'/tlpkg/tlgs/lib') + +if sys then + os.setenv('TEXMFVAR', kpse.var_value('TEXMFSYSVAR')) + os.setenv('TEXMFCONFIG', kpse.var_value('TEXMFSYSCONFIG')) + os.setenv('TEX_SYS_PROG', 'true') +end + +if sys and lfs.isfile(BINDIR..'/'..basename..'.exe') then + command={BINDIR..'/'..basename..'.exe'} +elseif lfs.isfile(BINDIR..'/'..basename..'-bin.exe') then + command={BINDIR..'/'..basename..'-bin.exe'} +elseif lfs.isfile(BINDIR..'/'..basename..'.pl') then + script=BINDIR..'/'..basename..'.pl' + command={perlbin, script} +elseif kpse.find_file(basename..'.pl', 'texmfscripts') then + script=kpse.find_file(basename..'.pl', 'texmfscripts') + command={perlbin, script} +elseif kpse.find_file(basename..'.texlua', 'texmfscripts') then + script=kpse.find_file(basename..'.texlua', 'texmfscripts') + command={'texlua', script} +else + io.stderr:write(filename..'.texlua: '..basename.. + ': No appropriate script found.\n') +end + +for i=1, #arg do + command[#command+1]=arg[i] +end + +command=fixwin(command) + +--[[ Prepend an additional hyphen to activate this code. +for i=0, #command do + print (command[i]) +end +os.exit(ret) +--]] + +ret=os.spawn(command) +os.exit(ret) |