From 5b594ce40e1f42599f14443fe78b4daa44471f39 Mon Sep 17 00:00:00 2001 From: Stephen Gutekanst Date: Mon, 28 Feb 2022 02:20:37 -0700 Subject: [PATCH] gpu-dawn: do not include OS and libc version in download URLs I'm not sure including the OS and libc version in download URLs makes much sense. It may be useful to include them as metadata in the future alongside the release, but it seems better to exclude these from the URL (especially so that others can download them from a script without fear of them changing for non-Zig consumption.) Signed-off-by: Stephen Gutekanst --- gpu-dawn/.github/workflows/ci.yml | 4 ++-- gpu-dawn/.github/workflows/m1_ci.yml | 4 ++-- gpu-dawn/build.zig | 22 +++++++++------------- 3 files changed, 13 insertions(+), 17 deletions(-) diff --git a/gpu-dawn/.github/workflows/ci.yml b/gpu-dawn/.github/workflows/ci.yml index 8a1bb240..9bbeab38 100644 --- a/gpu-dawn/.github/workflows/ci.yml +++ b/gpu-dawn/.github/workflows/ci.yml @@ -88,7 +88,7 @@ jobs: - name: upload (debug) run: ./dev/upload-release.sh env: - RELEASE_NAME: x86_64-macos.12---12-gnu_debug + RELEASE_NAME: x86_64-macos-gnu_debug GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} x86_64-macos_release-fast: runs-on: macos-latest @@ -111,5 +111,5 @@ jobs: - name: upload (release-fast) run: ./dev/upload-release.sh env: - RELEASE_NAME: x86_64-macos.12---12-gnu_release-fast + RELEASE_NAME: x86_64-macos-gnu_release-fast GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/gpu-dawn/.github/workflows/m1_ci.yml b/gpu-dawn/.github/workflows/m1_ci.yml index fb519baa..6d5be3be 100644 --- a/gpu-dawn/.github/workflows/m1_ci.yml +++ b/gpu-dawn/.github/workflows/m1_ci.yml @@ -30,7 +30,7 @@ jobs: - name: upload (debug) run: ./dev/upload-release.sh env: - RELEASE_NAME: aarch64-macos.12---12-gnu_debug + RELEASE_NAME: aarch64-macos-gnu_debug GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: install (release-fast) run: zig build install -Ddawn-from-source=true -Drelease-fast=true -Dtarget=aarch64-macos.12-gnu @@ -39,6 +39,6 @@ jobs: - name: upload (release-fast) run: ./dev/upload-release.sh env: - RELEASE_NAME: aarch64-macos.12---12-gnu_release-fast + RELEASE_NAME: aarch64-macos-gnu_release-fast UPLOAD_HEADERS: true GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/gpu-dawn/build.zig b/gpu-dawn/build.zig index af7b0928..16c30030 100644 --- a/gpu-dawn/build.zig +++ b/gpu-dawn/build.zig @@ -183,8 +183,6 @@ fn ensureSubmodules(allocator: std.mem.Allocator) !void { pub fn linkFromBinary(b: *Builder, step: *std.build.LibExeObjStep, options: Options) void { const target = (std.zig.system.NativeTargetInfo.detect(b.allocator, step.target) catch unreachable).target; - var zig_triple = target.zigTriple(b.allocator) catch unreachable; - const binaries_available = switch (target.os.tag) { .windows => false, // TODO(build-system): add Windows binaries .linux => target.cpu.arch.isX86() and target.abi.isGnu(), @@ -196,21 +194,12 @@ pub fn linkFromBinary(b: *Builder, step: *std.build.LibExeObjStep, options: Opti // our binary is incompatible with the target. const min_available = std.builtin.Version{ .major = 12, .minor = 0 }; if (target.os.version_range.semver.min.order(min_available) == .lt) break :blk false; - - // update zig_triple to reflect the Zig triple of the binary release we're downloading. - var binary_target = target; - binary_target.os.version_range = .{ - .semver = .{ - .min = min_available, - .max = min_available, - }, - }; - zig_triple = binary_target.zigTriple(b.allocator) catch unreachable; break :blk true; }, else => false, }; if (!binaries_available) { + const zig_triple = target.zigTriple(b.allocator) catch unreachable; std.log.err("gpu-dawn binaries for {s} not available.", .{zig_triple}); std.log.err("-> open an issue: https://github.com/hexops/mach/issues", .{}); std.log.err("-> build from source (takes 5-15 minutes):", .{}); @@ -218,6 +207,13 @@ pub fn linkFromBinary(b: *Builder, step: *std.build.LibExeObjStep, options: Opti std.process.exit(1); } + // Remove OS version range / glibc version from triple (we do not include that in our download + // URLs.) + var binary_target = std.zig.CrossTarget.fromTarget(target); + binary_target.os_version_min = .{ .none = .{} }; + binary_target.os_version_max = .{ .none = .{} }; + binary_target.glibc_version = null; + const zig_triple = binary_target.zigTriple(b.allocator) catch unreachable; ensureBinaryDownloaded(b.allocator, zig_triple, b.is_release, options.binary_version); const current_git_commit = getCurrentGitCommit(b.allocator) catch unreachable; @@ -290,7 +286,7 @@ pub fn ensureBinaryDownloaded(allocator: std.mem.Allocator, zig_triple: []const const github_triple = std.mem.replaceOwned(u8, allocator, zig_triple, "...", "---") catch unreachable; // Compose the download URL, e.g.: - // https://github.com/hexops/mach-gpu-dawn/releases/download/release-6b59025/libdawn_x86_64-macos.12---12-gnu_debug.a.gz + // https://github.com/hexops/mach-gpu-dawn/releases/download/release-6b59025/libdawn_x86_64-macos-gnu_debug.a.gz const download_url = std.mem.concat(allocator, u8, &.{ "https://github.com/hexops/mach-gpu-dawn/releases/download/", version,