New MinGW wrapper that makes gcc on Linux behave like MinGW on

Windows, using the Wine headers.
This commit is contained in:
Dimitrie O. Paun 2002-12-05 19:12:13 +00:00 committed by Alexandre Julliard
parent b0350a3f4a
commit 2652dcf4f0
3 changed files with 86 additions and 4 deletions

View File

@ -2,3 +2,4 @@ Makefile
bin2res
fnt2bdf
makedep
mingwrap

View File

@ -3,11 +3,19 @@ TOPSRCDIR = @top_srcdir@
TOPOBJDIR = ..
SRCDIR = @srcdir@
VPATH = @srcdir@
PROGRAMS = makedep fnt2bdf bin2res
MODULE = none
C_SRCS = makedep.c fnt2bdf.c bin2res.c
PROGRAMS = \
bin2res \
fnt2bdf \
makedep \
mingwrap
C_SRCS = \
bin2res.c \
fnt2bdf.c \
makedep.c \
mingwrap.c
SUBDIRS = \
widl \
@ -38,12 +46,16 @@ fnt2bdf: fnt2bdf.o
bin2res: bin2res.o
$(CC) $(CFLAGS) -o bin2res bin2res.o
mingwrap: mingwrap.o
$(CC) $(CFLAGS) -DINCLUDEDIR="$(includedir)" -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:

69
tools/mingwrap.c Normal file
View File

@ -0,0 +1,69 @@
/*
* 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>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#ifndef GCC_BIN
#define GCC_BIN "gcc"
#endif
#ifndef INCLUDEDIR
#define INCLUDEDIR "/usr/local/include/wine"
#endif
int main(int argc, char **argv)
{
char **gcc_argv;
int i, j;
gcc_argv = malloc(sizeof(char*) * (argc + 20));
i = 0;
gcc_argv[i++] = GCC_BIN;
gcc_argv[i++] = "-fshort-wchar";
gcc_argv[i++] = "-fPIC";
gcc_argv[i++] = "-I" INCLUDEDIR;
gcc_argv[i++] = "-I" INCLUDEDIR "/msvcrt";
gcc_argv[i++] = "-I" INCLUDEDIR "/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);
}