Switch MinGW building to CMake

Automatically grabs and compiles libpng, and avoids having hacky lines in our Makefile
(the compiler specification *should* be orthogonal to the build target!)

Also move the MinGW package install to the `install_deps.sh` script,
to move logic off of the YAML.
This commit is contained in:
ISSOtm
2026-03-19 21:44:18 +01:00
committed by Eldred Habert
parent 846aa975f1
commit a802bcb320
9 changed files with 92 additions and 84 deletions
+30 -3
View File
@@ -2,10 +2,32 @@
# This script requires `sh` instead of `bash` because the latter is not always installed on FreeBSD.
set -eu
case "${1%%-*}" in
case $# in
1) OS="$1"; TOOLSET= ;;
2) OS="$1"; TOOLSET="$2";;
*) echo >&2 "Usage: $0 <os> [toolset]" && exit 1;;
esac
case "${OS%%-*}" in
ubuntu|debian)
sudo apt-get -qq update
sudo apt-get install -yq bison libpng-dev pkgconf
pkgs=bison
case "$TOOLSET" in
mingw32)
pkgs="$pkgs libz-mingw-w64-dev g++-mingw-w64-i686-win32"
TOOLSET=
;;
mingw64)
pkgs="$pkgs libz-mingw-w64-dev g++-mingw-w64-x86-64-win32"
TOOLSET=
;;
'' | lcov)
pkgs="$pkgs libpng-dev pkgconf $TOOLSET"
TOOLSET=
;;
esac
sudo apt-get update -qq
# shellcheck disable=SC2086 # (This word splitting is intentional.)
sudo apt-get install -yq $pkgs
;;
macos)
# macOS bundles GNU Make 3.81, which doesn't support synced output.
@@ -32,6 +54,11 @@ case "${1%%-*}" in
;;
esac
if [ -n "$TOOLSET" ]; then
printf >&2 'Unknown toolset `%s` for OS `%s`\n' "$TOOLSET" "$OS"
exit 1
fi
# Print some system info, for easier debugging.
# https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-commands#grouping-log-lines
-29
View File
@@ -1,29 +0,0 @@
#!/bin/bash
set -euo pipefail
pngver=1.6.56
arch="$1"
## Grab sources and check them
wget http://downloads.sourceforge.net/project/libpng/libpng16/$pngver/libpng-$pngver.tar.xz
echo f7d8bf1601b7804f583a254ab343a6549ca6cf27d255c302c47af2d9d36a6f18 \*libpng-$pngver.tar.xz | \
sha256sum -c -
## Extract sources and patch them
tar -xf libpng-$pngver.tar.xz
## Start building!
mkdir -p build
cd build
../libpng-$pngver/configure \
--host="$arch" --target="$arch" \
--prefix="/usr/$arch" \
--enable-shared --disable-static \
CPPFLAGS="-D_FORTIFY_SOURCE=2" \
CFLAGS="-O2 -pipe -fno-plt -fno-exceptions --param=ssp-buffer-size=4" \
LDFLAGS="-Wl,-O1,--sort-common,--as-needed -fstack-protector"
make -kj
sudo make install