summaryrefslogtreecommitdiff
path: root/Master/bin/win32/ppower4.texlua
diff options
context:
space:
mode:
Diffstat (limited to 'Master/bin/win32/ppower4.texlua')
-rwxr-xr-xMaster/bin/win32/ppower4.texlua65
1 files changed, 57 insertions, 8 deletions
diff --git a/Master/bin/win32/ppower4.texlua b/Master/bin/win32/ppower4.texlua
index 06e6ff454ff..45aa25162e5 100755
--- a/Master/bin/win32/ppower4.texlua
+++ b/Master/bin/win32/ppower4.texlua
@@ -1,11 +1,11 @@
-#!/usr/bin/env texlua
+#! /usr/bin/env texlua
--*-Lua-*-
--- $Id$
+-- $Id: tl-w32-wrapper.texlua 7659 2008-04-26 00:33:32Z karl $
--- Copyright (C) 2008 Reinhard Kotucha.
+-- Copyright (C) 2007, 2008 Reinhard Kotucha, Norbert Preining.
-- You may freely use, modify and/or distribute this file.
--- Launch ppower4
+-- Wrapper for scripts.
function fixwin(args_unix)
if os.type == 'windows' then
@@ -20,11 +20,60 @@ function fixwin(args_unix)
end
end
-kpse.set_program_name('ppower4.texlua', 'ppower4')
+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')
-jarfile=kpse.find_file('pp4p.jar', 'texmfscripts')
+perlbin=TEXDIR..'/tlpkg/tlperl/bin/perl.exe'
-command={'java', '-jar', jarfile}
+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;'..TEXDIR..'/tlpkg/tlgs/fonts')
+
+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..'.tlu', 'texmfscripts') then
+ script=kpse.find_file(basename..'.tlu', '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]
@@ -32,7 +81,7 @@ end
command=fixwin(command)
---[[ prepend an additional hyphen to activate this code
+--[[ Prepend an additional hyphen to activate this code.
for i=0, #command do
print (command[i])
end