コード例 #1
0
ファイル: config_win.py プロジェクト: steveng2/pygame
def setup(sdl2):
    DEPS = DependencyGroup()

    if not sdl2:
        DEPS.add('SDL',
                 'SDL', ['SDL-[1-9].*'],
                 r'(lib){0,1}SDL\.dll$',
                 required=1)
        DEPS.add('FONT', 'SDL_ttf', ['SDL_ttf-[2-9].*'],
                 r'(lib){0,1}SDL_ttf\.dll$', ['SDL', 'z'])
        DEPS.add('IMAGE', 'SDL_image', ['SDL_image-[1-9].*'],
                 r'(lib){0,1}SDL_image\.dll$', ['SDL', 'jpeg', 'png', 'tiff'],
                 0),
        DEPS.add('MIXER', 'SDL_mixer', ['SDL_mixer-[1-9].*'],
                 r'(lib){0,1}SDL_mixer\.dll$', ['SDL', 'vorbisfile'])
        DEPS.add('PNG', 'png', ['libpng-[1-9].*'], r'(png|libpng13)\.dll$',
                 ['z'])
        DEPS.add('JPEG', 'jpeg', ['jpeg-[6-9]*'], r'(lib){0,1}jpeg\.dll$')
        DEPS.add('PORTMIDI', 'portmidi', ['portmidi'], r'portmidi\.dll$')
        #DEPS.add('PORTTIME', 'porttime', ['porttime'], r'porttime\.dll$')
        DEPS.add_dll(r'(lib){0,1}tiff\.dll$', 'tiff', ['tiff-[3-9].*'],
                     ['jpeg', 'z'])
        DEPS.add_dll(r'(z|zlib1)\.dll$', 'z', ['zlib-[1-9].*'])
        DEPS.add_dll(r'(libvorbis-0|vorbis)\.dll$', 'vorbis',
                     ['libvorbis-[1-9].*'], ['ogg'])
        DEPS.add_dll(r'(libvorbisfile-3|vorbisfile)\.dll$',
                     'vorbisfile',
                     link_lib='vorbis',
                     libs=['vorbis'])
        DEPS.add_dll(r'(libogg-0|ogg)\.dll$', 'ogg', ['libogg-[1-9].*'])
        for d in get_definitions():
            DEPS.add_win(d.name, d.value)
    else:
        DEPS.add('SDL',
                 'SDL2', ['SDL2-[1-9].*'],
                 r'(lib){0,1}SDL2\.dll$',
                 required=1)
        DEPS.add('PORTMIDI', 'portmidi', ['portmidi'], r'portmidi\.dll$')
        #DEPS.add('PORTTIME', 'porttime', ['porttime'], r'porttime\.dll$')
        DEPS.add('MIXER', 'SDL2_mixer', ['SDL2_mixer-[1-9].*'],
                 r'(lib){0,1}SDL2_mixer\.dll$', ['SDL', 'vorbisfile'])
        DEPS.add('IMAGE', 'SDL2_image', ['SDL2_image-[1-9].*'],
                 r'(lib){0,1}SDL2_image\.dll$', ['SDL', 'jpeg', 'png', 'tiff'],
                 0)
        DEPS.add('FONT', 'SDL2_ttf', ['SDL2_ttf-[2-9].*'],
                 r'(lib){0,1}SDL2_ttf\.dll$', ['SDL', 'z', 'freetype'])
        DEPS.add('FREETYPE',
                 'freetype', ['freetype-[1-9].*'],
                 r'(lib){0,1}libfreetype[-0-9]*.dll\.dll$',
                 find_header='ft2build\.h',
                 find_lib='(lib)?freetype[-0-9]*\.lib')
        _add_sdl2_dll_deps(DEPS)
        for d in get_definitions():
            DEPS.add_win(d.name, d.value)

    DEPS.configure()
    return list(DEPS)
コード例 #2
0
ファイル: config_win.py プロジェクト: greck2908/pygame
def setup():
    DEPS = DependencyGroup()

    DEPS.add('SDL', 'SDL2', ['SDL2-[1-9].*'], r'(lib){0,1}SDL2\.dll$', required=1)
    DEPS.add('PORTMIDI', 'portmidi', ['portmidi'], r'portmidi\.dll$', find_header=r'portmidi\.h')
    #DEPS.add('PORTTIME', 'porttime', ['porttime'], r'porttime\.dll$')
    DEPS.add_dummy('PORTTIME')
    DEPS.add('MIXER', 'SDL2_mixer', ['SDL2_mixer-[1-9].*'], r'(lib){0,1}SDL2_mixer\.dll$',
             ['SDL', 'vorbisfile'])
    DEPS.add('PNG', 'png', ['SDL2_image-[2-9].*', 'libpng-[1-9].*'], r'(png|libpng)[-0-9]*\.dll$', ['z'],
             find_header=r'png\.h', find_lib=r'(lib)?png1[-0-9]*\.lib')
    DEPS.add('JPEG', 'jpeg', ['SDL2_image-[2-9].*', 'jpeg-9*'], r'(lib){0,1}jpeg-9\.dll$',
             find_header=r'jpeglib\.h', find_lib=r'(lib)?jpeg-9\.lib')
    DEPS.add('IMAGE', 'SDL2_image', ['SDL2_image-[1-9].*'], r'(lib){0,1}SDL2_image\.dll$',
             ['SDL', 'jpeg', 'png', 'tiff'], 0)
    DEPS.add('FONT', 'SDL2_ttf', ['SDL2_ttf-[2-9].*'], r'(lib){0,1}SDL2_ttf\.dll$', ['SDL', 'z', 'freetype'])
    DEPS.add('FREETYPE', 'freetype', ['freetype-[1-9].*'], r'(lib){0,1}freetype[-0-9]*\.dll$',
             find_header=r'ft2build\.h', find_lib=r'(lib)?freetype[-0-9]*\.lib')
    DEPS.configure()
    _add_sdl2_dll_deps(DEPS)
    for d in get_definitions():
        DEPS.add_win(d.name, d.value)
    DEPS.configure()

    return list(DEPS)
コード例 #3
0
ファイル: config_win.py プロジェクト: MyreMylar/pygame
def setup_prebuilt_sdl2(prebuilt_dir):
    Dependency.huntpaths[:] = [prebuilt_dir]
    Dependency.lib_hunt.extend([
        '',
        'lib',
        os.path.join('lib', get_machine_type()),
    ])
    Dependency.inc_hunt.append('')

    DEPS = DependencyGroup()

    DEPS.add('SDL',
             'SDL2', ['SDL2-[1-9].*'],
             r'(lib){0,1}SDL2\.dll$',
             required=1)
    fontDep = DEPS.add('FONT', 'SDL2_ttf', ['SDL2_ttf-[2-9].*'],
                       r'(lib){0,1}SDL2_ttf\.dll$', ['SDL'])
    imageDep = DEPS.add('IMAGE', 'SDL2_image', ['SDL2_image-[1-9].*'],
                        r'(lib){0,1}SDL2_image\.dll$',
                        ['SDL', 'jpeg', 'png', 'tiff'], 0)
    mixerDep = DEPS.add('MIXER', 'SDL2_mixer', ['SDL2_mixer-[1-9].*'],
                        r'(lib){0,1}SDL2_mixer\.dll$', ['SDL', 'vorbisfile'])
    DEPS.add('PORTMIDI',
             'portmidi', ['portmidi'],
             r'portmidi\.dll$',
             find_header=r'portmidi\.h')
    #DEPS.add('PORTTIME', 'porttime', ['porttime'], r'porttime\.dll$')
    DEPS.add_dummy('PORTTIME')
    DEPS.configure()

    DEPS.add('FREETYPE',
             'freetype', ['freetype'],
             r'freetype[-0-9]*\.dll$',
             find_header=r'ft2build\.h',
             find_lib=r'freetype[-0-9]*\.lib')

    png = DEPS.add('PNG',
                   'png', ['SDL2_image-[2-9].*', 'libpng-[1-9].*'],
                   r'(png|libpng)[-0-9]*\.dll$', ['z'],
                   find_header=r'png\.h',
                   find_lib=r'(lib)?png1[-0-9]*\.lib')
    png.path = imageDep.path
    png.inc_dir = [os.path.join(prebuilt_dir, 'include').replace('\\', '/')]
    png.found = True
    jpeg = DEPS.add('JPEG',
                    'jpeg', ['SDL2_image-[2-9].*', 'jpeg-9*'],
                    r'(lib){0,1}jpeg-9\.dll$',
                    find_header=r'jpeglib\.h',
                    find_lib=r'(lib)?jpeg-9\.lib')
    jpeg.path = imageDep.path
    jpeg.inc_dir = [os.path.join(prebuilt_dir, 'include').replace('\\', '/')]
    jpeg.found = True

    dllPaths = {
        'png': imageDep.path,
        'jpeg': imageDep.path,
        'tiff': imageDep.path,
        'z': imageDep.path,
        'webp': imageDep.path,
        'vorbis': mixerDep.path,
        'vorbisfile': mixerDep.path,
        'ogg': mixerDep.path,
        'flac': mixerDep.path,
        'modplug': mixerDep.path,
        'mpg123': mixerDep.path,
        'opus': mixerDep.path,
        'opusfile': mixerDep.path,
    }
    _add_sdl2_dll_deps(DEPS)
    for dll in DEPS.dlls:
        if dllPaths.get(dll.lib_name):
            dll.path = dllPaths.get(dll.lib_name)

    for d in get_definitions():
        DEPS.add_win(d.name, d.value)

    DEPS.configure()
    return list(DEPS)
コード例 #4
0
ファイル: config_win.py プロジェクト: endolith/pygame
DEPS.add('IMAGE', 'SDL_image', ['SDL_image-[1-9].*'], r'(lib){0,1}SDL_image\.dll$',
         ['SDL', 'jpeg', 'png', 'tiff'], 0),
DEPS.add('MIXER', 'SDL_mixer', ['SDL_mixer-[1-9].*'], r'(lib){0,1}SDL_mixer\.dll$',
         ['SDL', 'vorbisfile'])
DEPS.add('PNG', 'png', ['libpng-[1-9].*'], r'(png|libpng13)\.dll$', ['z'])
DEPS.add('JPEG', 'jpeg', ['jpeg-[6-9]*'], r'(lib){0,1}jpeg\.dll$')
DEPS.add('PORTMIDI', 'portmidi', ['portmidi'], r'portmidi\.dll$')
#DEPS.add('PORTTIME', 'porttime', ['porttime'], r'porttime\.dll$')
DEPS.add_dll(r'(lib){0,1}tiff\.dll$', 'tiff', ['tiff-[3-9].*'], ['jpeg', 'z'])
DEPS.add_dll(r'(z|zlib1)\.dll$', 'z', ['zlib-[1-9].*'])
DEPS.add_dll(r'(libvorbis-0|vorbis)\.dll$', 'vorbis', ['libvorbis-[1-9].*'],
             ['ogg'])
DEPS.add_dll(r'(libvorbisfile-3|vorbisfile)\.dll$', 'vorbisfile',
             link_lib='vorbis', libs=['vorbis'])
DEPS.add_dll(r'(libogg-0|ogg)\.dll$', 'ogg', ['libogg-[1-9].*'])
for d in get_definitions():
    DEPS.add_win(d.name, d.value)


def setup_prebuilt(prebuilt_dir):
    setup = open('Setup', 'w')
    try:
        try:
            setup_win_in = open(os.path.join(prebuilt_dir, 'Setup_Win.in'))
        except IOError:
            raise IOError("%s missing required Setup_Win.in" % prebuilt_dir)

        # Copy Setup.in to Setup, replacing the BeginConfig/EndConfig
        # block with prebuilt\Setup_Win.in .
        setup_in = open('Setup.in')
        try:
コード例 #5
0
ファイル: config_msys2.py プロジェクト: greck2908/pygame
def setup_prebuilt_sdl2(prebuilt_dir):
    Dependency.huntpaths[:] = [prebuilt_dir]
    Dependency.lib_hunt.extend([
        '',
        # MSYS2 installs prebuilt .dll in /mingw*/bin
        'bin',
        'lib',
    ])
    Dependency.inc_hunt.append('')

    DEPS = DependencyGroup()

    sdlDep = DEPS.add('SDL',
                      'SDL2', ['SDL2-[1-9].*'],
                      r'(lib){0,1}SDL2\.dll$',
                      find_header=r'SDL\.h',
                      required=1)
    sdlDep.inc_dir = [os.path.join(prebuilt_dir, 'include').replace('\\', '/')]
    sdlDep.inc_dir.append('%s/SDL2' % sdlDep.inc_dir[0])
    fontDep = DEPS.add('FONT', 'SDL2_ttf', ['SDL2_ttf-[2-9].*'],
                       r'(lib){0,1}SDL2_ttf\.dll$', ['SDL', 'z', 'freetype'])
    imageDep = DEPS.add('IMAGE', 'SDL2_image', ['SDL2_image-[1-9].*'],
                        r'(lib){0,1}SDL2_image\.dll$',
                        ['SDL', 'jpeg', 'png', 'tiff'], 0)
    mixerDep = DEPS.add('MIXER', 'SDL2_mixer', ['SDL2_mixer-[1-9].*'],
                        r'(lib){0,1}SDL2_mixer\.dll$', ['SDL', 'vorbisfile'])
    DEPS.add('PORTMIDI',
             'portmidi', ['portmidi'],
             r'(lib){0,1}portmidi\.dll$',
             find_header=r'portmidi\.h')
    # #DEPS.add('PORTTIME', 'porttime', ['porttime'], r'porttime\.dll$')
    DEPS.add_dummy('PORTTIME')

    # force use of the correct freetype DLL
    ftDep = DEPS.add('FREETYPE',
                     'freetype', ['SDL2_ttf-[2-9].*', 'freetype-[1-9].*'],
                     r'(lib)?freetype[-0-9]*\.dll$',
                     find_header=r'ft2build\.h',
                     find_lib=r'libfreetype[-0-9]*\.dll\.a')
    ftDep.path = fontDep.path
    ftDep.inc_dir = [os.path.join(prebuilt_dir, 'include').replace('\\', '/')]
    ftDep.inc_dir.append('%s/freetype2' % ftDep.inc_dir[0])
    ftDep.found = True

    png = DEPS.add('PNG',
                   'png', ['SDL2_image-[2-9].*', 'libpng-[1-9].*'],
                   r'(png|libpng)[-0-9]*\.dll$', ['z'],
                   find_header=r'png\.h',
                   find_lib=r'(lib)?png1[-0-9]*\.dll\.a')
    png.path = imageDep.path
    png.inc_dir = [os.path.join(prebuilt_dir, 'include').replace('\\', '/')]
    png.found = True
    jpeg = DEPS.add('JPEG',
                    'jpeg', ['SDL2_image-[2-9].*', 'jpeg(-8*)?'],
                    r'(lib){0,1}jpeg-8\.dll$',
                    find_header=r'jpeglib\.h',
                    find_lib=r'(lib)?jpeg(-8)?\.dll\.a')
    jpeg.path = imageDep.path
    jpeg.inc_dir = [os.path.join(prebuilt_dir, 'include').replace('\\', '/')]
    jpeg.found = True

    dllPaths = {
        'png': imageDep.path,
        'jpeg': imageDep.path,
        'tiff': imageDep.path,
        'z': imageDep.path,
        'webp': imageDep.path,
        'vorbis': mixerDep.path,
        'vorbisfile': mixerDep.path,
        'ogg': mixerDep.path,
        'flac': mixerDep.path,
        'modplug': mixerDep.path,
        'mpg123': mixerDep.path,
        'opus': mixerDep.path,
        'opusfile': mixerDep.path,
        'freetype': fontDep.path,
    }
    _add_sdl2_dll_deps(DEPS)
    for dll in DEPS.dlls:
        if dllPaths.get(dll.lib_name):
            dll.path = dllPaths.get(dll.lib_name)

    for d in get_definitions():
        DEPS.add_win(d.name, d.value)

    DEPS.configure()
    return list(DEPS)
コード例 #6
0
DEPS.dlls.append(DependencyDLL(r'swscale\.dll', link=dep, libs=['swscale']))
DEPS.dlls.append(
    DependencyDLL(r'(lib){0,1}SDL_mixer\.dll$',
                  link=dep,
                  libs=['SDL', 'vorbisfile', 'smpeg']))
#DEPS.add('PORTTIME', 'porttime', ['porttime'], r'porttime\.dll$')
DEPS.add_dll(r'(lib){0,1}tiff\.dll$', 'tiff', ['tiff-[3-9].*'], ['jpeg', 'z'])
DEPS.add_dll(r'(z|zlib1)\.dll$', 'z', ['zlib-[1-9].*'])
DEPS.add_dll(r'(libvorbis-0|vorbis)\.dll$', 'vorbis', ['libvorbis-[1-9].*'],
             ['ogg'])
DEPS.add_dll(r'(libvorbisfile-3|vorbisfile)\.dll$',
             'vorbisfile',
             link_lib='vorbis',
             libs=['vorbis'])
DEPS.add_dll(r'(libogg-0|ogg)\.dll$', 'ogg', ['libogg-[1-9].*'])
for d in get_definitions():
    DEPS.add_win(d.name, d.value)


def setup_prebuilt(prebuilt_dir):
    setup = open('Setup', 'w')
    try:
        try:
            setup_win_in = open(os.path.join(prebuilt_dir, 'Setup_Win.in'))
        except IOError:
            raise IOError("%s missing required Setup_Win.in" % prebuilt_dir)

        # Copy Setup.in to Setup, replacing the BeginConfig/EndConfig
        # block with prebuilt\Setup_Win.in .
        setup_in = open('Setup.in')
        try:
コード例 #7
0
ファイル: config_msys.py プロジェクト: endolith/pygame
def main():
    m = msys.Msys(require_mingw=False)
    print_('\nHunting dependencies...')
    DEPS = [
        DependencyProg('SDL', 'SDL_CONFIG', 'sdl-config', '1.2.13', m),
        Dependency('FONT', 'SDL_ttf.h', 'libSDL_ttf.dll.a'),
        Dependency('IMAGE', 'SDL_image.h', 'libSDL_image.dll.a'),
        Dependency('MIXER', 'SDL_mixer.h', 'libSDL_mixer.dll.a'),
        Dependency('PNG', 'png.h', 'libpng.dll.a'),
        Dependency('JPEG', 'jpeglib.h', 'libjpeg.dll.a'),
        Dependency('PORTMIDI', 'portmidi.h', 'libportmidi.dll.a'),
        Dependency('PORTTIME', 'portmidi.h', 'libportmidi.dll.a'),
        DependencyDLL('TIFF'),
        DependencyDLL('VORBISFILE'),
        DependencyDLL('VORBIS'),
        DependencyDLL('OGG'),
        DependencyDLL('FREETYPE'),
        DependencyDLL('Z'),
    ]

    if not DEPS[0].found:
        print_('Unable to run "sdl-config". Please make sure a development version of SDL is installed.')
        sys.exit(1)

    if localbase:
        incdirs = [localbase+d for d in origincdirs]
        libdirs = [localbase+d for d in origlibdirs]
    else:
        incdirs = []
        libdirs = []
    incdirs += [m.msys_to_windows("/usr/local"+d) for d in origincdirs]
    libdirs += [m.msys_to_windows("/usr/local"+d) for d in origlibdirs]
    if m.mingw_root is not None:
        incdirs += [m.msys_to_windows("/mingw"+d) for d in origincdirs]
        libdirs += [m.msys_to_windows("/mingw"+d) for d in origlibdirs]
    for arg in string.split(DEPS[0].cflags):
        if arg[:2] == '-I':
            incdirs.append(arg[2:])
        elif arg[:2] == '-L':
            libdirs.append(arg[2:])
    dll_deps = []
    for d in DEPS:
        d.configure(incdirs, libdirs)
        if d.needs_dll:
            dll_dep = DependencyDLL(d.name)
            dll_dep.configure(incdirs, libdirs, d.lib_dir)
            dll_deps.append(dll_dep)

    DEPS += dll_deps
    for d in get_definitions():
        DEPS.append(DependencyWin(d.name, d.value))
    for d in DEPS:
        if isinstance(d, DependencyDLL):
            if d.lib_dir == '':
                print_("DLL for %-12s: not found" % d.lib_name)
            else:
                print_("DLL for %-12s: %s" % (d.lib_name, d.lib_dir))
    
    for d in DEPS[1:]:
        if not d.found:
            if "-auto" not in sys.argv and not confirm("""
Warning, some of the pygame dependencies were not found. Pygame can still
compile and install, but games that depend on those missing dependencies
will not run. Would you like to continue the configuration?"""):
                raise SystemExit("Missing dependencies")
            break

    return DEPS
コード例 #8
0
ファイル: config_win.py プロジェクト: steveng2/pygame
def setup_prebuilt_sdl2(prebuilt_dir):
    huntpaths[:] = [prebuilt_dir]
    Dependency.lib_hunt.extend([
        '',
        'lib',
        os.path.join('lib', get_machine_type()),
    ])
    Dependency.inc_hunt.append('')

    DEPS = DependencyGroup()

    DEPS.add('SDL',
             'SDL2', ['SDL2-[1-9].*'],
             r'(lib){0,1}SDL2\.dll$',
             required=1)
    fontDep = DEPS.add('FONT', 'SDL2_ttf', ['SDL2_ttf-[2-9].*'],
                       r'(lib){0,1}SDL2_ttf\.dll$', ['SDL', 'z'])
    imageDep = DEPS.add('IMAGE', 'SDL2_image', ['SDL2_image-[1-9].*'],
                        r'(lib){0,1}SDL2_image\.dll$',
                        ['SDL', 'jpeg', 'png', 'tiff'], 0)
    mixerDep = DEPS.add('MIXER', 'SDL2_mixer', ['SDL2_mixer-[1-9].*'],
                        r'(lib){0,1}SDL2_mixer\.dll$', ['SDL', 'vorbisfile'])
    DEPS.add('PORTMIDI', 'portmidi', ['portmidi'], r'portmidi\.dll$')
    #DEPS.add('PORTTIME', 'porttime', ['porttime'], r'porttime\.dll$')
    DEPS.add_dummy('PORTTIME')
    ftDep = DEPS.add('FREETYPE',
                     'freetype', ['freetype-[1-9].*'],
                     r'(lib){0,1}libfreetype[-0-9]*\.dll$',
                     find_header='ft2build\.h',
                     find_lib='(lib)?freetype[-0-9]*\.lib')

    DEPS.configure()

    # workaround to find freetype header
    if ftDep.found:
        ftDep.inc_dir = [ftDep.inc_dir, '%s/freetype2' % ftDep.inc_dir]

    dllPaths = {
        'png': imageDep.path,
        'jpeg': imageDep.path,
        'tiff': imageDep.path,
        'z': imageDep.path,
        'webp': imageDep.path,
        'vorbis': mixerDep.path,
        'vorbisfile': mixerDep.path,
        'ogg': mixerDep.path,
        'flac': mixerDep.path,
        'modplug': mixerDep.path,
        'mpg123': mixerDep.path,
        'opus': mixerDep.path,
        'opusfile': mixerDep.path,

        #'freetype': fontDep.path,
    }
    _add_sdl2_dll_deps(DEPS)
    for dll in DEPS.dlls:
        dll.path = dllPaths.get(dll.lib_name)

    for d in get_definitions():
        DEPS.add_win(d.name, d.value)

    DEPS.configure()
    return list(DEPS)
コード例 #9
0
ファイル: config_msys.py プロジェクト: swebb650/pygame-1
def main():
    m = msys.Msys(require_mingw=False)
    print_('\nHunting dependencies...')
    DEPS = [
        DependencyProg('SDL', 'SDL_CONFIG', 'sdl-config', '1.2.13', m),
        Dependency('FONT', 'SDL_ttf.h', 'libSDL_ttf.dll.a'),
        Dependency('IMAGE', 'SDL_image.h', 'libSDL_image.dll.a'),
        Dependency('MIXER', 'SDL_mixer.h', 'libSDL_mixer.dll.a'),
        Dependency('PNG', 'png.h', 'libpng.dll.a'),
        Dependency('JPEG', 'jpeglib.h', 'libjpeg.dll.a'),
        Dependency('PORTMIDI', 'portmidi.h', 'libportmidi.dll.a'),
        Dependency('PORTTIME', 'portmidi.h', 'libportmidi.dll.a'),
        DependencyDLL('TIFF'),
        DependencyDLL('VORBISFILE'),
        DependencyDLL('VORBIS'),
        DependencyDLL('OGG'),
        DependencyDLL('FREETYPE'),
        DependencyDLL('Z'),
    ]

    if not DEPS[0].found:
        print_('Unable to run "sdl-config". Please make sure a development version of SDL is installed.')
        sys.exit(1)

    if localbase:
        incdirs = [localbase+d for d in origincdirs]
        libdirs = [localbase+d for d in origlibdirs]
    else:
        incdirs = []
        libdirs = []
    incdirs += [m.msys_to_windows("/usr/local"+d) for d in origincdirs]
    libdirs += [m.msys_to_windows("/usr/local"+d) for d in origlibdirs]
    if m.mingw_root is not None:
        incdirs += [m.msys_to_windows("/mingw"+d) for d in origincdirs]
        libdirs += [m.msys_to_windows("/mingw"+d) for d in origlibdirs]
    for arg in string.split(DEPS[0].cflags):
        if arg[:2] == '-I':
            incdirs.append(arg[2:])
        elif arg[:2] == '-L':
            libdirs.append(arg[2:])
    dll_deps = []
    for d in DEPS:
        d.configure(incdirs, libdirs)
        if d.needs_dll:
            dll_dep = DependencyDLL(d.name)
            dll_dep.configure(incdirs, libdirs, d.lib_dir)
            dll_deps.append(dll_dep)

    DEPS += dll_deps
    for d in get_definitions():
        DEPS.append(DependencyWin(d.name, d.value))
    for d in DEPS:
        if isinstance(d, DependencyDLL):
            if d.lib_dir == '':
                print_("DLL for %-12s: not found" % d.lib_name)
            else:
                print_("DLL for %-12s: %s" % (d.lib_name, d.lib_dir))

    for d in DEPS[1:]:
        if not d.found:
            if "-auto" not in sys.argv:
                logging.warning(
                    "Some pygame dependencies were not found. "
                    "Pygame can still compile and install, but games that "
                    "depend on those missing dependencies will not run. "
                    "Use -auto to continue building without all dependencies. "
                )
                raise SystemExit("Missing dependencies")
            break

    return DEPS
コード例 #10
0
def main():
    m = msys.Msys(require_mingw=False)
    print_('\nHunting dependencies...')
    DEPS = [
        DependencyProg('SDL', 'SDL_CONFIG', 'sdl-config', '1.2.13', m),
        Dependency('FONT', 'SDL_ttf.h', 'libSDL_ttf.dll.a'),
        Dependency('IMAGE', 'SDL_image.h', 'libSDL_image.dll.a'),
        Dependency('MIXER', 'SDL_mixer.h', 'libSDL_mixer.dll.a'),
        DependencyProg('SMPEG', 'SMPEG_CONFIG', 'smpeg-config', '0.4.3', m),
        Dependency('PNG', 'png.h', 'libpng.dll.a'),
        Dependency('JPEG', 'jpeglib.h', 'libjpeg.dll.a'),
        Dependency('PORTMIDI', 'portmidi.h', 'libportmidi.dll.a'),
        Dependency('PORTTIME', 'portmidi.h', 'libportmidi.dll.a'),
        Dependency('AVFORMAT', 'libavformat/avformat.h', 'libavformat.dll.a',
                   ['avformat', 'avcodec', 'avutil']),
        Dependency('SWSCALE', 'libswscale/swscale.h', 'libswscale.dll.a',
                   ['swscale', 'avutil']),
        DependencyDLL('TIFF'),
        DependencyDLL('VORBISFILE'),
        DependencyDLL('VORBIS'),
        DependencyDLL('OGG'),
        DependencyDLL('FREETYPE'),
        DependencyDLL('Z'),
        DependencyDLL('AVCODEC'),
        DependencyDLL('AVUTIL'),
    ]

    if not DEPS[0].found:
        print_(
            'Unable to run "sdl-config". Please make sure a development version of SDL is installed.'
        )
        sys.exit(1)

    if localbase:
        incdirs = [localbase + d for d in origincdirs]
        libdirs = [localbase + d for d in origlibdirs]
    else:
        incdirs = []
        libdirs = []
    incdirs += [m.msys_to_windows("/usr/local" + d) for d in origincdirs]
    libdirs += [m.msys_to_windows("/usr/local" + d) for d in origlibdirs]
    if m.mingw_root is not None:
        incdirs += [m.msys_to_windows("/mingw" + d) for d in origincdirs]
        libdirs += [m.msys_to_windows("/mingw" + d) for d in origlibdirs]
    for arg in string.split(DEPS[0].cflags):
        if arg[:2] == '-I':
            incdirs.append(arg[2:])
        elif arg[:2] == '-L':
            libdirs.append(arg[2:])
    dll_deps = []
    for d in DEPS:
        d.configure(incdirs, libdirs)
        if d.needs_dll:
            dll_dep = DependencyDLL(d.name)
            dll_dep.configure(incdirs, libdirs, d.lib_dir)
            dll_deps.append(dll_dep)

    DEPS += dll_deps
    for d in get_definitions():
        DEPS.append(DependencyWin(d.name, d.value))
    for d in DEPS:
        if isinstance(d, DependencyDLL):
            if d.lib_dir == '':
                print_("DLL for %-12s: not found" % d.lib_name)
            else:
                print_("DLL for %-12s: %s" % (d.lib_name, d.lib_dir))

    for d in DEPS[1:]:
        if not d.found:
            if "-auto" not in sys.argv and not confirm("""
Warning, some of the pygame dependencies were not found. Pygame can still
compile and install, but games that depend on those missing dependencies
will not run. Would you like to continue the configuration?"""):
                raise SystemExit()
            break

    return DEPS