mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-12-06 21:15:43 +00:00
CI's mingw folded ffxConfigure into an identical stub and dropped its export (amd_fidelityfx_vk.dll: missing ffxConfigure); every exported name keeps its own body.
51 lines
2.2 KiB
Bash
Executable File
51 lines
2.2 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
here=$(cd "$(dirname "$0")" && pwd)
|
|
mkdir -p "${1:?usage: build.sh <out-dir>}"
|
|
out=$(cd "$1" && pwd)
|
|
work=$(mktemp -d)
|
|
trap 'rm -rf "$work"' EXIT
|
|
|
|
cc=x86_64-w64-mingw32-gcc
|
|
objdump=x86_64-w64-mingw32-objdump
|
|
for tool in "$cc" "$objdump"; do
|
|
command -v "$tool" >/dev/null || { echo "upscale-bridges: $tool not found (apt install gcc-mingw-w64-x86-64)" >&2; exit 1; }
|
|
done
|
|
cflags=(-O2 -fno-ipa-icf -shared -s -Wall -Wextra -Wno-unused-function -static-libgcc -I"$here"
|
|
-ffile-prefix-map="$here"=. -Wl,--no-insert-timestamp)
|
|
|
|
build() {
|
|
local name=$1 source=$2 definition=$3
|
|
shift 3
|
|
# ld derives the DLL's image base from the -o path, so link in $work under the bare name.
|
|
(cd "$work" && "$cc" "${cflags[@]}" "$here/$source" "$here/$definition" "$@" -o "$name")
|
|
python3 -I "$here/pe.py" verify "$work/$name" "$here/$definition" "$here/$source" "$objdump"
|
|
python3 -I "$here/pe.py" stamp "$work/$name"
|
|
}
|
|
|
|
build amd_fidelityfx_vk.dll wl_ffx_bridge.c wl_ffx_bridge.def -lm
|
|
for name in amd_fidelityfx_dx12.dll amd_fidelityfx_upscaler_vk.dll amd_fidelityfx_upscaler_dx12.dll amd_fidelityfx_loader_dx12.dll; do
|
|
cp "$work/amd_fidelityfx_vk.dll" "$work/$name"
|
|
done
|
|
build libxess.dll wl_xess_bridge.c libxess.def -lm
|
|
build ffx_fsr3upscaler_x64.dll wl_fsr23_bridge.c ffx_fsr3upscaler_x64.def -lm
|
|
build ffx_fsr2_api_x64.dll wl_fsr23_bridge.c ffx_fsr2_api_x64.def -lm
|
|
build nvngx.dll wl_ngx_bridge.c nvngx.def -lm
|
|
for name in _nvngx.dll nvngx_dlss.dll; do
|
|
cp "$work/nvngx.dll" "$work/$name"
|
|
done
|
|
build nvapi64.dll wl_nvapi_shim.c nvapi64.def
|
|
|
|
names=(_nvngx.dll amd_fidelityfx_dx12.dll amd_fidelityfx_loader_dx12.dll amd_fidelityfx_upscaler_dx12.dll
|
|
amd_fidelityfx_upscaler_vk.dll amd_fidelityfx_vk.dll ffx_fsr2_api_x64.dll ffx_fsr3upscaler_x64.dll
|
|
libxess.dll nvapi64.dll nvngx.dll nvngx_dlss.dll)
|
|
[ "$(ls "$work" | sort)" = "$(printf '%s\n' "${names[@]}" | sort)" ] || { echo "upscale-bridges: unexpected outputs" >&2; exit 1; }
|
|
# The ARM64EC Wine loads x86-64 builtins from aarch64-windows as well.
|
|
for arch in x86_64-windows aarch64-windows; do
|
|
rm -rf "${out:?}/$arch"
|
|
mkdir -p "$out/$arch"
|
|
for name in "${names[@]}"; do
|
|
install -m 644 "$work/$name" "$out/$arch/$name"
|
|
done
|
|
done
|