Skip to content

Commit b2f1b77

Browse files
committed
Try compiling windows deps on CI
1 parent 6fed43d commit b2f1b77

File tree

3 files changed

+140
-1
lines changed

3 files changed

+140
-1
lines changed

.github/workflows/build-windows.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,67 @@ 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+
61+
- name: Test for Win Deps cache hit
62+
id: windep-cache
63+
uses: actions/[email protected]
64+
with:
65+
path: ${{ github.workspace }}/pygame_win_deps_${{ matrix.winarch }}
66+
# The hash of all files in buildconfig manylinux-build and windependencies is
67+
# the key to the cache. If anything changes here, the deps are built again
68+
key: windep-${{ hashFiles('buildconfig/manylinux-build/**') }}-${{ hashFiles('buildconfig/windependencies/*.sh') }}-${{ matrix.winarch }}
69+
lookup-only: true
70+
71+
- uses: msys2/setup-msys2@v2
72+
with:
73+
msystem: ${{ matrix.msystem }}
74+
install: >-
75+
mingw-w64-${{ matrix.winarch }}-gcc
76+
mingw-w64-${{ matrix.winarch }}-cmake
77+
mingw-w64-${{ matrix.winarch }}-autotools
78+
mingw-w64-${{ matrix.winarch }}-nasm
79+
mingw-w64-${{ matrix.winarch }}-python
80+
81+
# build win deps on cache miss
82+
- name: Build Win Deps
83+
if: steps.windep-cache.outputs.cache-hit != 'true'
84+
shell: msys2 {0}
85+
run: |
86+
export WIN_ARCH="${{ matrix.winarch }}"
87+
cd buildconfig/windependencies
88+
bash ./build_win_deps.sh
89+
90+
# Uncomment when you want to manually verify the deps by downloading them
91+
- name: Upload win deps
92+
uses: actions/upload-artifact@v3
93+
with:
94+
name: pygame-win-deps-${{ matrix.winarch }}
95+
path: ${{ github.workspace }}/pygame_win_deps_${{ matrix.winarch }}
96+
3997
build:
4098
name: ${{ matrix.name }}
99+
needs: deps
41100
runs-on: windows-latest
42101
strategy:
43102
fail-fast: false # if a particular matrix build fails, don't skip the rest

buildconfig/manylinux-build/docker_base/libtiff/build-tiff.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ cd $TIFF
1313

1414
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
1515
./configure $PG_BASE_CONFIGURE_FLAGS --disable-lzma --disable-webp --disable-zstd
16-
elif [[ "$OSTYPE" == "darwin"* ]]; then
16+
else
1717
# Use CMake on macOS because arm64 builds fail with weird errors in ./configure
1818
cmake . $PG_BASE_CMAKE_FLAGS -Dlzma=OFF -Dwebp=OFF -Dzstd=OFF
1919
fi
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# This uses manylinux build scripts to build dependencies on windows.
2+
3+
set -e -x
4+
5+
# The below three lines convert something like D:\path\goes\here to /d/path/goes/here
6+
export BASE_DIR=$(echo "$GITHUB_WORKSPACE" | tr '[:upper:]' '[:lower:]')
7+
export BASE_DIR="${BASE_DIR//\\//}" # //\\// replaces all \ with / in the variable
8+
export BASE_DIR="/${BASE_DIR//:/}" # remove colon from drive part, add leading /
9+
10+
export PG_DEP_PREFIX="$BASE_DIR/pygame_win_deps_$WIN_ARCH"
11+
12+
export PKG_CONFIG_PATH="$PG_DEP_PREFIX/lib/pkgconfig:$PKG_CONFIG_PATH"
13+
14+
mkdir $PG_DEP_PREFIX
15+
16+
# for great speed.
17+
export MAKEFLAGS="-j 2"
18+
19+
# for scripts using ./configure
20+
export CC="gcc"
21+
export CXX="g++"
22+
23+
# With this we
24+
# 1) Force install prefix to $PG_DEP_PREFIX
25+
# 2) use lib directory within $PG_DEP_PREFIX (and not lib64)
26+
# 3) make release binaries
27+
# 4) build shared libraries
28+
# 5) make cmake use gcc/g++/make
29+
export PG_BASE_CMAKE_FLAGS="-DCMAKE_INSTALL_PREFIX=$PG_DEP_PREFIX \
30+
-DCMAKE_INSTALL_LIBDIR:PATH=lib \
31+
-DCMAKE_BUILD_TYPE=Release \
32+
-DBUILD_SHARED_LIBS=true \
33+
-DCMAKE_C_COMPILER=$CC -DCMAKE_CXX_COMPILER=$CXX -DCMAKE_MAKE_PROGRAM=make"
34+
35+
export CMAKE_GENERATOR="MSYS Makefiles"
36+
37+
export PG_BASE_CONFIGURE_FLAGS="--prefix=$PG_DEP_PREFIX"
38+
39+
export PG_BASE_MESON_FLAGS="--prefix=$PG_DEP_PREFIX \
40+
-Dlibdir=lib \
41+
-Dbuildtype=release \
42+
-Ddefault_library=shared"
43+
44+
cd ../manylinux-build/docker_base
45+
46+
# Now start installing dependencies
47+
# ---------------------------------
48+
49+
# install some buildtools
50+
bash buildtools/install.sh
51+
52+
# sdl_image deps
53+
bash zlib-ng/build-zlib-ng.sh
54+
bash libpng/build-png.sh # depends on zlib
55+
bash libjpegturbo/build-jpeg-turbo.sh
56+
bash libtiff/build-tiff.sh
57+
bash libwebp/build-webp.sh
58+
59+
# freetype (also sdl_ttf dep)
60+
bash brotli/build-brotli.sh
61+
bash bzip2/build-bzip2.sh
62+
bash freetype/build-freetype.sh
63+
64+
# sdl_mixer deps
65+
bash libmodplug/build-libmodplug.sh
66+
bash ogg/build-ogg.sh
67+
bash flac/build-flac.sh
68+
bash mpg123/build-mpg123.sh
69+
bash opus/build-opus.sh # needs libogg (which is a container format)
70+
71+
# fluidsynth (for sdl_mixer)
72+
# bash gettext/build-gettext.sh
73+
bash glib/build-glib.sh
74+
bash sndfile/build-sndfile.sh
75+
bash fluidsynth/build-fluidsynth.sh
76+
77+
bash sdl_libs/build-sdl2-libs.sh
78+
79+
# for pygame.midi
80+
bash portmidi/build-portmidi.sh

0 commit comments

Comments
 (0)