Skip to content

Commit

Permalink
Near-release plumbing
Browse files Browse the repository at this point in the history
Namely:

 - update sdl2, curl, mbedtls, and amend the corresponding patches
 - attempt to use mingw32-make when make doesn't exist
 - introduce angry_patch to combat patch being unable to deal with line endings in 2024
 - bump ghactions jobs to macos-13 and ubuntu-22.04
 - make vs-env.sh only do its work if it hasn't already done so (because otherwise the double work breaks some """"build systems"""" like luajit's)
 - get bzip2 to stop using fdopen
 - specify ubuntu version in the prepare step
 - unlock meson version from 1.2.3
 - enable wayland on linux by installing it in the ubuntu jobs
  • Loading branch information
LBPHacker committed Nov 6, 2024
1 parent a600dd1 commit b6515e8
Show file tree
Hide file tree
Showing 14 changed files with 75 additions and 102 deletions.
51 changes: 30 additions & 21 deletions .github/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ tarball_hash() {
lua-5.1.5.tar.gz) sha256sum=2640fc56a795f29d28ef15e13c34a47e223960b0240e8cb0a82d9b0738695333;; # acquired from https://www.lua.org/ftp/lua-5.1.5.tar.gz
lua-5.2.4.tar.gz) sha256sum=b9e2e4aad6789b3b63a056d442f7b39f0ecfca3ae0f1fc0ae4e9614401b69f4b;; # acquired from https://www.lua.org/ftp/lua-5.2.4.tar.gz
LuaJIT-2.1.0-git.tar.gz) sha256sum=d88203e0517df7e1981c8fd3ecb5abd5df1b1c34316160b8842eec7d4be398c6;; # acquired from https://luajit.org/git/luajit.git with git archive --format=tar.gz --prefix=LuaJIT-2.1.0-git/ d06beb0480c5
curl-8.7.1.tar.gz) sha256sum=f91249c87f68ea00cf27c44fdfa5a78423e41e71b7d408e5901a9896d905c495;; # acquired from https://curl.se/download/curl-8.7.1.tar.gz
SDL2-2.24.2.tar.gz) sha256sum=b35ef0a802b09d90ed3add0dcac0e95820804202914f5bb7b0feb710f1a1329f;; # acquired from https://github.com/libsdl-org/SDL/releases/download/release-2.24.2/SDL2-2.24.2.tar.gz
curl-8.10.1.tar.gz) sha256sum=d15ebab765d793e2e96db090f0e172d127859d78ca6f6391d7eafecfd894bbc0;; # acquired from https://curl.se/download/curl-8.10.1.tar.gz
SDL2-2.30.9.tar.gz) sha256sum=24b574f71c87a763f50704bbb630cbe38298d544a1f890f099a4696b1d6beba4;; # acquired from https://github.com/libsdl-org/SDL/releases/download/release-2.30.9/SDL2-2.30.9.tar.gz
libpng-1.6.37.tar.gz) sha256sum=daeb2620d829575513e35fecc83f0d3791a620b9b93d800b763542ece9390fb4;; # acquired from https://download.sourceforge.net/libpng/libpng-1.6.37.tar.gz
mbedtls-3.2.1.tar.gz) sha256sum=d0e77a020f69ad558efc660d3106481b75bd3056d6301c31564e04a0faae88cc;; # acquired from https://codeload.github.com/Mbed-TLS/mbedtls/tar.gz/refs/tags/v3.2.1
mbedtls-3.6.2.tar.bz2) sha256sum=8b54fb9bcf4d5a7078028e0520acddefb7900b3e66fec7f7175bb5b7d85ccdca;; # acquired from https://github.com/Mbed-TLS/mbedtls/releases/download/mbedtls-3.6.2/mbedtls-3.6.2.tar.bz2
jsoncpp-1.9.5.tar.gz) sha256sum=f409856e5920c18d0c2fb85276e24ee607d2a09b5e7d5f0a371368903c275da2;; # acquired from https://github.com/open-source-parsers/jsoncpp/archive/refs/tags/1.9.5.tar.gz
bzip2-1.0.8.tar.gz) sha256sum=ab5a03176ee106d3f0fa90e381da478ddae405918153cca248e682cd0c4a2269;; # acquired from https://sourceware.org/pub/bzip2/bzip2-1.0.8.tar.gz
nghttp2-1.50.0.tar.gz) sha256sum=6de469efc8e9d47059327a6736aebe0a7d73f57e5e37ab4c4f838fb1eebd7889;; # acquired from https://github.com/nghttp2/nghttp2/archive/refs/tags/v1.50.0.tar.gz
Expand Down Expand Up @@ -122,7 +122,7 @@ if [[ -z ${BSH_NO_PACKAGES-} ]]; then
pacman -S --noconfirm --needed mingw-w64-ucrt-x86_64-gcc
else
sudo apt update
sudo apt install libc6-dev fcitx-libs-dev libibus-1.0-dev
sudo apt install libc6-dev fcitx-libs-dev libibus-1.0-dev libwayland-dev
fi
;;
windows)
Expand Down Expand Up @@ -198,7 +198,7 @@ if [[ $BSH_HOST_PLATFORM-$BSH_HOST_LIBC == windows-msvc ]]; then
case $BSH_HOST_ARCH in
x86_64) vs_env_arch=x64 ; cmake_vs_toolset=v141; vcvars_ver=14.1;;
x86) vs_env_arch=x86 ; cmake_vs_toolset=v141; vcvars_ver=14.1;;
aarch64) vs_env_arch=x64_arm64; cmake_vs_toolset=v143; vcvars_ver=14.3;;
aarch64) vs_env_arch=x64_arm64; cmake_vs_toolset=v143; vcvars_ver=14.29;;
esac
cmake_vs_toolset=${BSH_VS_TOOLSET_CMAKE-$cmake_vs_toolset}
VS_ENV_PARAMS=$vs_env_arch$'\t'-vcvars_ver=${BSH_VS_TOOLSET-$vcvars_ver}
Expand Down Expand Up @@ -296,6 +296,9 @@ function check_program() {
}

make=make
if which mingw32-make; then
make=mingw32-make
fi
check_program cmake
check_program 7z
if [[ $BSH_HOST_PLATFORM-$BSH_HOST_LIBC == windows-msvc ]]; then
Expand Down Expand Up @@ -342,6 +345,19 @@ function dos2unix() {
inplace_sed 's/\r//' $1
}

function angry_patch() {
>&2 echo "fixing line endings in $1 because patch is not competent enough to do it on its own"
dos2unix $1
for line in $(grep $1 -Fe "--- "); do # not perfect but I don't care
file="$(echo "$line" | cut -d ' ' -f 2 | cut -d '/' -f 2-)"
if [[ -f "$file" ]]; then
>&2 echo "fixing line endings in $file because patch is not competent enough to do it on its own"
dos2unix "$file"
fi
done
patch -p1 -i $1
}

function add_install_flags() {
declare -n cmake_configure_ptr=$1
cmake_configure_ptr+=$'\t'-DCMAKE_INSTALL_PREFIX=$(export_path $zip_root_real)
Expand Down Expand Up @@ -390,7 +406,7 @@ function patch_breakpoint() {
esac
if [[ -f $patch_path ]]; then
>&2 echo ============== applying patch $patch_path ==============
patch -p1 -i $patch_path
angry_patch $patch_path
fi
case $mode in
apply) ;;
Expand Down Expand Up @@ -488,7 +504,7 @@ function compile_mbedtls() {
if [[ $BSH_HOST_PLATFORM == darwin ]] || [[ $BSH_HOST_PLATFORM == emscripten ]]; then
return
fi
get_and_cd mbedtls-3.2.1.tar.gz mbedtls_version
get_and_cd mbedtls-3.6.2.tar.bz2 mbedtls_version
mkdir build
cmake_configure=cmake # not local because add_*_flags can't deal with that
cmake_configure+=$'\t'-G$'\t'Ninja
Expand All @@ -515,7 +531,7 @@ function compile_mbedtls() {
cp **/mbed*.pdb $zip_root_real/lib
fi
cd ..
echo cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30 LICENSE | sha256sum -c
echo 9b405ef4c89342f5eae1dd828882f931747f71001cfba7d114801039b52ad09b LICENSE | sha256sum -c
cp LICENSE $zip_root_real/licenses/mbedtls.LICENSE
uncd_and_unget
}
Expand Down Expand Up @@ -576,12 +592,9 @@ function compile_curl() {
if [[ $BSH_HOST_PLATFORM == emscripten ]]; then
return
fi
get_and_cd curl-8.7.1.tar.gz curl_version
get_and_cd curl-8.10.1.tar.gz curl_version
curl_version+="+nghttp2-$nghttp2_version"
curl_version+="+zlib-$zlib_version"
if [[ $BSH_HOST_ARCH-$BSH_HOST_PLATFORM == arm-android ]]; then
patch_breakpoint $patches_real/curl-arm-fseeko.patch apply
fi
mkdir build
cmake_configure=cmake # not local because add_*_flags can't deal with that
cmake_configure+=$'\t'-G$'\t'Ninja
Expand Down Expand Up @@ -630,13 +643,9 @@ function compile_curl() {
VERBOSE=1 cmake --build . -j$NPROC --config $cmake_build_type
VERBOSE=1 cmake --install . --config $cmake_build_type
if [[ $BSH_HOST_PLATFORM-$BSH_HOST_LIBC == windows-msvc ]]; then
# TODO: there's something wrong on aarch64-windows-msvc-static; no good pdb is generated, which also means
# no debug symbols. I think this also affects other indirect dependencies such as nghttp2, but I have
# no way to verify because I'd have to install vs on an aarch64 machine with windows. I only have
# access to such machines through qemu on x86_64 and I don't like pain THAT much. I'll shelves this
# problem for now because I'm 99% sure it's a vs bug.
if [[ $BSH_HOST_ARCH-$BSH_HOST_PLATFORM-$BSH_HOST_LIBC-$BSH_STATIC_DYNAMIC != aarch64-windows-msvc-static ]]; then
cp **/libcurl*.pdb $zip_root_real/lib
if ! cp **/libcurl*.pdb $zip_root_real/lib; then
# TODO: libcurl's cmake config does not set the pdb's name correctly so we grab anything we see
cp **/*.pdb $zip_root_real/lib/libcurl.pdb
fi
fi
cd ..
Expand All @@ -650,7 +659,7 @@ function compile_sdl2() {
if [[ $BSH_HOST_PLATFORM == emscripten ]]; then
return
fi
get_and_cd SDL2-2.24.2.tar.gz sdl2_version
get_and_cd SDL2-2.30.9.tar.gz sdl2_version
patch_breakpoint $patches_real/sdl-no-dynapi.patch apply
patch_breakpoint $patches_real/sdl-fix-haptic-inclusion.patch apply
if [[ $BSH_HOST_PLATFORM == linux ]]; then
Expand Down Expand Up @@ -711,7 +720,7 @@ function compile_sdl2() {
cp sdl.jar $zip_root_real/lib
cd ../../../../..
fi
echo fcb07e07ac6bc8b2fcf047b50431ef4ebe5b619d7ca7c82212018309a9067426 LICENSE.txt | sha256sum -c
echo 9b9e1764f06701bcf7ce21e942c682d5921ba0900c6fca760321b1c8837a9662 LICENSE.txt | sha256sum -c
cp LICENSE.txt $zip_root_real/licenses/sdl2.LICENSE
uncd_and_unget
library_versions+="sdl2_version = '$sdl2_version-tpt-libs'"$'\n'
Expand Down
16 changes: 8 additions & 8 deletions .github/prepare.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,21 @@ def set_output(key, value):

configurations = []
for bsh_host_arch, bsh_host_platform, bsh_host_libc, bsh_static_dynamic, bsh_build_platform, runs_on in [
( 'x86_64' , 'linux', 'gnu', 'static', 'linux', 'ubuntu-20.04' ),
( 'x86_64' , 'linux', 'gnu', 'static', 'linux', 'ubuntu-22.04' ),
( 'x86_64' , 'windows', 'mingw', 'static', 'windows', 'windows-2019' ),
( 'x86_64' , 'windows', 'msvc', 'static', 'windows', 'windows-2019' ),
( 'x86_64' , 'windows', 'msvc', 'dynamic', 'windows', 'windows-2019' ),
( 'x86' , 'windows', 'msvc', 'static', 'windows', 'windows-2019' ),
( 'x86' , 'windows', 'msvc', 'dynamic', 'windows', 'windows-2019' ),
( 'aarch64' , 'windows', 'msvc', 'static', 'windows', 'windows-2019' ),
( 'aarch64' , 'windows', 'msvc', 'dynamic', 'windows', 'windows-2019' ),
( 'x86_64' , 'darwin', 'macos', 'static', 'darwin', 'macos-12' ),
( 'aarch64' , 'darwin', 'macos', 'static', 'darwin', 'macos-12' ),
( 'x86' , 'android', 'bionic', 'static', 'linux', 'ubuntu-20.04' ),
( 'x86_64' , 'android', 'bionic', 'static', 'linux', 'ubuntu-20.04' ),
( 'arm' , 'android', 'bionic', 'static', 'linux', 'ubuntu-20.04' ),
( 'aarch64' , 'android', 'bionic', 'static', 'linux', 'ubuntu-20.04' ),
( 'wasm32' , 'emscripten', 'emscripten', 'static', 'linux', 'ubuntu-20.04' ),
( 'x86_64' , 'darwin', 'macos', 'static', 'darwin', 'macos-13' ),
( 'aarch64' , 'darwin', 'macos', 'static', 'darwin', 'macos-13' ),
( 'x86' , 'android', 'bionic', 'static', 'linux', 'ubuntu-22.04' ),
( 'x86_64' , 'android', 'bionic', 'static', 'linux', 'ubuntu-22.04' ),
( 'arm' , 'android', 'bionic', 'static', 'linux', 'ubuntu-22.04' ),
( 'aarch64' , 'android', 'bionic', 'static', 'linux', 'ubuntu-22.04' ),
( 'wasm32' , 'emscripten', 'emscripten', 'static', 'linux', 'ubuntu-22.04' ),
]:
for debug_release in [ 'debug', 'release' ]:
job_name = f'build+target={bsh_host_arch}-{bsh_host_platform}-{bsh_host_libc}-{bsh_static_dynamic}-{debug_release}'
Expand Down
50 changes: 26 additions & 24 deletions .github/vs-env.sh
Original file line number Diff line number Diff line change
@@ -1,31 +1,33 @@
set -euo pipefail
IFS=$'\t\n'

IFS=$'\t\n\r'
for i in $("$(env | grep '^ProgramFiles(x86)=' | cut -d = -f 2-)/Microsoft Visual Studio/Installer/vswhere.exe" \
-sort \
-prerelease \
-requiresAny \
-requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 \
-requires Microsoft.VisualStudio.Workload.WDExpress \
-products \* \
-utf8 \
-property installationPath); do
if ! [ -z ${VS_ENV_FILTER-} ]; then
if ! echo $i | grep $VS_ENV_FILTER >/dev/null; then
continue
if [[ -z "${DevEnvDir-}" ]]; then
IFS=$'\t\n\r'
for i in $("$(env | grep '^ProgramFiles(x86)=' | cut -d = -f 2-)/Microsoft Visual Studio/Installer/vswhere.exe" \
-sort \
-prerelease \
-requiresAny \
-requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 \
-requires Microsoft.VisualStudio.Workload.WDExpress \
-products \* \
-utf8 \
-property installationPath); do
if ! [ -z ${VS_ENV_FILTER-} ]; then
if ! echo $i | grep $VS_ENV_FILTER >/dev/null; then
continue
fi
fi
fi
vs_install_dir=$i
break
done
IFS=$'\t\n'
vs_install_dir=$i
break
done
IFS=$'\t\n'

for i in $(MSYS_NO_PATHCONV=1 cmd /c "$vs_install_dir\\VC\\Auxiliary\\Build\\vcvarsall.bat" $VS_ENV_PARAMS \& env \& exit /b); do
set +e
export "$i" 2>/dev/null
echo $i | grep ERROR
set -e
done
for i in $(MSYS_NO_PATHCONV=1 cmd /c "$vs_install_dir\\VC\\Auxiliary\\Build\\vcvarsall.bat" $VS_ENV_PARAMS \& env \& exit /b); do
set +e
export "$i" 2>/dev/null
echo $i | grep ERROR
set -e
done
fi

cl
4 changes: 2 additions & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:

jobs:
prepare:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
outputs:
do_release: ${{ steps.prepare.outputs.do_release }}
matrix: ${{ steps.prepare.outputs.matrix }}
Expand Down Expand Up @@ -46,7 +46,7 @@ jobs:
- uses: actions/setup-python@v5
with:
python-version: '3.10'
- run: python -m pip install meson==1.2.3 ninja
- run: python -m pip install meson ninja
- if: matrix.bsh_build_platform == 'darwin'
run: brew install bash coreutils
- run: bash -c './.github/build.sh'
Expand Down
2 changes: 1 addition & 1 deletion patches/bzip2-meson.patch
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ diff -Naur bzip2-1.0.8.old/meson.build bzip2-1.0.8.new/meson.build
@@ -0,0 +1,24 @@
+project('bzip2', 'c', default_options: 'c_std=c99')
+
+bz2_args = [ '-D_FILE_OFFSET_BITS=64' ]
+bz2_args = [ '-D_FILE_OFFSET_BITS=64', '-DBZ_STRICT_ANSI' ]
+if host_machine.system() == 'windows'
+ bz2_args += [ '-DWIN32' ]
+endif
Expand Down
38 changes: 0 additions & 38 deletions patches/curl-arm-fseeko.patch

This file was deleted.

2 changes: 1 addition & 1 deletion patches/sdl-linux-no-input-events.patch
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ diff -Naur SDL2-2.24.2.old/CMakeLists.txt SDL2-2.24.2.new/CMakeLists.txt
- #ifndef EVIOCGNAME
- #error EVIOCGNAME() ioctl not available
- #endif
- int main(int argc, char** argv) { return 0; }" HAVE_INPUT_EVENTS)
- int main(int argc, char** argv) { return 0; }" HAVE_LINUX_INPUT_H)
-
if(LINUX)
check_c_source_compiles("
Expand Down
14 changes: 7 additions & 7 deletions patches/zlib-gz-intmax-visibility.patch
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ diff -Naur zlib-1.2.11.old/zlib.map zlib-1.2.11.new/zlib.map
--- zlib-1.2.11.old/zlib.map 2023-10-01 11:24:02.064751999 +0200
+++ zlib-1.2.11.new/zlib.map 2023-10-01 11:24:12.968353760 +0200
@@ -15,7 +15,6 @@
zcfree;
z_errmsg;
gz_error;
- gz_intmax;
_*;
};

zcfree;
z_errmsg;
gz_error;
- gz_intmax;
_*;
};

Binary file removed tarballs/SDL2-2.24.2.tar.gz
Binary file not shown.
Binary file added tarballs/SDL2-2.30.9.tar.gz
Binary file not shown.
Binary file added tarballs/curl-8.10.1.tar.gz
Binary file not shown.
Binary file removed tarballs/curl-8.7.1.tar.gz
Binary file not shown.
Binary file removed tarballs/mbedtls-3.2.1.tar.gz
Binary file not shown.
Binary file added tarballs/mbedtls-3.6.2.tar.bz2
Binary file not shown.

0 comments on commit b6515e8

Please sign in to comment.