From 4fdf35cdec0bf5e6bad4d805233803767dc6ce08 Mon Sep 17 00:00:00 2001 From: midipix Date: Tue, 19 Apr 2016 09:43:49 -0400 Subject: link mode: PE support: generate host tag symlinks for implib installation. --- src/logic/slbt_exec_link.c | 46 +++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 43 insertions(+), 3 deletions(-) diff --git a/src/logic/slbt_exec_link.c b/src/logic/slbt_exec_link.c index 0275455..fc6eab9 100644 --- a/src/logic/slbt_exec_link.c +++ b/src/logic/slbt_exec_link.c @@ -411,10 +411,48 @@ static int slbt_exec_link_create_import_library( struct slbt_exec_ctx * ectx, char * impfilename, char * deffilename, - char * soname) + char * soname, + bool ftag) { + char * slash; char * dlltool[8]; char program[PATH_MAX]; + char hosttag[PATH_MAX]; + char hostlnk[PATH_MAX]; + + /* libfoo.so.def.{flavor} */ + if (ftag) { + if ((size_t)snprintf(hosttag,sizeof(hosttag),"%s.%s", + deffilename, + dctx->cctx->host.flavor) >= sizeof(hosttag)) + return -1; + + if ((size_t)snprintf(hostlnk,sizeof(hostlnk),"%s.host", + deffilename) >= sizeof(hostlnk)) + return -1; + + /* libfoo.so.def is under .libs/ */ + if (!(slash = strrchr(deffilename,'/'))) + return -1; + + if (slbt_create_symlink( + dctx,ectx, + deffilename, + hosttag, + false)) + return -1; + + /* libfoo.so.def.{flavor} is under .libs/ */ + if (!(slash = strrchr(hosttag,'/'))) + return -1; + + if (slbt_create_symlink( + dctx,ectx, + ++slash, + hostlnk, + false)) + return -1; + } /* dlltool argv */ if ((size_t)snprintf(program,sizeof(program),"%s", @@ -898,7 +936,8 @@ int slbt_exec_link( dctx,ectx, ectx->pimpfilename, ectx->deffilename, - soname)) + soname, + true)) return -1; /* symlink: libfoo.lib.a --> libfoo.x.lib.a */ @@ -924,7 +963,8 @@ int slbt_exec_link( dctx,ectx, ectx->vimpfilename, ectx->deffilename, - soname)) + soname, + false)) return -1; } } -- cgit v1.2.3