Skip to content

Commit f7f77dd

Browse files
committed
Compile windows deps manually (pass 1 - 8)
1 parent f31ede7 commit f7f77dd

File tree

2 files changed

+124
-0
lines changed

2 files changed

+124
-0
lines changed

.github/workflows/build-windows.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,63 @@ concurrency:
3636
cancel-in-progress: true
3737

3838
jobs:
39+
deps:
40+
name: ${{ matrix.name }} deps
41+
runs-on: windows-latest
42+
strategy:
43+
matrix:
44+
# make i686 deps and x86_64 deps
45+
include:
46+
- {
47+
name: "64-bit",
48+
winarch: x86_64,
49+
msystem: MINGW64
50+
}
51+
- {
52+
name: "32-bit",
53+
winarch: i686,
54+
msystem: MINGW32
55+
}
56+
57+
steps:
58+
- run: git config --global core.autocrlf input # do not introduce carriage returns
59+
- uses: actions/[email protected]
60+
- uses: msys2/setup-msys2@v2
61+
with:
62+
msystem: ${{ matrix.msystem }}
63+
install: >-
64+
cmake
65+
gcc
66+
67+
- name: Test for Win Deps cache hit
68+
id: windep-cache
69+
uses: actions/[email protected]
70+
with:
71+
path: ${{ github.workspace }}/pygame_win_deps_${{ matrix.winarch }}
72+
# The hash of all files in buildconfig manylinux-build and windependencies is
73+
# the key to the cache. If anything changes here, the deps are built again
74+
key: windep-${{ hashFiles('buildconfig/manylinux-build/**') }}-${{ hashFiles('buildconfig/windependencies/*.sh') }}-${{ matrix.winarch }}
75+
lookup-only: true
76+
77+
# build win deps on cache miss
78+
- name: Build Win Deps
79+
if: steps.windep-cache.outputs.cache-hit != 'true'
80+
shell: msys2 {0}
81+
run: |
82+
export WIN_ARCH="${{ matrix.winarch }}"
83+
cd buildconfig/windependencies
84+
bash ./build_win_deps.sh
85+
86+
# Uncomment when you want to manually verify the deps by downloading them
87+
- name: Upload win deps
88+
uses: actions/upload-artifact@v3
89+
with:
90+
name: pygame-win-deps-${{ matrix.winarch }}
91+
path: ${{ github.workspace }}/pygame_win_deps_${{ matrix.winarch }}
92+
3993
build:
4094
name: ${{ matrix.name }}
95+
needs: deps
4196
runs-on: windows-latest
4297
strategy:
4398
fail-fast: false # if a particular matrix build fails, don't skip the rest
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# This uses manylinux build scripts to build dependencies on windows.
2+
3+
set -e -x
4+
5+
export WIN_PREFIX_PATH=${GITHUB_WORKSPACE}/pygame_win_deps_${WIN_ARCH}
6+
7+
mkdir $WIN_PREFIX_PATH
8+
9+
# for great speed.
10+
export MAKEFLAGS="-j 2"
11+
12+
# for scripts using ./configure
13+
export CC="gcc"
14+
export CXX="g++"
15+
16+
# With this we
17+
# 1) Force install prefix to $WIN_PREFIX_PATH
18+
# 2) use lib directory (and not lib64)
19+
# 3) make release binaries
20+
# 4) build shared libraries
21+
# 5) make cmake use gcc/g++/make
22+
export PG_BASE_CMAKE_FLAGS="-DCMAKE_INSTALL_PREFIX=$WIN_PREFIX_PATH \
23+
-DCMAKE_INSTALL_LIBDIR:PATH=lib \
24+
-DCMAKE_BUILD_TYPE=Release \
25+
-DBUILD_SHARED_LIBS=true \
26+
-DCMAKE_C_COMPILER=$CC -DCMAKE_CXX_COMPILER=$CXX -DCMAKE_MAKE_PROGRAM=make"
27+
28+
export ARCHS_CONFIG_FLAG="--prefix=$WIN_PREFIX_PATH"
29+
30+
cd ../manylinux-build/docker_base
31+
32+
# Now start installing dependencies
33+
# ---------------------------------
34+
35+
mkdir -p ${WIN_PREFIX_PATH}/usr/local/man/man1
36+
37+
# sdl_image deps
38+
bash zlib-ng/build-zlib-ng.sh
39+
bash libpng/build-png.sh # depends on zlib
40+
bash libjpegturbo/build-jpeg-turbo.sh
41+
bash libtiff/build-tiff.sh
42+
bash libwebp/build-webp.sh
43+
44+
# freetype (also sdl_ttf dep)
45+
bash brotli/build-brotli.sh
46+
bash bzip2/build-bzip2.sh
47+
bash freetype/build-freetype.sh
48+
49+
# sdl_mixer deps
50+
bash libmodplug/build-libmodplug.sh
51+
bash ogg/build-ogg.sh
52+
bash flac/build-flac.sh
53+
bash mpg123/build-mpg123.sh
54+
bash opus/build-opus.sh # needs libogg (which is a container format)
55+
56+
# installs sdl2 by itself (fluidsynth can use it)
57+
bash sdl_libs/build-sdl2.sh
58+
59+
# fluidsynth (for sdl_mixer)
60+
bash gettext/build-gettext.sh
61+
bash glib/build-glib.sh # depends on gettext
62+
bash sndfile/build-sndfile.sh
63+
bash fluidsynth/build-fluidsynth.sh
64+
65+
# build sdl_image, sdl_ttf and sdl_mixer
66+
bash sdl_libs/build-sdl2-libs.sh
67+
68+
# for pygame.midi
69+
bash portmidi/build-portmidi.sh

0 commit comments

Comments
 (0)