1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133
|
#!/usr/bin/env python
import distutils.core
import os
import os.path
import platform
import sys
try:
import bdist_mpkg
except:
pass
# This environment variable should have the full path to the installed
# Ren'Py dependencies.
install = os.environ.get("RENPY_DEPS_INSTALL", "/home/tom/ab/deps/install")
# Check to see if that's the case.
if not os.path.isdir(install):
print "The Ren'Py dependencies install directory:"
print
print install
print
print "does not exist. Please set RENPY_DEPS_INSTALL to the correct"
print "location of the Ren'Py dependencies install directory, and "
print "re-run this script."
sys.exit(-1)
# Default compile arguements for everybody.
include_dirs = [ install + "/include", install + "/include/SDL" ]
library_dirs = [ install + "/lib" ]
extra_compile_args = [ "-O3", "-funroll-loops", "-ffast-math" ]
extra_link_args = [ ]
png_libraries = [ 'png', "z" ]
sdl_libraries = [ 'SDL' ]
sound_libraries = [ 'SDL_sound', 'smpeg', 'vorbisfile', 'vorbis', 'ogg', 'modplug', 'speex', 'stdc++', ]
# The following turn on optional modules.
nativemidi = None
winmixer = None
linmixer = None
# Detect win32.
if platform.win32_ver()[0]:
nativemidi = [ 'nativemidi.c', 'native_midi_win32.c', 'native_midi_common.c', 'rwobject.c' ]
nativemidi_libs = [ 'winmm', 'SDL' ]
extra_compile_args.append("-fno-strict-aliasing")
winmixer = True
# Detect mac.
if platform.mac_ver()[0]:
nativemidi = [ 'nativemidi.c', 'native_midi_mac.c', 'native_midi_common.c', 'rwobject.c' ]
nativemidi_libs = [ 'SDL' ]
# Detect OSS.
try:
import ossaudiodev
linmixer = True
except:
pass
extensions = [ ]
py_modules = [ 'pysdlsound.__init__' ]
rpe = distutils.core.Extension(
"_renpy",
[ "IMG_savepng.c", "core.c", "rwobject.c", "_renpy.c" ],
include_dirs=include_dirs,
library_dirs=library_dirs,
extra_compile_args=extra_compile_args,
extra_link_args=extra_link_args,
libraries=sdl_libraries + png_libraries,
)
extensions.append(rpe)
psse = distutils.core.Extension(
"pysdlsound.sound",
[ "pss.c", "rwobject.c", "sound.c" ],
include_dirs=include_dirs,
library_dirs=library_dirs,
extra_compile_args=extra_compile_args,
extra_link_args=extra_link_args,
libraries=sound_libraries + sdl_libraries,
)
extensions.append(psse)
if nativemidi:
nme = distutils.core.Extension(
"pysdlsound.nativemidi",
nativemidi,
include_dirs=include_dirs,
library_dirs=library_dirs,
extra_compile_args=extra_compile_args,
libraries=nativemidi_libs,
extra_link_args=extra_link_args,
)
extensions.append(nme)
if winmixer:
wme = distutils.core.Extension(
"pysdlsound.winmixer",
[ 'winmixer.c' ],
libraries=['winmm'],
)
extensions.append(wme)
if linmixer:
py_modules.append('pysdlsound.linmixer')
# ffplay = distutils.core.Extension(
# "renpy_ffplay",
# ["renpy_ffplay.c", "ffplay_module.c"],
# include_dirs = [ install + '/include/SDL', install + '/include/ffmpeg', install + '/include' ],
# library_dirs = [ install + '/lib' ],
# libraries = [ 'avcodec', 'avformat', 'avcodec', 'avutil', 'vorbis', 'vorbisenc', 'ogg', 'SDL', 'z', 'm', ],
# )
# extensions.append(ffplay)
distutils.core.setup(
name = "renpy_module",
version = "5.5.0",
ext_modules = extensions,
py_modules = py_modules,
package_dir = { '' : 'lib' },
)
|