From fc8ee9c0c22a831f03d35885e14ac72ddc91a04c Mon Sep 17 00:00:00 2001 From: midipix Date: Tue, 13 Feb 2024 16:22:20 +0000 Subject: driver: rlibtool mode: also derive DLLTOOL from the located libtool script. --- src/driver/slbt_driver_ctx.c | 9 ++++++++- src/driver/slbt_host_params.c | 7 ++++--- src/internal/slibtool_driver_impl.h | 3 ++- src/internal/slibtool_lconf_impl.c | 11 +++++++++++ 4 files changed, 25 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/driver/slbt_driver_ctx.c b/src/driver/slbt_driver_ctx.c index a6e93d0..6f96e42 100644 --- a/src/driver/slbt_driver_ctx.c +++ b/src/driver/slbt_driver_ctx.c @@ -340,6 +340,7 @@ int slbt_get_driver_ctx( uint64_t lflags; const char * cfgmeta_ar; const char * cfgmeta_ranlib; + const char * cfgmeta_dlltool; if (flags & SLBT_DRIVER_MODE_AR) argv_optv_init(slbt_ar_options,optv); @@ -395,6 +396,7 @@ int slbt_get_driver_ctx( cfgmeta_ar = 0; cfgmeta_ranlib = 0; + cfgmeta_dlltool = 0; /* get options */ for (entry=meta->entries; entry->fopt || entry->arg; entry++) { @@ -602,6 +604,7 @@ int slbt_get_driver_ctx( case TAG_DLLTOOL: cctx.host.dlltool = entry->arg; + cfgmeta_dlltool = cfgexplicit; break; case TAG_MDSO: @@ -812,6 +815,9 @@ int slbt_get_driver_ctx( if (ctx->cctx.host.ranlib && !cfgmeta_ranlib) cfgmeta_ranlib = cfglconf; + if (ctx->cctx.host.dlltool && !cfgmeta_dlltool) + cfgmeta_dlltool = cfglconf; + if (cmdnoshared) lflags &= ~(uint64_t)SLBT_DRIVER_DISABLE_STATIC; @@ -852,7 +858,8 @@ int slbt_get_driver_ctx( &ctx->cctx.host, &ctx->cctx.cfgmeta, cfgmeta_ar, - cfgmeta_ranlib)) + cfgmeta_ranlib, + cfgmeta_dlltool)) return slbt_get_driver_ctx_fail(&ctx->ctx,0); /* flavor settings */ diff --git a/src/driver/slbt_host_params.c b/src/driver/slbt_host_params.c index 5811e02..f63f9b3 100644 --- a/src/driver/slbt_host_params.c +++ b/src/driver/slbt_host_params.c @@ -137,7 +137,8 @@ int slbt_init_host_params( struct slbt_host_params * host, struct slbt_host_params * cfgmeta, const char * cfgmeta_ar, - const char * cfgmeta_ranlib) + const char * cfgmeta_ranlib, + const char * cfgmeta_dlltool) { int fdcwd; int arprobe; @@ -413,7 +414,7 @@ int slbt_init_host_params( /* dlltool */ if (host->dlltool) - cfgmeta->dlltool = cfgexplicit; + cfgmeta->dlltool = cfgmeta_dlltool ? cfgmeta_dlltool : cfgexplicit; else if (strcmp(host->flavor,"cygwin") && strcmp(host->flavor,"midipix") @@ -622,7 +623,7 @@ int slbt_set_alternate_host( &ictx->ctx.ahost, &ictx->ctx.cctx.ahost, &ictx->ctx.cctx.acfgmeta, - 0,0)) { + 0,0,0)) { slbt_free_host_params(&ictx->ctx.ahost); return SLBT_CUSTOM_ERROR(ctx,SLBT_ERR_HOST_INIT); } diff --git a/src/internal/slibtool_driver_impl.h b/src/internal/slibtool_driver_impl.h index 948d68c..2644e27 100644 --- a/src/internal/slibtool_driver_impl.h +++ b/src/internal/slibtool_driver_impl.h @@ -245,7 +245,8 @@ int slbt_init_host_params( struct slbt_host_params * host, struct slbt_host_params * cfgmeta, const char * cfgmeta_ar, - const char * cfgmeta_ranlib); + const char * cfgmeta_ranlib, + const char * cfgmeta_dlltool); void slbt_free_host_params(struct slbt_host_strs * host); diff --git a/src/internal/slibtool_lconf_impl.c b/src/internal/slibtool_lconf_impl.c index da0ffdd..c6c2f2a 100644 --- a/src/internal/slibtool_lconf_impl.c +++ b/src/internal/slibtool_lconf_impl.c @@ -806,6 +806,17 @@ int slbt_get_lconf_flags( } + /* dlltool tool (optional) */ + if (!ctx->cctx.host.dlltool) { + if (slbt_get_lconf_var(addr,cap,"DLLTOOL=",&val) >= 0) { + if (val[0] && !(ctx->host.dlltool = strdup(val))) + return SLBT_SYSTEM_ERROR(dctx,0); + + ctx->cctx.host.dlltool = ctx->host.dlltool; + } + } + + /* all done */ ctx->lconf.addr = addr; ctx->lconf.size = st.st_size; -- cgit v1.2.3