[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Multipurpose binaries with different names
From: |
Jan Engelhardt |
Subject: |
Multipurpose binaries with different names |
Date: |
Fri, 24 Jul 2009 11:25:51 +0200 (CEST) |
User-agent: |
Alpine 2.00 (LSU 1167 2008-08-23) |
Hi,
when one has a program that does something like
if(strcmp(argv[0], "gunzip") == 0)
uncompress();
else
compress();
and this program also uses a libtool library, then the - lets use this
example - just-built "gzip" file will be around 4 kilobytes only, it is
a libtool wrapper scripts for .libs/gzip. "gunzip" would then be a
symlink to "gzip", but calling gunzip results in the libtool script
calling gzip instead, thereby leading to the wrong mode of operation.
This makes it hard to run libtooled programs from within the compilation
directory. A possible workaround is that the libtool wrapper script
honors $0 a little more:
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##*/}";
Could something like this be implemented? My current libtool version is
2.2.6.
Jan
- Multipurpose binaries with different names,
Jan Engelhardt <=