Commit 9e4fc4c9 authored by Alexandre Julliard's avatar Alexandre Julliard

Converted winebuild option parsing to use getopt_long. Added a number

of long aliases for the existing short options.
parent bdbde0f8
......@@ -127,7 +127,7 @@ LINTS = $(C_SRCS:.c=.ln)
$(WINDRES) -i $< -o $@
.spec.spec.c:
$(LDPATH) $(WINEBUILD) $(DEFS) -o $@ -M $(MODULE) --spec $<
$(LDPATH) $(WINEBUILD) $(DEFS) -o $@ --main-module $(MODULE) --spec $<
.spec.spec.def:
$(LDPATH) $(WINEBUILD) $(DEFS) -o $@ --def $<
......
......@@ -26,7 +26,7 @@ all: $(MODULE)$(DLLEXT) $(SUBDIRS)
# Rules for .so files
$(MAINSPEC).c: $(MAINSPEC) $(RC_SRCS:.rc=.res) $(SYMBOLFILE) $(IMPORTLIBS) $(WINEBUILD)
$(LDPATH) $(WINEBUILD) $(DEFS) -o $@ --spec $(SRCDIR)/$(MAINSPEC) $(RC_SRCS:.rc=.res) $(SYMBOLFILE) $(DLLMAIN:%=-e %) -L$(DLLDIR) $(DELAYIMPORTS:%=-d%) $(IMPORTS:%=-l%)
$(LDPATH) $(WINEBUILD) $(DEFS) -o $@ --spec $(SRCDIR)/$(MAINSPEC) $(RC_SRCS:.rc=.res) $(SYMBOLFILE) $(DLLMAIN:%=--entry %) -L$(DLLDIR) $(DELAYIMPORTS:%=-d%) $(IMPORTS:%=-l%)
$(MODULE).so: $(MAINSPEC).o $(ALL_OBJS) Makefile.in
$(LDSHARED) $(LDDLLFLAGS) $(MAINSPEC).o $(ALL_OBJS) -o $@ -L$(DLLDIR) $(LDIMPORTS:%=-l%) $(ALL_LIBS) -lc
......
......@@ -34,7 +34,7 @@ all: $(TESTPROGRAM)
# Rule for main module spec file
$(MODULE).spec.c: $(RC_SRCS:.rc=.res) $(OBJS) $(IMPORTLIBS) $(WINEBUILD)
$(LDPATH) $(WINEBUILD) $(DEFS) -o $@ -exe $(MODULE) -mcui $(RC_SRCS:.rc=.res) $(OBJS) -L$(DLLDIR) -L.. $(DELAYIMPORTS:%=-d%) $(IMPORTS:%=-l%)
$(LDPATH) $(WINEBUILD) $(DEFS) -o $@ --exe $(MODULE) --exe-mode cui $(RC_SRCS:.rc=.res) $(OBJS) -L$(DLLDIR) -L.. $(DELAYIMPORTS:%=-d%) $(IMPORTS:%=-l%)
# Rules for .so main module
......
......@@ -75,7 +75,7 @@ EXTRASUBDIRS = \
# Special rules for 16-bit resource and spec files
gdi.exe.spec.c: gdi.exe.spec version16.res
$(LDPATH) $(WINEBUILD) $(DEFS) -H 65520 -o $@ -M $(MODULE) -r version16.res --spec $(SRCDIR)/gdi.exe.spec
$(LDPATH) $(WINEBUILD) $(DEFS) -o $@ --heap 65520 --main-module $(MODULE) --res version16.res --spec $(SRCDIR)/gdi.exe.spec
version16.res: version16.rc
$(LDPATH) $(WRC) $(WRCFLAGS) $(DIVINCL) -o $@ -w16 $(SRCDIR)/version16.rc
......
......@@ -52,7 +52,7 @@ kernel.res: $(MC_SRCS:.mc=.mc.rc)
# Special rules for 16-bit resource and spec files
krnl386.exe.spec.c: krnl386.exe.spec version16.res
$(LDPATH) $(WINEBUILD) $(DEFS) -N kernel -o $@ -M $(MODULE) -r version16.res --spec $(SRCDIR)/krnl386.exe.spec
$(LDPATH) $(WINEBUILD) $(DEFS) -o $@ --dll-name kernel --main-module $(MODULE) --res version16.res --spec $(SRCDIR)/krnl386.exe.spec
version16.res: version16.rc
$(LDPATH) $(WRC) $(WRCFLAGS) $(DIVINCL) -o $@ -w16 $(SRCDIR)/version16.rc
......
......@@ -69,6 +69,6 @@ version16.res: version16.rc
$(LDPATH) $(WRC) $(WRCFLAGS) $(DIVINCL) -o $@ -w16 $(SRCDIR)/version16.rc
shell.spec.c: shell.spec version16.res
$(LDPATH) $(WINEBUILD) $(DEFS) -o $@ -M $(MODULE) -r version16.res --spec $(SRCDIR)/shell.spec
$(LDPATH) $(WINEBUILD) $(DEFS) -o $@ --main-module $(MODULE) --res version16.res --spec $(SRCDIR)/shell.spec
### Dependencies:
......@@ -103,13 +103,13 @@ EXTRASUBDIRS = \
# Special rules for 16-bit resource and spec files
user.exe.spec.c: user.exe.spec resources/version16.res
$(LDPATH) $(WINEBUILD) $(DEFS) -H 65520 -o $@ -M $(MODULE) -r resources/version16.res --spec $(SRCDIR)/user.exe.spec
$(LDPATH) $(WINEBUILD) $(DEFS) -o $@ --heap 65520 --main-module $(MODULE) --res resources/version16.res --spec $(SRCDIR)/user.exe.spec
display.spec.c: display.spec resources/display.res
$(LDPATH) $(WINEBUILD) $(DEFS) -o $@ -M $(MODULE) -r resources/display.res --spec $(SRCDIR)/display.spec
$(LDPATH) $(WINEBUILD) $(DEFS) -o $@ --main-module $(MODULE) --res resources/display.res --spec $(SRCDIR)/display.spec
mouse.spec.c: mouse.spec resources/mouse.res
$(LDPATH) $(WINEBUILD) $(DEFS) -o $@ -M $(MODULE) -r resources/mouse.res --spec $(SRCDIR)/mouse.spec
$(LDPATH) $(WINEBUILD) $(DEFS) -o $@ --main-module $(MODULE) --res resources/mouse.res --spec $(SRCDIR)/mouse.spec
resources/display.res: resources/display.rc
$(LDPATH) $(WRC) $(WRCFLAGS) $(DIVINCL) -o $@ -w16 $(SRCDIR)/resources/display.rc
......
......@@ -21,7 +21,7 @@ $(MODULE): $(ALL_OBJS)
$(CC) -o $@ $(ALL_OBJS) -L$(DLLDIR) $(LDIMPORTS:%=-l%) $(LIBWINE) $(LIBUNICODE) $(LIBPORT) $(LIBS) $(LDFLAGS)
wine.spec.c: $(WINEBUILD)
$(LDPATH) $(WINEBUILD) $(DEFS) -o $@ --exe wine -mgui -e wine_initial_task -L$(DLLDIR) $(IMPORTS:%=-l%)
$(LDPATH) $(WINEBUILD) $(DEFS) -o $@ --exe wine --exe-mode gui --entry wine_initial_task -L$(DLLDIR) $(IMPORTS:%=-l%)
install:: $(MODULE)
$(MKINSTALLDIRS) $(bindir)
......
......@@ -24,7 +24,7 @@ all: $(MODULE)$(DLLEXT) $(BASEMODULE)$(EXEEXT)
# Rule for main module spec file
$(MODULE).spec.c: $(RC_SRCS:.rc=.res) $(ALL_OBJS) $(WINEBUILD)
$(LDPATH) $(WINEBUILD) $(DEFS) -o $@ --exe $(MODULE) $(APPMODE:%=-m%) $(RC_SRCS:.rc=.res) $(ALL_OBJS) -L$(DLLDIR) $(DELAYIMPORTS:%=-d%) $(IMPORTS:%=-l%)
$(LDPATH) $(WINEBUILD) $(DEFS) -o $@ --exe $(MODULE) $(APPMODE:%=--exe-mode %) $(RC_SRCS:.rc=.res) $(ALL_OBJS) -L$(DLLDIR) $(DELAYIMPORTS:%=-d%) $(IMPORTS:%=-l%)
# Rules for .so main module
......
......@@ -18,13 +18,13 @@ C_SRCS = \
all: $(PROGRAMS:%=%$(DLLEXT)) $(PROGRAMS:.exe=$(EXEEXT))
aviinfo.exe.spec.c: aviinfo.o $(WINEBUILD)
$(LDPATH) $(WINEBUILD) $(DEFS) -o $@ --exe aviinfo.exe -mgui aviinfo.o -L$(DLLDIR) -lkernel32
$(LDPATH) $(WINEBUILD) $(DEFS) -o $@ --exe aviinfo.exe --exe-mode gui aviinfo.o -L$(DLLDIR) -lkernel32
aviplay.exe.spec.c: aviplay.o $(WINEBUILD)
$(LDPATH) $(WINEBUILD) $(DEFS) -o $@ --exe aviplay.exe -mgui aviplay.o -L$(DLLDIR) -lddraw -lkernel32
$(LDPATH) $(WINEBUILD) $(DEFS) -o $@ --exe aviplay.exe --exe-mode gui aviplay.o -L$(DLLDIR) -lddraw -lkernel32
icinfo.exe.spec.c: icinfo.o $(WINEBUILD)
$(LDPATH) $(WINEBUILD) $(DEFS) -o $@ --exe icinfo.exe -mgui icinfo.o -L$(DLLDIR) -lmsvfw32 -lkernel32
$(LDPATH) $(WINEBUILD) $(DEFS) -o $@ --exe icinfo.exe --exe-mode gui icinfo.o -L$(DLLDIR) -lmsvfw32 -lkernel32
aviinfo.exe.so: aviinfo.o aviinfo.exe.spec.o
$(LDSHARED) $(LDDLLFLAGS) -o $@ aviinfo.o aviinfo.exe.spec.o $(ALL_LIBS) -lc
......
......@@ -31,12 +31,6 @@
#include <stdlib.h>
#include <string.h>
#ifdef HAVE_ASM_STRING
# define STRING ".string"
#else
# define STRING ".ascii"
#endif
typedef enum
{
TYPE_VARIABLE, /* variable */
......@@ -185,9 +179,9 @@ extern int nb_errors;
extern int display_warnings;
extern int kill_at;
extern char DLLName[80];
extern char DLLFileName[80];
extern char owner_name[80];
extern char *owner_name;
extern char *dll_name;
extern char *dll_file_name;
extern char *init_func;
extern char *input_file_name;
extern const char *output_file_name;
......
......@@ -154,8 +154,8 @@ static int BuildModule16( FILE *outfile, int max_code_offset,
pModule->fileinfo = (int)pFileInfo - (int)pModule;
memset( pFileInfo, 0, sizeof(*pFileInfo) - sizeof(pFileInfo->szPathName) );
pFileInfo->cBytes = sizeof(*pFileInfo) - sizeof(pFileInfo->szPathName)
+ strlen(DLLFileName);
strcpy( pFileInfo->szPathName, DLLFileName );
+ strlen(dll_file_name);
strcpy( pFileInfo->szPathName, dll_file_name );
pstr = (char *)pFileInfo + pFileInfo->cBytes + 1;
/* Segment table */
......@@ -197,8 +197,8 @@ static int BuildModule16( FILE *outfile, int max_code_offset,
pstr = (char *)(((long)pstr + 3) & ~3);
pModule->name_table = (int)pstr - (int)pModule;
/* First entry is module name */
*pstr = strlen( DLLName );
strcpy( pstr + 1, DLLName );
*pstr = strlen( dll_name );
strcpy( pstr + 1, dll_name );
strupper( pstr + 1 );
pstr += *pstr + 1;
*pstr++ = 0;
......@@ -592,7 +592,7 @@ static void output_stub_funcs( FILE *outfile )
fprintf( outfile, " rec.flags = %d;\n", EH_NONCONTINUABLE );
fprintf( outfile, " rec.rec = 0;\n" );
fprintf( outfile, " rec.params = 2;\n" );
fprintf( outfile, " rec.info[0] = \"%s\";\n", DLLFileName );
fprintf( outfile, " rec.info[0] = \"%s\";\n", dll_file_name );
fprintf( outfile, " rec.info[1] = func;\n" );
fprintf( outfile, "#ifdef __GNUC__\n" );
fprintf( outfile, " rec.addr = __builtin_return_address(1);\n" );
......@@ -644,11 +644,11 @@ void BuildSpec16File( FILE *outfile )
memset( data, 0, 16 );
data_offset = 16;
if (!DLLName[0]) /* set default name from file name */
if (!dll_name) /* set default name from file name */
{
char *p;
strcpy( DLLName, DLLFileName );
if ((p = strrchr( DLLName, '.' ))) *p = 0;
dll_name = xstrdup( dll_file_name );
if ((p = strrchr( dll_name, '.' ))) *p = 0;
}
output_stub_funcs( outfile );
......@@ -691,7 +691,7 @@ void BuildSpec16File( FILE *outfile )
char profile[101];
strcpy( profile, get_function_name( typelist[i] ));
BuildCallFrom16Func( outfile, profile, DLLFileName );
BuildCallFrom16Func( outfile, profile, dll_file_name );
}
#endif
......@@ -788,7 +788,7 @@ void BuildSpec16File( FILE *outfile )
#ifdef __i386__
fprintf( outfile, " { 0x68, __wine_%s_CallFrom16_%s, 0x9a, __wine_call_from_16_%s,\n",
make_c_identifier(DLLFileName), profile,
make_c_identifier(dll_file_name), profile,
(typelist[i]->flags & (FLAG_REGISTER|FLAG_INTERRUPT)) ? "regs":
typelist[i]->type == TYPE_PASCAL_16? "word" : "long" );
if (argsize)
......@@ -831,7 +831,7 @@ void BuildSpec16File( FILE *outfile )
type = bsearch( &odp, typelist, nTypes, sizeof(ORDDEF *), Spec16TypeCompare );
assert( type );
fprintf( outfile, " /* %s.%d */ ", DLLName, i );
fprintf( outfile, " /* %s.%d */ ", dll_name, i );
#ifdef __i386__
fprintf( outfile, "{ 0x5566, 0x68, %s, 0xe866, %d /* %s */ },\n",
#else
......@@ -886,8 +886,8 @@ void BuildSpec16File( FILE *outfile )
/* Output the DLL constructor */
sprintf( constructor, "__wine_spec_%s_init", make_c_identifier(DLLFileName) );
sprintf( destructor, "__wine_spec_%s_fini", make_c_identifier(DLLFileName) );
sprintf( constructor, "__wine_spec_%s_init", make_c_identifier(dll_file_name) );
sprintf( destructor, "__wine_spec_%s_fini", make_c_identifier(dll_file_name) );
output_dll_init( outfile, constructor, destructor );
fprintf( outfile,
......
......@@ -53,13 +53,13 @@ static const char *make_internal_name( const ORDDEF *odp, const char *prefix )
if (odp->name || odp->export_name)
{
char *p;
sprintf( buffer, "__wine_%s_%s_%s", prefix, DLLFileName,
sprintf( buffer, "__wine_%s_%s_%s", prefix, dll_file_name,
odp->name ? odp->name : odp->export_name );
/* make sure name is a legal C identifier */
for (p = buffer; *p; p++) if (!isalnum(*p) && *p != '_') break;
if (!*p) return buffer;
}
sprintf( buffer, "__wine_%s_%s_%d", prefix, make_c_identifier(DLLFileName), odp->ordinal );
sprintf( buffer, "__wine_%s_%s_%d", prefix, make_c_identifier(dll_file_name), odp->ordinal );
return buffer;
}
......@@ -495,7 +495,7 @@ void BuildSpec32File( FILE *outfile )
fprintf( outfile, "}\n" );
fprintf( outfile, "#endif\n" );
fprintf( outfile, "static const char dllname[] = \"%s\";\n\n", DLLFileName );
fprintf( outfile, "static const char dllname[] = \"%s\";\n\n", dll_file_name );
fprintf( outfile, "extern int __wine_spec_exports[];\n\n" );
#ifdef __i386__
......@@ -773,7 +773,7 @@ void BuildSpec32File( FILE *outfile )
/* Output the DLL constructor */
sprintf( constructor, "__wine_spec_%s_init", make_c_identifier(DLLFileName) );
sprintf( constructor, "__wine_spec_%s_init", make_c_identifier(dll_file_name) );
output_dll_init( outfile, constructor, NULL );
fprintf( outfile,
......@@ -783,7 +783,7 @@ void BuildSpec32File( FILE *outfile )
" extern void *__wine_dbg_register( char * const *, int );\n"
" __wine_dll_register( &nt_header, \"%s\" );\n"
"}\n",
constructor, DLLFileName );
constructor, dll_file_name );
}
......@@ -802,7 +802,7 @@ void BuildDef32File(FILE *outfile)
fprintf(outfile, "; File generated automatically from %s; do not edit!\n\n",
input_file_name );
fprintf(outfile, "LIBRARY %s\n\n", DLLFileName);
fprintf(outfile, "LIBRARY %s\n\n", dll_file_name);
fprintf(outfile, "EXPORTS\n");
......
.\" -*- nroff -*-
.TH WINEBUILD 1 "December 2002" "@PACKAGE_STRING@" "Wine dll builder"
.TH WINEBUILD 1 "March 2003" "@PACKAGE_STRING@" "Wine dll builder"
.SH NAME
winebuild \- Wine dll builder
.SH SYNOPSIS
......@@ -19,7 +19,7 @@ option can be specified, as described in the \fBOPTIONS\fR section.
You have to specify exactly one of the following options, depending on
what you want winebuild to generate.
.TP
.BI \--spec\ file.spec
.BI \--spec=\ file.spec
Build a C file from a spec file (see \fBSPEC FILE SYNTAX\fR for
details). The resulting C file must be compiled and linked to the
other object files to build a working Wine dll.
......@@ -32,7 +32,7 @@ final dll, to allow
to get the list of all undefined symbols that need to be imported from
other dlls.
.TP
.BI \--exe\ name
.BI \--exe=\ name
Build a C file for the named executable. This is basically the same as
the --spec mode except that it doesn't require a .spec file as input,
since an executable doesn't export functions. The resulting C file
......@@ -41,7 +41,7 @@ working Wine executable, and all the other object files must be listed
as
.I input files.
.TP
.BI \--def\ file.spec
.BI \--def=\ file.spec
Build a .def file from a spec file. This is used when building dlls
with a PE (Win32) compiler.
.TP
......@@ -69,7 +69,7 @@ Generate the assembly code for the 32-bit relay routines. This is for
Wine internal usage only, you should never need to use this option.
.SH OPTIONS
.TP
.BI \-C\ directory
.BI \-C,\ --source-dir= directory
Change to the specified directory before reading source files. Only
meaningful in
.BR \--debug\ and\ --glue\ modes.
......@@ -77,7 +77,7 @@ meaningful in
.BI \-D\ symbol
Ignored for compatibility with the C compiler.
.TP
.BI \-e\ function
.BI \-e,\ --entry= function
Specify the module entry point function; if not specified, the default
is
.B DllMain
......@@ -91,21 +91,18 @@ modules.
.BI \-f\ flags
Ignored for compatibility with the C compiler.
.TP
.BI \-F\ filename
.BI \-F,\ --filename= filename
Set the file name of the module. The default is to use the base name
of the spec file (without any extension).
.TP
.B \-h
.B \-h, --help
Display a usage message and exit.
.TP
.BI \-H\ size
.BI \-H,\ --heap= size
Specify the size of the module local heap in bytes (only valid for
Win16 modules); default is no local heap.
.TP
.BI \-I\ directory
Ignored for compatibility with the C compiler.
.TP
.BI \-i\ [-]symbol[,[-]symbol]
.BI \-i,\ --ignore= [-]symbol[,[-]symbol]
Specify a list of symbols that should be ignored when resolving
undefined symbols against the imported libraries. This forces these
symbols to be resolved from the Unix C library (or from another Unix
......@@ -113,33 +110,36 @@ library linked with the application). If a symbol is prefixed by '-'
it is removed from the list instead of being added; a stand-alone '-'
clears the whole list.
.TP
.BI \-K\ flags
.BI \-I\ directory
Ignored for compatibility with the C compiler.
.TP
.BI \-k
.B \-k, --kill-at
Remove the stdcall decorations from the symbol names in the
generated .def file. Only meaningful in \fB--def\fR mode.
.TP
.BI \-L\ directory
.BI \-K\ flags
Ignored for compatibility with the C compiler.
.TP
.BI \-L,\ --library-path= directory
Append the specified directory to the list of directories that are
searched for import libraries.
.TP
.BI \-l\ lib.dll
.BI \-l,\ --library= name
Import the specified library, looking for a corresponding
\fIlib.dll.so\fR file in the directories specified with the \fB-L\fR
\fIlibname.def\fR file in the directories specified with the \fB-L\fR
option.
.TP
.BI \-dl\ lib.dll
.BI \-d,\ --delay-lib= name
Same as the \fB-l\fR option, but import the specified library in
delayed mode (i.e. the library won't be loaded until a function
imported from it is actually called).
.TP
.BI \-M\ module
.BI \-M,\ --main-module= module
Specify that we are building a 16-bit dll, that will ultimately be
linked together with the 32-bit dll specified in \fImodule\fR. Only
meaningful in \fB--spec\fR mode.
.TP
.BI \-m\ mode
.BI \-m,\ --exe-mode= mode
Set the executable mode, which can be one of the following:
.br
.B cui
......@@ -161,16 +161,16 @@ passed to the entry point.
.br
This option is only meaningful in \fB--exe\fR mode.
.TP
.BI \-N\ dllname
.BI \-N,\ --dll-name= dllname
Set the internal name of the module. It is only used in Win16
modules. The default is to use the base name of the spec file (without
any extension). This is used for KERNEL, since it lives in
KRNL386.EXE. It shouldn't be needed otherwise.
.TP
.BI \-o\ file
.BI \-o,\ --output= file
Set the name of the output file (default is standard output).
.TP
.BI \-r\ rsrc.res
.BI \-r,\ --res= rsrc.res
Load resources from the specified binary resource file. The
\fIrsrc.res\fR can be produced from a source resource file with
.BR wrc(1)
......@@ -183,7 +183,10 @@ and will automatically be handled correctly (though the
.B \-r
option will also work for Win32 files).
.TP
.B \-w
.B \--version
Display the program version and exit.
.TP
.B \-w, --warnings
Turn on warnings.
.SH "SPEC FILE SYNTAX"
.SS "General syntax"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment