From 5e58040cb4e77c2f3aae4cd20dd1f6eabc4b1ba3 Mon Sep 17 00:00:00 2001 From: midipix Date: Sun, 10 Apr 2016 06:52:07 -0400 Subject: install mode: install the executables, not the generated executable wrappers. --- src/logic/slbt_exec_install.c | 27 +++++++++++++++++++++++++-- src/logic/slbt_exec_link.c | 11 +++++++++++ 2 files changed, 36 insertions(+), 2 deletions(-) (limited to 'src/logic') diff --git a/src/logic/slbt_exec_install.c b/src/logic/slbt_exec_install.c index b073132..cf9ba77 100644 --- a/src/logic/slbt_exec_install.c +++ b/src/logic/slbt_exec_install.c @@ -106,9 +106,20 @@ static int slbt_exec_install_entry( char slnkname[PATH_MAX]; char dlnkname[PATH_MAX]; char lasource[PATH_MAX]; + bool fexe = false; + struct stat st; + + /* executable wrapper? */ + if ((size_t)snprintf(slnkname,sizeof(slnkname),"%s.exe.wrapper", + entry->arg) >= sizeof(slnkname)) + return -1; + + fexe = stat(slnkname,&st) + ? false + : true; /* .la ? */ - if (!(dot = strrchr(entry->arg,'.')) || strcmp(dot,".la")) { + if (!fexe && (!(dot = strrchr(entry->arg,'.')) || strcmp(dot,".la"))) { *src = (char *)entry->arg; *dst = dest ? 0 : (char *)last->arg; @@ -132,9 +143,21 @@ static int slbt_exec_install_entry( } else sprintf(srcfile,".libs/%s",lasource); - strcpy(slnkname,srcfile); + /* executable? */ + if (fexe) { + *src = srcfile; + *dst = dest ? 0 : (char *)last->arg; + + if (!(dctx->cctx->drvflags & SLBT_DRIVER_SILENT)) + if (slbt_output_install(dctx,ectx)) + return -1; + + return (((ret = slbt_spawn(ectx,true)) < 0) || ectx->exitcode) + ? -1 : 0; + } /* libfoo.la --> libfoo.so */ + strcpy(slnkname,srcfile); dot = strrchr(slnkname,'.'); sprintf(dot,dctx->cctx->settings.dsosuffix); diff --git a/src/logic/slbt_exec_link.c b/src/logic/slbt_exec_link.c index 4b5fdc8..23802b1 100644 --- a/src/logic/slbt_exec_link.c +++ b/src/logic/slbt_exec_link.c @@ -411,6 +411,7 @@ static int slbt_exec_link_create_executable( char cwd [PATH_MAX]; char output [PATH_MAX]; char wrapper[PATH_MAX]; + char wraplnk[PATH_MAX]; /* initial state */ slbt_reset_arguments(ectx); @@ -502,6 +503,16 @@ static int slbt_exec_link_create_executable( fclose(ectx->fwrapper); ectx->fwrapper = 0; + if ((size_t)snprintf(wraplnk,sizeof(wraplnk),"%s.exe.wrapper", + dctx->cctx->output) >= sizeof(wraplnk)) + return -1; + + if (slbt_create_symlink( + dctx,ectx, + dctx->cctx->output,wraplnk, + false)) + return -1; + if (rename(wrapper,dctx->cctx->output)) return -1; -- cgit v1.2.3