Skip to content

Commit

Permalink
Migrate mingw builds to msys2 ucrt, update tpt-libs
Browse files Browse the repository at this point in the history
  • Loading branch information
LBPHacker committed Jan 12, 2024
1 parent 8a7a36b commit bc9d43b
Show file tree
Hide file tree
Showing 61 changed files with 202 additions and 197 deletions.
34 changes: 17 additions & 17 deletions .github/build.sh
Expand Up @@ -45,7 +45,7 @@ wasm32-emscripten-emscripten-static) ;;
esac

if [[ $BSH_HOST_PLATFORM == android ]]; then
android_platform=android-30
android_platform=android-31
if [[ -z "${JAVA_HOME_8_X64-}" ]]; then
>&2 echo "JAVA_HOME_8_X64 not set"
exit 1
Expand All @@ -69,9 +69,13 @@ if [[ -z ${BSH_NO_PACKAGES-} ]]; then
)
;;
windows)
if [[ $BSH_BUILD_PLATFORM == linux ]] && [[ $BSH_HOST_LIBC == mingw ]]; then
sudo apt update
sudo apt install g++-mingw-w64-x86-64
if [[ $BSH_BUILD_PLATFORM-$BSH_HOST_LIBC == windows-mingw ]]; then
pacman -Syu --noconfirm --needed mingw-w64-ucrt-x86_64-gcc
if [[ $BSH_STATIC_DYNAMIC == static ]]; then
pacman -S --noconfirm --needed mingw-w64-ucrt-x86_64-{cmake,7zip} patch
else
pacman -S --noconfirm --needed mingw-w64-ucrt-x86_64-{pkgconf,bzip2,luajit,jsoncpp,curl,SDL2,libpng,meson,fftw}
fi
fi
;;
linux)
Expand Down Expand Up @@ -247,6 +251,11 @@ if [[ $BSH_STATIC_DYNAMIC == static ]]; then
c_link_args+=\'-static-libstdc++\',
fi
else
if [[ "$BSH_HOST_PLATFORM-$BSH_HOST_LIBC $BSH_BUILD_PLATFORM" == "windows-mingw windows" ]]; then
meson_configure+=$'\t'-Dworkaround_elusive_bzip2=true
meson_configure+=$'\t'-Dworkaround_elusive_bzip2_include_dir=/ucrt64/include
meson_configure+=$'\t'-Dworkaround_elusive_bzip2_lib_dir=/ucrt64/lib
fi
if [[ $BSH_BUILD_PLATFORM == linux ]]; then
meson_configure+=$'\t'-Dworkaround_elusive_bzip2=true
fi
Expand Down Expand Up @@ -298,14 +307,10 @@ fi
if [[ $RELEASE_TYPE != dev ]]; then
meson_configure+=$'\t'-Dignore_updates=false
fi
if [[ $BSH_HOST_PLATFORM-$BSH_HOST_LIBC == windows-mingw ]]; then
if [[ $BSH_BUILD_PLATFORM == linux ]]; then
meson_configure+=$'\t'--cross-file=.github/mingw-ghactions.ini
fi
if [[ "$BSH_HOST_PLATFORM-$BSH_HOST_LIBC" == "windows-mingw" ]]; then
meson_configure+=$'\t'--cross-file=.github/mingw-ghactions.ini
fi
if [[ $BSH_HOST_PLATFORM-$BSH_HOST_LIBC != windows-mingw ]] && [[ $BSH_STATIC_DYNAMIC == static ]]; then
# LTO simply doesn't work with MinGW. I have no idea why and I also don't care.
# It also has a tendency to not play well with dynamic libraries.
if [[ $BSH_DEBUG_RELEASE-$BSH_STATIC_DYNAMIC == release-static ]]; then
meson_configure+=$'\t'-Db_lto=true
fi
if [[ $BSH_HOST_PLATFORM-$BSH_HOST_ARCH == darwin-aarch64 ]]; then
Expand All @@ -314,7 +319,7 @@ fi
if [[ $BSH_HOST_PLATFORM == emscripten ]]; then
meson_configure+=$'\t'--cross-file=.github/emscripten-ghactions.ini
fi
if [[ $RELEASE_TYPE == tptlibsdev ]] && ([[ $BSH_HOST_PLATFORM == windows ]] || [[ $BSH_STATIC_DYNAMIC == static ]]); then
if [[ $RELEASE_TYPE == tptlibsdev ]] && ([[ $BSH_HOST_PLATFORM-$BSH_HOST_LIBC == windows-msvc ]] || [[ $BSH_STATIC_DYNAMIC == static ]]); then
if [[ -z ${TPTLIBSREMOTE-} ]]; then
if [[ -z "${GITHUB_REPOSITORY_OWNER-}" ]]; then
>&2 echo "GITHUB_REPOSITORY_OWNER not set"
Expand All @@ -324,11 +329,6 @@ if [[ $RELEASE_TYPE == tptlibsdev ]] && ([[ $BSH_HOST_PLATFORM == windows ]] ||
else
tptlibsremote=$TPTLIBSREMOTE
fi
if [[ "$BSH_HOST_ARCH-$BSH_HOST_PLATFORM-$BSH_HOST_LIBC-$BSH_STATIC_DYNAMIC $BSH_BUILD_PLATFORM" == "x86_64-windows-mingw-dynamic linux" ]]; then
>&2 echo "this configuration is not supported in tptlibsdev mode"
touch $ASSET_PATH
exit 0
fi
tptlibsbranch=$(echo $RELEASE_NAME | cut -d '-' -f 2-) # $RELEASE_NAME is tptlibsdev-BRANCH
if [[ -d build-tpt-libs ]] && [[ ${TPTLIBSRESET-} == yes ]]; then
rm -rf build-tpt-libs
Expand Down
10 changes: 10 additions & 0 deletions .github/force-msys2-bash.sh
@@ -0,0 +1,10 @@
set -euo pipefail
IFS=$'\t\n'

echo 'C:\msys64\ucrt64\bin' >> tmp
echo 'C:\msys64\usr\bin' >> tmp
cat $GITHUB_PATH >> tmp
mv tmp $GITHUB_PATH

echo "MSYSTEM=UCRT64" >> $GITHUB_ENV
echo "PKG_CONFIG="'C:\msys64\ucrt64\bin\pkg-config.exe' >> $GITHUB_ENV
4 changes: 2 additions & 2 deletions .github/mingw-ghactions.ini
Expand Up @@ -2,8 +2,8 @@
prefix = 'x86_64-w64-mingw32'

[binaries]
c = prefix + '-gcc-posix'
cpp = prefix + '-g++-posix'
c = prefix + '-gcc'
cpp = prefix + '-g++'
strip = prefix + '-strip'
windres = prefix + '-windres'

Expand Down
12 changes: 8 additions & 4 deletions .github/prepare.py
Expand Up @@ -17,6 +17,7 @@ def set_output(key, value):
match_beta = re.fullmatch(r'refs/tags/v([0-9]+)\.([0-9]+)\.([0-9]+)b', ref)
match_snapshot = re.fullmatch(r'refs/tags/snapshot-([0-9]+)', ref)
match_tptlibsdev = re.fullmatch(r'refs/heads/tptlibsdev-(.*)', ref)
match_alljobs = re.fullmatch(r'refs/heads/(.*)-alljobs', ref)
do_release = False
do_priority = 10
if event_name == 'pull_request':
Expand All @@ -43,6 +44,8 @@ def set_output(key, value):
else:
release_type = 'dev'
release_name = 'dev'
if match_alljobs:
do_priority = 0
do_publish = publish_hostport and do_release

set_output('release_type', release_type)
Expand Down Expand Up @@ -100,10 +103,10 @@ def set_output(key, value):
( 'x86_64', 'linux', 'gnu', 'dynamic', 'linux', 'ubuntu-20.04', '', False, False, None, 'nohttp', None, 'debug', 10 ),
( 'x86_64', 'linux', 'gnu', 'dynamic', 'linux', 'ubuntu-20.04', '', False, False, None, 'nolua', None, 'debug', 10 ),
( 'x86_64', 'linux', 'gnu', 'dynamic', 'linux', 'ubuntu-20.04', '', False, False, None, None, None, 'release', 10 ),
# ( 'x86_64', 'windows', 'mingw', 'static', 'linux', 'ubuntu-20.04', '', False, False, None, None, None, 'debug', 10 ), # ubuntu-20.04 doesn't have windows TLS headers somehow and I haven't yet figured out how to get them
# ( 'x86_64', 'windows', 'mingw', 'static', 'linux', 'ubuntu-20.04', '', False, True, '.dbg', None, None, 'release', 10 ), # ubuntu-20.04 doesn't have windows TLS headers somehow and I haven't yet figured out how to get them
( 'x86_64', 'windows', 'mingw', 'dynamic', 'linux', 'ubuntu-20.04', '', False, False, None, None, None, 'debug', 10 ),
( 'x86_64', 'windows', 'mingw', 'dynamic', 'linux', 'ubuntu-20.04', '', False, False, None, None, None, 'release', 10 ),
# ( 'x86_64', 'windows', 'mingw', 'static', 'linux', 'ubuntu-20.04', '', False, False, None, None, None, 'debug', 10 ), # ubuntu-20.04 doesn't have windows TLS headers somehow and I haven't yet figured out how to get them; worse, it's a different toolchain
# ( 'x86_64', 'windows', 'mingw', 'static', 'linux', 'ubuntu-20.04', '', False, True, '.dbg', None, None, 'release', 10 ), # ubuntu-20.04 doesn't have windows TLS headers somehow and I haven't yet figured out how to get them; worse, it's a different toolchain
# ( 'x86_64', 'windows', 'mingw', 'dynamic', 'linux', 'ubuntu-20.04', '', False, False, None, None, None, 'debug', 10 ), # ubuntu-20.04 doesn't have ucrt64-capable mingw >_>
# ( 'x86_64', 'windows', 'mingw', 'dynamic', 'linux', 'ubuntu-20.04', '', False, False, None, None, None, 'release', 10 ), # ubuntu-20.04 doesn't have ucrt64-capable mingw >_>
( 'x86_64', 'windows', 'mingw', 'static', 'windows', 'windows-2019', '.exe', False, False, None, None, None, 'debug', 0 ), # priority = 0: static debug build
( 'x86_64', 'windows', 'mingw', 'static', 'windows', 'windows-2019', '.exe', False, True, '.dbg', None, None, 'release', 10 ),
( 'x86_64', 'windows', 'mingw', 'dynamic', 'windows', 'windows-2019', '.exe', False, False, None, None, None, 'debug', 10 ),
Expand Down Expand Up @@ -178,6 +181,7 @@ def set_output(key, value):
'bsh_static_dynamic': statdyn, # part of the unique portion of the matrix
'bsh_debug_release': dbgrel, # part of the unique portion of the matrix
'runs_on': runson,
'force_msys2_bash': (bplatform == 'windows' and libc == 'mingw') and 'yes' or 'no',
'package_suffix': suffix,
'package_mode': mode,
'publish': publish and 'yes' or 'no',
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/build.yaml
Expand Up @@ -62,6 +62,8 @@ jobs:
steps:
- run: git config --global core.autocrlf false
- uses: actions/checkout@v3
- if: matrix.force_msys2_bash == 'yes'
run: bash -c './.github/force-msys2-bash.sh'
- uses: actions/setup-python@v4
with:
python-version: '3.10'
Expand Down
12 changes: 6 additions & 6 deletions meson.build
Expand Up @@ -69,8 +69,8 @@ if static_variant != 'prebuilt' and host_platform == 'android'
warning('only prebuilt libs are supported for android')
static_variant = 'prebuilt'
endif
if static_variant == 'system' and host_platform == 'windows'
warning('no way to find system libs on windows')
if static_variant == 'system' and host_platform == 'windows' and host_libc == 'msvc'
warning('no way to find system libs for msvc on windows')
static_variant = 'prebuilt'
endif

Expand All @@ -82,20 +82,19 @@ tpt_libs_static = 'none'
if static_variant == 'prebuilt'
tpt_libs_static = 'static'
endif
if static_variant == 'none' and host_platform == 'windows'
if static_variant == 'none' and host_platform == 'windows' and host_libc == 'msvc'
tpt_libs_static = 'dynamic'
endif
tpt_libs_debug = is_debug ? 'debug' : 'release'
tpt_libs_variant = '@0@-@1@-@2@-@3@'.format(host_arch, host_platform, host_libc, tpt_libs_static)
tpt_libs_vtag = get_option('tpt_libs_vtag')
if tpt_libs_vtag == ''
tpt_libs_vtag = 'v20231003175140'
tpt_libs_vtag = 'v20240112165024'
endif
if tpt_libs_static != 'none'
if tpt_libs_variant not in [
'x86_64-linux-gnu-static',
'x86_64-windows-mingw-static',
'x86_64-windows-mingw-dynamic',
'x86_64-windows-msvc-static',
'x86_64-windows-msvc-dynamic',
'x86-windows-msvc-static',
Expand Down Expand Up @@ -329,7 +328,8 @@ if host_platform == 'windows'
if host_arch == 'x86_64'
args_ccomp_win += [ '-DZLIB_WINAPI' ]
endif
else
endif
if tpt_libs_static == 'dynamic'
foreach input_output_condition : tpt_libs.get_variable('config_dlls')
dll_input = input_output_condition[0]
dll_output = input_output_condition[1]
Expand Down
1 change: 1 addition & 0 deletions src/client/http/requestmanager/meson.build
Expand Up @@ -12,6 +12,7 @@ else
if host_platform == 'windows'
use_system_cert_provider = true
client_files += files('WindowsCertProvider.cpp')
powder_deps += c_compiler.find_library('crypt32')
endif
if host_platform == 'android'
use_system_cert_provider = true
Expand Down

This file was deleted.

@@ -0,0 +1,6 @@
[wrap-file]
directory = tpt-libs-prebuilt-aarch64-android-bionic-static-debug-v20240112165024

source_url = https://github.com/The-Powder-Toy/tpt-libs/releases/download/v20240112165024/tpt-libs-prebuilt-aarch64-android-bionic-static-debug-v20240112165024.zip
source_filename = tpt-libs-prebuilt-aarch64-android-bionic-static-debug-v20240112165024.zip
source_hash = 0aa6c80de3f38a8f2ce5cad2e79822adb6648da8355c5345be99ee678bfd80ee

This file was deleted.

@@ -0,0 +1,6 @@
[wrap-file]
directory = tpt-libs-prebuilt-aarch64-android-bionic-static-release-v20240112165024

source_url = https://github.com/The-Powder-Toy/tpt-libs/releases/download/v20240112165024/tpt-libs-prebuilt-aarch64-android-bionic-static-release-v20240112165024.zip
source_filename = tpt-libs-prebuilt-aarch64-android-bionic-static-release-v20240112165024.zip
source_hash = da3bd2fead1f021bfa2aa97e8c713a5685c70e71e3e110ea688628ca2c103c27

This file was deleted.

@@ -0,0 +1,6 @@
[wrap-file]
directory = tpt-libs-prebuilt-aarch64-darwin-macos-static-debug-v20240112165024

source_url = https://github.com/The-Powder-Toy/tpt-libs/releases/download/v20240112165024/tpt-libs-prebuilt-aarch64-darwin-macos-static-debug-v20240112165024.zip
source_filename = tpt-libs-prebuilt-aarch64-darwin-macos-static-debug-v20240112165024.zip
source_hash = b43d51ea1a346fbcca7519dad21bd0b102fe8b46d82a9ac1042b874f9fa62c06

This file was deleted.

@@ -0,0 +1,6 @@
[wrap-file]
directory = tpt-libs-prebuilt-aarch64-darwin-macos-static-release-v20240112165024

source_url = https://github.com/The-Powder-Toy/tpt-libs/releases/download/v20240112165024/tpt-libs-prebuilt-aarch64-darwin-macos-static-release-v20240112165024.zip
source_filename = tpt-libs-prebuilt-aarch64-darwin-macos-static-release-v20240112165024.zip
source_hash = d5db5ecfa0d5ec7d54b041bb47d25145ac62ef1a25008befe99c761cfd4f5617

This file was deleted.

@@ -0,0 +1,6 @@
[wrap-file]
directory = tpt-libs-prebuilt-arm-android-bionic-static-debug-v20240112165024

source_url = https://github.com/The-Powder-Toy/tpt-libs/releases/download/v20240112165024/tpt-libs-prebuilt-arm-android-bionic-static-debug-v20240112165024.zip
source_filename = tpt-libs-prebuilt-arm-android-bionic-static-debug-v20240112165024.zip
source_hash = 515f85bf7d4303fe4cf9be53b7e7cfccd11635ed758f75a0a513f2fdd82326b3

This file was deleted.

@@ -0,0 +1,6 @@
[wrap-file]
directory = tpt-libs-prebuilt-arm-android-bionic-static-release-v20240112165024

source_url = https://github.com/The-Powder-Toy/tpt-libs/releases/download/v20240112165024/tpt-libs-prebuilt-arm-android-bionic-static-release-v20240112165024.zip
source_filename = tpt-libs-prebuilt-arm-android-bionic-static-release-v20240112165024.zip
source_hash = ffdee9c2a73a1023ef456029621e861666a9fd230c1106fda8fa69ca11b1625b

This file was deleted.

@@ -0,0 +1,6 @@
[wrap-file]
directory = tpt-libs-prebuilt-wasm32-emscripten-emscripten-static-debug-v20240112165024

source_url = https://github.com/The-Powder-Toy/tpt-libs/releases/download/v20240112165024/tpt-libs-prebuilt-wasm32-emscripten-emscripten-static-debug-v20240112165024.zip
source_filename = tpt-libs-prebuilt-wasm32-emscripten-emscripten-static-debug-v20240112165024.zip
source_hash = 83ff6aa694497b8960f5136fcbc1d2ed95afc7b147b9268fbbdc237b3d8bb5ec

This file was deleted.

@@ -0,0 +1,6 @@
[wrap-file]
directory = tpt-libs-prebuilt-wasm32-emscripten-emscripten-static-release-v20240112165024

source_url = https://github.com/The-Powder-Toy/tpt-libs/releases/download/v20240112165024/tpt-libs-prebuilt-wasm32-emscripten-emscripten-static-release-v20240112165024.zip
source_filename = tpt-libs-prebuilt-wasm32-emscripten-emscripten-static-release-v20240112165024.zip
source_hash = 3e96dda457d0b9550a335f40a2c194237920e7f527357db9e74bae9242ead29d

This file was deleted.

@@ -0,0 +1,6 @@
[wrap-file]
directory = tpt-libs-prebuilt-x86-android-bionic-static-debug-v20240112165024

source_url = https://github.com/The-Powder-Toy/tpt-libs/releases/download/v20240112165024/tpt-libs-prebuilt-x86-android-bionic-static-debug-v20240112165024.zip
source_filename = tpt-libs-prebuilt-x86-android-bionic-static-debug-v20240112165024.zip
source_hash = 8df8000396af91f63320a042131aafeb31afc9fa78f78e9c211ba24dea73798a

This file was deleted.

@@ -0,0 +1,6 @@
[wrap-file]
directory = tpt-libs-prebuilt-x86-android-bionic-static-release-v20240112165024

source_url = https://github.com/The-Powder-Toy/tpt-libs/releases/download/v20240112165024/tpt-libs-prebuilt-x86-android-bionic-static-release-v20240112165024.zip
source_filename = tpt-libs-prebuilt-x86-android-bionic-static-release-v20240112165024.zip
source_hash = 13d2910c9a38958d146eff01e8987bf7dc94d8ee57761ee00992fea5ce9cab03

This file was deleted.

@@ -0,0 +1,6 @@
[wrap-file]
directory = tpt-libs-prebuilt-x86-windows-msvc-dynamic-debug-v20240112165024

source_url = https://github.com/The-Powder-Toy/tpt-libs/releases/download/v20240112165024/tpt-libs-prebuilt-x86-windows-msvc-dynamic-debug-v20240112165024.zip
source_filename = tpt-libs-prebuilt-x86-windows-msvc-dynamic-debug-v20240112165024.zip
source_hash = 460632c4902760d9f894437be9c2979ebbd2fcf5cbe6604731eb7db65c77813c

0 comments on commit bc9d43b

Please sign in to comment.