wrc: Add --nls-dir option.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
feature/deterministic
Alexandre Julliard 2020-02-12 09:03:51 +01:00
parent 37d977da22
commit 64ff68c884
4 changed files with 17 additions and 0 deletions

View File

@ -16,7 +16,9 @@ LEX_SRCS = parser.l
BISON_SRCS = parser.y BISON_SRCS = parser.y
wrc_EXTRADEFS = \ wrc_EXTRADEFS = \
-DNLSDIR="\"${nlsdir}\"" \
-DINCLUDEDIR="\"${includedir}\"" \ -DINCLUDEDIR="\"${includedir}\"" \
-DBIN_TO_NLSDIR=\"`$(MAKEDEP) -R ${bindir} ${nlsdir}`\" \
-DBIN_TO_INCLUDEDIR=\"`$(MAKEDEP) -R ${bindir} ${includedir}`\" -DBIN_TO_INCLUDEDIR=\"`$(MAKEDEP) -R ${bindir} ${includedir}`\"
EXTRALIBS = $(GETTEXTPO_LIBS) -lwpp EXTRALIBS = $(GETTEXTPO_LIBS) -lwpp

View File

@ -66,6 +66,7 @@ static const char usage[] =
" -J, --input-format=FORMAT The input format (either `rc' or `rc16')\n" " -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" " -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" " -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" " --no-use-temp-file Ignored for compatibility with windres\n"
" --nostdinc Disables searching the standard include path\n" " --nostdinc Disables searching the standard include path\n"
" -o, --output=FILE Output to file (default is infile.res)\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 char *temp_name = NULL; /* Temporary file for preprocess pipe */
static const char *includedir; static const char *includedir;
const char *nlsdirs[3] = { NULL, NLSDIR, NULL };
int line_number = 1; /* The current line */ int line_number = 1; /* The current line */
int char_number = 1; /* The current char pos within the 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_NOSTDINC = 1,
LONG_OPT_TMPFILE, LONG_OPT_TMPFILE,
LONG_OPT_NOTMPFILE, LONG_OPT_NOTMPFILE,
LONG_OPT_NLS_DIR,
LONG_OPT_PO_DIR, LONG_OPT_PO_DIR,
LONG_OPT_PREPROCESSOR, LONG_OPT_PREPROCESSOR,
LONG_OPT_SYSROOT, LONG_OPT_SYSROOT,
@ -196,6 +199,7 @@ static const struct option long_options[] = {
{ "input", 1, NULL, 'i' }, { "input", 1, NULL, 'i' },
{ "input-format", 1, NULL, 'J' }, { "input-format", 1, NULL, 'J' },
{ "language", 1, NULL, 'l' }, { "language", 1, NULL, 'l' },
{ "nls-dir", 1, NULL, LONG_OPT_NLS_DIR },
{ "no-use-temp-file", 0, NULL, LONG_OPT_NOTMPFILE }, { "no-use-temp-file", 0, NULL, LONG_OPT_NOTMPFILE },
{ "nostdinc", 0, NULL, LONG_OPT_NOSTDINC }, { "nostdinc", 0, NULL, LONG_OPT_NOSTDINC },
{ "output", 1, NULL, 'o' }, { "output", 1, NULL, 'o' },
@ -349,6 +353,8 @@ static void init_argv0_dir( const char *argv0 )
if (p == dir) p++; if (p == dir) p++;
*p = 0; *p = 0;
includedir = strmake( "%s/%s", dir, BIN_TO_INCLUDEDIR ); 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 ); free( dir );
#endif #endif
} }
@ -408,6 +414,9 @@ int main(int argc,char *argv[])
case LONG_OPT_NOTMPFILE: case LONG_OPT_NOTMPFILE:
if (debuglevel) warning("--no-use-temp-file option not yet supported, ignored.\n"); if (debuglevel) warning("--no-use-temp-file option not yet supported, ignored.\n");
break; break;
case LONG_OPT_NLS_DIR:
nlsdirs[0] = xstrdup( optarg );
break;
case LONG_OPT_PO_DIR: case LONG_OPT_PO_DIR:
po_dir = xstrdup( optarg ); po_dir = xstrdup( optarg );
break; break;

View File

@ -45,6 +45,8 @@ extern int check_utf8;
extern char *input_name; extern char *input_name;
extern char *cmdline; extern char *cmdline;
extern const char *nlsdirs[];
extern int line_number; extern int line_number;
extern int char_number; extern int char_number;

View File

@ -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 only difference between 32-bit and 64-bit is whether
the _WIN64 preprocessor symbol is defined. the _WIN64 preprocessor symbol is defined.
.TP .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 .I \fB\-\-nostdinc\fR
Do not search the standard include path, look for include files only Do not search the standard include path, look for include files only
in the directories explicitly specified with the \fB\-I\fR option. in the directories explicitly specified with the \fB\-I\fR option.