From 9a02e2b279c811545fbbaed99041b3171d64bb84 Mon Sep 17 00:00:00 2001 From: midipix Date: Wed, 11 Jul 2018 08:46:55 -0400 Subject: driver: added --windres support. --- include/slibtool/slibtool.h | 1 + src/driver/slbt_driver_ctx.c | 32 ++++++++++++++++++++++++++++++++ src/internal/slibtool_driver_impl.h | 2 ++ src/output/slbt_output_config.c | 6 ++++++ src/skin/slbt_skin_default.c | 4 ++++ 5 files changed, 45 insertions(+) diff --git a/include/slibtool/slibtool.h b/include/slibtool/slibtool.h index c12ce0e..78bf62d 100644 --- a/include/slibtool/slibtool.h +++ b/include/slibtool/slibtool.h @@ -199,6 +199,7 @@ struct slbt_host_params { const char * flavor; const char * ar; const char * ranlib; + const char * windres; const char * dlltool; const char * mdso; const char * ldrpath; diff --git a/src/driver/slbt_driver_ctx.c b/src/driver/slbt_driver_ctx.c index 6675adb..44cdd81 100644 --- a/src/driver/slbt_driver_ctx.c +++ b/src/driver/slbt_driver_ctx.c @@ -617,6 +617,31 @@ static int slbt_init_host_params( host->ranlib = drvhost->ranlib; } + /* windres */ + if (host->windres) + cfgmeta->windres = cfgexplicit; + + else if (strcmp(host->flavor,"cygwin") + && strcmp(host->flavor,"midipix") + && strcmp(host->flavor,"mingw")) { + host->windres = ""; + cfgmeta->windres = "not applicable"; + + } else { + if (!(drvhost->windres = calloc(1,toollen))) + return -1; + + if (fnative) { + strcpy(drvhost->windres,"windres"); + cfgmeta->windres = cfgnative; + } else { + sprintf(drvhost->windres,"%s-windres",host->host); + cfgmeta->windres = cfghost; + } + + host->windres = drvhost->windres; + } + /* dlltool */ if (host->dlltool) cfgmeta->dlltool = cfgexplicit; @@ -687,6 +712,9 @@ static void slbt_free_host_params(struct slbt_host_strs * host) if (host->ranlib) free(host->ranlib); + if (host->windres) + free(host->windres); + if (host->dlltool) free(host->dlltool); @@ -1130,6 +1158,10 @@ int slbt_get_driver_ctx( cctx.host.ranlib = entry->arg; break; + case TAG_WINDRES: + cctx.host.windres = entry->arg; + break; + case TAG_DLLTOOL: cctx.host.dlltool = entry->arg; break; diff --git a/src/internal/slibtool_driver_impl.h b/src/internal/slibtool_driver_impl.h index 02345f8..ab4ace1 100644 --- a/src/internal/slibtool_driver_impl.h +++ b/src/internal/slibtool_driver_impl.h @@ -41,6 +41,7 @@ enum app_tags { TAG_FLAVOR, TAG_AR, TAG_RANLIB, + TAG_WINDRES, TAG_DLLTOOL, TAG_MDSO, TAG_IMPLIB, @@ -80,6 +81,7 @@ struct slbt_host_strs { char * flavor; char * ar; char * ranlib; + char * windres; char * dlltool; char * mdso; }; diff --git a/src/output/slbt_output_config.c b/src/output/slbt_output_config.c index 2d29ce9..934da61 100644 --- a/src/output/slbt_output_config.c +++ b/src/output/slbt_output_config.c @@ -65,6 +65,9 @@ int slbt_output_config(const struct slbt_driver_ctx * dctx) if ((len = strlen(cctx->host.ranlib)) > midwidth) midwidth = len; + if ((len = strlen(cctx->host.windres)) > midwidth) + midwidth = len; + if ((len = strlen(cctx->host.dlltool)) > midwidth) midwidth = len; @@ -98,6 +101,9 @@ int slbt_output_config(const struct slbt_driver_ctx * dctx) if (slbt_output_config_line(fdout,"ranlib",cctx->host.ranlib,cctx->cfgmeta.ranlib,midwidth)) return SLBT_SYSTEM_ERROR(dctx); + if (slbt_output_config_line(fdout,"windres",cctx->host.windres,cctx->cfgmeta.windres,midwidth)) + return SLBT_SYSTEM_ERROR(dctx); + if (slbt_output_config_line(fdout,"dlltool",cctx->host.dlltool,cctx->cfgmeta.dlltool,midwidth)) return SLBT_SYSTEM_ERROR(dctx); diff --git a/src/skin/slbt_skin_default.c b/src/skin/slbt_skin_default.c index f691731..d8ad0dd 100644 --- a/src/skin/slbt_skin_default.c +++ b/src/skin/slbt_skin_default.c @@ -95,6 +95,10 @@ const struct argv_option slbt_default_options[] = { "explicitly specify the PE custom import library " "generator to be used"}, + {"windres", 0,TAG_WINDRES,ARGV_OPTARG_REQUIRED,0,0,"", + "explicitly specify the PE resource compiler " + "to be used"}, + {"implib", 0,TAG_IMPLIB,ARGV_OPTARG_REQUIRED,0, "idata|dsometa",0, "PE import libraries should either use the legacy " -- cgit v1.2.3