From fab6d5d0d50935866762b5a237d6183978043a53 Mon Sep 17 00:00:00 2001 From: GaryOAO <62834599+GaryOAO@users.noreply.github.com> Date: Fri, 20 Nov 2026 20:26:18 +0800 Subject: [PATCH 1/2] build: produce the shared Fedora RPM in one packaging pass --- .github/workflows/linux-packages.yml | 52 +-------------------- .github/workflows/release.yml | 2 +- docs/linux-packages.md | 9 ++-- packaging/build-linux.sh | 53 ++++++++++++++++----- packaging/combine-fedora.py | 69 ---------------------------- packaging/container-fedora-compat.sh | 15 ++++++ packaging/container-linux-build.sh | 8 ++-- packaging/container-linux-test.sh | 19 ++++++-- packaging/deb_manifest.py | 4 +- packaging/linux-targets.json | 12 ++--- packaging/stage-linux.py | 12 +++-- scripts/build-amd-runtime.sh | 54 ++++++++++++++-------- scripts/build-gpu-interop-probe.sh | 18 ++------ scripts/prepare-wine-headers.sh | 17 +++++++ 14 files changed, 154 insertions(+), 190 deletions(-) delete mode 100644 packaging/combine-fedora.py create mode 100755 packaging/container-fedora-compat.sh create mode 100755 scripts/prepare-wine-headers.sh diff --git a/.github/workflows/linux-packages.yml b/.github/workflows/linux-packages.yml index 9ce3db2..36a58c9 100644 --- a/.github/workflows/linux-packages.yml +++ b/.github/workflows/linux-packages.yml @@ -36,7 +36,7 @@ jobs: - name: Unit and UI tests run: env -u WAYLAND_DISPLAY GDK_BACKEND=x11 UUWAY_UI_TESTS=1 xvfb-run -a dbus-run-session -- /usr/bin/python3 -m pytest tests -q -p no:cacheprovider - name: Shell scripts - run: shellcheck -S warning install.sh packaging/*.sh packaging/deb/postinst packaging/deb/prerm packaging/deb/postrm scripts/build-*.sh scripts/install-wine11.sh + run: shellcheck -S warning install.sh packaging/*.sh packaging/deb/postinst packaging/deb/prerm packaging/deb/postrm scripts/build-*.sh scripts/install-wine11.sh scripts/prepare-wine-headers.sh native: needs: test runs-on: ubuntu-24.04 @@ -44,7 +44,7 @@ jobs: strategy: fail-fast: false matrix: - target: [debian-13, fedora-44, fedora-45, arch] + target: [debian-13, fedora, arch] steps: - uses: actions/checkout@v4 - name: Build and install-check UUWay with official Wine 11.0 binaries @@ -58,54 +58,6 @@ jobs: with: name: uuway-${{ matrix.target }} path: out/ - fedora: - needs: native - runs-on: ubuntu-24.04 - steps: - - uses: actions/checkout@v4 - - uses: actions/download-artifact@v4 - with: - name: uuway-fedora-44 - path: input44 - - uses: actions/download-artifact@v4 - with: - name: uuway-fedora-45 - path: input45 - - name: Assemble one Fedora RPM with automatic FFmpeg ABI selection - env: - VERSION: ${{ inputs.version || '1.5.3~ci' }} - run: | - mkdir -p out - docker run --rm -e VERSION -v "$PWD:/source:ro" -v "$PWD/out:/result" fedora:44 bash -c ' - set -e - dnf install -y --setopt=install_weak_deps=False python3 rpm-build cpio - python3 /source/packaging/combine-fedora.py --version "$VERSION" \ - --fedora44 /source/input44/*.rpm --fedora45 /source/input45/*.rpm --output-dir /result - ' - - uses: actions/upload-artifact@v4 - with: - name: uuway-fedora - path: out/ - fedora-check: - needs: fedora - runs-on: ubuntu-24.04 - timeout-minutes: 40 - strategy: - fail-fast: false - matrix: - version: ['44', '45'] - steps: - - uses: actions/checkout@v4 - - uses: actions/download-artifact@v4 - with: - name: uuway-fedora - path: out - - name: Install and update the same RPM on each Fedora version - env: - FEDORA_VERSION: ${{ matrix.version }} - run: | - docker run --rm -i -v "$PWD/out:/packages:ro" -v "$PWD:/source:ro" \ - "fedora:$FEDORA_VERSION" bash -s -- "fedora-$FEDORA_VERSION" /packages < packaging/container-linux-test.sh ubuntu-compat: needs: test runs-on: ubuntu-24.04 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7459053..4e64cf1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -63,7 +63,7 @@ jobs: f'uuway-{version}-1.fedora.x86_64.rpm', f'uuway-{arch_version}-1-x86_64.pkg.tar.zst'] assert all((root / name).is_file() for name in names), names - # Version-specific Fedora builds are CI inputs; publish only the shared RPM. + # Keep the release packages and generate one checksum file for all of them. for path in root.iterdir(): if path.is_file() and path.name not in names: path.unlink() diff --git a/docs/linux-packages.md b/docs/linux-packages.md index cd5847d..2ae8fcf 100644 --- a/docs/linux-packages.md +++ b/docs/linux-packages.md @@ -7,7 +7,7 @@ and code contributions via [PRs](https://github.com/GaryOAO/UUWay/compare) are w | Target | Build image | Outputs | | --- | --- | --- | | `debian-13` | Debian 13 | UUWay `.deb` | -| Fedora | Fedora 44 + 45 | one shared UUWay `.rpm` | +| `fedora` | Fedora 44 + 45 | one shared UUWay `.rpm` | | `arch` | Arch Linux | UUWay `.pkg.tar.zst`, generated PKGBUILD | All builds are x86_64 and carry NVIDIA NVENC and AMD VA-API backends. GPU drivers @@ -35,6 +35,7 @@ Compiled host artifacts and host packages are never used or changed. ```bash packaging/build-linux.sh --target debian-13 --version 1.5.0 +packaging/build-linux.sh --target fedora --version 1.5.0 packaging/build-linux.sh --target arch --version 1.5.0 ``` @@ -43,8 +44,10 @@ Outputs go to `build/linux//`. Use `--output-dir DIR` to override it; `UUWAY_BUILD_CPUS` default to 8; set both to 4 for concurrent local builds. The build downloads official prebuilt Wine 11.0 and compiles only UUWay. The **Experimental Linux packages** GitHub Actions workflow builds Ubuntu and all -the native targets and uploads artifacts. Fedora builds are combined into one RPM, -then that same package is install-checked on both Fedora 44 and 45. +the native targets and uploads artifacts. The Fedora target compiles the common +files on Fedora 44 and builds three AMD components against Fedora 45's FFmpeg +libraries as well. It packages the files directly into one RPM, then checks +installation, updates and rollback with that RPM on both Fedora 44 and 45. The **Release** workflow runs these checks before assembling a complete draft release. A second, clean container installs the resulting packages without the build diff --git a/packaging/build-linux.sh b/packaging/build-linux.sh index f553165..8d86cab 100755 --- a/packaging/build-linux.sh +++ b/packaging/build-linux.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash # Build distribution-native UUWay using official prebuilt Wine 11.0. -# Usage: packaging/build-linux.sh --target debian-13|fedora-44|fedora-45|arch --version 1.4.3 +# Usage: packaging/build-linux.sh --target debian-13|fedora|arch --version X.Y.Z set -Eeuo pipefail repo_dir="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd)" target='' version='' output_dir='' keep=0 @@ -15,6 +15,8 @@ while (($#)); do esac done [[ "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+([.+~][A-Za-z0-9.]+)?$ ]] || { echo '--version must be X.Y.Z (optionally +/~ suffix)' >&2; exit 2; } +case "$target" in fedora-44|fedora-45) target=fedora ;; esac +output_dir="${output_dir:-$repo_dir/build/linux/$target}" image="$(python3 - "$repo_dir" "$target" <<'PY' import json, pathlib, sys targets = json.loads((pathlib.Path(sys.argv[1]) / 'packaging/linux-targets.json').read_text()) @@ -23,14 +25,33 @@ if sys.argv[2] not in targets: print(targets[sys.argv[2]]['image']) PY )" -output_dir="${output_dir:-$repo_dir/build/linux/$target}" name="uuway-$target-$$" -cleanup() { ((keep)) || docker rm -f "$name" >/dev/null 2>&1 || true; } +containers=() +start_builder() { + local container="$1" build_image="$2" + docker run -d --name "$container" --cpus "${UUWAY_BUILD_CPUS:-8}" "$build_image" sleep infinity >/dev/null + containers+=("$container") + git -C "$repo_dir" ls-files -z --cached --others --exclude-standard --deduplicate | + tar -C "$repo_dir" --null -T - -cf - | + docker exec -i "$container" sh -c 'mkdir -p /work/UUWay && tar xf - -C /work/UUWay' +} +cleanup() { + if ((!keep && ${#containers[@]})); then docker rm -f "${containers[@]}" >/dev/null || true; fi +} trap cleanup EXIT -docker run -d --name "$name" --cpus "${UUWAY_BUILD_CPUS:-8}" "$image" sleep infinity >/dev/null -git -C "$repo_dir" ls-files -z --cached --others --exclude-standard --deduplicate | - tar -C "$repo_dir" --null -T - -cf - | - docker exec -i "$name" sh -c 'mkdir -p /work/UUWay && tar xf - -C /work/UUWay' +start_builder "$name" "$image" +if [[ "$target" == fedora ]]; then + compat="$name-compat" + start_builder "$compat" fedora:45 + docker exec -w /work/UUWay "$compat" bash packaging/container-fedora-compat.sh /work/compat + compat_dir=/work/UUWay/build/compat/fedora45 + docker exec "$name" mkdir -p "$compat_dir" + docker exec -w /work/compat "$compat" tar cf - . | docker exec -i -w "$compat_dir" "$name" tar xf - + if ((!keep)); then + docker rm -f "$compat" >/dev/null + containers=("$name") + fi +fi # Cache downloads only; compiled host artifacts never enter a distribution build. if [[ -d "$repo_dir/build/multidistro/downloads" ]]; then docker exec "$name" mkdir -p /work/UUWay/build/multidistro @@ -41,9 +62,19 @@ docker exec -e "SOURCE_DATE_EPOCH=$(git -C "$repo_dir" log -1 --format=%ct)" \ bash packaging/container-linux-build.sh "$target" "$version" /work/out mkdir -p "$output_dir" docker cp "$name:/work/out/." "$output_dir/" -# Resolve runtime dependencies again in a pristine image, without build packages. +cleanup +containers=() +# Resolve runtime dependencies in a pristine image for each supported release. output_dir="$(cd "$output_dir" && pwd)" -docker run --rm -i --mount "type=bind,source=$output_dir,target=/packages,readonly" \ - --mount "type=bind,source=$repo_dir,target=/source,readonly" \ - "$image" bash -s -- "$target" /packages < "$repo_dir/packaging/container-linux-test.sh" +install_check() { + docker run --rm -i --mount "type=bind,source=$output_dir,target=/packages,readonly" \ + --mount "type=bind,source=$repo_dir,target=/source,readonly" \ + "$1" bash -s -- "$2" /packages < "$repo_dir/packaging/container-linux-test.sh" +} +if [[ "$target" == fedora ]]; then + install_check "$image" fedora-44 + install_check fedora:45 fedora-45 +else + install_check "$image" "$target" +fi printf '\nBuilt and install-checked %s packages in %s\n' "$target" "$output_dir" diff --git a/packaging/combine-fedora.py b/packaging/combine-fedora.py deleted file mode 100644 index 9651fc0..0000000 --- a/packaging/combine-fedora.py +++ /dev/null @@ -1,69 +0,0 @@ -#!/usr/bin/python3 -"""Make one Fedora RPM from CI's Fedora 44 baseline and three Fedora 45 AMD files.""" -import argparse -import hashlib -import importlib.util -import json -from pathlib import Path -import shutil -import subprocess -import tempfile - -ROOT = Path(__file__).resolve().parents[1] - - -def module(name, path): - spec = importlib.util.spec_from_file_location(name, path) - value = importlib.util.module_from_spec(spec) - spec.loader.exec_module(value) - return value - - -def extract(package, destination): - destination.mkdir() - with subprocess.Popen(['rpm2cpio', str(package)], stdout=subprocess.PIPE) as producer: - subprocess.run(['cpio', '-idmu', '--quiet', '--no-absolute-filenames'], cwd=destination, - stdin=producer.stdout, check=True) - producer.stdout.close() - if producer.wait(): - raise RuntimeError('rpm2cpio failed: ' + str(package)) - - -def main(): - parser = argparse.ArgumentParser(description=__doc__) - parser.add_argument('--fedora44', type=Path, required=True) - parser.add_argument('--fedora45', type=Path, required=True) - parser.add_argument('--version', required=True) - parser.add_argument('--output-dir', type=Path, required=True) - args = parser.parse_args() - stage = module('stage_linux', ROOT / 'packaging/stage-linux.py') - checks = module('update_checks', ROOT / 'scripts/uuway_update_apply.py') - platform = module('platform_files', ROOT / 'scripts/uuway_platform.py') - for package, target in ((args.fedora44, 'fedora-44'), (args.fedora45, 'fedora-45')): - control = checks.package_control(package, target) - if (control.get('Package'), control.get('Version'), control.get('Architecture')) != ('uuway', args.version, 'x86_64'): - raise ValueError('Mismatched input package: ' + str(package)) - args.output_dir.mkdir(parents=True, exist_ok=True) - with tempfile.TemporaryDirectory(prefix='uuway-fedora-') as temporary: - work = Path(temporary) - primary, secondary = work / 'fedora44', work / 'fedora45' - extract(args.fedora44.resolve(), primary) - extract(args.fedora45.resolve(), secondary) - lib = primary / 'usr/lib/uuway' - compat = lib / 'build/compat/fedora45' - compat.mkdir(parents=True) - for name in sorted(platform.FEDORA_AMD_VARIANTS): - shutil.copy2(secondary / 'usr/lib/uuway/build/backends/amd/native-presenter' / name, compat / name) - info = lib / 'package-info.json' - metadata = json.loads(info.read_text()) - metadata.update(target='fedora', fedora_versions=['44', '45']) - info.write_text(json.dumps(metadata, indent=2) + '\n') - stage.build_rpm(primary, work, args.output_dir, 'uuway', args.version, - stage.RUNTIME['rpm'], 'fedora', runtime=True) - package = args.output_dir / checks.package_name(args.version, 'fedora') - digest = hashlib.sha256(package.read_bytes()).hexdigest() - (args.output_dir / 'SHA256SUMS').write_text(f'{digest} {package.name}\n') - - -if __name__ == '__main__': - main() diff --git a/packaging/container-fedora-compat.sh b/packaging/container-fedora-compat.sh new file mode 100755 index 0000000..282db7c --- /dev/null +++ b/packaging/container-fedora-compat.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +# Build the Fedora 45 components that link to the distribution's FFmpeg. +set -Eeuo pipefail +output="${1:?output directory}" +repo_dir="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd)" +# shellcheck source=/dev/null +. /etc/os-release +[[ $EUID == 0 && "$ID:$VERSION_ID" == fedora:45 ]] || { echo 'Run in a Fedora 45 build container.' >&2; exit 2; } +dnf install -y --setopt=install_weak_deps=False \ + ca-certificates curl git gcc mingw64-gcc pkgconf-pkg-config dpkg \ + pipewire-devel libdrm-devel vulkan-headers vulkan-loader-devel glslang glslang-devel \ + ffmpeg-free-devel libva-devel +bash "$repo_dir/scripts/install-wine11.sh" fedora-45 --build-tools +bash "$repo_dir/scripts/prepare-wine-headers.sh" +UURB_WINE_BIN=/opt/uuway-wine11/usr/bin bash "$repo_dir/scripts/build-amd-runtime.sh" --ffmpeg-only "$output" diff --git a/packaging/container-linux-build.sh b/packaging/container-linux-build.sh index d16ecdd..8e7dc38 100755 --- a/packaging/container-linux-build.sh +++ b/packaging/container-linux-build.sh @@ -17,7 +17,7 @@ case "$target:${ID:-}:${VERSION_ID:-}" in glslang-tools libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libfcitx5core-dev \ libfcitx5utils-dev libavcodec-dev libavutil-dev libswscale-dev libva-dev ;; - fedora-44:fedora:44|fedora-45:fedora:45) + fedora:fedora:44) dnf install -y --setopt=install_weak_deps=False ca-certificates curl git ripgrep python3 gcc gcc-c++ \ make mingw64-gcc mingw64-gcc-c++ meson ninja-build \ pkgconf-pkg-config xz dpkg rpm-build python3-rpm \ @@ -36,7 +36,9 @@ case "$target:${ID:-}:${VERSION_ID:-}" in *) echo "Target $target does not match ${PRETTY_NAME:-unknown}" >&2; exit 2 ;; esac cd "$repo_dir" -bash scripts/install-wine11.sh "$target" --build-tools +wine_target="$target" +if [[ "$target" == fedora ]]; then wine_target=fedora-44; fi +bash scripts/install-wine11.sh "$wine_target" --build-tools # CUDA link stubs and headers are build inputs, never installed in a runtime package. mkdir -p build/multidistro/downloads cuda_base=https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64 @@ -51,7 +53,7 @@ cuda-driver-dev-12-1_12.1.105-1_amd64.deb 49a0807b1f37da920a9417b3fa16d5e281c306 CUDA ln -sfn cuda-12.1 /usr/local/cuda UURB_WINE_BIN=/opt/wine-stable/bin -[[ "$target" != arch && "$target" != fedora-45 ]] || UURB_WINE_BIN=/opt/uuway-wine11/usr/bin +[[ "$target" != arch ]] || UURB_WINE_BIN=/opt/uuway-wine11/usr/bin export UURB_WINE_BIN export UURB_USE_SYSTEM_TOOLCHAIN=1 UURB_PIPEWIRE_HEADERS=/usr/include UURB_GLSLANG="$(command -v glslangValidator)" diff --git a/packaging/container-linux-test.sh b/packaging/container-linux-test.sh index 6b58780..62ca883 100755 --- a/packaging/container-linux-test.sh +++ b/packaging/container-linux-test.sh @@ -42,13 +42,17 @@ for backend in nvidia amd; do runuser -u uuway-test -- /usr/bin/python3 /usr/lib/uuway/scripts/package-uu-native-runtime.py \ package --with-input --backend "$backend" "/home/uuway-test/releases/$backend" > "/tmp/uuway-$backend.json" done -python3 - "$output" <<'PY' +python3 - "$output" "$target" <<'PY' import json, pathlib, subprocess, sys root = pathlib.Path('/usr/lib/uuway') info = json.loads((root / 'package-info.json').read_text()) sys.path.insert(0, str(root / 'scripts')) import uuway_platform as platform release = platform.os_release() +if sys.argv[2].startswith('fedora-'): + assert sys.argv[2] == f"fedora-{release['VERSION_ID']}" + assert info['target'] == 'fedora' and info['format'] == 'rpm', info + assert set(info['fedora_versions']) == {'44', '45'}, info for backend in ('nvidia', 'amd'): bundle = json.loads(pathlib.Path(f'/tmp/uuway-{backend}.json').read_text())['bundle'] subprocess.run(['runuser', '-u', 'uuway-test', '--', '/usr/bin/python3', @@ -85,14 +89,19 @@ assert control['Architecture'] == update.TARGETS[info['target']][1] expected_version = info['version'].replace('~', '.').replace('+', '.') if info['format'] == 'arch' else info['version'] assert control['Version'] == expected_version, control if info['target'] == 'fedora': + assert packages[0].name == update.package_name(info['version'], 'fedora'), packages import importlib.util spec = importlib.util.spec_from_file_location('packager', root / 'scripts/package-uu-native-runtime.py') packager = importlib.util.module_from_spec(spec) spec.loader.exec_module(packager) - for source in ('build/native-presenter/uurb-nvenc-encode.dll.so', - 'build/native-presenter/uu-pipewire-native-probe'): - selected = packager.backend_inputs('amd', {'file': source})['file'] - assert ('compat/fedora45' in selected) == (release['VERSION_ID'] == '45'), selected + baseline = root / 'build/backends/amd/native-presenter' + compat = root / 'build/compat/fedora45' + assert {path.name for path in compat.iterdir()} == platform.FEDORA_AMD_VARIANTS + for name in platform.FEDORA_AMD_VARIANTS: + assert (baseline / name).is_file() and (compat / name).is_file(), name + expected = (compat if release['VERSION_ID'] == '45' else baseline) / name + selected = root / packager.backend_inputs('amd', {'file': f'build/native-presenter/{name}'})['file'] + assert selected == expected, selected print('Target-aware OTA asset:', update.package_name('1.5.0', info['target'])) print('Both GPU bundles verify; installed ELF dependencies resolve. Live desktop acceptance remains required.') PY diff --git a/packaging/deb_manifest.py b/packaging/deb_manifest.py index 0478781..d1dcb79 100644 --- a/packaging/deb_manifest.py +++ b/packaging/deb_manifest.py @@ -82,6 +82,7 @@ ) BACKEND_NAMES = ('nvidia', 'amd') AMD_BACKEND_EXTRA = ('uu-vaapi-probe',) +FFMPEG_AMD_COMPONENTS = (*AMD_BACKEND_EXTRA, 'uurb-nvenc-encode.dll.so', 'uu-pipewire-native-probe') EXECUTABLE_ELF = {'uu-native-input', 'uu-pipewire-native-probe', 'uu-pipewire-dmabuf-probe', 'uu-vaapi-probe'} DXVK_STAGE = ('dxgi.dll', 'd3d11.dll', 'DXVK_LICENSE') @@ -160,8 +161,7 @@ def files(): entries.append((f'build/helpers/{name}', f'{LIB}/build/helpers/{name}', mode)) # Ubuntu 26.04 ships a newer FFmpeg ABI. Keep its three ABI-dependent AMD # binaries beside the Ubuntu 24.04 build and select them at runtime. - compat_names = sorted(AMD_BACKEND_EXTRA + ('uurb-nvenc-encode.dll.so', 'uu-pipewire-native-probe')) - compat = [f'build/compat/ubuntu26/{name}' for name in compat_names] + compat = [f'build/compat/ubuntu26/{name}' for name in sorted(FFMPEG_AMD_COMPONENTS)] if all((Path(__file__).resolve().parents[1] / source).is_file() for source in compat): entries.extend((source, f'{LIB}/{source}', 0o755) for source in compat) return entries diff --git a/packaging/linux-targets.json b/packaging/linux-targets.json index 4165981..0657b7a 100644 --- a/packaging/linux-targets.json +++ b/packaging/linux-targets.json @@ -5,22 +5,16 @@ "suite": "trixie", "label": "Debian 13" }, - "fedora-44": { + "fedora": { "image": "fedora:44", "format": "rpm", - "suite": "fedora44", - "label": "Fedora 44" + "suite": "fedora", + "label": "Fedora 44 / 45" }, "arch": { "image": "archlinux:base-devel", "format": "arch", "suite": "arch", "label": "Arch Linux" - }, - "fedora-45": { - "image": "fedora:45", - "format": "rpm", - "suite": "fedora45", - "label": "Fedora 45" } } diff --git a/packaging/stage-linux.py b/packaging/stage-linux.py index 3ff310f..ef58ce8 100755 --- a/packaging/stage-linux.py +++ b/packaging/stage-linux.py @@ -139,11 +139,17 @@ def main(): stage.mkdir() entries = [entry for entry in deb.deb_manifest.files() if target['format'] == 'deb' or 'lintian' not in entry[1]] + metadata = dict(version=args.version, target=args.target, format=target['format'], ota=True, + desktop='GNOME Wayland / Hyprland (single-output experiment)', status='experimental', wine='11.0') + if args.target == 'fedora': + metadata['fedora_versions'] = ['44', '45'] + for name in deb.deb_manifest.FFMPEG_AMD_COMPONENTS: + source = f'build/compat/fedora45/{name}' + mode = 0o755 if name in deb.deb_manifest.EXECUTABLE_ELF else 0o644 + entries.append((source, f'{deb.deb_manifest.LIB}/{source}', mode)) deb.check_sources(entries) deb.copy_tree(entries, stage, epoch) - (stage / 'usr/lib/uuway/package-info.json').write_text(json.dumps(dict( - version=args.version, target=target.get('package_target', args.target), format=target['format'], ota=True, - desktop='GNOME Wayland / Hyprland (single-output experiment)', status='experimental', wine='11.0'), indent=2) + '\n') + (stage / 'usr/lib/uuway/package-info.json').write_text(json.dumps(metadata, indent=2) + '\n') fmt = target['format'] if fmt == 'deb': native = deb.shlibs_depends(stage) diff --git a/scripts/build-amd-runtime.sh b/scripts/build-amd-runtime.sh index 0f6a41d..29ca190 100755 --- a/scripts/build-amd-runtime.sh +++ b/scripts/build-amd-runtime.sh @@ -1,27 +1,34 @@ #!/usr/bin/env bash # Build an explicit AMD runtime using the installed UUWay support artifacts. # No CUDA headers, CUDA stubs, NVIDIA driver or global DXVK overrides required. +# --ffmpeg-only DIR builds the three FFmpeg-linked files for a second host ABI. set -Eeuo pipefail repo_dir="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd)" -base="${UURB_AMD_BASE:-${1:-/usr/lib/uuway}}" winegcc="${UURB_WINEGCC:-${UURB_WINE_BIN:-/opt/wine-stable/bin}/winegcc}" stage="$repo_dir/build/native-presenter" headers="$repo_dir/build/gpu-relay/nv-codec-headers" -for tool in gcc x86_64-w64-mingw32-gcc "$winegcc" pkg-config glslangValidator; do +for tool in gcc "$winegcc" pkg-config glslangValidator; do command -v "$tool" >/dev/null || { echo "Missing build dependency: $tool" >&2; exit 1; } done -[[ -d "$base/build/dxvk-capture/stage" ]] || { echo 'Install the upstream uuway package first.' >&2; exit 1; } +mkdir -p "$stage" +compat_output='' +if [[ "${1:-}" == --ffmpeg-only ]]; then + compat_output="${2:?--ffmpeg-only needs an output directory}" +else + base="${UURB_AMD_BASE:-${1:-/usr/lib/uuway}}" + [[ -d "$base/build/dxvk-capture/stage" ]] || { echo 'Install the upstream uuway package first.' >&2; exit 1; } + command -v x86_64-w64-mingw32-gcc >/dev/null + rm -f "$repo_dir/build/encoder-backend" + if [[ "$base" != "$repo_dir" ]]; then + cp -a "$base/build/dxvk-capture" "$repo_dir/build/" + cp -a "$base/build/helpers" "$repo_dir/build/" + cp -a "$base/build/native-presenter/." "$stage/" + fi + bash "$repo_dir/scripts/build-uu-native-bootstrap.sh" +fi [[ -d "$headers/.git" ]] || git clone --depth 1 --branch n13.0.19.0 https://github.com/FFmpeg/nv-codec-headers.git "$headers" [[ "$(git -C "$headers" rev-parse HEAD)" == e844e5b26f46bb77479f063029595293aa8f812d ]] || exit 1 git -C "$headers" diff --exit-code HEAD -- include/ -mkdir -p "$stage" -rm -f "$repo_dir/build/encoder-backend" -if [[ "$base" != "$repo_dir" ]]; then - cp -a "$base/build/dxvk-capture" "$repo_dir/build/" - cp -a "$base/build/helpers" "$repo_dir/build/" - cp -a "$base/build/native-presenter/." "$stage/" -fi -bash "$repo_dir/scripts/build-uu-native-bootstrap.sh" common=(-std=c11 -O2 -Wall -Wextra -Werror -DUURB_VAAPI -I "$headers/include") if [[ "${UURB_AMD_TRACE:-0}" == 1 ]]; then common+=(-DUURB_NVENC_TRACE); fi wine_headers="$repo_dir/build/gpu-relay/wine-dev/usr/include/wine" @@ -33,7 +40,7 @@ win=(-I "$wine_headers" -I "$wine_headers/wine/windows") read -r -a native_cflags <<< "$(pkg-config --cflags libavcodec libavutil libswscale libva)" read -r -a native_link <<< "$(pkg-config --libs libavcodec libavutil libswscale libva)" native=("${native_link[@]}" -lvulkan -ldl -pthread) -for source in native_vaapi_encoder native_vaapi_query native_gpu_frame_channel native_host_frame; do +for source in native_vaapi_encoder native_vaapi_query; do gcc "${common[@]}" "${native_cflags[@]}" -fPIC -c "$repo_dir/src/$source.c" -o "$stage/$source.o" done "$winegcc" -m64 -shared "${common[@]}" "${win[@]}" \ @@ -41,13 +48,6 @@ done "$repo_dir/src/uu_nvenc_encode.c" "$repo_dir/src/uu_d3d11_vaapi_session.c" \ "$repo_dir/src/uu_d3d11_frame_adapter.c" "$stage/native_vaapi_encoder.o" "$stage/native_vaapi_query.o" \ -ld3d11 -ld3dcompiler -ldxgi -ldxguid -luuid -lvulkan-1 "${native[@]}" -x86_64-w64-mingw32-gcc "${common[@]}" -shared \ - '-DUURB_NVENC_BACKEND_FILENAME=L"uurb-nvenc-encode.dll.so"' \ - -o "$stage/uurb-nvenc-encode-loader.dll" "$repo_dir/src/uu_nvenc_query_loader.c" -"$winegcc" -m64 -shared "${common[@]}" "${win[@]}" \ - -o "$stage/uurb-dxgi-capture.dll" "$repo_dir/src/uu_dxgi_duplication.spec" \ - "$repo_dir/src/uu_dxgi_duplication.c" "$repo_dir/src/uu_d3d11_host_capture.c" "$stage/native_gpu_frame_channel.o" \ - -ld3d11 -ldxgi -ldxguid -luuid UURB_GLSLANG="$(command -v glslangValidator)" bash "$repo_dir/scripts/build-native-cursor-shaders.sh" read -r -a pipewire_cflags <<< "$(pkg-config --cflags libpipewire-0.3)" gcc "${common[@]}" "${native_cflags[@]}" -std=gnu11 "${pipewire_cflags[@]}" \ @@ -58,6 +58,22 @@ gcc "${common[@]}" "${native_cflags[@]}" -std=gnu11 "${pipewire_cflags[@]}" \ -I "$stage/cursor-shaders" -o "$stage/uu-pipewire-native-probe" -lpipewire-0.3 "${native[@]}" gcc "${common[@]}" "${native_cflags[@]}" -I "$repo_dir/src" "$repo_dir/tests/probes/vaapi_encode.c" \ "$stage/native_vaapi_encoder.o" -o "$stage/uu-vaapi-probe" "${native[@]}" +if [[ -n "$compat_output" ]]; then + mkdir -p "$compat_output" + install -m 0755 "$stage/uurb-nvenc-encode.dll.so" "$stage/uu-pipewire-native-probe" \ + "$stage/uu-vaapi-probe" "$compat_output/" + exit 0 +fi +for source in native_gpu_frame_channel native_host_frame; do + gcc "${common[@]}" "${native_cflags[@]}" -fPIC -c "$repo_dir/src/$source.c" -o "$stage/$source.o" +done +x86_64-w64-mingw32-gcc "${common[@]}" -shared \ + '-DUURB_NVENC_BACKEND_FILENAME=L"uurb-nvenc-encode.dll.so"' \ + -o "$stage/uurb-nvenc-encode-loader.dll" "$repo_dir/src/uu_nvenc_query_loader.c" +"$winegcc" -m64 -shared "${common[@]}" "${win[@]}" \ + -o "$stage/uurb-dxgi-capture.dll" "$repo_dir/src/uu_dxgi_duplication.spec" \ + "$repo_dir/src/uu_dxgi_duplication.c" "$repo_dir/src/uu_d3d11_host_capture.c" "$stage/native_gpu_frame_channel.o" \ + -ld3d11 -ldxgi -ldxguid -luuid x86_64-w64-mingw32-gcc "${common[@]}" -o "$stage/uu-nvenc-pe-encode-probe.exe" \ "$repo_dir/src/uu_nvenc_encode_probe.c" -ld3d11 -ld3dcompiler -ldxgi -ldxguid gcc -std=c11 -O2 -Wall -Wextra -Werror -D_GNU_SOURCE -I "$repo_dir/src" \ diff --git a/scripts/build-gpu-interop-probe.sh b/scripts/build-gpu-interop-probe.sh index 90e35cb..9886844 100644 --- a/scripts/build-gpu-interop-probe.sh +++ b/scripts/build-gpu-interop-probe.sh @@ -7,9 +7,7 @@ work="$repo_dir/build/gpu-relay" stage="$repo_dir/build/native-presenter" wine_revision=db11d0fe6a169c457e23d007e20404643d067aa8 codec_revision=e844e5b26f46bb77479f063029595293aa8f812d -header_archive="$work/downloads/libwine-dev_9.0~repack-4build3_amd64.deb" -header_sha=b9599eb86a630087248394795cb09abe023745f1230057f9762e152f83101f0a -for tool in gcc git curl sha256sum dpkg-deb "${UURB_WINE_BIN:-/opt/wine-stable/bin}/winegcc"; do +for tool in gcc git "${UURB_WINE_BIN:-/opt/wine-stable/bin}/winegcc"; do command -v "$tool" >/dev/null || { printf 'Missing dependency: %s\n' "$tool" >&2; exit 1; } done [[ "$("${UURB_WINE_BIN:-/opt/wine-stable/bin}/wine" --version)" == wine-11.0 ]] || { @@ -38,18 +36,8 @@ for source in wine-review nv-codec-headers; do printf 'Untracked dependency headers: %s\n' "$source" >&2; exit 1; } done -mkdir -p "$work/downloads" "$stage" -if [[ ! -f "$header_archive" ]]; then - curl --fail --location --proto '=https' --proto-redir '=https' --retry 3 \ - 'https://archive.ubuntu.com/ubuntu/pool/universe/w/wine/libwine-dev_9.0~repack-4build3_amd64.deb' \ - -o "$header_archive.part" - printf '%s %s\n' "$header_sha" "$header_archive.part" | sha256sum --strict -c - - mv -- "$header_archive.part" "$header_archive" -fi -printf '%s %s\n' "$header_sha" "$header_archive" | sha256sum --strict -c - -# Wine 9 generated COM headers provide the unchanged D3D11 declarations. Wine 11 -# private server headers are compiled in a separate native translation unit. -dpkg-deb -x "$header_archive" "$work/wine-dev" +mkdir -p "$stage" +bash "$repo_dir/scripts/prepare-wine-headers.sh" bash "$repo_dir/scripts/build-native-presenter.sh" common=(-std=c11 -O2 -Wall -Wextra -Werror) gcc "${common[@]}" -fPIC -I /usr/local/cuda/include -I "$work/nv-codec-headers/include" \ diff --git a/scripts/prepare-wine-headers.sh b/scripts/prepare-wine-headers.sh new file mode 100755 index 0000000..7d2f1fa --- /dev/null +++ b/scripts/prepare-wine-headers.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash +# The native builds use Wine 9's generated D3D11 COM declarations with Wine 11. +set -Eeuo pipefail +repo_dir="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd)" +work="$repo_dir/build/gpu-relay" +name='libwine-dev_9.0~repack-4build3_amd64.deb' +archive="$work/downloads/$name" +sha=b9599eb86a630087248394795cb09abe023745f1230057f9762e152f83101f0a +mkdir -p "$work/downloads" +if [[ ! -f "$archive" ]]; then + curl --fail --location --proto '=https' --proto-redir '=https' --retry 3 \ + "https://archive.ubuntu.com/ubuntu/pool/universe/w/wine/$name" -o "$archive.part" + printf '%s %s\n' "$sha" "$archive.part" | sha256sum --strict -c - + mv -- "$archive.part" "$archive" +fi +printf '%s %s\n' "$sha" "$archive" | sha256sum --strict -c - +dpkg-deb -x "$archive" "$work/wine-dev" From ac3359ed715a15a3c12fabb57c5e6309d293ba0f Mon Sep 17 00:00:00 2001 From: GaryOAO <62834599+GaryOAO@users.noreply.github.com> Date: Fri, 20 Nov 2026 20:45:46 +0800 Subject: [PATCH 2/2] build: install the compiler driver required by winegcc --- packaging/container-fedora-compat.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/container-fedora-compat.sh b/packaging/container-fedora-compat.sh index 282db7c..0ebec45 100755 --- a/packaging/container-fedora-compat.sh +++ b/packaging/container-fedora-compat.sh @@ -7,7 +7,7 @@ repo_dir="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd)" . /etc/os-release [[ $EUID == 0 && "$ID:$VERSION_ID" == fedora:45 ]] || { echo 'Run in a Fedora 45 build container.' >&2; exit 2; } dnf install -y --setopt=install_weak_deps=False \ - ca-certificates curl git gcc mingw64-gcc pkgconf-pkg-config dpkg \ + ca-certificates curl git gcc gcc-c++ mingw64-gcc pkgconf-pkg-config dpkg \ pipewire-devel libdrm-devel vulkan-headers vulkan-loader-devel glslang glslang-devel \ ffmpeg-free-devel libva-devel bash "$repo_dir/scripts/install-wine11.sh" fedora-45 --build-tools