Commits

Leonard Ritter committed f04f6e5

darwin installs dylib

  • Participants
  • Parent commits 3a2ff15

Comments (0)

Files changed (4)

 *.avi
 *.glc
 *.dll
+*.dylib
 *.mp4
 *.p3d
 debug.txt
-@echo off
 python utils/mksdl.py %*
 
     dllname = 'libSDL2.so'
 elif sys.platform == 'win32':
     dllname = 'SDL2.dll'
+else:
+    dllname = 'libSDL2.dylib'
 
 setup(
     name = "pysdl-cffi",

File utils/mksdl.py

         os.path.join(builddir, 'SDL2.dll'),
         os.path.join(basedir, 'sdl'))
 
+def run_darwin_build():
+    if not clone_repo():
+        return
+    
+    os.chdir(targetdir)
+    builddir = os.path.join(targetdir, 'build')
+    if not os.path.isdir(builddir):
+        os.makedirs(builddir)
+    
+    os.environ['CFLAGS'] = '-fPIC'
+    os.environ['CXXFLAGS'] = '-fPIC'
+    os.chdir(builddir)
+    cmd = '../configure --with-pic --prefix {0}'.format(bindir)
+    print(cmd)
+    if os.system(cmd):
+        print("failed :(")
+        return
+    
+    cmd = 'make -j 4'
+    print(cmd)
+    if os.system(cmd):
+        print("failed :(")
+        return
+    
+    if os.path.isdir(bindir):
+        print("Removing stale {0}...".format(bindir))
+        shutil.rmtree(bindir)
+    os.makedirs(bindir)
+    
+    cmd = 'make install'
+    print(cmd)
+    if os.system(cmd):
+        print("failed :(")
+        return
+    
+    # copy over
+    shutil.copy2(os.path.join(bindir, 'lib', 'libSDL2-2.0.0.dylib'),
+        os.path.join(basedir, 'sdl', 'libSDL2.dylib'))
+    
+    print("SDL is ready.")
+
 def run_linux_build():
     if not clone_repo():
         return
 if __name__ == '__main__':
     if sys.platform == 'linux2':
         run_linux_build()
+    elif sys.platform == 'darwin':
+        run_darwin_build()
     elif sys.platform == 'win32':
         run_win32_build()