[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Multipurpose binaries with different names
From: |
Ralf Wildenhues |
Subject: |
Re: Multipurpose binaries with different names |
Date: |
Sat, 25 Jul 2009 10:33:29 +0200 |
User-agent: |
Mutt/1.5.20 (2009-06-15) |
* Jan Engelhardt wrote on Fri, Jul 24, 2009 at 11:25:51AM CEST:
>
> if [[ "$0" != %program_name% ]]; then
> t=$(mktemp -d);
> ln -s %program_name% "$t/${0##*/}";
> [...do libtool setup like LD_LIBRARY_PATH etc...]
> exec "$t/${0##*/}";
Actually, this isn't such a bad idea: use 'exec -a' for the benefit of
bash users, and something slow like the above for the rest. Thanks for
the suggestion.
Of course, [[ is not portable, nor can we use $(cmd) or ${..##..}, nor
necessarily 'ln -s'; OTOH we own .libs and everything below it, so there
is little need for mktemp if we can make up our minds about the naming
strategy.
It would probably still be good to re-check the libtool logic to
ensure that the final executed executable, if it lives below .libs,
is always the one with the same name as the name of the wrapper
script/executable, rather than possibly lt-$name. That way, the
expensive code as above would be used even less often.
Cheers,
Ralf