From 64ff68c8847adb230beca184195a66d424f3dfa0 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Wed, 12 Feb 2020 09:03:51 +0100 Subject: [PATCH] wrc: Add --nls-dir option. Signed-off-by: Alexandre Julliard --- tools/wrc/Makefile.in | 2 ++ tools/wrc/wrc.c | 9 +++++++++ tools/wrc/wrc.h | 2 ++ tools/wrc/wrc.man.in | 4 ++++ 4 files changed, 17 insertions(+) diff --git a/tools/wrc/Makefile.in b/tools/wrc/Makefile.in index c81276ebc68..f68081847ee 100644 --- a/tools/wrc/Makefile.in +++ b/tools/wrc/Makefile.in @@ -16,7 +16,9 @@ LEX_SRCS = parser.l BISON_SRCS = parser.y wrc_EXTRADEFS = \ + -DNLSDIR="\"${nlsdir}\"" \ -DINCLUDEDIR="\"${includedir}\"" \ + -DBIN_TO_NLSDIR=\"`$(MAKEDEP) -R ${bindir} ${nlsdir}`\" \ -DBIN_TO_INCLUDEDIR=\"`$(MAKEDEP) -R ${bindir} ${includedir}`\" EXTRALIBS = $(GETTEXTPO_LIBS) -lwpp diff --git a/tools/wrc/wrc.c b/tools/wrc/wrc.c index f81fe7baa6f..6c1887a788f 100644 --- a/tools/wrc/wrc.c +++ b/tools/wrc/wrc.c @@ -66,6 +66,7 @@ static const char usage[] = " -J, --input-format=FORMAT The input format (either `rc' or `rc16')\n" " -l, --language=LANG Set default language to LANG (default is neutral {0, 0})\n" " -m16, -m32, -m64 Build for 16-bit, 32-bit resp. 64-bit platforms\n" + " --nls-dir=DIR Directory containing the NLS codepage mappings\n" " --no-use-temp-file Ignored for compatibility with windres\n" " --nostdinc Disables searching the standard include path\n" " -o, --output=FILE Output to file (default is infile.res)\n" @@ -157,6 +158,7 @@ char *input_name = NULL; /* The name given on the command-line */ static char *temp_name = NULL; /* Temporary file for preprocess pipe */ static const char *includedir; +const char *nlsdirs[3] = { NULL, NLSDIR, NULL }; int line_number = 1; /* The current line */ int char_number = 1; /* The current char pos within the line */ @@ -175,6 +177,7 @@ enum long_options_values LONG_OPT_NOSTDINC = 1, LONG_OPT_TMPFILE, LONG_OPT_NOTMPFILE, + LONG_OPT_NLS_DIR, LONG_OPT_PO_DIR, LONG_OPT_PREPROCESSOR, LONG_OPT_SYSROOT, @@ -196,6 +199,7 @@ static const struct option long_options[] = { { "input", 1, NULL, 'i' }, { "input-format", 1, NULL, 'J' }, { "language", 1, NULL, 'l' }, + { "nls-dir", 1, NULL, LONG_OPT_NLS_DIR }, { "no-use-temp-file", 0, NULL, LONG_OPT_NOTMPFILE }, { "nostdinc", 0, NULL, LONG_OPT_NOSTDINC }, { "output", 1, NULL, 'o' }, @@ -349,6 +353,8 @@ static void init_argv0_dir( const char *argv0 ) if (p == dir) p++; *p = 0; includedir = strmake( "%s/%s", dir, BIN_TO_INCLUDEDIR ); + if (strendswith( dir, "/tools/wrc" )) nlsdirs[0] = strmake( "%s/../../nls", dir ); + else nlsdirs[0] = strmake( "%s/%s", dir, BIN_TO_NLSDIR ); free( dir ); #endif } @@ -408,6 +414,9 @@ int main(int argc,char *argv[]) case LONG_OPT_NOTMPFILE: if (debuglevel) warning("--no-use-temp-file option not yet supported, ignored.\n"); break; + case LONG_OPT_NLS_DIR: + nlsdirs[0] = xstrdup( optarg ); + break; case LONG_OPT_PO_DIR: po_dir = xstrdup( optarg ); break; diff --git a/tools/wrc/wrc.h b/tools/wrc/wrc.h index 9664dd0392e..24b0e28904f 100644 --- a/tools/wrc/wrc.h +++ b/tools/wrc/wrc.h @@ -45,6 +45,8 @@ extern int check_utf8; extern char *input_name; extern char *cmdline; +extern const char *nlsdirs[]; + extern int line_number; extern int char_number; diff --git a/tools/wrc/wrc.man.in b/tools/wrc/wrc.man.in index 24dca049023..e3ad8fca4d9 100644 --- a/tools/wrc/wrc.man.in +++ b/tools/wrc/wrc.man.in @@ -80,6 +80,10 @@ Generate resources for 16-bit, 32-bit or 64-bit platforms respectively. The only difference between 32-bit and 64-bit is whether the _WIN64 preprocessor symbol is defined. .TP +.I \fB\-\-nls-dir=\fIdir\fR +Specify the directory to search for the NLS files containing the +codepage mapping tables. +.TP .I \fB\-\-nostdinc\fR Do not search the standard include path, look for include files only in the directories explicitly specified with the \fB\-I\fR option.