diff options
author | midipix <writeonce@midipix.org> | 2016-04-24 09:14:59 -0400 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2016-04-24 10:31:23 -0400 |
commit | 112a2bc026f48bf9453c2bb8766f730e8c0d1bc9 (patch) | |
tree | ac307b883e62fd368f0a3e9e0128a01e55479cda | |
parent | 1f87fd5f1cddc5ad065a3f85b5fd5d09d709dca1 (diff) | |
download | slibtool-112a2bc026f48bf9453c2bb8766f730e8c0d1bc9.tar.bz2 slibtool-112a2bc026f48bf9453c2bb8766f730e8c0d1bc9.tar.xz |
execution context: link mode: install mode: added -release semantics support.
-rw-r--r-- | include/slibtool/slibtool.h | 1 | ||||
-rw-r--r-- | src/driver/slbt_driver_ctx.c | 1 | ||||
-rw-r--r-- | src/logic/slbt_exec_ctx.c | 12 | ||||
-rw-r--r-- | src/logic/slbt_exec_install.c | 12 | ||||
-rw-r--r-- | src/logic/slbt_exec_link.c | 49 | ||||
-rw-r--r-- | src/skin/slbt_skin_default.c | 5 |
6 files changed, 70 insertions, 10 deletions
diff --git a/include/slibtool/slibtool.h b/include/slibtool/slibtool.h index 2b55a84..953ab19 100644 --- a/include/slibtool/slibtool.h +++ b/include/slibtool/slibtool.h @@ -121,6 +121,7 @@ struct slbt_exec_ctx { char * lafilename; char * laifilename; char * dsofilename; + char * relfilename; char * deffilename; char * dimpfilename; char * pimpfilename; diff --git a/src/driver/slbt_driver_ctx.c b/src/driver/slbt_driver_ctx.c index beb5122..1c6343f 100644 --- a/src/driver/slbt_driver_ctx.c +++ b/src/driver/slbt_driver_ctx.c @@ -809,6 +809,7 @@ int slbt_get_driver_ctx( case TAG_RELEASE: cctx.release = entry->arg; + cctx.drvflags |= SLBT_DRIVER_AVOID_VERSION; break; case TAG_EXPSYM_FILE: diff --git a/src/logic/slbt_exec_ctx.c b/src/logic/slbt_exec_ctx.c index 23cae68..17c6cd8 100644 --- a/src/logic/slbt_exec_ctx.c +++ b/src/logic/slbt_exec_ctx.c @@ -357,6 +357,18 @@ int slbt_get_exec_ctx( dctx->cctx->verinfo.revision, dctx->cctx->settings.impsuffix); ch++; + + /* relfilename */ + if (dctx->cctx->release) { + ictx->ctx.relfilename = ch; + ch += sprintf(ch,"%s%s%s-%s%s", + ictx->ctx.ldirname, + dsoprefix, + dctx->cctx->libname, + dctx->cctx->release, + dctx->cctx->settings.dsosuffix); + ch++; + } } /* linking: exefilename */ diff --git a/src/logic/slbt_exec_install.c b/src/logic/slbt_exec_install.c index a595774..0eddd6d 100644 --- a/src/logic/slbt_exec_install.c +++ b/src/logic/slbt_exec_install.c @@ -233,6 +233,7 @@ static int slbt_exec_install_entry( char lasource[PATH_MAX]; bool fexe = false; bool fpe; + bool frelease; struct stat st; /* executable wrapper? */ @@ -297,9 +298,15 @@ static int slbt_exec_install_entry( dest ? (char *)dest->arg : (char *)last->arg)) return -1; - /* libfoo.a --> libfoo.so */ + /* dot/suffix */ strcpy(slnkname,srcfile); dot = strrchr(slnkname,'.'); + + /* libfoo.a --> libfoo.so.release */ + sprintf(dot,"%s.release",dctx->cctx->settings.dsosuffix); + frelease = stat(slnkname,&st) ? false : true; + + /* libfoo.a --> libfoo.so */ strcpy(dot,dctx->cctx->settings.dsosuffix); /* PE support: does .libs/libfoo.so.def exist? */ @@ -377,6 +384,9 @@ static int slbt_exec_install_entry( false)) return -1; + if (frelease) + return 0; + /* libfoo.so.x.y.z --> libfoo.so.x */ strcpy(slnkname,target); diff --git a/src/logic/slbt_exec_link.c b/src/logic/slbt_exec_link.c index 72e9880..0386941 100644 --- a/src/logic/slbt_exec_link.c +++ b/src/logic/slbt_exec_link.c @@ -588,7 +588,8 @@ static int slbt_exec_link_create_archive( static int slbt_exec_link_create_library( const struct slbt_driver_ctx * dctx, struct slbt_exec_ctx * ectx, - const char * dsofilename) + const char * dsofilename, + const char * relfilename) { char ** parg; char cwd [PATH_MAX]; @@ -632,6 +633,17 @@ static int slbt_exec_link_create_library( *ectx->soname = "-Wl,-soname"; *ectx->lsoname = soname; + } else if (relfilename) { + if ((size_t)snprintf(soname,sizeof(soname),"-Wl,%s%s-%s%s", + dctx->cctx->settings.dsoprefix, + dctx->cctx->libname, + dctx->cctx->release, + dctx->cctx->settings.dsosuffix) + >= sizeof(soname)) + return -1; + + *ectx->soname = "-Wl,-soname"; + *ectx->lsoname = soname; } /* PE: --output-def */ @@ -654,7 +666,9 @@ static int slbt_exec_link_create_library( } /* output */ - if (dctx->cctx->drvflags & SLBT_DRIVER_AVOID_VERSION) { + if (relfilename) { + strcpy(output,relfilename); + } else if (dctx->cctx->drvflags & SLBT_DRIVER_AVOID_VERSION) { strcpy(output,dsofilename); } else { if ((size_t)snprintf(output,sizeof(output),"%s.%d.%d.%d", @@ -841,11 +855,21 @@ static int slbt_exec_link_create_library_symlink( char target[PATH_MAX]; char lnkname[PATH_MAX]; - sprintf(target,"%s.%d.%d.%d", - ectx->dsofilename, - dctx->cctx->verinfo.major, - dctx->cctx->verinfo.minor, - dctx->cctx->verinfo.revision); + if (ectx->relfilename) { + strcpy(target,ectx->relfilename); + sprintf(lnkname,"%s.release",ectx->dsofilename); + + if (slbt_create_symlink( + dctx,ectx, + target,lnkname, + false)) + return -1; + } else + sprintf(target,"%s.%d.%d.%d", + ectx->dsofilename, + dctx->cctx->verinfo.major, + dctx->cctx->verinfo.minor, + dctx->cctx->verinfo.revision); if (fmajor) sprintf(lnkname,"%s.%d", @@ -986,7 +1010,8 @@ int slbt_exec_link( /* linking: libfoo.so.x.y.z */ if (slbt_exec_link_create_library( dctx,ectx, - ectx->dsofilename)) { + ectx->dsofilename, + ectx->relfilename)) { slbt_free_exec_ctx(actx); return -1; } @@ -1007,6 +1032,14 @@ int slbt_exec_link( slbt_free_exec_ctx(actx); return -1; } + } else if (ectx->relfilename) { + /* symlink: libfoo.so --> libfoo-x.y.z.so */ + if (slbt_exec_link_create_library_symlink( + dctx,ectx, + false)) { + slbt_free_exec_ctx(actx); + return -1; + } } /* PE import libraries */ diff --git a/src/skin/slbt_skin_default.c b/src/skin/slbt_skin_default.c index 88c38dd..a223ae8 100644 --- a/src/skin/slbt_skin_default.c +++ b/src/skin/slbt_skin_default.c @@ -99,7 +99,10 @@ const struct argv_option slbt_default_options[] = { {"release", 0,TAG_RELEASE,ARGV_OPTARG_REQUIRED, ARGV_OPTION_HYBRID_ONLY|ARGV_OPTION_HYBRID_SPACE,0,0, - "specify release information"}, + "specify release information; this will result " + "in the generation of libfoo-x.y.z.so, " + "followed by the creation of libfoo.so " + "as a symlink thereto"}, {"export-symbols", 0,TAG_EXPSYM_FILE,ARGV_OPTARG_REQUIRED, ARGV_OPTION_HYBRID_ONLY|ARGV_OPTION_HYBRID_SPACE, |