Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into sis-video-work
Browse files Browse the repository at this point in the history
  • Loading branch information
Cacodemon345 committed Feb 24, 2024
2 parents 6323410 + 1d2f893 commit 8e39496
Show file tree
Hide file tree
Showing 947 changed files with 114,802 additions and 71,665 deletions.
4 changes: 2 additions & 2 deletions .ci/AppImageBuilder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,16 @@ AppDir:
- libgles2 # if QT:BOOL=ON
- libglvnd0 # if QT:BOOL=ON
- libglx0 # if QT:BOOL=ON
- libgomp1
- libgs9
- libpng16-16
- libqt5core5a # if QT:BOOL=ON
- libqt5gui5 # if QT:BOOL=ON
- libqt5widgets5 # if QT:BOOL=ON
- libsixel1 # if CLI:BOOL=ON
- libslirp0 # if SLIRP_EXTERNAL:BOOL=ON
- libslirp0
- libsndio7.0 # if OPENAL:BOOL=ON
- libvdeplug-dev # -dev also pulls in libvdeplug2. -dev is required to get the proper .so symlink to the library
- libwayland-client0 # if QT:BOOL=ON
- libx11-6 # if QT:BOOL=ON
- libx11-xcb1 # if QT:BOOL=ON
- libxcb1 # if QT:BOOL=ON
Expand Down
88 changes: 52 additions & 36 deletions .ci/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
# - For Windows (MSYS MinGW) builds:
# - Packaging requires 7-Zip on Program Files
# - Packaging the Ghostscript DLL requires 32-bit and/or 64-bit Ghostscript on Program Files
# - Packaging the FluidSynth DLL requires it to be at /home/86Box/dll32/libfluidsynth.dll
# and/or /home/86Box/dll64/libfluidsynth64.dll (for 32-bit and 64-bit builds respectively)
# - Packaging the XAudio2 DLL for FAudio requires it to be at /home/86Box/dll32/xaudio2*.dll
# and/or /home/86Box/dll64/xaudio2*.dll (for 32-bit and 64-bit builds respectively)
# - For Linux builds:
# - Only Debian and derivatives are supported
# - dpkg and apt-get are called through sudo to manage dependencies; make sure those
Expand Down Expand Up @@ -259,6 +259,7 @@ case $arch in
esac
[ ! -e "cmake/$toolchain.cmake" ] && toolchain=flags-gcc
toolchain_file="cmake/$toolchain.cmake"
toolchain_file_libs=

# Perform platform-specific setup.
strip_binary=strip
Expand Down Expand Up @@ -287,7 +288,6 @@ then
echo [-] Using MSYSTEM [$MSYSTEM]

# Install dependencies only if we're in a new build and/or architecture.
freetype_dll="$cache_dir/freetype.$MSYSTEM.dll"
if check_buildtag "$MSYSTEM"
then
# Update databases and keyring only if we're in a new build.
Expand Down Expand Up @@ -332,9 +332,6 @@ then
# Clean pacman cache when running under Jenkins to save disk space.
[ "$CI" = "true" ] && rm -rf /var/cache/pacman/pkg

# Generate a new freetype DLL for this architecture.
rm -f "$freetype_dll"

# Save build tag to skip this later. Doing it here (once everything is
# in place) is important to avoid potential issues with retried builds.
save_buildtag "$MSYSTEM"
Expand Down Expand Up @@ -543,12 +540,25 @@ then
# Attempt to install dependencies.
sudo "$macports/bin/port" install $(cat .ci/dependencies_macports.txt) 2>&1 | tee macports.log

# Stop if no port version activation errors were found.
# Check for port activation errors.
stuck_dep=$(grep " cannot be built while another version of " macports.log | cut -d" " -f10)
[ -z $stuck_dep ] && break
if [ -n "$stuck_dep" ]
then
# Deactivate the stuck dependency and try again.
sudo "$macports/bin/port" -f deactivate "$stuck_dep"
continue
fi

stuck_dep=$(grep " Please deactivate this port first, or " macports.log | cut -d" " -f5 | tr -d :)
if [ -n "$stuck_dep" ]
then
# Activate the stuck dependency and try again.
sudo "$macports/bin/port" -f activate "$stuck_dep"
continue
fi

# Deactivate the stuck dependency and try again.
sudo "$macports/bin/port" -f deactivate $stuck_dep
# Stop if no errors were found.
break
done

# Remove MacPorts error detection log.
Expand All @@ -569,6 +579,7 @@ else
arm32) arch_deb="armhf";;
*) arch_deb="$arch";;
esac
grep -q " bullseye " /etc/apt/sources.list || echo [!] WARNING: System not running the expected Debian version

# Establish general dependencies.
pkgs="cmake ninja-build pkg-config git wget p7zip-full extra-cmake-modules wayland-protocols tar gzip file appstream"
Expand All @@ -577,7 +588,7 @@ else
pkgs="$pkgs build-essential"
else
# Add foreign architecture if required.
if ! dpkg --print-foreign-architectures | grep -Fx "$arch_deb"
if ! dpkg --print-foreign-architectures | grep -Fqx "$arch_deb"
then
sudo dpkg --add-architecture "$arch_deb"

Expand All @@ -594,7 +605,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
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
do
libpkgs="$libpkgs $pkg:$arch_deb"
length=$(echo -n $pkg | sed 's/-dev$//' | sed "s/qtdeclarative/qt/" | wc -c)
Expand All @@ -615,10 +626,7 @@ else
*) libdir="$arch_triplet";;
esac

# Create CMake cross toolchain file. The file is saved on a fixed location for
# the library builds we do later, since running CMake again on a library we've
# already built before will *not* update its toolchain file path; therefore, we
# cannot point them to our working directory, which may change across builds.
# Create CMake cross toolchain file.
toolchain_file_new="$cache_dir/toolchain.$arch_deb.cmake"
cat << EOF > "$toolchain_file_new"
set(CMAKE_SYSTEM_NAME Linux)
Expand Down Expand Up @@ -646,6 +654,14 @@ EOF
toolchain_file="$toolchain_file_new"
strip_binary="$arch_triplet-strip"

# Create a separate toolchain file for library compilation without including
# our own toolchain files, letting libraries set their own C(XX)FLAGS instead.
# The file is saved on a fixed location, since running CMake again on a library
# we've already built before will *not* update its toolchain file path; therefore,
# we cannot point them to our working directory, which may change across builds.
toolchain_file_libs="$cache_dir/toolchain.$arch_deb.libs.cmake"
grep -Ev "^include\(" "$toolchain_file" > "$toolchain_file_libs"

# Install dependencies only if we're in a new build and/or architecture.
if check_buildtag "$arch_deb"
then
Expand All @@ -668,9 +684,6 @@ EOF
else
echo [-] Not installing dependencies again
fi

# Link against the system libslirp instead of compiling ours.
cmake_flags_extra="$cmake_flags_extra -D SLIRP_EXTERNAL=ON"
fi

# Point CMake to the toolchain file.
Expand Down Expand Up @@ -790,10 +803,6 @@ then
sevenzip="$pf/7-Zip/7z.exe"
[ "$arch" = "32" -a -d "/c/Program Files (x86)" ] && pf="/c/Program Files (x86)"

# Archive freetype from cache or generate it from local MSYS installation.
[ ! -e "$freetype_dll" ] && .ci/static2dll.sh -p freetype2 /$MSYSTEM/lib/libfreetype.a "$freetype_dll"
cp -p "$freetype_dll" archive_tmp/freetype.dll

# Archive Ghostscript DLL from local official distribution installation.
for gs in "$pf"/gs/gs*.*.*
do
Expand All @@ -804,8 +813,8 @@ then
"$sevenzip" e -y -o"archive_tmp" "$discord_zip" "lib/$arch_discord/discord_game_sdk.dll"
[ ! -e "archive_tmp/discord_game_sdk.dll" ] && echo [!] No Discord Game SDK for architecture [$arch_discord]

# Archive other DLLs from local directory.
cp -p "/home/$project/dll$arch/"* archive_tmp/
# Archive XAudio2 DLL if required.
grep -q "OPENAL:BOOL=ON" build/CMakeCache.txt || cp -p "/home/$project/dll$arch/xaudio2"* archive_tmp/

# Archive executable, while also stripping it if requested.
if [ $strip -ne 0 ]
Expand Down Expand Up @@ -885,11 +894,6 @@ else
cwd_root="$(pwd)"
check_buildtag "libs.$arch_deb"

cp cmake/flags-gcc.cmake cmake/flags-gcc.cmake.old
sed -i -e 's/ -Werror=.*\([" ]\)/\1/g' cmake/flags-gcc.cmake # temporary hack for -Werror=old-style-definition non-compliance on FluidSynth and SDL2
sed -i -e 's/ C;CXX/ IGNORED/' cmake/flags-gcc.cmake # workaround for dynamic c(xx)flags system overwriting library flags and breaking (at least) openal-soft
sed -i -e 's/_INIT / /g' cmake/flags-gcc.cmake # still append our own flags

if grep -q "OPENAL:BOOL=ON" build/CMakeCache.txt
then
# Build openal-soft 1.23.1 manually to fix audio issues. This is a temporary
Expand All @@ -906,7 +910,7 @@ else
sed -i -e 's/PW_KEY_CONFIG_NAME/"config.name"/g' "$prefix/alc/backends/pipewire.cpp"

prefix_build="$prefix/build-$arch_deb"
cmake -G Ninja -D "CMAKE_TOOLCHAIN_FILE=$toolchain_file" -D "CMAKE_INSTALL_PREFIX=$cwd_root/archive_tmp/usr" -S "$prefix" -B "$prefix_build" || exit 99
cmake -G Ninja -D "CMAKE_TOOLCHAIN_FILE=$toolchain_file_libs" -D "CMAKE_INSTALL_PREFIX=$cwd_root/archive_tmp/usr" -S "$prefix" -B "$prefix_build" || exit 99
cmake --build "$prefix_build" -j$(nproc) || exit 99
cmake --install "$prefix_build" || exit 99

Expand All @@ -922,7 +926,7 @@ else
wget -qO - https://github.com/FNA-XNA/FAudio/archive/refs/tags/22.03.tar.gz | tar zxf - -C "$cache_dir" || rm -rf "$prefix"
fi
prefix_build="$prefix/build-$arch_deb"
cmake -G Ninja -D "CMAKE_TOOLCHAIN_FILE=$toolchain_file" -D "CMAKE_INSTALL_PREFIX=$cwd_root/archive_tmp/usr" -S "$prefix" -B "$prefix_build" || exit 99
cmake -G Ninja -D "CMAKE_TOOLCHAIN_FILE=$toolchain_file_libs" -D "CMAKE_INSTALL_PREFIX=$cwd_root/archive_tmp/usr" -S "$prefix" -B "$prefix_build" || exit 99
cmake --build "$prefix_build" -j$(nproc) || exit 99
cmake --install "$prefix_build" || exit 99

Expand All @@ -943,7 +947,7 @@ else
wget -qO - https://github.com/thestk/rtmidi/archive/refs/tags/4.0.0.tar.gz | tar zxf - -C "$cache_dir" || rm -rf "$prefix"
fi
prefix_build="$prefix/build-$arch_deb"
cmake -G Ninja -D RTMIDI_API_JACK=OFF -D "CMAKE_TOOLCHAIN_FILE=$toolchain_file" -D "CMAKE_INSTALL_PREFIX=$cwd_root/archive_tmp/usr" -S "$prefix" -B "$prefix_build" || exit 99
cmake -G Ninja -D RTMIDI_API_JACK=OFF -D "CMAKE_TOOLCHAIN_FILE=$toolchain_file_libs" -D "CMAKE_INSTALL_PREFIX=$cwd_root/archive_tmp/usr" -S "$prefix" -B "$prefix_build" || exit 99
cmake --build "$prefix_build" -j$(nproc) || exit 99
cmake --install "$prefix_build" || exit 99

Expand All @@ -957,7 +961,7 @@ else
fi
prefix_build="$prefix/build-$arch_deb"
cmake -G Ninja -D enable-dbus=OFF -D enable-jack=OFF -D enable-oss=OFF -D enable-sdl2=OFF -D enable-pulseaudio=OFF -D enable-pipewire=OFF -D enable-alsa=OFF \
-D "CMAKE_TOOLCHAIN_FILE=$toolchain_file" -D "CMAKE_INSTALL_PREFIX=$cwd_root/archive_tmp/usr" \
-D "CMAKE_TOOLCHAIN_FILE=$toolchain_file_libs" -D "CMAKE_INSTALL_PREFIX=$cwd_root/archive_tmp/usr" \
-S "$prefix" -B "$prefix_build" || exit 99
cmake --build "$prefix_build" -j$(nproc) || exit 99
cmake --install "$prefix_build" || exit 99
Expand Down Expand Up @@ -988,12 +992,24 @@ else
-D SDL_ATOMIC=OFF -D SDL_EVENTS=ON -D SDL_HAPTIC=OFF -D SDL_POWER=OFF -D SDL_THREADS=ON -D SDL_TIMERS=ON -D SDL_FILE=OFF \
-D SDL_LOADSO=ON -D SDL_CPUINFO=ON -D SDL_FILESYSTEM=$sdl_ui -D SDL_DLOPEN=OFF -D SDL_SENSOR=OFF -D SDL_LOCALE=OFF \
\
-D "CMAKE_TOOLCHAIN_FILE=$toolchain_file" -D "CMAKE_INSTALL_PREFIX=$cwd_root/archive_tmp/usr" \
-D "CMAKE_TOOLCHAIN_FILE=$toolchain_file_libs" -D "CMAKE_INSTALL_PREFIX=$cwd_root/archive_tmp/usr" \
-S "$prefix" -B "$prefix_build" || exit 99
cmake --build "$prefix_build" -j$(nproc) || exit 99
cmake --install "$prefix_build" || exit 99

mv cmake/flags-gcc.cmake.old cmake/flags-gcc.cmake
# We rely on the host to provide Vulkan libs to sidestep any potential
# dependency issues. While Qt expects libvulkan.so, at least Debian only
# ships libvulkan.so.1 without a symlink, so make our own as a workaround.
# The relative paths prevent appimage-builder from flattening the links.
mkdir -p "archive_tmp/usr/lib/$libdir"
relroot="../../../../../../../../../../../../../../../../../../../../../../../../../../../../.."
ln -s "$relroot/usr/lib/libvulkan.so.1" "archive_tmp/usr/lib/libvulkan.so"
ln -s "$relroot/usr/lib/$libdir/libvulkan.so.1" "archive_tmp/usr/lib/$libdir/libvulkan.so"

# The FluidSynth packaged by Debian bullseye is ABI incompatible with
# the newer version we compile, despite sharing a major version. Since we
# don't run into the one breaking ABI change they made, just symlink it.
ln -s "$(readlink "archive_tmp/usr/lib/libfluidsynth.so.3")" "archive_tmp/usr/lib/libfluidsynth.so.2"

# Archive Discord Game SDK library.
7z e -y -o"archive_tmp/usr/lib" "$discord_zip" "lib/$arch_discord/discord_game_sdk.so"
Expand Down
1 change: 1 addition & 0 deletions .ci/dependencies_macports.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ qt5
wget
fluidsynth
ghostscript
libslirp
vde2
2 changes: 2 additions & 0 deletions .ci/dependencies_msys.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@ SDL2
zlib
libpng
rtmidi
libslirp
fluidsynth
qt5-static
qt5-translations
Loading

0 comments on commit 8e39496

Please sign in to comment.