diff options
author | midipix <writeonce@midipix.org> | 2021-05-07 17:13:54 +0000 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2021-05-07 17:13:54 +0000 |
commit | fb9dae2d4e56b78852332a271da059c9cb21b108 (patch) | |
tree | 5942e8e3548fcf78b29d745ef3fe228276c3fe9d | |
parent | c860590a4bc33dfa817ccad083be9146f9da38b1 (diff) | |
download | slibtool-fb9dae2d4e56b78852332a271da059c9cb21b108.tar.bz2 slibtool-fb9dae2d4e56b78852332a271da059c9cb21b108.tar.xz |
slbt_exec_install_entry(): account for -release used alongside -version-info.
-rw-r--r-- | src/logic/slbt_exec_install.c | 39 |
1 files changed, 35 insertions, 4 deletions
diff --git a/src/logic/slbt_exec_install.c b/src/logic/slbt_exec_install.c index 1faa305..1afeb27 100644 --- a/src/logic/slbt_exec_install.c +++ b/src/logic/slbt_exec_install.c @@ -329,6 +329,7 @@ static int slbt_exec_install_entry( char * dot; char * base; char * host; + char * mark; char * slash; char * suffix; char * dsosuffix; @@ -343,6 +344,7 @@ static int slbt_exec_install_entry( bool fexe = false; bool fpe; bool frelease; + bool fdualver; bool farchive; size_t slen; size_t dlen; @@ -437,12 +439,22 @@ static int slbt_exec_install_entry( slen = sizeof(slnkname); slen -= (dot - slnkname); + /* detect -release, exclusively or alongside -version-info */ + frelease = false; + fdualver = false; + /* libfoo.a --> libfoo.so.release */ sprintf(dot,"%s.release",dsosuffix); - frelease = fstatat(fdcwd,slnkname,&st,0) ? false : true; + frelease = !fstatat(fdcwd,slnkname,&st,0); + + /* libfoo.a --> libfoo.so.dualver */ + if (!frelease) { + sprintf(dot,"%s.dualver",dsosuffix); + fdualver = !fstatat(fdcwd,slnkname,&st,0); + } /* libfoo.so.def.{flavor} */ - if (frelease) { + if (frelease || fdualver) { strcpy(dlnkname,slnkname); slash = strrchr(dlnkname,'/'); @@ -453,8 +465,27 @@ static int slbt_exec_install_entry( if (slbt_readlinkat(fdcwd,slnkname,slash,dlen)) return SLBT_SYSTEM_ERROR(dctx,slnkname); - slash += strlen(slash); - strcpy(slash,".def.host"); + if (fdualver) { + /* remove .patch */ + if (!(mark = strrchr(dlnkname,'.'))) + return SLBT_CUSTOM_ERROR(dctx,SLBT_ERR_INSTALL_FLOW); + + *mark = 0; + + /* remove .minor */ + if (!(mark = strrchr(dlnkname,'.'))) + return SLBT_CUSTOM_ERROR(dctx,SLBT_ERR_INSTALL_FLOW); + + *mark = 0; + + /* remove .major */ + if (!(mark = strrchr(dlnkname,'.'))) + return SLBT_CUSTOM_ERROR(dctx,SLBT_ERR_INSTALL_FLOW); + } else { + mark = slash += strlen(slash); + } + + strcpy(mark,".def.host"); if (slbt_readlinkat(fdcwd,dlnkname,hosttag,sizeof(hosttag))) return SLBT_SYSTEM_ERROR(dctx,slnkname); |