diff options
author | midipix <writeonce@midipix.org> | 2016-05-20 20:54:35 -0400 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2016-05-20 21:04:52 -0400 |
commit | fe97e7cb46a373d0e1e2ac076271bde9a38083e9 (patch) | |
tree | 2ed5f98798125425452a205e9cdeadc67ac24555 /src | |
parent | 378bccc03ddf06c5f4cec7fa2a9c687fd3d2b6f4 (diff) | |
download | slibtool-fe97e7cb46a373d0e1e2ac076271bde9a38083e9.tar.bz2 slibtool-fe97e7cb46a373d0e1e2ac076271bde9a38083e9.tar.xz |
link mode: support over-linking for an .la wrapper linker input argument.
Diffstat (limited to 'src')
-rw-r--r-- | src/logic/slbt_exec_link.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/logic/slbt_exec_link.c b/src/logic/slbt_exec_link.c index 53ab54c..6f1bb33 100644 --- a/src/logic/slbt_exec_link.c +++ b/src/logic/slbt_exec_link.c @@ -430,7 +430,14 @@ static int slbt_exec_link_create_dep_file( char ** parg; char * popt; char * plib; + char * mark; + char * base; + size_t size; + FILE * fdeps; + char * deplib; + char deplibs[PATH_MAX]; char depfile[PATH_MAX]; + struct stat st; if (ectx->fdeps) fclose(ectx->fdeps); @@ -459,6 +466,40 @@ static int slbt_exec_link_create_dep_file( } else if (!strncmp(*parg,"--library=",10)) { popt = *parg; plib = popt + 10; + } else if ((popt = strrchr(*parg,'.')) && !strcmp(popt,".la")) { + /* import dependency list */ + if ((base = strrchr(*parg,'/'))) + base++; + else + base = *parg; + + strcpy(depfile,*parg); + mark = depfile + (base - *parg); + size = sizeof(depfile) - (base - *parg); + + if ((size_t)snprintf(mark,size,".libs/%s",base) + >= size) + return -1; + + mark = strrchr(mark,'.'); + size = sizeof(depfile) - (mark - depfile); + + if ((size_t)snprintf(mark,size,".a.slibtool.deps") + >= size) + return -1; + + if (stat(depfile,&st)) + return -1; + + if (!(fdeps = fopen(depfile,"r"))) + return -1; + + for (deplib=fgets(deplibs,st.st_size+1,fdeps); deplib; ) { + if (fprintf(ectx->fdeps,"%s",deplib) < 0) + return -1; + + deplib = fgets(deplibs,st.st_size+1,fdeps); + } } if (plib) |