mirror of
https://github.com/bryanthaboi/gen1recomp
synced 2026-10-01 07:40:29 -04:00
CLOSES #2290, CLOSES #2338, CLOSES #2186, CLOSES #2305, CLOSES #2332, CLOSES #2320, CLOSES #2344, CLOSES #2291, CLOSES #2335, CLOSES #2340, CLOSES #2385, CLOSES #2352, CLOSES #2378, CLOSES #2403, CLOSES #2404, CLOSES #2405, CLOSES #2367, CLOSES #2037, CLOSES #2177, CLOSES #2368, CLOSES #2382, CLOSES #1951
CLOSES #2290, CLOSES #2338, CLOSES #2186, CLOSES #2305, CLOSES #2332, CLOSES #2320, CLOSES #2344, CLOSES #2291, CLOSES #2335, CLOSES #2340, CLOSES #2385, CLOSES #2352, CLOSES #2378, CLOSES #2403, CLOSES #2404, CLOSES #2405, CLOSES #2367, CLOSES #2037, CLOSES #2177, CLOSES #2368, CLOSES #2382, CLOSES #1951
This commit is contained in:
Executable
+56
@@ -0,0 +1,56 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
export LC_ALL=C
|
||||
|
||||
if [ $# -ne 2 ]; then
|
||||
echo "usage: $0 <liblibrashader_bridge.so> <libc++_shared.so>" >&2
|
||||
exit 2
|
||||
fi
|
||||
bridge="$1"
|
||||
libcxx="$2"
|
||||
if [ ! -f "$bridge" ]; then
|
||||
echo "no bridge at $bridge" >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
nm="${LLVM_NM:-}"
|
||||
if [ -z "$nm" ]; then
|
||||
for ndk in "${ANDROID_NDK_HOME:-}" "${ANDROID_NDK_ROOT:-}"; do
|
||||
[ -n "$ndk" ] || continue
|
||||
for cand in "$ndk"/toolchains/llvm/prebuilt/*/bin/llvm-nm; do
|
||||
if [ -x "$cand" ]; then
|
||||
nm="$cand"
|
||||
break 2
|
||||
fi
|
||||
done
|
||||
done
|
||||
fi
|
||||
if [ -z "$nm" ]; then
|
||||
nm="$(command -v llvm-nm || true)"
|
||||
fi
|
||||
if [ -z "$nm" ] || [ ! -x "$nm" ]; then
|
||||
echo "llvm-nm not found (set LLVM_NM or ANDROID_NDK_HOME)" >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
tmp="$(mktemp -d)"
|
||||
trap 'rm -rf "$tmp"' EXIT
|
||||
|
||||
"$nm" -D --undefined-only "$bridge" > "$tmp/undefined"
|
||||
awk '$(NF-1) == "U" { s = $NF; sub(/@.*/, "", s); if (s ~ /^_Z/) print s }' \
|
||||
"$tmp/undefined" | sort -u > "$tmp/need"
|
||||
|
||||
: > "$tmp/have"
|
||||
if [ -f "$libcxx" ]; then
|
||||
"$nm" -D --defined-only "$libcxx" > "$tmp/defined"
|
||||
awk '{ s = $NF; sub(/@.*/, "", s); print s }' "$tmp/defined" | sort -u > "$tmp/have"
|
||||
fi
|
||||
|
||||
comm -23 "$tmp/need" "$tmp/have" > "$tmp/missing"
|
||||
if [ -s "$tmp/missing" ]; then
|
||||
count="$(wc -l < "$tmp/missing" | tr -d ' ')"
|
||||
echo "$(basename "$bridge") needs $count C++ runtime symbols that $libcxx does not define, so dlopen fails:"
|
||||
head -n 5 "$tmp/missing" | sed 's/^/ /'
|
||||
exit 1
|
||||
fi
|
||||
echo "$(basename "$bridge") links against $(basename "$libcxx")"
|
||||
@@ -566,12 +566,76 @@ shader_bridge_absent() {
|
||||
warn "$SHADER_BRIDGE_LIB: $1; this build can run converted presets but not CONVERT new ones"
|
||||
}
|
||||
|
||||
shader_bridge_verify_apk() {
|
||||
local apk="$1" abi missing="" apk_entries
|
||||
apk_entries="$(unzip -Z1 "$apk")"
|
||||
for abi in $SHADER_BRIDGE_ABIS; do
|
||||
grep -qxF "lib/$abi/$SHADER_BRIDGE_LIB" <<< "$apk_entries" || missing="$missing $abi"
|
||||
shader_bridge_ndk_triple() {
|
||||
case "$1" in
|
||||
arm64-v8a) printf 'aarch64-linux-android' ;;
|
||||
armeabi-v7a) printf 'arm-linux-androideabi' ;;
|
||||
x86_64) printf 'x86_64-linux-android' ;;
|
||||
x86) printf 'i686-linux-android' ;;
|
||||
*) printf '' ;;
|
||||
esac
|
||||
}
|
||||
|
||||
shader_bridge_gradle_ndk() {
|
||||
printf '%s' "${ANDROID_SDK_ROOT:-${ANDROID_HOME:-$HOME/Library/Android/sdk}}/ndk/$NDK_VERSION"
|
||||
}
|
||||
|
||||
shader_bridge_gradle_libcxx() {
|
||||
local abi="$1" triple cand
|
||||
triple="$(shader_bridge_ndk_triple "$abi")"
|
||||
for cand in "$(shader_bridge_gradle_ndk)"/toolchains/llvm/prebuilt/*/sysroot/usr/lib/"$triple"/libc++_shared.so; do
|
||||
if [ -f "$cand" ]; then
|
||||
printf '%s' "$cand"
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
printf ''
|
||||
}
|
||||
|
||||
shader_bridge_check_links() {
|
||||
local bridge="$1" libcxx="$2" label="$3" out rc=0
|
||||
if [ -z "$libcxx" ]; then
|
||||
out="no libc++_shared.so under $(shader_bridge_gradle_ndk)"
|
||||
rc=2
|
||||
else
|
||||
out="$(ANDROID_NDK_HOME="$(shader_bridge_gradle_ndk)" \
|
||||
bash "$ROOT/scripts/android_bridge_link_check.sh" "$bridge" "$libcxx" 2>&1)" || rc=$?
|
||||
fi
|
||||
[ "$rc" -eq 0 ] && return 0
|
||||
if [ "$rc" -eq 1 ]; then
|
||||
if [ "${SHADERFX_BRIDGE_REQUIRED:-}" = "1" ]; then
|
||||
fail "$label: $out
|
||||
Build the bridge with NDK $NDK_VERSION (the one gradle packs libc++_shared.so from)."
|
||||
fi
|
||||
warn "$label: $out"
|
||||
return 0
|
||||
fi
|
||||
if [ "${SHADERFX_BRIDGE_REQUIRED:-}" = "1" ]; then
|
||||
fail "$label: cannot check that $SHADER_BRIDGE_LIB links: $out"
|
||||
fi
|
||||
warn "$label: cannot check that $SHADER_BRIDGE_LIB links: $out"
|
||||
}
|
||||
|
||||
shader_bridge_verify_apk() {
|
||||
local apk="$1" abi missing="" apk_entries tmp
|
||||
apk_entries="$(unzip -Z1 "$apk")"
|
||||
tmp="$(mktemp -d)"
|
||||
trap "rm -rf '$tmp'" EXIT
|
||||
for abi in $SHADER_BRIDGE_ABIS; do
|
||||
if grep -qxF "lib/$abi/$SHADER_BRIDGE_LIB" <<< "$apk_entries"; then
|
||||
mkdir -p "$tmp/$abi"
|
||||
unzip -o -q -j "$apk" "lib/$abi/$SHADER_BRIDGE_LIB" -d "$tmp/$abi"
|
||||
if grep -qxF "lib/$abi/libc++_shared.so" <<< "$apk_entries"; then
|
||||
unzip -o -q -j "$apk" "lib/$abi/libc++_shared.so" -d "$tmp/$abi"
|
||||
fi
|
||||
shader_bridge_check_links "$tmp/$abi/$SHADER_BRIDGE_LIB" "$tmp/$abi/libc++_shared.so" \
|
||||
"$(basename "$apk") lib/$abi"
|
||||
else
|
||||
missing="$missing $abi"
|
||||
fi
|
||||
done
|
||||
rm -rf "$tmp"
|
||||
trap - EXIT
|
||||
[ -z "$missing" ] && return 0
|
||||
if [ "${SHADERFX_BRIDGE_REQUIRED:-}" = "1" ]; then
|
||||
fail "$(basename "$apk") is missing lib/<abi>/$SHADER_BRIDGE_LIB for:$missing"
|
||||
@@ -594,6 +658,8 @@ bundle_shader_bridge_android() {
|
||||
if [ -f "$prebuilt/$abi/$SHADER_BRIDGE_LIB" ]; then
|
||||
mkdir -p "$jni/$abi"
|
||||
cp "$prebuilt/$abi/$SHADER_BRIDGE_LIB" "$jni/$abi/$SHADER_BRIDGE_LIB"
|
||||
shader_bridge_check_links "$jni/$abi/$SHADER_BRIDGE_LIB" "$(shader_bridge_gradle_libcxx "$abi")" \
|
||||
"SHADERFX_BRIDGE_ANDROID_DIR $abi"
|
||||
else
|
||||
warn "SHADERFX_BRIDGE_ANDROID_DIR has no $abi/$SHADER_BRIDGE_LIB"
|
||||
fi
|
||||
|
||||
@@ -205,6 +205,7 @@ if [ "$HAVE_RED_DATA" = "1" ]; then
|
||||
run_tier "T3 save editor: gold / gen2" "$LUA" tests/save_editor_gen2_tests.lua
|
||||
run_tier "T3 save editor: wheel scrolling" "$LUA" tests/save_editor_wheel_bug595_test.lua
|
||||
run_tier "T3 save editor: pad / NX input" "$LUA" tests/save_editor_pad_input_test.lua
|
||||
run_tier "T3 save editor: bag / PC move" "$LUA" tests/save_editor_item_move_bug1951_test.lua
|
||||
run_tier "T5 link (loopback lockstep)" "$LUA" tests/run_link_tests.lua
|
||||
# The oversize-save vendor oracle (tests/save_oversize_vendor_test.lua)
|
||||
# cross-checks the launcher's footer-truncation import against the
|
||||
|
||||
Reference in New Issue
Block a user