[luatex] Problem building 0.50.0 (and trunk)
Reinhard Kotucha
reinhard.kotucha at web.de
Fri Jan 8 23:27:22 CET 2010
On 8 January 2010 Norbert Preining wrote:
> On Fr, 08 Jan 2010, Reinhard Kotucha wrote:
> > > I doubt "which" is sufficiently portable, given that we're already
> > > talking about systems that don't have /bin/bash.
> >
> > We have a function called "which" already in tlpkg/TeXLive/TLUtils.pm.
>
> That does not help, if you missed it, we are talking about the build
> system of TeX Live, not the installation. And there we are in sh world,
> not perl world.
Sure, but it's not difficult to port it to sh. I mentioned this
function in order to allow you to estimate the required effort.
The script below should work on Cygwin and MinGW too, though I can
test it only on Linux. It's very likely that it still contains bugs.
It expects config.guess in the current directory (can be copied from
tlpkg/installer/).
Regarding "test -x", I don't have access to a Windows machine, but as
far as I remember, Cygwin supports Unix file permissions natively and
MinGW regards everything as executable which has the extension ".exe".
Hope it works as expected.
Regards,
Reinhard
------------------------------------------------------------------------
#! /bin/sh
SYS_ID=`./config.guess`
SAVED_IFS=$IFS # We have to restore IFS when we are finished.
# which() expects a program name as an argument (without extension).
# Return value is 0 if the program was found in PATH and 1 otherwise.
# If the program was found in PATH, the variable PROG contains the name
# of the program preceded by the first element of PATH where the program
# was found. Don't use PROG unless the return value is 0.
which () {
prog="$1"
if echo $SYS_ID | egrep "(mingw|cygwin)"; then
prog="$1.exe"
fi
if echo $SYS_ID | grep "mingw"; then
IFS=';'
else
IFS=:
fi
for p in $PATH; do
if [ -x "$p/$prog" ]; then
PROG="$p/$prog";
IFS=$SAVED_IFS;
return 0
fi
done
IFS=$SAVED_IFS
return 1
}
# Example Code:
echo "System: $SYS_ID"
if which bash; then
echo $PROG
else
echo "No bash in $PATH"
fi
------------------------------------------------------------------------
--
----------------------------------------------------------------------------
Reinhard Kotucha Phone: +49-511-3373112
Marschnerstr. 25
D-30167 Hannover mailto:reinhard.kotucha at web.de
----------------------------------------------------------------------------
Microsoft isn't the answer. Microsoft is the question, and the answer is NO.
----------------------------------------------------------------------------
More information about the luatex
mailing list