From 23cb2784b6853fc4e566c0da8e5e710af600b253 Mon Sep 17 00:00:00 2001 From: Casper Hornstrup Date: Tue, 9 Dec 2003 19:02:19 +0000 Subject: [PATCH] 2003-12-09 Casper S. Hornstrup * rules.mak (WINEBUILD): Define. * tools/winebuild/Makefile: New file. * tools/winebuild/import.c (ldcombine_files): Replace mkstemps with Win32 APIs. * tools/winebuild/main.c (main): Win16 specs and relays are not supported. * tools/winebuild/spec32.c (EXCEPTION_WINE_STUB, EH_NONCONTINUABLE): Define. (BuildDef32File): Don't emit PRIVATE. svn path=/trunk/; revision=6932 --- reactos/ChangeLog | 11 +++++++++ reactos/rules.mak | 1 + reactos/tools/winebuild/Makefile | 41 ++++++++++++++++++++++++++++++++ reactos/tools/winebuild/import.c | 23 ++++++++++++++---- reactos/tools/winebuild/main.c | 12 ++++++++++ reactos/tools/winebuild/spec32.c | 9 +++++++ 6 files changed, 93 insertions(+), 4 deletions(-) create mode 100644 reactos/tools/winebuild/Makefile diff --git a/reactos/ChangeLog b/reactos/ChangeLog index 5f8a8a19dac..c6defaf7756 100644 --- a/reactos/ChangeLog +++ b/reactos/ChangeLog @@ -1,3 +1,14 @@ +2003-12-09 Casper S. Hornstrup + + * rules.mak (WINEBUILD): Define. + * tools/winebuild/Makefile: New file. + * tools/winebuild/import.c (ldcombine_files): Replace mkstemps with Win32 + APIs. + * tools/winebuild/main.c (main): Win16 specs and relays are not supported. + * tools/winebuild/spec32.c (EXCEPTION_WINE_STUB, EH_NONCONTINUABLE): + Define. + (BuildDef32File): Don't emit PRIVATE. + 2003-12-09 Casper S. Hornstrup * tools/winebuild: Import winebuild from Wine (D20031208). diff --git a/reactos/rules.mak b/reactos/rules.mak index bd46ae7d9a6..4aec169e756 100644 --- a/reactos/rules.mak +++ b/reactos/rules.mak @@ -100,6 +100,7 @@ RTOUCH = $(TOOLS_PATH)/rtouch REGTESTS = $(TOOLS_PATH)/regtests MC = $(TOOLS_PATH)/wmc/wmc CABMAN = $(TOOLS_PATH)/cabman/cabman +WINEBUILD = $(TOOLS_PATH)/winebuild/winebuild XSLTPROC = xsltproc diff --git a/reactos/tools/winebuild/Makefile b/reactos/tools/winebuild/Makefile new file mode 100644 index 00000000000..8052fb9351c --- /dev/null +++ b/reactos/tools/winebuild/Makefile @@ -0,0 +1,41 @@ +# +# winebuild +# +PATH_TO_TOP = ../.. + +TARGET = winebuild$(EXE_POSTFIX) + +all: $(TARGET) + +# relay.o spec16.o +OBJECTS = \ + import.o \ + main.o \ + parser.o \ + res16.o \ + res32.o \ + spec32.o \ + utils.o + +CLEAN_FILES = *.o $(TARGET) + +HOST_CFLAGS = -D__USE_W32API -I$(PATH_TO_TOP)/include -I$(PATH_TO_TOP)/include/wine + +%.o: %.c + $(HOST_CC) $(HOST_CFLAGS) -c $< -o $@ + +$(TARGET): $(OBJECTS) + $(HOST_CC) $(OBJECTS) -o $(TARGET) + +ifeq ($(HOST),mingw32-linux) +clean: + rm -f $(CLEAN_FILES) +endif +ifneq ($(HOST),mingw32-linux) +clean: + del $(CLEAN_FILES) +endif + +.PHONY: clean + +include $(PATH_TO_TOP)/rules.mak diff --git a/reactos/tools/winebuild/import.c b/reactos/tools/winebuild/import.c index f45ab86e162..f1aa28f8312 100644 --- a/reactos/tools/winebuild/import.c +++ b/reactos/tools/winebuild/import.c @@ -30,6 +30,10 @@ # include #endif +#if defined(WIN32) +#include +#endif + #include "build.h" struct func @@ -634,16 +638,27 @@ static const char *ldcombine_files( char **argv ) int i, len = 0; char *cmd; int fd, err; +#if defined(WIN32) + char tmppath[MAX_PATH]; + char tmpfile[MAX_PATH]; +#endif - if (output_file_name && output_file_name[0]) +#if defined(WIN32) + if (GetTempPathA(MAX_PATH, tmppath) == 0) return NULL; + if (GetTempFileNameA(tmppath, "WNB", 0, tmpfile) == 0) fatal_error( "could not generate a temp file\n" ); + ld_tmp_file = xstrdup( tmpfile ); + if ((fd = open( ld_tmp_file, O_RDONLY )) == -1) +#else + if (output_file_name && output_file_name[0]) { - ld_tmp_file = xmalloc( strlen(output_file_name) + 10 ); + ld_tmp_file = xmalloc( MAX_PATH); strcpy( ld_tmp_file, output_file_name ); strcat( ld_tmp_file, ".XXXXXX.o" ); } - else ld_tmp_file = xstrdup( "/tmp/winebuild.tmp.XXXXXX.o" ); - + else ld_tmp_file = xstrdup( "/tmp/winebuild.tmp.XXXXXX.o" ); if ((fd = mkstemps( ld_tmp_file, 2 ) == -1)) fatal_error( "could not generate a temp file\n" ); +#endif + close( fd ); atexit( remove_ld_tmp_file ); diff --git a/reactos/tools/winebuild/main.c b/reactos/tools/winebuild/main.c index 3ac191389ca..5b1d769b206 100644 --- a/reactos/tools/winebuild/main.c +++ b/reactos/tools/winebuild/main.c @@ -388,9 +388,13 @@ int main(int argc, char **argv) switch (SpecType) { case SPEC_WIN16: +#if defined(WIN32) + fatal_error( "Win16 specs are not supported in ReactOS version of winebuild\n" ); +#else if (argv[0]) fatal_error( "file argument '%s' not allowed in this mode\n", argv[0] ); BuildSpec16File( output_file ); +#endif break; case SPEC_WIN32: read_undef_symbols( argv ); @@ -415,12 +419,20 @@ int main(int argc, char **argv) BuildDebugFile( output_file, current_src_dir, argv ); break; case MODE_RELAY16: +#if defined(WIN32) + fatal_error( "Win16 relays are not supported in ReactOS version of winebuild\n" ); +#else if (argv[0]) fatal_error( "file argument '%s' not allowed in this mode\n", argv[0] ); BuildRelays16( output_file ); +#endif break; case MODE_RELAY32: +#if defined(WIN32) + fatal_error( "Win32 relays are not supported in ReactOS version of winebuild\n" ); +#else if (argv[0]) fatal_error( "file argument '%s' not allowed in this mode\n", argv[0] ); BuildRelays32( output_file ); +#endif break; default: usage(1); diff --git a/reactos/tools/winebuild/spec32.c b/reactos/tools/winebuild/spec32.c index 02567c3a99e..2139b94c26b 100644 --- a/reactos/tools/winebuild/spec32.c +++ b/reactos/tools/winebuild/spec32.c @@ -32,7 +32,13 @@ #include "windef.h" #include "winbase.h" +#if defined(WIN32) +#define EXCEPTION_WINE_STUB 0x80000100 /* stub entry point called */ +#define EH_NONCONTINUABLE 0x01 +#else #include "wine/exception.h" +#endif + #include "build.h" @@ -900,7 +906,10 @@ void BuildDef32File(FILE *outfile) fprintf( outfile, " @%d", odp->ordinal ); if (!odp->name) fprintf( outfile, " NONAME" ); if (is_data) fprintf( outfile, " DATA" ); +#if !defined(WIN32) + /* MinGW binutils cannot handle this correctly */ if (odp->flags & FLAG_PRIVATE) fprintf( outfile, " PRIVATE" ); +#endif fprintf( outfile, "\n" ); } }