Skip to content

Commit

Permalink
buildconfig: Remove SDL1 stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
illume committed Nov 6, 2021
1 parent 878f347 commit 35482aa
Show file tree
Hide file tree
Showing 14 changed files with 83 additions and 313 deletions.
12 changes: 1 addition & 11 deletions buildconfig/appveyor.yml
Expand Up @@ -26,70 +26,60 @@ environment:
PYTHONPATH: "C:\\Python36"
PYTHON_VERSION: "3.6.0"
PYTHON_ARCH: "32"
USE_SDL2: "-sdl2"
USE_ANALYZE: ""

- PYTHON: "C:\\Python37\\python"
PYTHONPATH: "C:\\Python37"
PYTHON_VERSION: "3.7.0"
PYTHON_ARCH: "32"
USE_SDL2: "-sdl2"
USE_ANALYZE: ""

- PYTHON: "C:\\Python38\\python"
PYTHONPATH: "C:\\Python38"
PYTHON_VERSION: "3.8.0"
PYTHON_ARCH: "32"
USE_SDL2: "-sdl2"
USE_ANALYZE: ""

- PYTHON: "C:\\Python39\\python"
PYTHONPATH: "C:\\Python39"
PYTHON_VERSION: "3.9.0"
PYTHON_ARCH: "32"
USE_SDL2: "-sdl2"
USE_ANALYZE: ""

- PYTHON: "C:\\Python310\\python"
PYTHONPATH: "C:\\Python310"
PYTHON_VERSION: "3.10.0"
PYTHON_ARCH: "32"
USE_SDL2: "-sdl2"
USE_ANALYZE: ""

- PYTHON: "C:\\Python36-x64\\python"
PYTHONPATH: "C:\\Python36-x64"
PYTHON_VERSION: "3.6.0"
PYTHON_ARCH: "64"
USE_SDL2: "-sdl2"
USE_ANALYZE: ""

- PYTHON: "C:\\Python37-x64\\python"
PYTHONPATH: "C:\\Python37-x64"
PYTHON_VERSION: "3.7.0"
PYTHON_ARCH: "64"
USE_SDL2: "-sdl2"
USE_ANALYZE: ""

- PYTHON: "C:\\Python38-x64\\python"
PYTHONPATH: "C:\\Python38-x64"
PYTHON_VERSION: "3.8.0"
PYTHON_ARCH: "64"
USE_SDL2: "-sdl2"
USE_ANALYZE: "-enable-msvc-analyze"

- PYTHON: "C:\\Python39-x64\\python"
PYTHONPATH: "C:\\Python39-x64"
PYTHON_VERSION: "3.9.0"
PYTHON_ARCH: "64"
USE_SDL2: "-sdl2"
USE_ANALYZE: ""

- PYTHON: "C:\\Python310-x64\\python"
PYTHONPATH: "C:\\Python310-x64"
PYTHON_VERSION: "3.10.0"
PYTHON_ARCH: "64"
USE_SDL2: "-sdl2"
USE_ANALYZE: ""

init:
Expand Down Expand Up @@ -132,7 +122,7 @@ install:
- "set PATH=%PATH%;%APPVEYOR_BUILD_FOLDER%\\%PYPY_VERSION%"
- "%PYTHON% -m ensurepip"
- "%PYTHON% -m pip install -U wheel pip twine requests"
- "%WITH_COMPILER% %PYTHON% -m buildconfig %USE_SDL2%"
- "%WITH_COMPILER% %PYTHON% -m buildconfig"
- "%WITH_COMPILER% %PYTHON% setup.py build -j4 %USE_ANALYZE%"
- "%WITH_COMPILER% %PYTHON% setup.py -setuptools %DISTRIBUTIONS%"
- ps: "ls dist"
Expand Down
7 changes: 1 addition & 6 deletions buildconfig/config.py
Expand Up @@ -97,10 +97,8 @@ def prepdep(dep, basepath):
else:
dep.line = dep.name+' =' + ''.join(incs) + ''.join(lids) + ' ' + dep.cflags + libs

def writesetupfile(deps, basepath, additional_lines, sdl2=False):
def writesetupfile(deps, basepath, additional_lines):
"""create a modified copy of Setup.SDLx.in"""
assert sdl2

sdl_setup_filename = os.path.join(BASE_PATH, 'buildconfig',
'Setup.SDL2.in')

Expand Down Expand Up @@ -161,7 +159,6 @@ def writesetupfile(deps, basepath, additional_lines, sdl2=False):

def main(auto=False):
additional_platform_setup = []
sdl2 = True
conan = "-conan" in sys.argv

if '-sdl2' in sys.argv:
Expand All @@ -171,8 +168,6 @@ def main(auto=False):
Only SDL2 is supported now.""")

kwds = {}
if sdl2:
kwds['sdl2'] = True
if conan:
print_('Using CONAN configuration...\n')
try:
Expand Down
32 changes: 8 additions & 24 deletions buildconfig/config_darwin.py
Expand Up @@ -126,27 +126,14 @@ def find_freetype():



def main(sdl2=False):

if sdl2:
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'])],
]
else:
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')],
]
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']),
Expand All @@ -160,10 +147,7 @@ def main(sdl2=False):

print ('Hunting dependencies...')
incdirs = ['/usr/local/include', '/opt/homebrew/include']
if sdl2:
incdirs.extend(['/usr/local/include/SDL2', '/opt/homebrew/include/SDL2', '/opt/local/include/SDL2'])
else:
incdirs.extend(['/usr/local/include/SDL', '/opt/homebrew/include/SDL', '/opt/local/include/SDL'])
incdirs.extend(['/usr/local/include/SDL2', '/opt/homebrew/include/SDL2', '/opt/local/include/SDL2'])

incdirs.extend([
#'/usr/X11/include',
Expand Down
5 changes: 1 addition & 4 deletions buildconfig/config_msys2.py
Expand Up @@ -467,10 +467,7 @@ def setup_prebuilt_sdl2(prebuilt_dir):
return list(DEPS)


def main(sdl2=True):
if not sdl2:
raise Exception("Building SDL1.x on MSYS2 is not supported")

def main():
machine_type = get_machine_type()

# config MSYS2 always requires prebuilt dependencies, in the
Expand Down
40 changes: 13 additions & 27 deletions buildconfig/config_unix.py
Expand Up @@ -130,20 +130,15 @@ def configure(self, incdirs, libdirs):

sdl_lib_name = 'SDL'

def main(sdl2=False):
def main():
global origincdirs, origlibdirs

#these get prefixes with '/usr' and '/usr/local' or the $LOCALBASE
if sdl2:
origincdirs = ['/include', '/include/SDL2']
origlibdirs = ['/lib', '/lib64', '/X11R6/lib',
'/lib/i386-linux-gnu', '/lib/x86_64-linux-gnu',
'/lib/arm-linux-gnueabihf/', '/lib/aarch64-linux-gnu/']

else:
origincdirs = ['/include', '/include/SDL', '/include/SDL']
origlibdirs = ['/lib', '/lib64', '/X11R6/lib', '/lib/arm-linux-gnueabihf/',
'/lib/aarch64-linux-gnu/']
origincdirs = ['/include', '/include/SDL2']
origlibdirs = ['/lib', '/lib64', '/X11R6/lib',
'/lib/i386-linux-gnu', '/lib/x86_64-linux-gnu',
'/lib/arm-linux-gnueabihf/', '/lib/aarch64-linux-gnu/']

if 'ORIGLIBDIRS' in os.environ and os.environ['ORIGLIBDIRS'] != "":
origlibdirs = os.environ['ORIGLIBDIRS'].split(":")

Expand Down Expand Up @@ -189,22 +184,13 @@ def find_freetype():
return freetype_config
return pkg_config

if sdl2:
DEPS = [
DependencyProg('SDL', 'SDL_CONFIG', 'sdl2-config', '2.0', ['sdl']),
Dependency('FONT', 'SDL_ttf.h', 'libSDL2_ttf.so', ['SDL2_ttf']),
Dependency('IMAGE', 'SDL_image.h', 'libSDL2_image.so', ['SDL2_image']),
Dependency('MIXER', 'SDL_mixer.h', 'libSDL2_mixer.so', ['SDL2_mixer']),
#Dependency('GFX', 'SDL_gfxPrimitives.h', 'libSDL2_gfx.so', ['SDL2_gfx']),
]
else:
DEPS = [
DependencyProg('SDL', 'SDL_CONFIG', 'sdl-config', '1.2', ['sdl']),
Dependency('FONT', 'SDL_ttf.h', 'libSDL_ttf.so', ['SDL_ttf']),
Dependency('IMAGE', 'SDL_image.h', 'libSDL_image.so', ['SDL_image']),
Dependency('MIXER', 'SDL_mixer.h', 'libSDL_mixer.so', ['SDL_mixer']),
#Dependency('GFX', 'SDL_gfxPrimitives.h', 'libSDL_gfx.so', ['SDL_gfx']),
]
DEPS = [
DependencyProg('SDL', 'SDL_CONFIG', 'sdl2-config', '2.0', ['sdl']),
Dependency('FONT', 'SDL_ttf.h', 'libSDL2_ttf.so', ['SDL2_ttf']),
Dependency('IMAGE', 'SDL_image.h', 'libSDL2_image.so', ['SDL2_image']),
Dependency('MIXER', 'SDL_mixer.h', 'libSDL2_mixer.so', ['SDL2_mixer']),
#Dependency('GFX', 'SDL_gfxPrimitives.h', 'libSDL2_gfx.so', ['SDL2_gfx']),
]
DEPS.extend([
Dependency('PNG', 'png.h', 'libpng', ['png']),
Dependency('JPEG', 'jpeglib.h', 'libjpeg', ['jpeg']),
Expand Down
113 changes: 24 additions & 89 deletions buildconfig/config_win.py
Expand Up @@ -373,57 +373,29 @@ def _add_sdl2_dll_deps(DEPS):
DEPS.add_dll(r'(z|zlib1)\.dll$', 'z', ['zlib-[1-9].*'])
DEPS.add_dll(r'(lib)?webp[-0-9]*\.dll$', 'webp', ['*webp-[0-9]*'])

def setup(sdl2):
def setup():
DEPS = DependencyGroup()

if not sdl2:
DEPS.add('SDL', 'SDL', ['SDL-[1-9].*'], r'(lib){0,1}SDL\.dll$', required=1,
find_header=r'SDL\.h')
DEPS.add('FONT', 'SDL_ttf', ['SDL_ttf-[2-9].*'], r'(lib){0,1}SDL_ttf\.dll$', ['SDL', 'z'],
find_header=r'SDL_ttf\.h')
DEPS.add('IMAGE', 'SDL_image', ['SDL_image-[1-9].*'], r'(lib){0,1}SDL_image\.dll$',
['SDL', 'jpeg', 'png', 'tiff'], 0, find_header=r'SDL_image\.h'),
DEPS.add('MIXER', 'SDL_mixer', ['SDL_mixer-[1-9].*'], r'(lib){0,1}SDL_mixer\.dll$',
['SDL', 'vorbisfile'], find_header=r'SDL_mixer\.h')
DEPS.add('PNG', 'png', ['libpng-[1-9].*'], r'(png|libpng)[-0-9]*\.dll$', ['z'])
DEPS.add('JPEG', 'jpeg', ['jpeg-[6-9]*'], r'(lib){0,1}jpeg[-0-9]*\.dll$')
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('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()
DEPS.add_dll(r'(lib){0,1}tiff[-0-9]*\.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)
DEPS.configure()
else:
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()
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)

Expand Down Expand Up @@ -499,40 +471,7 @@ def setup_prebuilt_sdl2(prebuilt_dir):
DEPS.configure()
return list(DEPS)

def setup_prebuilt_sdl1(prebuilt_dir):
with open('Setup', 'w') as setup_:
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 .
with open(os.path.join('buildconfig', 'Setup.SDL1.in')) as setup_in:
try:
do_copy = True
for line in setup_in:
if line.startswith('#--StartConfig'):
do_copy = False
setup_.write(setup_win_in.read())
try:
with open(os.path.join('buildconfig', 'Setup_Win_Common.in')) as setup_win_common_in:
setup_.write(setup_win_common_in.read())
except OSError:
pass
elif line.startswith('#--EndConfig'):
do_copy = True
elif do_copy:
setup_.write(line)
except OSError:
pass
except OSError:
pass

print("Wrote to \"Setup\".")

def main(sdl2=False):
def main():
machine_type = get_machine_type()
prebuilt_dir = 'prebuilt-%s' % machine_type
use_prebuilt = '-prebuilt' in sys.argv
Expand All @@ -549,7 +488,6 @@ def main(sdl2=False):
download_kwargs = {
'x86': False,
'x64': False,
'sdl2': sdl2,
}
download_kwargs[machine_type] = True

Expand All @@ -570,13 +508,10 @@ def main(sdl2=False):
use_prebuilt = True

if use_prebuilt:
if sdl2:
return setup_prebuilt_sdl2(prebuilt_dir)
setup_prebuilt_sdl1(prebuilt_dir)
raise SystemExit()
return setup_prebuilt_sdl2(prebuilt_dir)
else:
print ("Note: cannot find directory \"%s\"; do not use prebuilts." % prebuilt_dir)
return setup(sdl2)
return setup()

if __name__ == '__main__':
print ("""This is the configuration subscript for Windows.
Expand Down
2 changes: 1 addition & 1 deletion buildconfig/download_msys2_prebuilt.py
Expand Up @@ -61,7 +61,7 @@ def install_prebuilts(x86=True, x64=True):
raise Exception("Some dependencies could not be installed")


def update(x86=True, x64=True, sdl2=True):
def update(x86=True, x64=True):
install_prebuilts(x86=x86, x64=x64)


Expand Down

0 comments on commit 35482aa

Please sign in to comment.