Jenkins: Integrate mdsx library into the build process

This commit is contained in:
RichardG867
2026-01-21 20:41:30 -03:00
parent 97e1f5bd39
commit 06f9a46f5d

View File

@@ -12,7 +12,7 @@
#
# Authors: RichardG, <richardg867@gmail.com>
#
# Copyright 2021-2023 RichardG.
# Copyright 2021-2026 RichardG.
#
#
@@ -334,6 +334,7 @@ toolchain_file="cmake/$toolchain.cmake"
toolchain_file_libs=
# Perform platform-specific setup.
cc_binary=gcc
strip_binary=strip
if is_windows
then
@@ -698,7 +699,7 @@ else
# ...and the ones we do want listed. Non-dev packages fill missing spots on the list.
libpkgs=""
longest_libpkg=0
for pkg in libc6-dev libstdc++6 libopenal-dev libfreetype6-dev libx11-dev libsdl2-dev libpng-dev librtmidi-dev qtdeclarative5-dev libwayland-dev libevdev-dev libxkbcommon-x11-dev libglib2.0-dev libslirp-dev libfaudio-dev libaudio-dev libjack-jackd2-dev libpipewire-0.3-dev libsamplerate0-dev libsndio-dev libvdeplug-dev libfluidsynth-dev libsndfile1-dev libserialport-dev libinstpatch-dev
for pkg in libc6-dev libstdc++6 libopenal-dev libfreetype6-dev libx11-dev libsdl2-dev libpng-dev librtmidi-dev qtdeclarative5-dev libwayland-dev libevdev-dev libxkbcommon-x11-dev libglib2.0-dev libslirp-dev libfaudio-dev libaudio-dev libjack-jackd2-dev libpipewire-0.3-dev libsamplerate0-dev libsndio-dev libvdeplug-dev libfluidsynth-dev libsndfile1-dev libinstpatch-dev libserialport-dev
do
libpkgs="$libpkgs $pkg:$arch_deb"
length=$(echo -n $pkg | sed 's/-dev$//' | sed "s/qtdeclarative/qt/" | wc -c)
@@ -742,6 +743,7 @@ set(ENV{PKG_CONFIG_LIBDIR} "/usr/lib/$libdir/pkgconfig:/usr/share/$libdir/pkgcon
include("$(realpath "$toolchain_file")")
EOF
toolchain_file="$toolchain_file_new"
cc_binary="$arch_triplet-gcc"
strip_binary="$arch_triplet-strip"
# Create a separate toolchain file for library compilation without including
@@ -881,14 +883,14 @@ then
fi
# Download assets if we're making a release build.
git_repo=$(git remote get-url origin 2> /dev/null)
if [ "$CI" = "true" ]
then
# Backup strategy when running under Jenkins.
[ -z "$git_repo" ] && git_repo=$GIT_URL
fi
if grep -qiE "^BUILD_TYPE:[^=]+=release" build/CMakeCache.txt 2> /dev/null
then
git_repo=$(git remote get-url origin 2> /dev/null)
if [ "$CI" = "true" ]
then
# Backup strategy when running under Jenkins.
[ -z "$git_repo" ] && git_repo=$GIT_URL
fi
if [ -n "$git_repo" ]
then
echo [-] Downloading assets
@@ -905,6 +907,16 @@ then
fi
fi
# Build mdsx library.
debug_args=
grep -qiE "^CMAKE_BUILD_TYPE:[^=]+=Debug" build/CMakeCache.txt && debug_args=DEBUG=y
cd archive_tmp
git clone --depth 1 "$(dirname "$git_repo")/mdsx.git" mdsx || exit 99
make -C mdsx/src -j$(nproc) CC="$cc_binary" STRIP="$strip_binary" $debug_args || exit 99
mv mdsx/src/mdsx.* . || exit 99
rm -rf mdsx
cd ..
# Archive the executable and its dependencies.
# The executable should always be archived last for the check after this block.
status=0
@@ -952,6 +964,9 @@ then
unzip -j "$discord_zip" "lib/$arch_discord/discord_game_sdk.dylib" -d "archive_tmp/"*".app/Contents/Frameworks"
[ ! -e "archive_tmp/"*".app/Contents/Frameworks/discord_game_sdk.dylib" ] && echo [!] No Discord Game SDK for architecture [$arch_discord]
# Archive mdsx library.
mv "archive_tmp/mdsx.dylib" "archive_tmp/"*".app/Contents/Frameworks/"
# Hack to convert x86_64 binaries to x86_64h when building that architecture.
if [ "$arch" = "x86_64h" ]
then
@@ -1137,6 +1152,9 @@ else
7z e -y -o"archive_tmp/usr/lib" "$discord_zip" "lib/$arch_discord/discord_game_sdk.so"
[ ! -e "archive_tmp/usr/lib/discord_game_sdk.so" ] && echo [!] No Discord Game SDK for architecture [$arch_discord]
# Archive mdsx library.
mv "archive_tmp/mdsx.so" "archive_tmp/usr/lib/"
# Archive readme with library package versions.
echo Libraries used to compile this $arch build of $project: > archive_tmp/README
dpkg-query -f '${Package} ${Version}\n' -W $libpkgs | sed "s/-dev / /" | sed "s/qtdeclarative/qt/" | while IFS=" " read pkg version