diff options
author | midipix <writeonce@midipix.org> | 2018-08-13 15:18:09 +0000 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2018-08-13 19:26:24 -0400 |
commit | 499a718d986776354bbd4e7787ea1c30c851e384 (patch) | |
tree | 4d68ae7b43b9ae0ccfca293d6a0d7b98ce25cdab /src | |
parent | 0801fe615c2657fec3205626c7ae60a28db680fe (diff) | |
download | slibtool-499a718d986776354bbd4e7787ea1c30c851e384.tar.bz2 slibtool-499a718d986776354bbd4e7787ea1c30c851e384.tar.xz |
driver: added --heuristics support.
Diffstat (limited to 'src')
-rw-r--r-- | src/driver/slbt_driver_ctx.c | 36 | ||||
-rw-r--r-- | src/internal/slibtool_driver_impl.h | 1 | ||||
-rw-r--r-- | src/skin/slbt_skin_default.c | 6 |
3 files changed, 43 insertions, 0 deletions
diff --git a/src/driver/slbt_driver_ctx.c b/src/driver/slbt_driver_ctx.c index eac59c5..658b62b 100644 --- a/src/driver/slbt_driver_ctx.c +++ b/src/driver/slbt_driver_ctx.c @@ -14,6 +14,7 @@ #include "slibtool_version.h" #include "slibtool_driver_impl.h" #include "slibtool_errinfo_impl.h" +#include "slibtool_lconf_impl.h" #include "argv/argv.h" /* package info */ @@ -966,6 +967,8 @@ int slbt_get_driver_ctx( struct argv_meta * meta; struct argv_entry * entry; const char * program; + const char * lconf; + uint64_t lflags; argv_optv_init(slbt_default_options,optv); @@ -989,7 +992,9 @@ int slbt_get_driver_ctx( fdctx->fderr))) return -1; + lconf = 0; program = argv_program_name(argv[0]); + memset(&cctx,0,sizeof(cctx)); /* shared and static objects: enable by default, disable by ~switch */ @@ -1013,6 +1018,11 @@ int slbt_get_driver_ctx( cctx.drvflags |= SLBT_DRIVER_VERSION; break; + case TAG_HEURISTICS: + cctx.drvflags |= SLBT_DRIVER_HEURISTICS; + lconf = entry->arg; + break; + case TAG_MODE: if (!strcmp("clean",entry->arg)) cctx.mode = SLBT_MODE_CLEAN; @@ -1286,6 +1296,32 @@ int slbt_get_driver_ctx( if (!(ctx = slbt_driver_ctx_alloc(meta,fdctx,&cctx))) return slbt_get_driver_ctx_fail(meta); + /* heuristics */ + if (cctx.drvflags & SLBT_DRIVER_HEURISTICS) { + if (slbt_get_lconf_flags(&ctx->ctx,lconf,&lflags) < 0) { + slbt_free_driver_ctx(&ctx->ctx); + return -1; + } + + cctx.drvflags &= ~(uint64_t)SLBT_DRIVER_DISABLE_STATIC; + cctx.drvflags &= ~(uint64_t)SLBT_DRIVER_DISABLE_SHARED; + + cctx.drvflags |= lflags; + cctx.drvflags |= SLBT_DRIVER_SHARED; + cctx.drvflags |= SLBT_DRIVER_STATIC; + + /* -disable-static? */ + if (cctx.drvflags & SLBT_DRIVER_DISABLE_STATIC) + cctx.drvflags &= ~(uint64_t)SLBT_DRIVER_STATIC; + + /* -disable-shared? */ + if (cctx.drvflags & SLBT_DRIVER_DISABLE_SHARED) + cctx.drvflags &= ~(uint64_t)SLBT_DRIVER_SHARED; + + ctx->cctx.drvflags = cctx.drvflags; + } + + /* ctx */ ctx->ctx.program = program; ctx->ctx.cctx = &ctx->cctx; ctx->targv = sargv.targv; diff --git a/src/internal/slibtool_driver_impl.h b/src/internal/slibtool_driver_impl.h index ab4ace1..451b1a6 100644 --- a/src/internal/slibtool_driver_impl.h +++ b/src/internal/slibtool_driver_impl.h @@ -62,6 +62,7 @@ enum app_tags { TAG_NO_INSTALL, TAG_PREFER_PIC, TAG_PREFER_NON_PIC, + TAG_HEURISTICS, TAG_SHARED, TAG_STATIC, TAG_ALL_STATIC, diff --git a/src/skin/slbt_skin_default.c b/src/skin/slbt_skin_default.c index ce8df6f..7678f2a 100644 --- a/src/skin/slbt_skin_default.c +++ b/src/skin/slbt_skin_default.c @@ -11,6 +11,12 @@ const struct argv_option slbt_default_options[] = { {"help-all", 'h',TAG_HELP_ALL,ARGV_OPTARG_NONE,0,0,0, "show comprehensive help information"}, + {"heuristics", 0,TAG_HEURISTICS,ARGV_OPTARG_OPTIONAL,0,0,"<path>", + "enable/disable creation of shared/static libraries " + "by parsing a project-specific shell script, " + "the %s of which is either provided via this " + "command-line argument, or detected by the program."}, + {"mode", 0,TAG_MODE,ARGV_OPTARG_REQUIRED,0, "clean|compile|execute|finish" "|install|link|uninstall",0, |