diff options
author | midipix <writeonce@midipix.org> | 2016-03-19 16:32:46 -0400 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2016-03-19 16:32:46 -0400 |
commit | a66d34390e2668c1fe5ac5be3dea056dbe3c767c (patch) | |
tree | 3fcbf0a03c63518ecd541e876f91536b5ddc1f50 | |
parent | 5a916148f05272931f5b717074e9bb5ac60f20fc (diff) | |
download | slibtool-a66d34390e2668c1fe5ac5be3dea056dbe3c767c.tar.bz2 slibtool-a66d34390e2668c1fe5ac5be3dea056dbe3c767c.tar.xz |
driver: added flavor settings.
-rw-r--r-- | include/slibtool/slibtool.h | 12 | ||||
-rw-r--r-- | src/driver/slbt_driver_ctx.c | 36 |
2 files changed, 46 insertions, 2 deletions
diff --git a/include/slibtool/slibtool.h b/include/slibtool/slibtool.h index e64ec70..7105f0a 100644 --- a/include/slibtool/slibtool.h +++ b/include/slibtool/slibtool.h @@ -114,12 +114,24 @@ struct slbt_host_params { const char * dlltool; }; +struct slbt_flavor_settings { + const char * arprefix; + const char * arsuffix; + const char * dsoprefix; + const char * dsosuffix; + const char * exeprefix; + const char * exesuffix; + const char * impprefix; + const char * impsuffix; +}; + struct slbt_common_ctx { uint64_t drvflags; uint64_t actflags; uint64_t fmtflags; struct slbt_host_params host; struct slbt_host_params cfgmeta; + struct slbt_flavor_settings settings; struct slbt_version_info verinfo; enum slbt_mode mode; enum slbt_tag tag; diff --git a/src/driver/slbt_driver_ctx.c b/src/driver/slbt_driver_ctx.c index b9203c8..e8179c5 100644 --- a/src/driver/slbt_driver_ctx.c +++ b/src/driver/slbt_driver_ctx.c @@ -15,6 +15,18 @@ #include "argv/argv.h" +/* flavor settings */ +#define SLBT_FLAVOR_SETTINGS(flavor,arp,ars,dsop,dsos,exep,exes,impp,imps) \ + static const struct slbt_flavor_settings flavor = { \ + arp,ars,dsop,dsos,exep,exes,impp,imps} + +SLBT_FLAVOR_SETTINGS(host_flavor_default, "lib",".a", "lib",".so", "","", "", ""); +SLBT_FLAVOR_SETTINGS(host_flavor_midipix, "lib",".a", "lib",".so", "","", "lib",".lib.a"); +SLBT_FLAVOR_SETTINGS(host_flavor_mingw, "lib",".a", "lib",".dll", "",".exe", "lib",".dll.a"); +SLBT_FLAVOR_SETTINGS(host_flavor_cygwin, "lib",".a", "lib",".dll", "",".exe", "lib",".dll.a"); +SLBT_FLAVOR_SETTINGS(host_flavor_darwin, "lib",".a", "lib",".dylib", "","", "", ""); + + static const char cfgexplicit[] = "command-line argument"; static const char cfghost[] = "derived from <host>"; static const char cfgtarget[] = "derived from <target>"; @@ -389,6 +401,24 @@ static int slbt_init_host_params( return 0; } +static void slbt_init_flavor_settings(struct slbt_common_ctx * cctx) +{ + const struct slbt_flavor_settings * settings; + + if (!strcmp(cctx->host.flavor,"midipix")) + settings = &host_flavor_midipix; + else if (!strcmp(cctx->host.flavor,"mingw")) + settings = &host_flavor_mingw; + else if (!strcmp(cctx->host.flavor,"cygwin")) + settings = &host_flavor_cygwin; + else if (!strcmp(cctx->host.flavor,"darwin")) + settings = &host_flavor_darwin; + else + settings = &host_flavor_default; + + memcpy(&cctx->settings,settings,sizeof(*settings)); +} + static int slbt_init_version_info( struct slbt_driver_ctx_impl * ictx, struct slbt_version_info * verinfo) @@ -600,7 +630,7 @@ int slbt_get_driver_ctx( /* host params */ if ((cctx.drvflags & SLBT_DRIVER_HEURISTICS) || (cctx.drvflags & SLBT_DRIVER_CONFIG) - || (cctx.mode != SLBT_MODE_COMPILE)) + || (cctx.mode != SLBT_MODE_COMPILE)) { if (slbt_init_host_params( &ctx->cctx, &ctx->host, @@ -608,7 +638,9 @@ int slbt_get_driver_ctx( &ctx->cctx.cfgmeta)) { slbt_free_driver_ctx(&ctx->ctx); return -1; - } + } else + slbt_init_flavor_settings(&ctx->cctx); + } /* version info */ if (ctx->cctx.verinfo.verinfo) |