Alexandre Julliard : winegcc: Add explicit support for the Cygwin platform.

Alexandre Julliard julliard at winehq.org
Mon Jun 14 13:01:18 CDT 2010


Module: wine
Branch: master
Commit: ba9ec152e17f436fb3e73d8e08af811ba3520cef
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=ba9ec152e17f436fb3e73d8e08af811ba3520cef

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Mon Jun 14 15:58:07 2010 +0200

winegcc: Add explicit support for the Cygwin platform.

On Cygwin we want to use Wine's msvcrt, unlike on Mingw.

---

 tools/winegcc/utils.c   |    2 +-
 tools/winegcc/utils.h   |    2 +-
 tools/winegcc/winegcc.c |   18 +++++++++++++-----
 3 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/tools/winegcc/utils.c b/tools/winegcc/utils.c
index 411a9c1..05b9a65 100644
--- a/tools/winegcc/utils.c
+++ b/tools/winegcc/utils.c
@@ -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,
                                 const char* library, const char *suffix, char** file)
 {
-    if (platform != PLATFORM_WINDOWS)
+    if (platform != PLATFORM_WINDOWS && platform != PLATFORM_CYGWIN)
     {
         /* Unix shared object */
         if ((*file = try_lib_path(dir, "lib", library, ".so", file_so)))
diff --git a/tools/winegcc/utils.h b/tools/winegcc/utils.h
index 31cc3b9..d819415 100644
--- a/tools/winegcc/utils.h
+++ b/tools/winegcc/utils.h
@@ -38,7 +38,7 @@ enum target_cpu
 
 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;
diff --git a/tools/winegcc/winegcc.c b/tools/winegcc/winegcc.c
index 7e9c3f6..0dc7cc4 100644
--- a/tools/winegcc/winegcc.c
+++ b/tools/winegcc/winegcc.c
@@ -173,6 +173,7 @@ static const struct
     { "macos",   PLATFORM_APPLE },
     { "darwin",  PLATFORM_APPLE },
     { "solaris", PLATFORM_SOLARIS },
+    { "cygwin",  PLATFORM_CYGWIN },
     { "mingw32", PLATFORM_WINDOWS },
     { "windows", PLATFORM_WINDOWS },
     { "winnt",   PLATFORM_WINDOWS }
@@ -230,6 +231,8 @@ static const enum target_cpu build_cpu = CPU_ARM;
 static enum target_platform build_platform = PLATFORM_APPLE;
 #elif defined(__sun)
 static enum target_platform build_platform = PLATFORM_SOLARIS;
+#elif defined(__CYGWIN__)
+static enum target_platform build_platform = PLATFORM_CYGWIN;
 #elif defined(_WIN32)
 static enum target_platform build_platform = PLATFORM_WINDOWS;
 #else
@@ -332,7 +335,8 @@ static void compile(struct options* opts, const char* lang)
             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)
     {
@@ -678,7 +682,7 @@ static void build(struct options* opts)
 
     /* 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();
         char *res_o_name = NULL;
@@ -732,6 +736,7 @@ static void build(struct options* opts)
 
         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->use_msvcrt) add_library(opts, lib_dirs, files, "msvcrt");
 
         for ( j = 0; j < files->size; j++ )
         {
@@ -763,8 +768,12 @@ static void build(struct options* opts)
 
                         if (ext) *ext = 0;
                         p += 3;
-                        strarray_add(link_args, strmake("-L%s", lib ));
-                        strarray_add(link_args, strmake("-l%s", p ));
+                        /* don't use Wine's msvcrt on mingw */
+                        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 );
                         break;
                     }
@@ -782,7 +791,6 @@ static void build(struct options* opts)
                 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 );
 




More information about the wine-cvs mailing list