Skip to content

Commit

Permalink
Compile windows deps manually (pass 1 - 8)
Browse files Browse the repository at this point in the history
  • Loading branch information
ankith26 committed Oct 7, 2023
1 parent f31ede7 commit f7f77dd
Show file tree
Hide file tree
Showing 2 changed files with 124 additions and 0 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/build-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,63 @@ concurrency:
cancel-in-progress: true

jobs:
deps:
name: ${{ matrix.name }} deps
runs-on: windows-latest
strategy:
matrix:
# make i686 deps and x86_64 deps
include:
- {
name: "64-bit",
winarch: x86_64,
msystem: MINGW64
}
- {
name: "32-bit",
winarch: i686,
msystem: MINGW32
}

steps:
- run: git config --global core.autocrlf input # do not introduce carriage returns
- uses: actions/[email protected]
- uses: msys2/setup-msys2@v2
with:
msystem: ${{ matrix.msystem }}
install: >-
cmake
gcc
- 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

# 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@v3
with:
name: pygame-win-deps-${{ matrix.winarch }}
path: ${{ github.workspace }}/pygame_win_deps_${{ matrix.winarch }}

build:
name: ${{ matrix.name }}
needs: deps
runs-on: windows-latest
strategy:
fail-fast: false # if a particular matrix build fails, don't skip the rest
Expand Down
69 changes: 69 additions & 0 deletions buildconfig/windependencies/build_win_deps.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# This uses manylinux build scripts to build dependencies on windows.

set -e -x

export WIN_PREFIX_PATH=${GITHUB_WORKSPACE}/pygame_win_deps_${WIN_ARCH}

mkdir $WIN_PREFIX_PATH

# for great speed.
export MAKEFLAGS="-j 2"

# for scripts using ./configure
export CC="gcc"
export CXX="g++"

# With this we
# 1) Force install prefix to $WIN_PREFIX_PATH
# 2) use lib directory (and not lib64)
# 3) make release binaries
# 4) build shared libraries
# 5) make cmake use gcc/g++/make
export PG_BASE_CMAKE_FLAGS="-DCMAKE_INSTALL_PREFIX=$WIN_PREFIX_PATH \
-DCMAKE_INSTALL_LIBDIR:PATH=lib \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=true \
-DCMAKE_C_COMPILER=$CC -DCMAKE_CXX_COMPILER=$CXX -DCMAKE_MAKE_PROGRAM=make"

export ARCHS_CONFIG_FLAG="--prefix=$WIN_PREFIX_PATH"

cd ../manylinux-build/docker_base

# Now start installing dependencies
# ---------------------------------

mkdir -p ${WIN_PREFIX_PATH}/usr/local/man/man1

# sdl_image deps
bash zlib-ng/build-zlib-ng.sh
bash libpng/build-png.sh # depends on zlib
bash libjpegturbo/build-jpeg-turbo.sh
bash libtiff/build-tiff.sh
bash libwebp/build-webp.sh

# freetype (also sdl_ttf dep)
bash brotli/build-brotli.sh
bash bzip2/build-bzip2.sh
bash freetype/build-freetype.sh

# sdl_mixer deps
bash libmodplug/build-libmodplug.sh
bash ogg/build-ogg.sh
bash flac/build-flac.sh
bash mpg123/build-mpg123.sh
bash opus/build-opus.sh # needs libogg (which is a container format)

# installs sdl2 by itself (fluidsynth can use it)
bash sdl_libs/build-sdl2.sh

# fluidsynth (for sdl_mixer)
bash gettext/build-gettext.sh
bash glib/build-glib.sh # depends on gettext
bash sndfile/build-sndfile.sh
bash fluidsynth/build-fluidsynth.sh

# build sdl_image, sdl_ttf and sdl_mixer
bash sdl_libs/build-sdl2-libs.sh

# for pygame.midi
bash portmidi/build-portmidi.sh

0 comments on commit f7f77dd

Please sign in to comment.