mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-22 06:15:58 +00:00
build: make the local macOS build run natively, with no emulation On an arm64 Mac the x86/i386 session preloads were built in a linux/amd64 container under emulation, and the Rockstar launcher failed to link against Homebrew's SJLJ i686 mingw. Both now build on the host's own architecture. - build_local.sh: on arm64 build the x86 preloads in a native arm64 Debian bullseye container with the x86_64/i686 cross toolchains (glibc 2.31, as before); x86 hosts keep the native gcc-multilib path. - build-x86-preloads.sh: X86_CROSS=1 selects the cross toolchains. - rockstar-launcher/build-container.sh: build the launcher in a native Ubuntu container with a DWARF2 mingw, used on macOS only. - vr/build.sh: stop aborting silently when ANDROID_NDK_HOME names an NDK that is not installed. - build_local.sh: expand the empty stores_check array safely on bash 3.2 so the script reaches its signing step.
75 lines
3.4 KiB
Bash
Executable File
75 lines
3.4 KiB
Bash
Executable File
#!/bin/sh
|
|
set -eu
|
|
out=${1:?usage: build-x86-preloads.sh <linuxfs asset directory>}
|
|
tools() {
|
|
prefix=
|
|
if [ "${X86_CROSS:-}" = 1 ]; then
|
|
case $1 in i386) prefix=i686-linux-gnu- ;; *) prefix=x86_64-linux-gnu- ;; esac
|
|
fi
|
|
GCC=${prefix}gcc GXX=${prefix}g++ STRIP=${prefix}strip OBJDUMP=${prefix}objdump NM=${prefix}nm
|
|
}
|
|
for arch in x86_64 i386; do
|
|
tools $arch
|
|
case $arch in
|
|
x86_64) bits=-m64 ;;
|
|
i386) bits=-m32 ;;
|
|
esac
|
|
mkdir -p "$out/$arch"
|
|
$GCC $bits -shared -fPIC -O2 -Wall -pthread \
|
|
-o "$out/$arch/libddsession.so" tools/linuxfs/preload/*.c -ldl
|
|
$GXX $bits -shared -fPIC -O2 -Wall -Wno-attributes -Wno-nonnull-compare \
|
|
-pthread -std=c++17 -static-libstdc++ -static-libgcc -Wl,--exclude-libs,ALL \
|
|
-o "$out/$arch/libfakeinput.so" app/src/main/cpp/fakeinput_steam.cpp -ldl
|
|
$STRIP --strip-unneeded "$out/$arch/libddsession.so" "$out/$arch/libfakeinput.so"
|
|
for lib in "$out/$arch/libddsession.so" "$out/$arch/libfakeinput.so"; do
|
|
newest=$($OBJDUMP -T "$lib" | grep -o 'GLIBC_2\.[0-9]*' | sort -u -t. -k2,2n | tail -1)
|
|
minor=${newest#GLIBC_2.}
|
|
if [ "$minor" -gt 31 ]; then
|
|
echo "$lib needs $newest; Steam Linux Runtime 3.0 has glibc 2.31" >&2
|
|
exit 1
|
|
fi
|
|
if $OBJDUMP -p "$lib" | grep -q 'NEEDED.*lib\(stdc++\|gcc_s\)'; then
|
|
echo "$lib links the C++ runtime dynamically" >&2
|
|
exit 1
|
|
fi
|
|
done
|
|
done
|
|
for target in x86_64/faultreport i386/faultreport; do
|
|
arch=${target%/*} name=${target#*/}
|
|
tools $arch
|
|
case $arch in
|
|
x86_64) bits=-m64 ;;
|
|
i386) bits=-m32 ;;
|
|
esac
|
|
lib=$out/$arch/lib$name.so
|
|
$GCC $bits -shared -fPIC -O2 -Wall -Wextra -nostdlib -fno-stack-protector -fno-builtin -fvisibility=hidden \
|
|
-o "$lib" tools/linuxfs/fex/$name.c
|
|
$STRIP --strip-unneeded "$lib"
|
|
if $OBJDUMP -p "$lib" | grep -q NEEDED || [ -n "$($NM -D --undefined-only "$lib" 2>/dev/null)" ]; then
|
|
echo "$lib must not need any library" >&2
|
|
exit 1
|
|
fi
|
|
done
|
|
tools x86_64
|
|
lib=$out/x86_64/libwebkitinput.so
|
|
$GCC -m64 -shared -fPIC -O2 -Wall -Wextra -nostdlib -fno-stack-protector -fno-builtin -fvisibility=hidden \
|
|
-o "$lib" tools/linuxfs/fex/webkitinput.c
|
|
$STRIP --strip-unneeded "$lib"
|
|
if $OBJDUMP -p "$lib" | grep -q NEEDED || [ "$($NM -D --undefined-only "$lib" | awk '{print $1 $2}' | LC_ALL=C sort | tr '\n' ' ')" != "wdlsym wg_getenv wg_object_get_data wg_object_set wg_object_set_data wg_type_check_instance_is_a wgtk_container_forall wgtk_container_get_type wgtk_key_snooper_install wgtk_widget_get_toplevel wwebkit_user_script_new wwebkit_user_script_unref wwebkit_web_view_get_type wwebkit_web_view_get_uri wwebkit_web_view_run_javascript " ]; then
|
|
echo "$lib must need nothing but weak GLib, GTK and WebKit calls" >&2
|
|
exit 1
|
|
fi
|
|
stub=$(mktemp -d)
|
|
$GCC -m64 -shared -nostdlib -Wl,-soname,/usr/lib/x86_64-linux-gnu/libvulkan.so.1 -o "$stub/libvulkan.so.1" -x c /dev/null
|
|
lib=$out/x86_64/libvulkan-thunk.so
|
|
$GCC -m64 -shared -fPIC -O2 -Wall -Wextra -fvisibility=hidden -Wl,-soname,libvulkan.so.1 -Wl,-z,nodelete -Wl,--no-as-needed \
|
|
-o "$lib" tools/linuxfs/fex/vulkanpin.c "$stub/libvulkan.so.1" -ldl
|
|
rm -rf "$stub"
|
|
$STRIP --strip-unneeded "$lib"
|
|
newest=$($OBJDUMP -T "$lib" | grep -o 'GLIBC_2\.[0-9]*' | sort -u -t. -k2,2n | tail -1)
|
|
if ! $OBJDUMP -p "$lib" | grep -q 'NEEDED *\/usr/lib/x86_64-linux-gnu/libvulkan\.so\.1$' \
|
|
|| ! $OBJDUMP -p "$lib" | grep -q 'FLAGS_1 *0x0*8$' || [ "${newest#GLIBC_2.}" -gt 31 ]; then
|
|
echo "$lib must be nodelete, need the Vulkan thunk and run on glibc 2.31" >&2
|
|
exit 1
|
|
fi
|