Files
nixpkgs/pkgs/by-name/nv/nvibrant/hatch_build.patch

85 lines
2.7 KiB
Diff

diff --git a/hatch_build.py b/hatch_build.py
index da19ad8..f33e582 100644
--- a/hatch_build.py
+++ b/hatch_build.py
@@ -1,7 +1,6 @@
import hashlib
import os
import subprocess
-import sys
from pathlib import Path
from tempfile import TemporaryDirectory
@@ -57,46 +56,33 @@ class BuildHook(BuildHookInterface):
build_data["pure_python"] = False
- # Ensure submodule on git main
- subprocess.check_call(
- ("git", "submodule", "update", "--init", "--remote"),
- cwd=Dirs.repository,
- )
-
# Configure the project
subprocess.check_call((
- sys.executable, "-m", "mesonbuild.mesonmain",
- "setup", Dirs.build,
+ "meson", "setup", Dirs.build,
"--buildtype", "release",
"--reconfigure", "--wipe",
), cwd=Dirs.repository)
- # Intended operation
- subprocess.check_call(
- ("git", "config", "advice.detachedHead", "false"),
- cwd=Dirs.opengpu,
- )
-
# Keep track of breaking changes
hashes: dict[str, str] = dict()
# Make binaries for all known driver version
- for driver in sorted(subprocess.check_output(
- args=("git", "tag"),
+ for driver in subprocess.check_output(
+ args=("cat", "./SOURCE_TAGS"),
cwd=Dirs.opengpu
- ).decode().strip().splitlines()):
+ ).decode().strip().splitlines():
# Checkout driver version
- subprocess.check_call(
- ("git", "checkout", "-f", driver),
- cwd=Dirs.opengpu,
- )
+ if driver != os.environ["OLDEST_DRIVER_VERSION"]:
+ subprocess.check_call(
+ ("git", "apply", f"./PATCHES/{driver}.patch"),
+ cwd=Dirs.opengpu,
+ )
# Compile an executable
- subprocess.check_call((
- sys.executable, "-m", "ninja",
- "-C", Dirs.build,
- ))
+ subprocess.check_call(
+ ("ninja", "-C", Dirs.build)
+ )
# Find and vendor the binary for this version
binary = Dirs.build.joinpath("nvibrant")
@@ -109,12 +95,6 @@ class BuildHook(BuildHookInterface):
build_data["force_include"][str(target)] = f"nvibrant/resources/{target.name}"
hashes.setdefault(hashlib.md5(target.read_bytes()).hexdigest(), driver)
- # Revert back main branch
- subprocess.check_call(
- ("git", "checkout", "-f", "main"),
- cwd=Dirs.opengpu
- )
-
print("\nBreaking changes across driver versions:")
for hashsum, driver in hashes.items():