Commit ba9ec152 authored by Alexandre Julliard's avatar Alexandre Julliard

winegcc: Add explicit support for the Cygwin platform.

On Cygwin we want to use Wine's msvcrt, unlike on Mingw.
parent 6002cb06
...@@ -261,7 +261,7 @@ static char* try_lib_path(const char* dir, const char* pre, ...@@ -261,7 +261,7 @@ static char* try_lib_path(const char* dir, const char* pre,
static file_type guess_lib_type(enum target_platform platform, const char* dir, static file_type guess_lib_type(enum target_platform platform, const char* dir,
const char* library, const char *suffix, char** file) const char* library, const char *suffix, char** file)
{ {
if (platform != PLATFORM_WINDOWS) if (platform != PLATFORM_WINDOWS && platform != PLATFORM_CYGWIN)
{ {
/* Unix shared object */ /* Unix shared object */
if ((*file = try_lib_path(dir, "lib", library, ".so", file_so))) if ((*file = try_lib_path(dir, "lib", library, ".so", file_so)))
......
...@@ -38,7 +38,7 @@ enum target_cpu ...@@ -38,7 +38,7 @@ enum target_cpu
enum target_platform enum target_platform
{ {
PLATFORM_UNSPECIFIED, PLATFORM_APPLE, PLATFORM_SOLARIS, PLATFORM_WINDOWS PLATFORM_UNSPECIFIED, PLATFORM_APPLE, PLATFORM_SOLARIS, PLATFORM_WINDOWS, PLATFORM_CYGWIN
}; };
void error(const char* s, ...) DECLSPEC_NORETURN; void error(const char* s, ...) DECLSPEC_NORETURN;
......
...@@ -173,6 +173,7 @@ static const struct ...@@ -173,6 +173,7 @@ static const struct
{ "macos", PLATFORM_APPLE }, { "macos", PLATFORM_APPLE },
{ "darwin", PLATFORM_APPLE }, { "darwin", PLATFORM_APPLE },
{ "solaris", PLATFORM_SOLARIS }, { "solaris", PLATFORM_SOLARIS },
{ "cygwin", PLATFORM_CYGWIN },
{ "mingw32", PLATFORM_WINDOWS }, { "mingw32", PLATFORM_WINDOWS },
{ "windows", PLATFORM_WINDOWS }, { "windows", PLATFORM_WINDOWS },
{ "winnt", PLATFORM_WINDOWS } { "winnt", PLATFORM_WINDOWS }
...@@ -230,6 +231,8 @@ static const enum target_cpu build_cpu = CPU_ARM; ...@@ -230,6 +231,8 @@ static const enum target_cpu build_cpu = CPU_ARM;
static enum target_platform build_platform = PLATFORM_APPLE; static enum target_platform build_platform = PLATFORM_APPLE;
#elif defined(__sun) #elif defined(__sun)
static enum target_platform build_platform = PLATFORM_SOLARIS; static enum target_platform build_platform = PLATFORM_SOLARIS;
#elif defined(__CYGWIN__)
static enum target_platform build_platform = PLATFORM_CYGWIN;
#elif defined(_WIN32) #elif defined(_WIN32)
static enum target_platform build_platform = PLATFORM_WINDOWS; static enum target_platform build_platform = PLATFORM_WINDOWS;
#else #else
...@@ -332,7 +335,8 @@ static void compile(struct options* opts, const char* lang) ...@@ -332,7 +335,8 @@ static void compile(struct options* opts, const char* lang)
break; break;
} }
if (opts->target_platform == PLATFORM_WINDOWS) goto no_compat_defines; if (opts->target_platform == PLATFORM_WINDOWS || opts->target_platform == PLATFORM_CYGWIN)
goto no_compat_defines;
if (opts->processor != proc_cpp) if (opts->processor != proc_cpp)
{ {
...@@ -678,7 +682,7 @@ static void build(struct options* opts) ...@@ -678,7 +682,7 @@ static void build(struct options* opts)
/* building for Windows is completely different */ /* building for Windows is completely different */
if (opts->target_platform == PLATFORM_WINDOWS) if (opts->target_platform == PLATFORM_WINDOWS || opts->target_platform == PLATFORM_CYGWIN)
{ {
strarray *resources = strarray_alloc(); strarray *resources = strarray_alloc();
char *res_o_name = NULL; char *res_o_name = NULL;
...@@ -732,6 +736,7 @@ static void build(struct options* opts) ...@@ -732,6 +736,7 @@ static void build(struct options* opts)
if (!opts->nostartfiles) add_library(opts, lib_dirs, files, "winecrt0"); if (!opts->nostartfiles) add_library(opts, lib_dirs, files, "winecrt0");
if (opts->shared && !opts->nostdlib) add_library(opts, lib_dirs, files, "wine"); if (opts->shared && !opts->nostdlib) add_library(opts, lib_dirs, files, "wine");
if (!opts->shared && opts->use_msvcrt) add_library(opts, lib_dirs, files, "msvcrt");
for ( j = 0; j < files->size; j++ ) for ( j = 0; j < files->size; j++ )
{ {
...@@ -763,8 +768,12 @@ static void build(struct options* opts) ...@@ -763,8 +768,12 @@ static void build(struct options* opts)
if (ext) *ext = 0; if (ext) *ext = 0;
p += 3; p += 3;
strarray_add(link_args, strmake("-L%s", lib )); /* don't use Wine's msvcrt on mingw */
strarray_add(link_args, strmake("-l%s", p )); if (strcmp( p, "msvcrt" ) || opts->target_platform == PLATFORM_CYGWIN)
{
strarray_add(link_args, strmake("-L%s", lib ));
strarray_add(link_args, strmake("-l%s", p ));
}
free( lib ); free( lib );
break; break;
} }
...@@ -782,7 +791,6 @@ static void build(struct options* opts) ...@@ -782,7 +791,6 @@ static void build(struct options* opts)
break; break;
} }
} }
if (!opts->shared && (opts->use_msvcrt || opts->unicode_app)) strarray_add(link_args, "-lmsvcrt");
if (res_o_name) compile_resources_to_object( opts, resources, res_o_name ); if (res_o_name) compile_resources_to_object( opts, resources, res_o_name );
......
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