summaryrefslogtreecommitdiff
path: root/src/logic
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2016-04-30 10:10:24 -0400
committermidipix <writeonce@midipix.org>2016-04-30 10:10:24 -0400
commit02ae4d9d252c530a8c1aa3f48197f650844655e7 (patch)
treef0fb8409a1b1edc15c2bddd4ff449cc4a6b18bdc /src/logic
parentfd1cb820043c445d06f76ce5ab00be232bf36c27 (diff)
downloadslibtool-02ae4d9d252c530a8c1aa3f48197f650844655e7.tar.bz2
slibtool-02ae4d9d252c530a8c1aa3f48197f650844655e7.tar.xz
link mode: -disable-shared: create libfoo.a as a symlink to .libs/libfoo.a.
Diffstat (limited to 'src/logic')
-rw-r--r--src/logic/slbt_exec_link.c35
1 files changed, 32 insertions, 3 deletions
diff --git a/src/logic/slbt_exec_link.c b/src/logic/slbt_exec_link.c
index 452c9da..0c188a7 100644
--- a/src/logic/slbt_exec_link.c
+++ b/src/logic/slbt_exec_link.c
@@ -540,13 +540,19 @@ static int slbt_exec_link_create_archive(
const struct slbt_driver_ctx * dctx,
struct slbt_exec_ctx * ectx,
const char * arfilename,
- bool fpic)
+ bool fpic,
+ bool fprimary)
{
char ** aarg;
char ** parg;
+ char * base;
+ char * mark;
+ char * slash;
char * ranlib[3];
char program[PATH_MAX];
char output [PATH_MAX];
+ char arfile [PATH_MAX];
+ char arlink [PATH_MAX];
/* initial state */
slbt_reset_arguments(ectx);
@@ -622,6 +628,29 @@ static int slbt_exec_link_create_archive(
if ((slbt_spawn(ectx,true) < 0) || ectx->exitcode)
return -1;
+ if (fprimary && (dctx->cctx->drvflags & SLBT_DRIVER_DISABLE_SHARED)) {
+ strcpy(arlink,output);
+ mark = strrchr(arlink,'/');
+ *mark = 0;
+
+ base = output + (mark - arlink);
+ base++;
+
+ if ((slash = strrchr(arlink,'/')))
+ slash++;
+ else
+ slash = arlink;
+
+ strcpy(slash,base);
+ sprintf(arfile,".libs/%s",base);
+
+ if (slbt_exec_link_remove_file(dctx,ectx,arlink))
+ return -1;
+
+ if (symlink(arfile,arlink))
+ return -1;
+ }
+
return 0;
}
@@ -1024,7 +1053,7 @@ int slbt_exec_link(
/* non-pic libfoo.a */
if (dot && !strcmp(dot,".a"))
- if (slbt_exec_link_create_archive(dctx,ectx,output,false)) {
+ if (slbt_exec_link_create_archive(dctx,ectx,output,false,false)) {
slbt_free_exec_ctx(actx);
return -1;
}
@@ -1049,7 +1078,7 @@ int slbt_exec_link(
if (slbt_exec_link_create_archive(
dctx,ectx,
ectx->arfilename,
- fpic)) {
+ fpic,true)) {
slbt_free_exec_ctx(actx);
return -1;
}