Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
cc1577cd
Commit
cc1577cd
authored
Dec 15, 2002
by
Dimitrie O. Paun
Committed by
Alexandre Julliard
Dec 15, 2002
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Teach mingwrap to use winewrap to do the linking, just like gcc uses
ld to link on Unix. Based loosely on a uClib utility developed by Manuel Novoa III.
parent
3e1c6132
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
98 additions
and
6 deletions
+98
-6
mingwrap.c
tools/mingwrap.c
+98
-6
No files found.
tools/mingwrap.c
View file @
cc1577cd
/*
* MinGW wrapper: makes gcc behave like MinGW.
*
* Copyright 2000 Manuel Novoa III
* Copyright 2002 Dimitrie O. Paun
*
* This library is free software; you can redistribute it and/or
...
...
@@ -23,6 +24,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
...
...
@@ -36,34 +38,124 @@
#define INCLUDEDIR "/usr/local/include/wine"
#endif
void
error
(
const
char
*
s
,
...)
{
va_list
ap
;
va_start
(
ap
,
s
);
fprintf
(
stderr
,
"Error: "
);
vfprintf
(
stderr
,
s
,
ap
);
fprintf
(
stderr
,
"
\n
"
);
va_end
(
ap
);
exit
(
2
);
}
int
main
(
int
argc
,
char
**
argv
)
{
char
**
gcc_argv
;
int
i
,
j
;
int
linking
=
1
,
verbose
=
0
,
use_static_linking
=
0
;
int
use_stdinc
=
1
,
use_stdlib
=
1
,
use_msvcrt
=
0
,
gui_app
=
0
;
for
(
i
=
1
;
i
<
argc
;
i
++
)
{
if
(
argv
[
i
][
0
]
==
'-'
)
/* option */
{
switch
(
argv
[
i
][
1
])
{
case
'c'
:
/* compile or assemble */
case
'S'
:
/* generate assembler code */
case
'E'
:
/* preprocess only */
case
'M'
:
/* map file generation */
if
(
argv
[
i
][
2
]
==
0
)
linking
=
0
;
break
;
case
'v'
:
/* verbose */
if
(
argv
[
i
][
2
]
==
0
)
verbose
=
1
;
break
;
case
'm'
:
if
(
strcmp
(
"-mno-cygwin"
,
argv
[
i
])
==
0
)
use_msvcrt
=
1
;
else
if
(
strcmp
(
"-mwindows"
,
argv
[
i
])
==
0
)
gui_app
=
1
;
break
;
case
'n'
:
if
(
strcmp
(
"-nostdinc"
,
argv
[
i
])
==
0
)
use_stdinc
=
0
;
else
if
(
strcmp
(
"-nodefaultlibs"
,
argv
[
i
])
==
0
)
use_stdlib
=
0
;
else
if
(
strcmp
(
"-nostdlib"
,
argv
[
i
])
==
0
)
use_stdlib
=
0
;
break
;
case
's'
:
if
(
strcmp
(
"-static"
,
argv
[
i
])
==
0
)
use_static_linking
=
1
;
break
;
case
'W'
:
if
(
strncmp
(
"-Wl,"
,
argv
[
i
],
4
)
==
0
)
{
if
(
strstr
(
argv
[
i
],
"-static"
))
use_static_linking
=
1
;
}
break
;
case
'-'
:
if
(
strcmp
(
"-static"
,
argv
[
i
]
+
1
)
==
0
)
use_static_linking
=
1
;
break
;
}
}
}
if
(
use_static_linking
)
error
(
"Static linking is not supported."
);
gcc_argv
=
malloc
(
sizeof
(
char
*
)
*
(
argc
+
20
));
i
=
0
;
if
(
linking
)
{
gcc_argv
[
i
++
]
=
BINDIR
"/winewrap"
;
}
else
{
gcc_argv
[
i
++
]
=
GCC_BIN
;
gcc_argv
[
i
++
]
=
"-fshort-wchar"
;
gcc_argv
[
i
++
]
=
"-fPIC"
;
gcc_argv
[
i
++
]
=
"-I"
INCLUDEDIR
"/msvcrt"
;
if
(
use_stdinc
)
{
if
(
use_msvcrt
)
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
{
for
(
j
=
1
;
j
<
argc
;
j
++
)
{
if
(
strcmp
(
"-mno-cygwin"
,
argv
[
j
])
==
0
)
;
/* ignore this option */
else
if
(
strcmp
(
"-mwindows"
,
argv
[
j
])
==
0
)
;
/* ignore this option */
else
if
(
strcmp
(
"-s"
,
argv
[
j
])
==
0
)
;
/* ignore this option */
else
gcc_argv
[
i
++
]
=
argv
[
j
];
}
if
(
linking
)
{
if
(
use_stdlib
)
gcc_argv
[
i
++
]
=
use_msvcrt
?
"-lmsvcrt"
:
"-lc"
;
}
gcc_argv
[
i
]
=
NULL
;
return
execvp
(
GCC_BIN
,
gcc_argv
);
if
(
verbose
)
{
for
(
i
=
0
;
gcc_argv
[
i
];
i
++
)
printf
(
"%s "
,
gcc_argv
[
i
]);
printf
(
"
\n
"
);
}
execvp
(
gcc_argv
[
0
],
gcc_argv
);
return
1
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment