From 4f776c7135dd6d2738bb236301cd4fa1c86fb6f8 Mon Sep 17 00:00:00 2001 From: Robert Pfeiffer Date: Tue, 2 Nov 2021 09:28:31 +0100 Subject: [PATCH 1/3] Remove references to SDL1 from setup/buildconfig --- buildconfig/Setup.SDL1.in | 72 --------------------------------------- buildconfig/config.py | 16 ++++----- setup.py | 19 +++-------- 3 files changed, 12 insertions(+), 95 deletions(-) delete mode 100644 buildconfig/Setup.SDL1.in diff --git a/buildconfig/Setup.SDL1.in b/buildconfig/Setup.SDL1.in deleted file mode 100644 index 9f2cc98f63..0000000000 --- a/buildconfig/Setup.SDL1.in +++ /dev/null @@ -1,72 +0,0 @@ -#This Setup file is used by the setup.py script to configure the -#python extensions. You will likely use the "config.py" which will -#build a correct Setup file for you based on your system settings. -#If not, the format is simple enough to edit by hand. First change -#the needed commandline flags for each dependency, then comment out -#any unavailable optional modules in the first optional section. - - -#--StartConfig -SDL = -I/usr/include/SDL -D_REENTRANT -lSDL -FONT = -lSDL_ttf -IMAGE = -lSDL_image -MIXER = -lSDL_mixer -PNG = -lpng -JPEG = -ljpeg -SCRAP = -lX11 -PORTMIDI = -lportmidi -PORTTIME = -lporttime -FREETYPE = -lfreetype -#--EndConfig - -DEBUG = - -#the following modules are optional. you will want to compile -#everything you can, but you can ignore ones you don't have -#dependencies for, just comment them out - -imageext src_c/imageext.c $(SDL) $(IMAGE) $(PNG) $(JPEG) $(DEBUG) -font src_c/font.c $(SDL) $(FONT) $(DEBUG) -mixer src_c/mixer.c $(SDL) $(MIXER) $(DEBUG) -mixer_music src_c/music.c $(SDL) $(MIXER) $(DEBUG) -scrap src_c/scrap.c $(SDL) $(SCRAP) $(DEBUG) -pypm src_c/pypm.c $(SDL) $(PORTMIDI) $(PORTTIME) $(DEBUG) - -GFX = src_c/SDL_gfx/SDL_gfxPrimitives.c -#GFX = src_c/SDL_gfx/SDL_gfxBlitFunc.c src_c/SDL_gfx/SDL_gfxPrimitives.c -gfxdraw src_c/gfxdraw.c $(SDL) $(GFX) $(DEBUG) - -#optional freetype module (do not break in multiple lines -#or the configuration script will choke!) -_freetype src_c/freetype/ft_cache.c src_c/freetype/ft_wrap.c src_c/freetype/ft_render.c src_c/freetype/ft_render_cb.c src_c/freetype/ft_layout.c src_c/freetype/ft_unicode.c src_c/_freetype.c $(SDL) $(FREETYPE) $(DEBUG) - -#_sprite src_c/_sprite.c $(SDL) $(DEBUG) - -#these modules are required for pygame to run. they only require -#SDL as a dependency. these should not be altered - -base src_c/base.c $(SDL) $(DEBUG) -cdrom src_c/cdrom.c $(SDL) $(DEBUG) -color src_c/color.c $(SDL) $(DEBUG) -constants src_c/constants.c $(SDL) $(DEBUG) -display src_c/display.c $(SDL) $(DEBUG) -event src_c/event.c $(SDL) $(DEBUG) -fastevent src_c/fastevent.c src_c/fastevents.c $(SDL) $(DEBUG) -key src_c/key.c $(SDL) $(DEBUG) -mouse src_c/mouse.c $(SDL) $(DEBUG) -rect src_c/rect.c $(SDL) $(DEBUG) -rwobject src_c/rwobject.c $(SDL) $(DEBUG) -surface src_c/surface.c src_c/alphablit.c src_c/surface_fill.c $(SDL) $(DEBUG) -surflock src_c/surflock.c $(SDL) $(DEBUG) -time src_c/time.c $(SDL) $(DEBUG) -joystick src_c/joystick.c $(SDL) $(DEBUG) -draw src_c/draw.c $(SDL) $(DEBUG) -image src_c/image.c $(SDL) $(DEBUG) -overlay src_c/overlay.c $(SDL) $(DEBUG) -transform src_c/transform.c src_c/rotozoom.c src_c/scale2x.c src_c/scale_mmx.c $(SDL) $(DEBUG) -mask src_c/mask.c src_c/bitmask.c $(SDL) $(DEBUG) -bufferproxy src_c/bufferproxy.c $(SDL) $(DEBUG) -pixelarray src_c/pixelarray.c $(SDL) $(DEBUG) -math src_c/math.c $(SDL) $(DEBUG) -pixelcopy src_c/pixelcopy.c $(SDL) $(DEBUG) -newbuffer src_c/newbuffer.c $(SDL) $(DEBUG) diff --git a/buildconfig/config.py b/buildconfig/config.py index 552af07b44..6faddf2b2c 100644 --- a/buildconfig/config.py +++ b/buildconfig/config.py @@ -99,13 +99,11 @@ def prepdep(dep, basepath): def writesetupfile(deps, basepath, additional_lines, sdl2=False): """create a modified copy of Setup.SDLx.in""" - if sdl2: - sdl_setup_filename = os.path.join(BASE_PATH, 'buildconfig', + assert sdl2 + + sdl_setup_filename = os.path.join(BASE_PATH, 'buildconfig', 'Setup.SDL2.in') - else: - sdl_setup_filename = os.path.join(BASE_PATH, 'buildconfig', - 'Setup.SDL1.in') - + with open(sdl_setup_filename, 'r') as origsetup, \ open(os.path.join(BASE_PATH, 'Setup'), 'w') as newsetup: line = '' @@ -163,14 +161,14 @@ def writesetupfile(deps, basepath, additional_lines, sdl2=False): def main(auto=False): additional_platform_setup = [] - sdl1 = "-sdl1" in sys.argv - sdl2 = not sdl1 + sdl2 = True conan = "-conan" in sys.argv if '-sdl2' in sys.argv: sys.argv.remove('-sdl2') if '-sdl1' in sys.argv: - sys.argv.remove('-sdl1') + raise SystemExit("""Building PyGame with SDL1.2 is no longer supported. +Only SDL2 is supported now.""") kwds = {} if sdl2: diff --git a/setup.py b/setup.py index 2a2f4bc19b..5c39110ae0 100644 --- a/setup.py +++ b/setup.py @@ -121,14 +121,11 @@ def compilation_help(): -if not hasattr(sys, 'version_info') or sys.version_info < (2,7): +if not hasattr(sys, 'version_info') or sys.version_info < (3, 5): compilation_help() - raise SystemExit("Pygame requires Python version 2.7 or above.") -if sys.version_info >= (3, 0) and sys.version_info < (3, 4): - compilation_help() - raise SystemExit("Pygame requires Python3 version 3.5 or above.") + raise SystemExit("Pygame requires Python3 version 3.6 or above.") if IS_PYPY and sys.pypy_version_info < (7,): - raise SystemExit("Pygame requires PyPy version 7.0.0 above, compatible with CPython 2.7 or CPython 3.5+") + raise SystemExit("Pygame requires PyPy version 7.0.0 above, compatible with CPython >= 3.6") def consume_arg(name): if name in sys.argv: @@ -167,12 +164,6 @@ def consume_arg(name): '-Werror=incompatible-pointer-types' os.environ['CFLAGS'] = cflags -# For python 2 we remove the -j options. -if sys.version_info[0] < 3: - # Used for parallel builds with setuptools. Not supported by py2. - [consume_arg('-j%s' % x) for x in range(32)] - - STRIPPED=False # STRIPPED builds don't have developer resources like docs or tests @@ -405,9 +396,9 @@ def run_install_headers(self): try: s_mtime = os.stat("Setup")[stat.ST_MTIME] - sin_mtime = os.stat(os.path.join('buildconfig', 'Setup.SDL1.in'))[stat.ST_MTIME] + sin_mtime = os.stat(os.path.join('buildconfig', 'Setup.SDL2.in'))[stat.ST_MTIME] if sin_mtime > s_mtime: - print ('\n\nWARNING, "buildconfig/Setup.SDL1.in" newer than "Setup",' + print ('\n\nWARNING, "buildconfig/Setup.SDL2.in" newer than "Setup",' 'you might need to modify "Setup".') except OSError: pass From 878f347dcbfef096a592754d1ff17e6c505b18ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Dudfield?= Date: Sat, 6 Nov 2021 23:32:06 +0100 Subject: [PATCH 2/3] buildconfig: Remove appveyor/install.ps1 py2 removal --- buildconfig/appveyor.yml | 2 -- buildconfig/ci/appveyor/install.ps1 | 46 ----------------------------- 2 files changed, 48 deletions(-) delete mode 100644 buildconfig/ci/appveyor/install.ps1 diff --git a/buildconfig/appveyor.yml b/buildconfig/appveyor.yml index 59231064ed..8f61795762 100644 --- a/buildconfig/appveyor.yml +++ b/buildconfig/appveyor.yml @@ -96,8 +96,6 @@ init: - "ECHO %PYTHON% %PYTHON_VERSION% %PYTHON_ARCH%" install: - # install.ps1 only needed for SDL1 stuff. - # - "powershell buildconfig\\ci\\appveyor\\install.ps1" # https://github.com/appveyor/build-images/blob/master/scripts/Windows/install_python.ps1#L88-L108 - ps: | diff --git a/buildconfig/ci/appveyor/install.ps1 b/buildconfig/ci/appveyor/install.ps1 deleted file mode 100644 index 4f77666f19..0000000000 --- a/buildconfig/ci/appveyor/install.ps1 +++ /dev/null @@ -1,46 +0,0 @@ -# For downloading windows prebuilt dependencies. -# powershell appveyor\install.ps1 - -function DownloadPrebuilt () { - $webclient = New-Object System.Net.WebClient - - $download_url = "https://bitbucket.org/llindstrom/pygame/downloads/" - $build_date = "20150922" - $target = "x86" - if ($env:PYTHON_ARCH -eq "64") { - $target = "x64" - } - $prebuilt_file = "prebuilt-"+$target+"-pygame-1.9.2-"+$build_date+".zip" - $prebuilt_url = $download_url + $prebuilt_file - $prebuilt_zip = "prebuilt-" + $target + ".zip" - - $basedir = $pwd.Path + "\" - $filepath = $basedir + $prebuilt_zip - if (Test-Path $filepath) { - Write-Host "Reusing" $filepath - return $filepath - } - - # Download and retry up to 5 times in case of network transient errors. - Write-Host "Downloading" $filename "from" $prebuilt_url - $retry_attempts = 3 - for($i=0; $i -lt $retry_attempts; $i++){ - try { - $webclient.DownloadFile($prebuilt_url, $filepath) - break - } - Catch [Exception]{ - Start-Sleep 1 - } - } - Write-Host "File saved at" $filepath - - & 7z x $prebuilt_zip -} - - -function main () { - DownloadPrebuilt -} - -main From 35482aaf861cabe6f1ae9e39154229463c72e81c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Dudfield?= Date: Sat, 6 Nov 2021 23:47:30 +0100 Subject: [PATCH 3/3] buildconfig: Remove SDL1 stuff --- buildconfig/appveyor.yml | 12 +- buildconfig/config.py | 7 +- buildconfig/config_darwin.py | 32 ++--- buildconfig/config_msys2.py | 5 +- buildconfig/config_unix.py | 40 ++----- buildconfig/config_win.py | 113 ++++-------------- buildconfig/download_msys2_prebuilt.py | 2 +- buildconfig/download_win_prebuilt.py | 71 ++++++----- .../docker_base/Dockerfile-aarch64 | 1 - .../docker_base/Dockerfile-i686 | 1 - .../docker_base/Dockerfile-x86_64 | 1 - .../docker_base/sdl_libs/build-sdl-libs.sh | 106 ---------------- .../docker_base/sdl_libs/sdl.sha512 | 4 - .../docker_base/sdl_libs/smpeg.sha512 | 1 - 14 files changed, 83 insertions(+), 313 deletions(-) delete mode 100644 buildconfig/manylinux-build/docker_base/sdl_libs/build-sdl-libs.sh delete mode 100644 buildconfig/manylinux-build/docker_base/sdl_libs/sdl.sha512 delete mode 100644 buildconfig/manylinux-build/docker_base/sdl_libs/smpeg.sha512 diff --git a/buildconfig/appveyor.yml b/buildconfig/appveyor.yml index 8f61795762..a224834f06 100644 --- a/buildconfig/appveyor.yml +++ b/buildconfig/appveyor.yml @@ -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: @@ -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" diff --git a/buildconfig/config.py b/buildconfig/config.py index 6faddf2b2c..cc62656396 100644 --- a/buildconfig/config.py +++ b/buildconfig/config.py @@ -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') @@ -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: @@ -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: diff --git a/buildconfig/config_darwin.py b/buildconfig/config_darwin.py index b724afec0b..c785e18383 100644 --- a/buildconfig/config_darwin.py +++ b/buildconfig/config_darwin.py @@ -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']), @@ -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', diff --git a/buildconfig/config_msys2.py b/buildconfig/config_msys2.py index de11a1aafd..2d9844b541 100644 --- a/buildconfig/config_msys2.py +++ b/buildconfig/config_msys2.py @@ -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 diff --git a/buildconfig/config_unix.py b/buildconfig/config_unix.py index f6a4ea4bf8..5c50bcdc23 100644 --- a/buildconfig/config_unix.py +++ b/buildconfig/config_unix.py @@ -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(":") @@ -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']), diff --git a/buildconfig/config_win.py b/buildconfig/config_win.py index 18232d576e..1ea074576d 100644 --- a/buildconfig/config_win.py +++ b/buildconfig/config_win.py @@ -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) @@ -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 @@ -549,7 +488,6 @@ def main(sdl2=False): download_kwargs = { 'x86': False, 'x64': False, - 'sdl2': sdl2, } download_kwargs[machine_type] = True @@ -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. diff --git a/buildconfig/download_msys2_prebuilt.py b/buildconfig/download_msys2_prebuilt.py index 833dfd7ca2..e4944099ba 100644 --- a/buildconfig/download_msys2_prebuilt.py +++ b/buildconfig/download_msys2_prebuilt.py @@ -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) diff --git a/buildconfig/download_win_prebuilt.py b/buildconfig/download_win_prebuilt.py index 69fe72242a..befe88bb0c 100644 --- a/buildconfig/download_win_prebuilt.py +++ b/buildconfig/download_win_prebuilt.py @@ -77,32 +77,31 @@ def download_sha1_unzip(url, checksum, save_to_directory, unzip=True): os.mkdir(zip_dir) zip_ref.extractall(zip_dir) -def get_urls(x86=True, x64=True, sdl2=True): +def get_urls(x86=True, x64=True): url_sha1 = [] - if sdl2: - url_sha1.extend([ - [ - 'https://www.libsdl.org/release/SDL2-devel-2.0.16-VC.zip', - '13d952c333f3c2ebe9b7bc0075b4ad2f784e7584', - ], - [ - 'https://www.libsdl.org/projects/SDL_image/release/SDL2_image-devel-2.0.5-VC.zip', - '137f86474691f4e12e76e07d58d5920c8d844d5b', - ], - [ - 'https://www.libsdl.org/projects/SDL_ttf/release/SDL2_ttf-devel-2.0.15-VC.zip', - '1436df41ebc47ac36e02ec9bda5699e80ff9bd27', - ], - [ - 'https://www.libsdl.org/projects/SDL_mixer/release/SDL2_mixer-devel-2.0.4-VC.zip', - '9097148f4529cf19f805ccd007618dec280f0ecc', - ], - [ - # 'https://www.ijg.org/files/jpegsr9d.zip', - 'https://www.pygame.org/ftp/jpegsr9d.zip', - 'ed10aa2b5a0fcfe74f8a6f7611aeb346b06a1f99', - ], - ]) + url_sha1.extend([ + [ + 'https://www.libsdl.org/release/SDL2-devel-2.0.16-VC.zip', + '13d952c333f3c2ebe9b7bc0075b4ad2f784e7584', + ], + [ + 'https://www.libsdl.org/projects/SDL_image/release/SDL2_image-devel-2.0.5-VC.zip', + '137f86474691f4e12e76e07d58d5920c8d844d5b', + ], + [ + 'https://www.libsdl.org/projects/SDL_ttf/release/SDL2_ttf-devel-2.0.15-VC.zip', + '1436df41ebc47ac36e02ec9bda5699e80ff9bd27', + ], + [ + 'https://www.libsdl.org/projects/SDL_mixer/release/SDL2_mixer-devel-2.0.4-VC.zip', + '9097148f4529cf19f805ccd007618dec280f0ecc', + ], + [ + # 'https://www.ijg.org/files/jpegsr9d.zip', + 'https://www.pygame.org/ftp/jpegsr9d.zip', + 'ed10aa2b5a0fcfe74f8a6f7611aeb346b06a1f99', + ], + ]) if x86: url_sha1.append([ 'https://pygame.org/ftp/prebuilt-x86-pygame-1.9.2-20150922.zip', @@ -115,13 +114,13 @@ def get_urls(x86=True, x64=True, sdl2=True): ]) return url_sha1 -def download_prebuilts(temp_dir, x86=True, x64=True, sdl2=True): +def download_prebuilts(temp_dir, x86=True, x64=True): """ For downloading prebuilt dependencies. """ if not os.path.exists(temp_dir): print("Making dir :%s:" % temp_dir) os.makedirs(temp_dir) - for url, checksum in get_urls(x86=x86, x64=x64, sdl2=sdl2): + for url, checksum in get_urls(x86=x86, x64=x64): download_sha1_unzip(url, checksum, temp_dir, 1) def create_ignore_target_fnc(x64=False, x86=False): @@ -170,7 +169,7 @@ def copytree(src, dst, symlinks=False, ignore=None): else: shutil.copy2(s, d) -def place_downloaded_prebuilts(temp_dir, move_to_dir, x86=True, x64=True, sdl2=True): +def place_downloaded_prebuilts(temp_dir, move_to_dir, x86=True, x64=True): """ puts the downloaded prebuilt files into the right place. Leaves the files in temp_dir. copies to move_to_dir @@ -202,8 +201,6 @@ def copy(src, dst): if x64: prebuilt_dirs.append('prebuilt-x64') - if not sdl2: - return for prebuilt_dir in prebuilt_dirs: path = os.path.join(move_to_dir, prebuilt_dir) @@ -271,12 +268,12 @@ def copy(src, dst): ) ) -def update(x86=True, x64=True, sdl2=True): +def update(x86=True, x64=True): move_to_dir = "." - download_prebuilts(download_dir, x86=x86, x64=x64, sdl2=sdl2) - place_downloaded_prebuilts(download_dir, move_to_dir, x86=x86, x64=x64, sdl2=sdl2) + download_prebuilts(download_dir, x86=x86, x64=x64) + place_downloaded_prebuilts(download_dir, move_to_dir, x86=x86, x64=x64) -def ask(x86=True, x64=True, sdl2=True): +def ask(x86=True, x64=True): move_to_dir = "." if x64: dest_str = "\"%s/prebuilt-x64\"" % move_to_dir @@ -290,13 +287,13 @@ def ask(x86=True, x64=True, sdl2=True): download_prebuilt = True if download_prebuilt: - update(x86=x86, x64=x64, sdl2=sdl2) + update(x86=x86, x64=x64) return download_prebuilt -def cached(x86=True, x64=True, sdl2=True): +def cached(x86=True, x64=True): if not os.path.isdir(download_dir): return False - for url, check in get_urls(x86=x86, x64=x64, sdl2=sdl2): + for url, check in get_urls(x86=x86, x64=x64): filename = os.path.split(url)[-1] save_to = os.path.join(download_dir, filename) if not os.path.exists(save_to): diff --git a/buildconfig/manylinux-build/docker_base/Dockerfile-aarch64 b/buildconfig/manylinux-build/docker_base/Dockerfile-aarch64 index 752b75048a..a06f08d785 100644 --- a/buildconfig/manylinux-build/docker_base/Dockerfile-aarch64 +++ b/buildconfig/manylinux-build/docker_base/Dockerfile-aarch64 @@ -81,7 +81,6 @@ ADD fluidsynth /fluidsynth_build/ RUN ["bash", "/fluidsynth_build/build-fluidsynth.sh"] ADD sdl_libs /sdl_build/ -#RUN ["bash", "/sdl_build/build-sdl-libs.sh"] RUN ["bash", "/sdl_build/build-sdl2-libs.sh"] diff --git a/buildconfig/manylinux-build/docker_base/Dockerfile-i686 b/buildconfig/manylinux-build/docker_base/Dockerfile-i686 index 219576983d..7511689a61 100644 --- a/buildconfig/manylinux-build/docker_base/Dockerfile-i686 +++ b/buildconfig/manylinux-build/docker_base/Dockerfile-i686 @@ -83,7 +83,6 @@ RUN ["linux32", "bash", "/fluidsynth_build/build-fluidsynth.sh"] # Build and install SDL ADD sdl_libs /sdl_build/ -#RUN ["linux32", "bash", "/sdl_build/build-sdl-libs.sh"] RUN ["linux32", "bash", "/sdl_build/build-sdl2-libs.sh"] diff --git a/buildconfig/manylinux-build/docker_base/Dockerfile-x86_64 b/buildconfig/manylinux-build/docker_base/Dockerfile-x86_64 index 28ad91c770..34aa57da40 100644 --- a/buildconfig/manylinux-build/docker_base/Dockerfile-x86_64 +++ b/buildconfig/manylinux-build/docker_base/Dockerfile-x86_64 @@ -81,7 +81,6 @@ ADD fluidsynth /fluidsynth_build/ RUN ["bash", "/fluidsynth_build/build-fluidsynth.sh"] ADD sdl_libs /sdl_build/ -#RUN ["bash", "/sdl_build/build-sdl-libs.sh"] RUN ["bash", "/sdl_build/build-sdl2-libs.sh"] diff --git a/buildconfig/manylinux-build/docker_base/sdl_libs/build-sdl-libs.sh b/buildconfig/manylinux-build/docker_base/sdl_libs/build-sdl-libs.sh deleted file mode 100644 index 8b35d0c750..0000000000 --- a/buildconfig/manylinux-build/docker_base/sdl_libs/build-sdl-libs.sh +++ /dev/null @@ -1,106 +0,0 @@ -#!/bin/bash -set -e -x - -cd /sdl_build/ - -SDL="SDL-1.2.15" -IMG="SDL_image-1.2.12" -TTF="SDL_ttf-2.0.11" -MIX="SDL_mixer-1.2.12" - -# Download -curl -sL https://www.libsdl.org/release/${SDL}.tar.gz > ${SDL}.tar.gz -curl -sL https://www.libsdl.org/projects/SDL_image/release/${IMG}.tar.gz > ${IMG}.tar.gz -curl -sL https://www.libsdl.org/projects/SDL_ttf/release/${TTF}.tar.gz > ${TTF}.tar.gz -curl -sL https://www.libsdl.org/projects/SDL_mixer/release/${MIX}.tar.gz > ${MIX}.tar.gz -sha512sum -c sdl.sha512 - -# Build SDL -tar xzf ${SDL}.tar.gz -cd $SDL -./configure $ARCHS_CONFIG_FLAG --enable-png --disable-png-shared --enable-jpg --disable-jpg-shared -make -make install - -if [[ "$OSTYPE" == "darwin"* ]]; then - # Install to mac deps cache dir as well - make install DESTDIR=${MACDEP_CACHE_PREFIX_PATH} -fi - -cd .. - -# Link sdl-config into /usr/bin so that smpeg-config can find it -ln -s /usr/local/bin/sdl-config /usr/bin/ - -# Build smpeg. -svn co svn://svn.icculus.org/smpeg/tags/release_0_4_5 -# Check the sha512sum of the svn checkout is the same. -find release_0_4_5 -not -iwholename '*.svn*' -exec sha512sum {} + | awk '{print $1}' | sort | sha512sum -c smpeg.sha512 - - -cd release_0_4_5 -./autogen.sh -./configure $ARCHS_CONFIG_FLAG --disable-dependency-tracking --disable-debug --disable-gtk-player \ - --disable-gtktest --disable-opengl-player --disable-sdltest -make -make install - -if [[ "$OSTYPE" == "darwin"* ]]; then - # Install to mac deps cache dir as well - make install DESTDIR=${MACDEP_CACHE_PREFIX_PATH} -fi - -cd .. - -# Build SDL_image -tar xzf ${IMG}.tar.gz -cd $IMG -# The --disable-x-shared flags make it use standard dynamic linking rather than -# dlopen-ing the library itself. This is important for when auditwheel moves -# libraries into the wheel. -./configure $ARCHS_CONFIG_FLAG --enable-png --disable-png-shared --enable-jpg --disable-jpg-shared \ - --enable-tif --disable-tif-shared --enable-webp --disable-webp-shared -make -make install - -if [[ "$OSTYPE" == "darwin"* ]]; then - # Install to mac deps cache dir as well - make install DESTDIR=${MACDEP_CACHE_PREFIX_PATH} -fi - -cd .. - -# Build SDL_ttf -tar xzf ${TTF}.tar.gz -cd $TTF -./configure $ARCHS_CONFIG_FLAG -make -make install - -if [[ "$OSTYPE" == "darwin"* ]]; then - # Install to mac deps cache dir as well - make install DESTDIR=${MACDEP_CACHE_PREFIX_PATH} -fi - -cd .. - -# Build SDL_mixer -tar xzf ${MIX}.tar.gz -cd $MIX -# The --disable-x-shared flags make it use standard dynamic linking rather than -# dlopen-ing the library itself. This is important for when auditwheel moves -# libraries into the wheel. -./configure --enable-music-mod --disable-music-mod-shared \ - --enable-music-fluidsynth --disable-music-fluidsynth-shared \ - --enable-music-ogg --disable-music-ogg-shared \ - --enable-music-flac --disable-music-flac-shared \ - --enable-music-mp3 --disable-music-mp3-shared $ARCHS_CONFIG_FLAG -make -make install - -if [[ "$OSTYPE" == "darwin"* ]]; then - # Install to mac deps cache dir as well - make install DESTDIR=${MACDEP_CACHE_PREFIX_PATH} -fi - -cd .. diff --git a/buildconfig/manylinux-build/docker_base/sdl_libs/sdl.sha512 b/buildconfig/manylinux-build/docker_base/sdl_libs/sdl.sha512 deleted file mode 100644 index 1a727313e8..0000000000 --- a/buildconfig/manylinux-build/docker_base/sdl_libs/sdl.sha512 +++ /dev/null @@ -1,4 +0,0 @@ -ac392d916e6953b0925a7cbb0f232affea33339ef69b47a0a7898492afb9784b93138986df53d6da6d3e2ad79af1e9482df565ecca30f89428be0ae6851b1adc SDL-1.2.15.tar.gz -0e71b280abc2a7f15755e4480a3c1b52d41f9f8b0c9216a6f5bd9fc0e939456fb5d6c10419e1d1904785783f9a1891ead278c03e88b0466fecc6871c3ca40136 SDL_image-1.2.12.tar.gz -230f6c5a73f4bea364f8aa3d75f76694305571dea45f357def742b2b50849b2d896af71e08689981207edc99a9836088bee2d0bd98d92c7f4ca52b12b3d8cf96 SDL_mixer-1.2.12.tar.gz -64e04d1cd77e525e0f2413ad928841e5d3d09d551c030fc577b50777116580e430cb272b2aeb6191dfcc464669cf2f7a5a50d10e7c75637a3b1e8c8fca7fc78b SDL_ttf-2.0.11.tar.gz diff --git a/buildconfig/manylinux-build/docker_base/sdl_libs/smpeg.sha512 b/buildconfig/manylinux-build/docker_base/sdl_libs/smpeg.sha512 deleted file mode 100644 index 0102e9b189..0000000000 --- a/buildconfig/manylinux-build/docker_base/sdl_libs/smpeg.sha512 +++ /dev/null @@ -1 +0,0 @@ -737fefee0b2466c5e04b02f71bce53e09159075d1cba7a78753f6777e43dc618fb727f361a25ff945d6e88f7c706371238b3bc9fc64256e0ce9a73fe6bed4e44 -