diff options
author | midipix <writeonce@midipix.org> | 2016-04-30 13:58:53 -0400 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2016-04-30 15:43:27 -0400 |
commit | e9dbdf19b64af1560a24221c47cd7305bf0b23ed (patch) | |
tree | 4d8a295b7319748306db9d08d214ed3e46f55725 | |
parent | a715306378dc1558b6b979c8ff133b1f614aa141 (diff) | |
download | slibtool-e9dbdf19b64af1560a24221c47cd7305bf0b23ed.tar.bz2 slibtool-e9dbdf19b64af1560a24221c47cd7305bf0b23ed.tar.xz |
link mode: executable wrapper: added --mode=execute backend support.
-rw-r--r-- | src/logic/slbt_exec_link.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/logic/slbt_exec_link.c b/src/logic/slbt_exec_link.c index 1b3c998..cbd5c6f 100644 --- a/src/logic/slbt_exec_link.c +++ b/src/logic/slbt_exec_link.c @@ -798,6 +798,7 @@ static int slbt_exec_link_create_executable( const char * exefilename) { char ** parg; + char * base; char cwd [PATH_MAX]; char output [PATH_MAX]; char wrapper[PATH_MAX]; @@ -888,15 +889,26 @@ static int slbt_exec_link_create_executable( ectx->argv = depsmeta.altv; ectx->program = depsmeta.altv[0]; + /* executable wrapper: base name */ + if ((base = strrchr(dctx->cctx->output,'/'))) + base++; + else + base = wrapper; + /* executable wrapper: footer */ fabspath = (exefilename[0] == '/'); if (fprintf(ectx->fwrapper, "DL_PATH=\"$DL_PATH$LCOLON$%s\"\n\n" "export %s=$DL_PATH\n\n" + "if [ `basename \"$0\"` = \"%s.exe.wrapper\" ]; then\n" + "\tprogram=\"$1\"; shift\n" + "\texec \"$program\" \"$@\"\n" + "fi\n\n" "exec %s/%s \"$@\"\n", dctx->cctx->settings.ldpathenv, dctx->cctx->settings.ldpathenv, + base, fabspath ? "" : cwd, fabspath ? &exefilename[1] : exefilename) < 0) return slbt_exec_link_exit(&depsmeta,-1); |