def find_freetype(): """ modern freetype uses pkg-config. However, some older systems don't have that. """ pkg_config = DependencyProg('FREETYPE', 'FREETYPE_CONFIG', 'pkg-config freetype2', '2.0', ['freetype2'], '--modversion') if pkg_config.found: return pkg_config #DependencyProg('FREETYPE', 'FREETYPE_CONFIG', '/usr/X11R6/bin/freetype-config', '2.0', freetype_config = DependencyProg('FREETYPE', 'FREETYPE_CONFIG', 'freetype-config', '2.0', ['freetype'], '--ftversion') if freetype_config.found: return freetype_config return pkg_config
'--modversion') if pkg_config.found: return pkg_config #DependencyProg('FREETYPE', 'FREETYPE_CONFIG', '/usr/X11R6/bin/freetype-config', '2.0', freetype_config = DependencyProg('FREETYPE', 'FREETYPE_CONFIG', 'freetype-config', '2.0', ['freetype'], '--ftversion') if freetype_config.found: return freetype_config return pkg_config DEPS = [ [ DependencyProg('SDL', 'SDL_CONFIG', 'sdl-config', '1.2', ['sdl']), FrameworkDependency('SDL', 'SDL.h', 'libSDL', 'SDL') ], [ Dependency('FONT', ['SDL_ttf.h', 'SDL/SDL_ttf.h'], 'libSDL_ttf', ['SDL_ttf']), FrameworkDependency('FONT', 'SDL_ttf.h', 'libSDL_ttf', 'SDL_ttf') ], [ Dependency('IMAGE', ['SDL_image.h', 'SDL/SDL_image.h'], 'libSDL_image', ['SDL_image']), FrameworkDependency('IMAGE', 'SDL_image.h', 'libSDL_image', 'SDL_image') ], [ Dependency('MIXER', ['SDL_mixer.h', 'SDL/SDL_mixer.h'], 'libSDL_mixer',
self.ver = __import__(self.module).__version__ except ImportError: self.found = 0 if self.found and self.header: fullpath = os.path.join(get_python_inc(0), self.header) if not os.path.isfile(fullpath): self.found = 0 else: self.inc_dir = os.path.split(fullpath)[0] if self.found: print (self.name + ' '[len(self.name):] + ': found', self.ver) else: print (self.name + ' '[len(self.name):] + ': not found') DEPS = [ [DependencyProg('SDL', 'SDL_CONFIG', 'sdl-config', '1.2', ['sdl']), FrameworkDependency('SDL', 'SDL.h', 'libSDL', 'SDL')], [Dependency('FONT', ['SDL_ttf.h', 'SDL/SDL_ttf.h'], 'libSDL_ttf', ['SDL_ttf']), FrameworkDependency('FONT', 'SDL_ttf.h', 'libSDL_ttf', 'SDL_ttf')], [Dependency('IMAGE', ['SDL_image.h', 'SDL/SDL_image.h'], 'libSDL_image', ['SDL_image']), FrameworkDependency('IMAGE', 'SDL_image.h', 'libSDL_image', 'SDL_image')], [Dependency('MIXER', ['SDL_mixer.h', 'SDL/SDL_mixer.h'], 'libSDL_mixer', ['SDL_mixer']), FrameworkDependency('MIXER', 'SDL_mixer.h', 'libSDL_mixer', 'SDL_mixer')], [DependencyProg('SMPEG', 'SMPEG_CONFIG', 'smpeg-config', '0.4.3', ['smpeg']), FrameworkDependency('SMPEG', 'smpeg.h', 'libsmpeg', 'smpeg')], FrameworkDependency('PORTTIME', 'CoreMidi.h', 'CoreMidi', 'CoreMIDI'), FrameworkDependency('QUICKTIME', 'QuickTime.h', 'QuickTime', 'QuickTime'), Dependency('PNG', 'png.h', 'libpng', ['png']), Dependency('JPEG', 'jpeglib.h', 'libjpeg', ['jpeg']), Dependency('PORTMIDI', 'portmidi.h', 'libportmidi', ['portmidi']), DependencyProg('FREETYPE', 'FREETYPE_CONFIG', 'false', '2.0',
self.ver = __import__(self.module).__version__ except ImportError: self.found = 0 if self.found and self.header: fullpath = os.path.join(get_python_inc(0), self.header) if not os.path.isfile(fullpath): self.found = 0 else: self.inc_dir = os.path.split(fullpath)[0] if self.found: print (self.name + ' '[len(self.name):] + ': found', self.ver) else: print (self.name + ' '[len(self.name):] + ': not found') DEPS = [ [DependencyProg('SDL', 'SDL_CONFIG', 'sdl-config', '1.2', ['sdl']), FrameworkDependency('SDL', 'SDL.h', 'libSDL', 'SDL')], [Dependency('FONT', ['SDL_ttf.h', 'SDL/SDL_ttf.h'], 'libSDL_ttf', ['SDL_ttf']), FrameworkDependency('FONT', 'SDL_ttf.h', 'libSDL_ttf', 'SDL_ttf')], [Dependency('IMAGE', ['SDL_image.h', 'SDL/SDL_image.h'], 'libSDL_image', ['SDL_image']), FrameworkDependency('IMAGE', 'SDL_image.h', 'libSDL_image', 'SDL_image')], [Dependency('MIXER', ['SDL_mixer.h', 'SDL/SDL_mixer.h'], 'libSDL_mixer', ['SDL_mixer']), FrameworkDependency('MIXER', 'SDL_mixer.h', 'libSDL_mixer', 'SDL_mixer')], FrameworkDependency('PORTTIME', 'CoreMidi.h', 'CoreMidi', 'CoreMIDI'), FrameworkDependency('QUICKTIME', 'QuickTime.h', 'QuickTime', 'QuickTime'), Dependency('PNG', 'png.h', 'libpng', ['png']), Dependency('JPEG', 'jpeglib.h', 'libjpeg', ['jpeg']), Dependency('PORTMIDI', 'portmidi.h', 'libportmidi', ['portmidi']), #DependencyProg('FREETYPE', 'FREETYPE_CONFIG', '/usr/X11R6/bin/freetype-config', '2.0', # DependencyProg('FREETYPE', 'FREETYPE_CONFIG', 'freetype-config', '2.0', # ['freetype'], '--ftversion'),
self.ver = __import__(self.module).__version__ except ImportError: self.found = 0 if self.found and self.header: fullpath = os.path.join(get_python_inc(0), self.header) if not os.path.isfile(fullpath): self.found = 0 else: self.inc_dir = os.path.split(fullpath)[0] if self.found: print (self.name + ' '[len(self.name):] + ': found', self.ver) else: print (self.name + ' '[len(self.name):] + ': not found') DEPS = [ [DependencyProg('SDL', 'SDL_CONFIG', 'sdl-config', '1.2', ['sdl']), FrameworkDependency('SDL', 'SDL.h', 'libSDL', 'SDL')], [Dependency('FONT', ['SDL_ttf.h', 'SDL/SDL_ttf.h'], 'libSDL_ttf', ['SDL_ttf']), FrameworkDependency('FONT', 'SDL_ttf.h', 'libSDL_ttf', 'SDL_ttf')], [Dependency('IMAGE', ['SDL_image.h', 'SDL/SDL_image.h'], 'libSDL_image', ['SDL_image']), FrameworkDependency('IMAGE', 'SDL_image.h', 'libSDL_image', 'SDL_image')], [Dependency('MIXER', ['SDL_mixer.h', 'SDL/SDL_mixer.h'], 'libSDL_mixer', ['SDL_mixer']), FrameworkDependency('MIXER', 'SDL_mixer.h', 'libSDL_mixer', 'SDL_mixer')], [DependencyProg('SMPEG', 'SMPEG_CONFIG', 'smpeg-config', '0.4.3', ['smpeg']), FrameworkDependency('SMPEG', 'smpeg.h', 'libsmpeg', 'smpeg')], FrameworkDependency('PORTTIME', 'CoreMidi.h', 'CoreMidi', 'CoreMIDI'), FrameworkDependency('QUICKTIME', 'QuickTime.h', 'QuickTime', 'QuickTime'), Dependency('PNG', 'png.h', 'libpng', ['png']), Dependency('JPEG', 'jpeglib.h', 'libjpeg', ['jpeg']), Dependency('SCRAP', '','',[]), Dependency('PORTMIDI', 'portmidi.h', 'libportmidi', ['portmidi']),
def main(): DEPS = [ [DependencyProg('SDL', 'SDL_CONFIG', 'sdl2-config', '2.0', ['sdl'])], [ Dependency('FONT', ['SDL_ttf.h', 'SDL2/SDL_ttf.h'], 'libSDL2_ttf', ['SDL2_ttf']) ], [ Dependency('IMAGE', ['SDL_image.h', 'SDL2/SDL_image.h'], 'libSDL2_image', ['SDL2_image']) ], [ Dependency('MIXER', ['SDL_mixer.h', 'SDL2/SDL_mixer.h'], 'libSDL2_mixer', ['SDL2_mixer']) ], ] DEPS.extend([ Dependency('PNG', 'png.h', 'libpng', ['png']), Dependency('JPEG', 'jpeglib.h', 'libjpeg', ['jpeg']), Dependency('PORTMIDI', 'portmidi.h', 'libportmidi', ['portmidi']), Dependency('PORTTIME', 'porttime.h', '', []), find_freetype(), # Scrap is included in sdlmain_osx, there is nothing to look at. # Dependency('SCRAP', '','',[]), ]) print('Hunting dependencies...') incdirs = ['/usr/local/include', '/opt/homebrew/include'] incdirs.extend([ '/usr/local/include/SDL2', '/opt/homebrew/include/SDL2', '/opt/local/include/SDL2' ]) incdirs.extend([ #'/usr/X11/include', '/opt/local/include', '/opt/local/include/freetype2/freetype' ]) #libdirs = ['/usr/local/lib', '/usr/X11/lib', '/opt/local/lib'] libdirs = ['/usr/local/lib', '/opt/local/lib', '/opt/homebrew/lib'] for d in DEPS: if isinstance(d, (list, tuple)): for deptype in d: deptype.configure(incdirs, libdirs) else: d.configure(incdirs, libdirs) for d in DEPS: if type(d) == list: found = False for deptype in d: if deptype.found: found = True DEPS[DEPS.index(d)] = deptype break if not found: DEPS[DEPS.index(d)] = d[0] DEPS[0].cflags = '-Ddarwin ' + DEPS[0].cflags return DEPS
if self.found and self.header: fullpath = os.path.join(get_python_inc(0), self.header) if not os.path.isfile(fullpath): self.found = 0 else: self.inc_dir = os.path.split(fullpath)[0] if self.found: print(self.name + ' '[len(self.name):] + ': found', self.ver) else: print(self.name + ' '[len(self.name):] + ': not found') DEPS = [ [ DependencyProg('SDL', 'SDL_CONFIG', 'sdl-config', '1.2', ['sdl']), FrameworkDependency('SDL', 'SDL.h', 'libSDL', 'SDL') ], [ Dependency('FONT', ['SDL_ttf.h', 'SDL/SDL_ttf.h'], 'libSDL_ttf', ['SDL_ttf']), FrameworkDependency('FONT', 'SDL_ttf.h', 'libSDL_ttf', 'SDL_ttf') ], [ Dependency('IMAGE', ['SDL_image.h', 'SDL/SDL_image.h'], 'libSDL_image', ['SDL_image']), FrameworkDependency('IMAGE', 'SDL_image.h', 'libSDL_image', 'SDL_image') ], [ Dependency('MIXER', ['SDL_mixer.h', 'SDL/SDL_mixer.h'], 'libSDL_mixer',