Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/build-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ jobs:
matrix:
# make arm64 deps and x86_64 deps
include:
- { macarch: arm64, os: macos-14 }
- { macarch: x86_64, os: macos-13 }
- { macarch: arm64, os: macos-15 }
- { macarch: x86_64, os: macos-15 }

steps:
- uses: actions/[email protected]
Expand Down Expand Up @@ -64,8 +64,8 @@ jobs:
fail-fast: false # if a particular matrix build fails, don't skip the rest
matrix:
include:
- { macarch: arm64, os: macos-14 }
- { macarch: x86_64, os: macos-13 }
- { macarch: arm64, os: macos-15 }
- { macarch: x86_64, os: macos-15 }

env:
MAC_ARCH: ${{ matrix.macarch }}
Expand Down
82 changes: 76 additions & 6 deletions .github/workflows/build-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,31 +17,101 @@ concurrency:
cancel-in-progress: true

jobs:
deps:
name: ${{ matrix.winarch }} deps
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false # if a particular matrix build fails, don't skip the rest
matrix:
include:
- { winarch: x86_64, march: x86_64, msystem: MINGW64, os: windows-2022 }
- { winarch: x86, march: i686, msystem: MINGW32, os: windows-2022 }
- { winarch: aarch64, march: clang-aarch64, msystem: CLANGARM64, os: windows-11-arm }

steps:
- run: git config --global core.autocrlf input # do not introduce carriage returns
- uses: actions/[email protected]

- name: Test for Win Deps cache hit
id: windep-cache
uses: actions/[email protected]
with:
path: ${{ github.workspace }}/pygame_win_deps_${{ matrix.winarch }}
# The hash of all files in buildconfig manylinux-build and windependencies is
# the key to the cache. If anything changes here, the deps are built again
key: windep-${{ hashFiles('buildconfig/manylinux-build/**') }}-${{ hashFiles('buildconfig/windependencies/*.sh') }}-${{ matrix.winarch }}
lookup-only: true

# Setup msys environment
- uses: msys2/setup-msys2@v2
if: steps.windep-cache.outputs.cache-hit != 'true'
with:
update: true
msystem: ${{ matrix.msystem }}
install: >
git
mingw-w64-${{ matrix.march }}-gcc
mingw-w64-${{ matrix.march }}-binutils
mingw-w64-${{ matrix.march }}-tools
mingw-w64-${{ matrix.march }}-autotools
mingw-w64-${{ matrix.march }}-cmake
mingw-w64-${{ matrix.march }}-meson
mingw-w64-${{ matrix.march }}-python-pip
mingw-w64-${{ matrix.march }}-ca-certificates

# build win deps on cache miss
- name: Build Win Deps
if: steps.windep-cache.outputs.cache-hit != 'true'
shell: msys2 {0}
run: |
export WIN_ARCH="${{ matrix.winarch }}"
cd buildconfig/windependencies
bash ./build_win_deps.sh

# Uncomment when you want to manually verify the deps by downloading them
- name: Upload win deps
uses: actions/upload-artifact@v4
with:
name: pygame_win_deps_${{ matrix.winarch }}
path: ${{ github.workspace }}/pygame_win_deps_${{ matrix.winarch }}

build:
name: ${{ matrix.winarch }}
runs-on: windows-latest
needs: deps
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false # if a particular matrix build fails, don't skip the rest
matrix:
include:
- { winarch: AMD64, msvc-dev-arch: x86_amd64 }
- { winarch: x86, msvc-dev-arch: x86 }
- { winarch: x86_64, cibw_arch: AMD64, os: windows-2022 }
- { winarch: x86, cibw_arch: x86, os: windows-2022 }
- { winarch: aarch64, cibw_arch: ARM64, os: windows-11-arm }

env:
CIBW_ARCHS: ${{ matrix.winarch }}
CIBW_ARCHS: ${{ matrix.cibw_arch }}

steps:
- run: git config --global core.autocrlf input # do not introduce carriage returns
- uses: actions/[email protected]

- uses: TheMrMilchmann/setup-msvc-dev@v4 # this lets us use the developer command prompt on windows
- name: Force 32-bit MSVC
if: matrix.winarch == 'x86'
uses: egor-tensin/vs-shell@v2
with:
arch: ${{ matrix.msvc-dev-arch }}
arch: x86

- name: Install uv for speed
uses: astral-sh/setup-uv@v6
with:
version: "0.8.3"

- name: Fetch Windows deps
uses: actions/[email protected]
with:
path: ${{ github.workspace }}/pygame_win_deps_${{ matrix.winarch }}
key: windep-${{ hashFiles('buildconfig/manylinux-build/**') }}-${{ hashFiles('buildconfig/windependencies/*.sh') }}-${{ matrix.winarch }}
fail-on-cache-miss: true

- name: Build and test wheels
uses: pypa/[email protected]

Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
# Windows prebuilt external libraries
/prebuilt-x??
/prebuilt_downloads
/pygame_win_deps_*

# macOS generated files
.DS_Store
Expand Down
13 changes: 11 additions & 2 deletions buildconfig/macdependencies/build_mac_deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,21 @@ else
# install NASM to generate optimised x86_64 libjpegturbo builds
brew install nasm

# for scripts using ./configure to make x86_64 binaries
export CC="clang -target x86_64-apple-macos10.11"
export CXX="clang++ -target x86_64-apple-macos10.11"

export PG_BASE_CONFIGURE_FLAGS="$PG_BASE_CONFIGURE_FLAGS --host=x86_64-apple-darwin"

# configure cmake to cross-compile
export PG_BASE_CMAKE_FLAGS="$PG_BASE_CMAKE_FLAGS -DCMAKE_OSX_ARCHITECTURES=x86_64"

# SDL 2.26.5 new minimum macos is 10.11, so we build our x86 mac deps
# for 10.11 as well.
export MACOSX_DEPLOYMENT_TARGET=10.11

# needs native-file that has correct macosx deployment target
export PG_BASE_MESON_FLAGS="$PG_BASE_MESON_FLAGS --native-file $(pwd)/macos_x86_64.ini"
# configure meson to cross-compile with correct target
export PG_BASE_MESON_FLAGS="$PG_BASE_MESON_FLAGS --cross-file $(pwd)/macos_x86_64.ini"
fi

cd ../manylinux-build/docker_base
Expand Down
3 changes: 2 additions & 1 deletion buildconfig/macdependencies/clean_usr_local.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ ln -s /usr/bin/git /usr/local/bin/git
ln -s /usr/bin/git /opt/homebrew/bin/git

rm -rf /usr/local/lib/libtiff*
rm -rf /usr/local/lib/libzstd*
rm -rf /usr/local/lib/libzstd* /opt/homebrew/lib/libzstd*
rm -rf /usr/local/lib/libwebp*
rm -rf /usr/local/lib/libdeflate*
rm -rf /usr/local/lib/libsndfile*
Expand All @@ -25,6 +25,7 @@ rm -rf /usr/local/lib/libbrotlidec*
rm -rf /usr/local/lib/libopus*
rm -rf /usr/local/lib/freetype*
rm -rf /usr/local/opt/freetype*
rm -rf /opt/homebrew/lib/libgif*

rm -rf /usr/local/Cellar/libtiff /opt/homebrew/Cellar/libtiff
rm -rf /usr/local/Cellar/libsndfile /opt/homebrew/Cellar/libsndfile
Expand Down
8 changes: 7 additions & 1 deletion buildconfig/macdependencies/macos_x86_64.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
[constants]
macos_ver = ['-mmacosx-version-min=10.11']
macos_ver = ['-target', 'x86_64-apple-macos10.11']

[host_machine]
system = 'darwin'
cpu_family = 'x86_64'
cpu = 'x86_64'
endian = 'little'

[binaries]
c = ['clang']
Expand Down
8 changes: 4 additions & 4 deletions buildconfig/manylinux-build/docker_base/Dockerfile-aarch64
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# pin version on image for CI stability
FROM quay.io/pypa/manylinux2014_aarch64:2025.07.25-1
FROM quay.io/pypa/manylinux2014_aarch64:2025.09.08-1
ENV MAKEFLAGS="-j 4"
ENV PG_DEP_PREFIX="/usr/local"

Expand Down Expand Up @@ -94,12 +94,12 @@ RUN ["bash", "/libjpegturbo_build/build-jpeg-turbo.sh"]
ADD libpng /libpng_build/
RUN ["bash", "/libpng_build/build-png.sh"]

ADD libwebp /webp_build/
RUN ["bash", "/webp_build/build-webp.sh"]

ADD libtiff /libtiff_build/
RUN ["bash", "/libtiff_build/build-tiff.sh"]

ADD libwebp /webp_build/
RUN ["bash", "/webp_build/build-webp.sh"]

ADD brotli /brotli_build/
RUN ["bash", "/brotli_build/build-brotli.sh"]

Expand Down
8 changes: 4 additions & 4 deletions buildconfig/manylinux-build/docker_base/Dockerfile-i686
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# pin version on image for CI stability
FROM quay.io/pypa/manylinux2014_i686:2025.07.25-1
FROM quay.io/pypa/manylinux2014_i686:2025.09.08-1
ENV MAKEFLAGS="-j 4"
ENV PG_DEP_PREFIX="/usr/local"

Expand Down Expand Up @@ -94,12 +94,12 @@ RUN ["linux32", "bash", "/libjpegturbo_build/build-jpeg-turbo.sh"]
ADD libpng /libpng_build/
RUN ["linux32", "bash", "/libpng_build/build-png.sh"]

ADD libwebp /webp_build/
RUN ["linux32", "bash", "/webp_build/build-webp.sh"]

ADD libtiff /libtiff_build/
RUN ["linux32", "bash", "/libtiff_build/build-tiff.sh"]

ADD libwebp /webp_build/
RUN ["linux32", "bash", "/webp_build/build-webp.sh"]

ADD brotli /brotli_build/
RUN ["linux32", "bash", "/brotli_build/build-brotli.sh"]

Expand Down
8 changes: 4 additions & 4 deletions buildconfig/manylinux-build/docker_base/Dockerfile-x86_64
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# pin version on image for CI stability
FROM quay.io/pypa/manylinux2014_x86_64:2025.07.25-1
FROM quay.io/pypa/manylinux2014_x86_64:2025.09.08-1
ENV MAKEFLAGS="-j 4"
ENV PG_DEP_PREFIX="/usr/local"

Expand Down Expand Up @@ -94,12 +94,12 @@ RUN ["bash", "/libjpegturbo_build/build-jpeg-turbo.sh"]
ADD libpng /libpng_build/
RUN ["bash", "/libpng_build/build-png.sh"]

ADD libwebp /webp_build/
RUN ["bash", "/webp_build/build-webp.sh"]

ADD libtiff /libtiff_build/
RUN ["bash", "/libtiff_build/build-tiff.sh"]

ADD libwebp /webp_build/
RUN ["bash", "/webp_build/build-webp.sh"]

ADD brotli /brotli_build/
RUN ["bash", "/brotli_build/build-brotli.sh"]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,12 @@ cd $FLAC
mkdir build
cd build

if [ -n "$WIN_ARCH" ]; then
export PG_FLAC_EXTRA_ARGS="-DENABLE_MULTITHREADING=0"
fi

# use cmake to try to catch the ogg dependency
cmake .. $PG_BASE_CMAKE_FLAGS \
cmake .. $PG_BASE_CMAKE_FLAGS $PG_FLAC_EXTRA_ARGS \
-DBUILD_CXXLIBS=0 \
-DBUILD_PROGRAMS=0 \
-DBUILD_EXAMPLES=0 \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,25 @@ mkdir build
cd build

if [[ "$OSTYPE" == "linux-gnu"* ]]; then
export FLUIDSYNTH_EXTRA_PLAT_FLAGS="-Denable-alsa=NO -Denable-systemd=NO"
FLUIDSYNTH_EXTRA_PLAT_FLAGS=(
"-Denable-alsa=NO"
"-Denable-systemd=NO"
)
elif [[ "$OSTYPE" == "darwin"* ]]; then
# We don't need fluidsynth framework on mac builds
export FLUIDSYNTH_EXTRA_PLAT_FLAGS="-Denable-framework=NO"
FLUIDSYNTH_EXTRA_PLAT_FLAGS=(
"-Denable-framework=NO"
)
elif [[ -n "$WIN_ARCH" ]]; then
FLUIDSYNTH_EXTRA_PLAT_FLAGS=(
"-DCMAKE_C_FLAGS=-static-libgcc"
"-DCMAKE_EXE_LINKER_FLAGS=-static-libgcc"
"-DCMAKE_CXX_FLAGS=-static-libgcc -static-libstdc++"
)
fi

cmake .. $PG_BASE_CMAKE_FLAGS -Denable-readline=OFF $FLUIDSYNTH_EXTRA_PLAT_FLAGS \
cmake .. $PG_BASE_CMAKE_FLAGS -Denable-readline=OFF -Denable-openmp=OFF \
"${FLUIDSYNTH_EXTRA_PLAT_FLAGS[@]}" \
-Denable-pulseaudio=NO \
-Denable-pipewire=NO

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,8 @@ set -e -x

cd $(dirname `readlink -f "$0"`)

# TODO: when freetype is updated, we can look into resolving the circular
# dependency between freetype and harfbuzz by using the upcoming freetype
# dynamic harfbuzz loading feature.
FREETYPE="freetype-2.13.3"
HARFBUZZ_VER=11.3.3
FREETYPE="freetype-2.14.0"
HARFBUZZ_VER=11.4.5
HARFBUZZ_NAME="harfbuzz-$HARFBUZZ_VER"

curl -sL --retry 10 https://savannah.nongnu.org/download/freetype/${FREETYPE}.tar.gz > ${FREETYPE}.tar.gz
Expand All @@ -19,55 +16,48 @@ tar xzf ${FREETYPE}.tar.gz
unxz ${HARFBUZZ_NAME}.tar.xz
tar xf ${HARFBUZZ_NAME}.tar

# freetype and harfbuzz have an infamous circular dependency, which is why
# this file is not like the rest of docker_base files

# 1. First compile freetype without harfbuzz support
cd $FREETYPE

./configure $PG_BASE_CONFIGURE_FLAGS --with-harfbuzz=no
make
make install # this freetype is not installed to mac cache dir
# For now bzip2 is only used on macOS, on other platforms there are issues with
# it.
if [[ "$OSTYPE" == "darwin"* ]]; then
export PG_FT_BZ2="-Dbzip2=enabled"
else
export PG_FT_BZ2="-Dbzip2=disabled"
fi

meson setup _build $PG_BASE_MESON_FLAGS -Dbrotli=enabled -Dharfbuzz=dynamic \
-Dpng=enabled -Dzlib=system $PG_FT_BZ2

meson compile -C _build
meson install -C _build

cd ..

# 2. Compile harfbuzz with freetype support
cd ${HARFBUZZ_NAME}

# Harfbuzz tries to include libgcc/libstc++ while building on windows. Because
# we are compiling with MinGW, it would cause a dependency on libgcc_s_seh-1.dll
# which we don't want. So, statically link and only use what's required.
if [ -n "$WIN_ARCH" ]; then
PG_HARFBUZZ_EXTRA_ARGS=(
"-Dc_args=['-static-libgcc']"
"-Dc_link_args=['-static-libgcc']"
"-Dcpp_args=['-static-libgcc','-static-libstdc++']"
"-Dcpp_link_args=['-static-libgcc','-static-libstdc++']"
)
fi

# harfbuzz has a load of optional dependencies but only freetype is important
# to us.
# Cairo and chafa are only needed for harfbuzz commandline utilities so we
# don't use it. glib available is a bit old so we don't prefer it as of now.
# we also don't compile-in icu so that harfbuzz uses built-in unicode handling
meson setup _build $PG_BASE_MESON_FLAGS -Dfreetype=enabled \
-Dglib=disabled -Dgobject=disabled -Dcairo=disabled -Dchafa=disabled -Dicu=disabled \
-Dtests=disabled -Dintrospection=disabled -Ddocs=disabled
-Dtests=disabled -Dintrospection=disabled -Ddocs=disabled "${PG_HARFBUZZ_EXTRA_ARGS[@]}"

meson compile -C _build
meson install -C _build

if [[ "$OSTYPE" == "darwin"* ]]; then
# We do a little hack...
# When freetype finds harfbuzz with pkg-config, we tell freetype a little
# lie that harfbuzz doesn't depend on freetype (even though it does).
# This ensures no direct circular dylib link happen.
# This is a bit of a brittle hack: This command removes the entire line that
# contains "freetype". This is fine for now when the harfbuzz we are
# building has no other dependencies
sed -i '' '/freetype/d' $PG_DEP_PREFIX/lib/pkgconfig/harfbuzz.pc
fi

cd ..

# 3. Recompile freetype, and this time with harfbuzz support
cd $FREETYPE

# fully clean previous install
make clean
if [[ "$OSTYPE" == "darwin"* ]]; then
make uninstall
fi

./configure $PG_BASE_CONFIGURE_FLAGS --with-harfbuzz=yes
make
make install
Loading
Loading