mingwrap

Dimitrie O. Paun dpaun at rogers.com
Thu Dec 5 00:01:38 CST 2002


Hi,

This is the MinGW wrapper discussed here:
  http://www.dssd.ca/wine/Winelib-Apps.html

ChangeLog
  New MinGW wrapper that makes gcc on Linux behave like MinGW
  on Windows, using the Wine headers.

Index: tools/Makefile.in
===================================================================
RCS file: /var/cvs/wine/tools/Makefile.in,v
retrieving revision 1.24
diff -u -r1.24 Makefile.in
--- tools/Makefile.in	7 Aug 2002 00:03:01 -0000	1.24
+++ tools/Makefile.in	5 Dec 2002 05:53:08 -0000
@@ -4,10 +4,12 @@
 SRCDIR    = @srcdir@
 VPATH     = @srcdir@
 
-PROGRAMS = makedep fnt2bdf bin2res
+PROGRAMS = makedep fnt2bdf bin2res mingwrap
 MODULE   = none
 
-C_SRCS = makedep.c fnt2bdf.c bin2res.c
+EXTRACFLAGS = -DGCC_BIN='"$(CC)"' -Dprefix='"$(prefix)"'
+
+C_SRCS = makedep.c fnt2bdf.c bin2res.c mingwrap.c
 
 SUBDIRS = \
 	widl \
@@ -38,12 +40,16 @@
 bin2res: bin2res.o
 	$(CC) $(CFLAGS) -o bin2res bin2res.o
 
+mingwrap: mingwrap.o
+	$(CC) $(CFLAGS) -o mingwrap mingwrap.o
+
 install::
 	$(MKINSTALLDIRS) $(bindir) $(mandir)/man$(prog_manext)
 	$(INSTALL_SCRIPT) $(SRCDIR)/winemaker $(bindir)/winemaker
+	$(INSTALL_SCRIPT) $(SRCDIR)/mingwrap $(bindir)/mingwrap
 	$(INSTALL_DATA) $(SRCDIR)/winemaker.man $(mandir)/man$(prog_manext)/winemaker.$(prog_manext)
 
 uninstall::
-	$(RM) $(bindir)/winemaker $(mandir)/man$(prog_manext)/winemaker.$(prog_manext)
+	$(RM) $(bindir)/winemaker $(bindir)/mingwrap $(mandir)/man$(prog_manext)/winemaker.$(prog_manext)
 
 ### Dependencies:
--- /dev/null	2002-08-30 19:31:37.000000000 -0400
+++ tools/mingwrap.c	2002-12-05 00:41:04.000000000 -0500
@@ -0,0 +1,77 @@
+/*
+ * MinGW wrapper: makes gcc behave like MinGW.
+ *
+ * Copyright 2002 Dimitrie O. Paun
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include "config.h"
+#include "wine/port.h"
+
+#include <stdio.h>
+#include <string.h>
+#include <alloca.h>
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#ifndef GCC_BIN
+#define GCC_BIN "gcc"
+#endif
+
+#ifndef prefix
+#define prefix "/usr/local"
+#endif
+
+int main(int argc, char **argv)
+{
+    char **gcc_argv;
+    int i, j;
+
+    gcc_argv = alloca(sizeof(char*) * (argc + 20));
+
+    i = 0;
+    gcc_argv[i++] = GCC_BIN;
+
+    gcc_argv[i++] = "-fshort-wchar";
+    gcc_argv[i++] = "-fPIC";
+    gcc_argv[i++] = "-I"prefix"/include/wine";
+    gcc_argv[i++] = "-I"prefix"/include/wine/msvcrt";
+    gcc_argv[i++] = "-I"prefix"/include/wine/windows";
+    gcc_argv[i++] = "-DWINE_DEFINE_WCHAR_T";
+    gcc_argv[i++] = "-D__int8=char";
+    gcc_argv[i++] = "-D__int16=short";
+    gcc_argv[i++] = "-D__int32=int";
+    gcc_argv[i++] = "-D__int64=long long";
+     
+    for ( j = 1 ; j < argc ; j++ ) {
+	if (strcmp("-mno-cygwin", argv[j]) == 0) {
+	    /* ignore this option */
+        } else {
+            gcc_argv[i++] = argv[j];
+        }
+    }
+    gcc_argv[i] = NULL;
+
+    return execvp(GCC_BIN, gcc_argv);
+}


-- 
Dimi.




More information about the wine-patches mailing list