# Pragmatic vendored build of wgpu-native (gfx-rs/wgpu-native), the C-ABI # cdylib wrapper around wgpu-core/wgpu-hal/wgpu-types/naga. # # wgpu-native has no Fedora packages, and its Cargo.lock pulls in over a # hundred crates. Proper Fedora-guideline packaging (one SRPM per crate, # formal review) would be a multi-week effort. This spec instead targets # personal COPR builds only: Source1 is a single `cargo vendor` tree of the # full dependency graph at the pinned version, built fully offline in # %build. No per-crate packages, no Fedora review process. # # Version tracks wgpu-native's git tag (Cargo.toml itself carries a # placeholder "0.0.0" — real versioning is done via tags) and must stay in # sync with WGPU_NATIVE_VERSION in src/ifcviewer/CMakeLists.txt on the # ifcviewer-wgpu branch. # # --------------------------------------------------------------------------- # Regenerating Source0 and Source1 (e.g. when bumping %{version}) # # Neither source archive can be fetched by rpmbuild/spectool directly: # Source0 needs a submodule GitHub only ships as an empty dir in its # tarballs, and Source1 doesn't exist upstream at all — it's produced # locally with `cargo vendor`. Regenerate both like this: # # V=29.0.0.0 # value of %{version} above, with the leading "v" stripped # # # 1. Fetch the wgpu-native source tarball at the pinned tag. # curl -sL -o wgpu-native-native.tar.gz \ # https://github.com/gfx-rs/wgpu-native/archive/refs/tags/v${V}.tar.gz # tar xzf wgpu-native-native.tar.gz # -> wgpu-native-${V}/ # # # 2. Populate the ffi/webgpu-headers submodule (GitHub tarballs omit # # submodule content). Find the pinned commit for this tag with: # # curl -s "https://api.github.com/repos/gfx-rs/wgpu-native/contents/ffi/webgpu-headers?ref=v${V}" \ # # | grep '"sha"' # SUBMODULE_SHA=7d3186c3dd2c708703524027b46b8703534ab3cc # curl -sL -o webgpu-headers.tar.gz \ # "https://github.com/webgpu-native/webgpu-headers/archive/${SUBMODULE_SHA}.tar.gz" # tar xzf webgpu-headers.tar.gz # rm -rf wgpu-native-${V}/ffi/webgpu-headers # mv webgpu-headers-${SUBMODULE_SHA} wgpu-native-${V}/ffi/webgpu-headers # # # 3. Tar up Source0 (no build artifacts, no vendor/, no .cargo/). # tar cJf rust-wgpu-native-${V}.tar.xz wgpu-native-${V} # # # 4. Vendor the full Cargo.lock dependency tree and tar it as Source1. # # This must be run with network access; the result is what makes # # %build fully offline. # ( cd wgpu-native-${V} && cargo vendor vendor ) # tar cJf rust-wgpu-native-${V}-vendor.tar.xz -C wgpu-native-${V} vendor # # # 5. Regenerate the third-party license manifest (Source2). # ( cd wgpu-native-${V} && CARGO_NET_OFFLINE=true cargo metadata --format-version 1 ) \ # | python3 -c 'import json,sys; d=json.load(sys.stdin); [print(f"{p[\"name\"]} {p[\"version\"]} {p.get(\"license\") or \"NONE\"}") for p in sorted(d["packages"], key=lambda p: p["name"])]' \ # > THIRDPARTY.txt # # Drop all three files (rust-wgpu-native-${V}.tar.xz, # rust-wgpu-native-${V}-vendor.tar.xz, THIRDPARTY.txt) next to this spec, # bump Version/Release below, and rebuild. # --------------------------------------------------------------------------- # rpm's automatic debuginfo/-debugsource generation assumes a %build # driven by rpm's own C/C++ macros; Cargo's registry-relative source # paths don't map onto the build root the way find-debuginfo.sh expects, # which leaves debugsourcefiles.list empty and fails the build. Disable # debuginfo packages for this pure-cargo build rather than wiring up # rust-packaging's debuginfo machinery for a COPR-only spec. %global debug_package %{nil} Name: rust-wgpu-native Version: 29.0.0.0 Release: 3%{?dist} Summary: Native WebGPU implementation based on wgpu-core # wgpu-native itself: MIT OR Apache-2.0 # Vendored dependency tree additionally carries: BSD-3-Clause, ISC, # CC0-1.0, Unicode-3.0 (all permissive; see THIRDPARTY.txt for the # per-crate breakdown) License: MIT AND Apache-2.0 AND BSD-3-Clause AND ISC AND Unicode-3.0 AND CC0-1.0 URL: https://github.com/gfx-rs/wgpu-native Source0: %{name}-%{version}.tar.xz Source1: %{name}-%{version}-vendor.tar.xz Source2: THIRDPARTY.txt # The full clang package (not just clang-libs) is needed: bindgen's # build-time header parse of ffi/webgpu-headers/webgpu.h fails with # "'stddef.h' file not found" without clang's resource-dir headers, and # how that resource dir is packaged (bundled in clang-libs vs. requiring # a separate clang-resource-filesystem subpackage) varies across # Fedora/EPEL chroots — `clang` pulls in whatever's needed reliably. BuildRequires: rust cargo clang # Offline vendored cargo build; no network access needed or used in %build. %description wgpu-native provides a native, C-ABI implementation of the WebGPU API, built on top of wgpu-core/wgpu-hal/naga. It is used by desktop applications that want WebGPU without a browser, such as IfcOpenShell's ifcviewer. This build vendors the full pinned dependency tree into the source RPM and links entirely offline; it is not built or reviewed to Fedora packaging guidelines and is intended for COPR use only. %package devel Summary: Development headers for linking to wgpu-native Requires: %{name}%{?_isa} = %{version}-%{release} %description devel Headers (webgpu.h, wgpu.h), the unversioned .so symlink, static archive, and pkg-config file needed to build against wgpu-native. %prep %autosetup -n wgpu-native-%{version} tar xf %{SOURCE1} %build mkdir -p .cargo cat > .cargo/config.toml <<'EOF' [source.crates-io] replace-with = "vendored-sources" [source.vendored-sources] directory = "vendor" EOF export CARGO_NET_OFFLINE=true # cargo's cdylib output carries no DT_SONAME by default (a known Rust # toolchain gap). We control the linker invocation here, so bake the # SONAME in directly at link time instead of patchelf-ing it in after # the fact (which is what consumers of upstream's prebuilt release # binary have to do). export RUSTFLAGS="-C link-arg=-Wl,-soname,libwgpu_native.so.0" cargo build --release --offline %check nm -D --defined-only target/release/libwgpu_native.so | grep -q wgpuInstanceRelease %install install -Dpm0755 target/release/libwgpu_native.so %{buildroot}%{_libdir}/libwgpu_native.so.0 ln -s libwgpu_native.so.0 %{buildroot}%{_libdir}/libwgpu_native.so install -Dpm0644 target/release/libwgpu_native.a %{buildroot}%{_libdir}/libwgpu_native.a install -Dpm0644 ffi/webgpu-headers/webgpu.h %{buildroot}%{_includedir}/webgpu/webgpu.h install -Dpm0644 ffi/wgpu.h %{buildroot}%{_includedir}/webgpu/wgpu.h install -Dpm0644 %{SOURCE2} %{buildroot}%{_docdir}/%{name}/THIRDPARTY.txt mkdir -p %{buildroot}%{_libdir}/pkgconfig cat > %{buildroot}%{_libdir}/pkgconfig/wgpu-native.pc < - 29.0.0.0-3 - Disable debuginfo/-debugsource subpackage generation (find-debuginfo.sh can't resolve Cargo registry source paths against the build root) * Mon Aug 03 2026 Bruno Postle - 29.0.0.0-2 - BuildRequires clang instead of clang-libs (bindgen needs resource-dir headers like stddef.h; the clang-libs/clang-resource-filesystem split isn't reliable across all COPR chroot targets) * Mon Aug 03 2026 Bruno Postle - 29.0.0.0-1 - Initial pragmatic vendored COPR build