diff options
author | tv <tv> | 1999-01-04 22:37:29 +0000 |
---|---|---|
committer | tv <tv> | 1999-01-04 22:37:29 +0000 |
commit | 1ac8c0ae893cce269b1164bb0d5d075a4e36279b (patch) | |
tree | f6d6b811a4c9cc20cd3b49a70a233e6958d1095b /cross/COMMON/buwrapper.c | |
parent | 531eb73376adf514ac2b79ec993c9774230ed45b (diff) | |
download | pkgsrc-1ac8c0ae893cce269b1164bb0d5d075a4e36279b.tar.gz |
Major `cross' category overhaul. Clean up the shared Makefiles; move all
binutils stuff (except gas) to a shared, multiple-target binutils build;
reduce extract and compile times by being more specific with files and
targets; update to egcs 1.1.1 with a diffball from NetBSD's src/gnu/dist
tree; add 4.4BSD a.out archive support to binutils.
Diffstat (limited to 'cross/COMMON/buwrapper.c')
-rw-r--r-- | cross/COMMON/buwrapper.c | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/cross/COMMON/buwrapper.c b/cross/COMMON/buwrapper.c new file mode 100644 index 00000000000..0617513a720 --- /dev/null +++ b/cross/COMMON/buwrapper.c @@ -0,0 +1,50 @@ +/* $NetBSD: buwrapper.c,v 1.1 1999/01/04 22:37:30 tv Exp $ */ + +#include <err.h> +#include <stdlib.h> +#include <string.h> +#include <sysexits.h> +#include <unistd.h> + +/* + * Wrapper for binutils programs. + * + * This frontend sets the appropriate environment variables that tell + * binutils programs which target will be used. + */ + +static const char binsubdir[] = "libexec/binutils"; + +#define PATHLEN sizeof(PREFIX) + sizeof(binsubdir) + 20 + +int main(int argc, char **argv) { + char path[PATHLEN], *p, *prog; + + /* quickly find last part of path component */ + if (p = strrchr(argv[0], '/')) + p++; + else + p = argv[0]; + if (prog = strrchr(p, '-')) + prog++; + else + prog = p; + + /* make program pathname */ + snprintf(path, PATHLEN, "%s/%s/%s", PREFIX, binsubdir, prog); + + /* set up environment */ + setenv("GNUTARGET", GNUTARGET, 1); +#ifdef LDEMULATION + setenv("LDEMULATION", LDEMULATION, 1); +#endif +#ifdef LD_RPATH_LINK + setenv("LD_RPATH_LINK", LD_RPATH_LINK, 1); +#endif + + /* run it! */ + execv(path, argv); + + /* we shouldn't get here. */ + err(EX_OSERR, "(buwrapper): exec %s", path); +} |