summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2024-02-16 05:54:17 +0000
committermidipix <writeonce@midipix.org>2024-02-16 05:59:56 +0000
commit2611275c5f0a180c96963c9b1c4d2f1d76a04b5d (patch)
tree122822fb588318e0a9968c5a98d3c94c4e67c6a4 /src
parentd895920cf970aa2f8a23530334e1eebd649cc615 (diff)
downloadslibtool-2611275c5f0a180c96963c9b1c4d2f1d76a04b5d.tar.bz2
slibtool-2611275c5f0a180c96963c9b1c4d2f1d76a04b5d.tar.xz
driver: host.ar, host.ranlib: added support for tool-specific argument vector.
Diffstat (limited to 'src')
-rw-r--r--src/driver/slbt_driver_ctx.c65
-rw-r--r--src/internal/slibtool_lconf_impl.c4
2 files changed, 67 insertions, 2 deletions
diff --git a/src/driver/slbt_driver_ctx.c b/src/driver/slbt_driver_ctx.c
index 82514bc..bbc1dd9 100644
--- a/src/driver/slbt_driver_ctx.c
+++ b/src/driver/slbt_driver_ctx.c
@@ -317,6 +317,64 @@ static int slbt_driver_fail_incompatible_args(
return slbt_get_driver_ctx_fail(0,meta);
}
+
+static int slbt_driver_parse_tool_argv(const char * tool, char *** tool_argv)
+{
+ int argc;
+ char ** argv;
+ const char * ch;
+ const char * mark;
+
+ if (!(ch = tool))
+ return 0;
+
+ argc = 1;
+
+ for (; *ch == ' '; )
+ ch++;
+
+ for (; *ch; ) {
+ if (*ch++ == ' ') {
+ argc++;
+
+ for (; (*ch == ' '); )
+ ch++;
+ }
+ }
+
+ if (argc == 1)
+ return 0;
+
+ if (!(*tool_argv = calloc(++argc,sizeof(char *))))
+ return -1;
+
+ for (ch=tool; (*ch == ' '); ch++)
+ (void)0;
+
+ argv = *tool_argv;
+ mark = ch;
+
+ for (; *ch; ) {
+ if (*ch == ' ') {
+ if (!(*argv++ = strndup(mark,ch-mark)))
+ return -1;
+
+ for (; (*ch == ' '); )
+ ch++;
+
+ mark = ch;
+ } else {
+ ch++;
+ }
+ }
+
+ if (!(*argv++ = strndup(mark,ch-mark)))
+ return -1;
+
+ return 0;
+}
+
+
int slbt_get_driver_ctx(
char ** argv,
char ** envp,
@@ -883,6 +941,13 @@ int slbt_get_driver_ctx(
cfgmeta_dlltool))
return slbt_get_driver_ctx_fail(&ctx->ctx,0);
+ /* host tool arguments */
+ if (slbt_driver_parse_tool_argv(ctx->cctx.host.ar,&ctx->host.ar_argv) < 0)
+ return slbt_get_driver_ctx_fail(&ctx->ctx,0);
+
+ if (slbt_driver_parse_tool_argv(ctx->cctx.host.ranlib,&ctx->host.ranlib_argv) < 0)
+ return slbt_get_driver_ctx_fail(&ctx->ctx,0);
+
/* flavor settings */
slbt_init_flavor_settings(
&ctx->cctx,0,
diff --git a/src/internal/slibtool_lconf_impl.c b/src/internal/slibtool_lconf_impl.c
index 88dc873..5daa2f4 100644
--- a/src/internal/slibtool_lconf_impl.c
+++ b/src/internal/slibtool_lconf_impl.c
@@ -799,7 +799,7 @@ int slbt_get_lconf_flags(
/* ar tool */
if (!ctx->cctx.host.ar) {
- if (slbt_get_lconf_var(addr,cap,"AR=",0,&val) < 0)
+ if (slbt_get_lconf_var(addr,cap,"AR=",0x20,&val) < 0)
return SLBT_CUSTOM_ERROR(
dctx,SLBT_ERR_LCONF_PARSE);
@@ -812,7 +812,7 @@ int slbt_get_lconf_flags(
/* ranlib tool */
if (!ctx->cctx.host.ranlib) {
- if (slbt_get_lconf_var(addr,cap,"RANLIB=",0,&val) < 0)
+ if (slbt_get_lconf_var(addr,cap,"RANLIB=",0x20,&val) < 0)
return SLBT_CUSTOM_ERROR(
dctx,SLBT_ERR_LCONF_PARSE);