[PATCH 5/8] loader: add Cygwin support

Yaakov (Cygwin/X) yselkowitz at users.sourceforge.net
Thu Mar 29 01:22:38 PDT 2012


From: Yaakov Selkowitz <yselkowitz at users.sourceforge.net>

Cygwin libraries use the .dll extension and "cyg" prefix in place of "lib".

Signed-off-by: Yaakov Selkowitz <yselkowitz at users.sourceforge.net>
---
 hw/xfree86/loader/loadmod.c  |   18 ++++++++++++++++++
 hw/xfree86/man/xorg.conf.man |    2 +-
 2 files changed, 19 insertions(+), 1 deletions(-)

diff --git a/hw/xfree86/loader/loadmod.c b/hw/xfree86/loader/loadmod.c
index c6b5590..706b9b3 100644
--- a/hw/xfree86/loader/loadmod.c
+++ b/hw/xfree86/loader/loadmod.c
@@ -212,9 +212,15 @@ static const char *stdSubdirs[] = {
  * to port this DDX to, say, Darwin, we'll need to fix this.
  */
 static PatternRec stdPatterns[] = {
+#ifdef __CYGWIN__
+    {"^cyg(.*)\\.dll$",},
+    {"(.*)_drv\\.dll$",},
+    {"(.*)\\.dll$",},
+#else
     {"^lib(.*)\\.so$",},
     {"(.*)_drv\\.so$",},
     {"(.*)\\.so$",},
+#endif
     {NULL,}
 };
 
@@ -408,21 +414,33 @@ FindModuleInSubdir(const char *dirpath, const char *module)
             continue;
         }
 
+#ifdef __CYGWIN__
+        snprintf(tmpBuf, PATH_MAX, "cyg%s.dll", module);
+#else
         snprintf(tmpBuf, PATH_MAX, "lib%s.so", module);
+#endif
         if (strcmp(direntry->d_name, tmpBuf) == 0) {
             if (asprintf(&ret, "%s%s", dirpath, tmpBuf) == -1)
                 ret = NULL;
             break;
         }
 
+#ifdef __CYGWIN__
+        snprintf(tmpBuf, PATH_MAX, "%s_drv.dll", module);
+#else
         snprintf(tmpBuf, PATH_MAX, "%s_drv.so", module);
+#endif
         if (strcmp(direntry->d_name, tmpBuf) == 0) {
             if (asprintf(&ret, "%s%s", dirpath, tmpBuf) == -1)
                 ret = NULL;
             break;
         }
 
+#ifdef __CYGWIN__
+        snprintf(tmpBuf, PATH_MAX, "%s.dll", module);
+#else
         snprintf(tmpBuf, PATH_MAX, "%s.so", module);
+#endif
         if (strcmp(direntry->d_name, tmpBuf) == 0) {
             if (asprintf(&ret, "%s%s", dirpath, tmpBuf) == -1)
                 ret = NULL;
diff --git a/hw/xfree86/man/xorg.conf.man b/hw/xfree86/man/xorg.conf.man
index 72e5713..da67f59 100644
--- a/hw/xfree86/man/xorg.conf.man
+++ b/hw/xfree86/man/xorg.conf.man
@@ -701,7 +701,7 @@ This instructs the server to load the module called
 The module name given should be the module's standard name, not the
 module file name.
 The standard name is case\-sensitive, and does not include the \(lqlib\(rq
-prefix, or the \(lq.a\(rq, \(lq.o\(rq, or \(lq.so\(rq suffixes.
+or \(lqcyg\(rq prefixes, or the \(lq.so\(rq or \(lq.dll\(rq suffixes.
 .PP
 .RS 7
 Example: the DRI extension module can be loaded with the following entry:
-- 
1.7.9



More information about the xorg-devel mailing list