illume avatar illume committed d319548

some fixes for building with mingw and msys on windows

Comments (0)

Files changed (3)

 
 import sys, os, shutil, string
 
+def is_msys_mingw():
+    if os.environ.has_key("MSYSTEM"):
+        if os.environ["MSYSTEM"] == "MINGW32":
+            return 1
+    return 0
 
 
-if sys.platform == 'win32':
+if sys.platform == 'win32' and not is_msys_mingw():
     print 'Using WINDOWS configuration...\n'
     import config_win
     CFG = config_win
+elif sys.platform == 'win32' and is_msys_mingw():
+    print 'Using WINDOWS mingw/msys configuration...\n'
+    import config_msys
+    CFG = config_msys
 elif sys.platform == 'darwin':
     print 'Using Darwin configuration...\n'
     import config_darwin

distutils_mods.py

         cmpl = cmpl.replace("\\", "/")
         cmpl = cmpl.replace("c:", "/c")
         cmpl = cmpl.replace("C:", "/c")
+        cmpl = cmpl.replace("gcc", "gcc -g ")
         
         if self.verbose:
             print "cmpl is :%s:" % cmpl
 from distutils.ccompiler import new_compiler
 from distutils.command.install_data import install_data
 
+import config
+# a separate method for finding dlls with mingw.
+if config.is_msys_mingw():
+
+	# fix up the paths for msys compiling.
+	import distutils_mods
+	distutils.cygwinccompiler.Mingw32 = distutils_mods.mingcomp
+
+
 
 #headers to install
 headers = glob.glob(os.path.join('src', '*.h'))
 
 #try to find DLLs and copy them too  (only on windows)
 if sys.platform == 'win32':
-    tempcompiler = new_compiler()
-    ext = tempcompiler.shared_lib_extension
-    for e in extensions:
-        paths = []
-        for d in e.library_dirs:
-             for l in e.libraries:
-                    name = tempcompiler.shared_lib_format%(l, ext)
-                    paths.append(os.path.join(d, name))
-        for p in paths:
-            if os.path.isfile(p) and p not in data_files:
-                data_files.append(p)
+    
+    # check to see if we are using mingw.
+    import config
+    # a separate method for finding dlls with mingw.
+    if config.is_msys_mingw():
+
+        print data_files
+        # FIXME: hardcoding the dll paths for the moment.
+        the_dlls = ["C:\\msys\\1.0\\local\\bin\\SDL.dll",
+                    "C:\\msys\\1.0\\local\\bin\\SDL_image.dll",
+                    "C:\\msys\\1.0\\local\\bin\\SDL_ttf.dll",
+                    "C:\\msys\\1.0\\local\\bin\\SDL_mixer.dll",
+                   ]
+                   # no smpeg.
+                    #"C:\\msys\\1.0\\local\\bin\\smpeg.dll"]
+
+        data_files.extend(the_dlls)
+
+
+        
+        ext = "dll"
+        for e in extensions:
+            paths = []
+            print e.library_dirs
+            for d in e.library_dirs:
+                 for l in e.libraries:
+                        #name = tempcompiler.shared_lib_format%(l, ext)
+                        name = "%s.%s" %(l, ext)
+                        paths.append(os.path.join(d, name))
+            #print paths
+            for p in paths:
+                if os.path.isfile(p) and p not in data_files:
+                    data_files.append(p)
+
+
+    else:
+
+        tempcompiler = new_compiler()
+        ext = tempcompiler.shared_lib_extension
+        for e in extensions:
+            paths = []
+            print e.library_dirs
+            for d in e.library_dirs:
+                 for l in e.libraries:
+                        name = tempcompiler.shared_lib_format%(l, ext)
+                        paths.append(os.path.join(d, name))
+            for p in paths:
+                if os.path.isfile(p) and p not in data_files:
+                    data_files.append(p)
+
+
 
 
 #clean up the list of extensions
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.