summaryrefslogtreecommitdiff
path: root/src/driver
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2024-03-31 19:35:59 +0000
committermidipix <writeonce@midipix.org>2024-03-31 21:13:08 +0000
commit036a9e07a68379d00e7a05443a88745d129c0915 (patch)
tree82b29071a39b36a42c4907c747e1c1ea670d9556 /src/driver
parentc348919cf1f5014de375fe95303c84a728d6f908 (diff)
downloadslibtool-036a9e07a68379d00e7a05443a88745d129c0915.tar.bz2
slibtool-036a9e07a68379d00e7a05443a88745d129c0915.tar.xz
driver: auto-detect slibtool.cfg in non-heuristics mode where applicable.
Diffstat (limited to 'src/driver')
-rw-r--r--src/driver/slbt_driver_ctx.c30
1 files changed, 29 insertions, 1 deletions
diff --git a/src/driver/slbt_driver_ctx.c b/src/driver/slbt_driver_ctx.c
index 00e1998..de1288e 100644
--- a/src/driver/slbt_driver_ctx.c
+++ b/src/driver/slbt_driver_ctx.c
@@ -400,6 +400,7 @@ int slbt_lib_get_driver_ctx(
struct slbt_obj_list * objlistv;
struct slbt_driver_ctx_impl * ctx;
struct slbt_common_ctx cctx;
+ struct slbt_error_info** errinfp;
const struct argv_option * optv[SLBT_OPTV_ELEMENTS];
struct argv_meta * meta;
struct argv_entry * entry;
@@ -982,10 +983,37 @@ int slbt_lib_get_driver_ctx(
}
/* heuristics */
+ if (mkvars)
+ cctx.drvflags &= ~(uint64_t)SLBT_DRIVER_HEURISTICS;
+
if (cctx.drvflags & SLBT_DRIVER_HEURISTICS) {
- if (slbt_get_lconf_flags(&ctx->ctx,lconf,&lflags) < 0)
+ if (slbt_get_lconf_flags(&ctx->ctx,lconf,&lflags,false) < 0)
return slbt_lib_get_driver_ctx_fail(&ctx->ctx,0);
+ } else {
+ switch (cctx.mode) {
+ case SLBT_MODE_UNKNOWN:
+ case SLBT_MODE_STOOLIE:
+ break;
+
+ case SLBT_MODE_CONFIG:
+ lconf = mkvars ? 0 : "slibtool.cfg";
+ break;
+
+ default:
+ lconf = "slibtool.cfg";
+ break;
+ }
+
+ if (lconf && (errinfp = ctx->errinfp))
+ if (slbt_get_lconf_flags(&ctx->ctx,lconf,&lflags,true) < 0)
+ for (ctx->errinfp=errinfp; *errinfp; errinfp++)
+ *errinfp = 0;
+ if (ctx->lconfctx)
+ cctx.drvflags |= SLBT_DRIVER_HEURISTICS;
+ }
+
+ if (cctx.drvflags & SLBT_DRIVER_HEURISTICS) {
if (ctx->cctx.host.host && !cfgmeta_host)
cfgmeta_host = cfglconf;