gopher64: init at 1.0.16

TomaSajt 9b02a9d6 e175357f

+203
+99
pkgs/by-name/go/gopher64/package.nix
···
··· 1 + { 2 + lib, 3 + stdenv, 4 + rustPlatform, 5 + fetchFromGitHub, 6 + pkg-config, 7 + 8 + bzip2, 9 + libGL, 10 + libX11, 11 + libXcursor, 12 + libxkbcommon, 13 + libXi, 14 + moltenvk, 15 + sdl3, 16 + wayland, 17 + zstd, 18 + }: 19 + 20 + rustPlatform.buildRustPackage (finalAttrs: { 21 + pname = "gopher64"; 22 + version = "1.0.16"; 23 + 24 + src = fetchFromGitHub { 25 + owner = "gopher64"; 26 + repo = "gopher64"; 27 + tag = "v${finalAttrs.version}"; 28 + hash = "sha256-TduOmKK4OAmhP2VUT0eeoKHQHmsM8kptrxfgCdDFTRU="; 29 + fetchSubmodules = true; 30 + leaveDotGit = true; 31 + postFetch = '' 32 + cd "$out" 33 + git rev-parse HEAD > $out/GIT_REV 34 + find "$out" -name .git -print0 | xargs -0 rm -rf 35 + ''; 36 + }; 37 + 38 + cargoPatches = [ 39 + # upstream rebuilds SDL3 from source 40 + # this patch makes it use the SDL3 library provided by nixpkgs 41 + ./use-sdl3-via-pkg-config.patch 42 + 43 + # make the build script use the @GIT_REV@ string that will be substituted in the logic below 44 + ./set-git-rev.patch 45 + ]; 46 + 47 + postPatch = '' 48 + # use the file generated in the fetcher to supply the git revision 49 + substituteInPlace build.rs \ 50 + --replace-fail "@GIT_REV@" $(cat GIT_REV) 51 + ''; 52 + 53 + useFetchCargoVendor = true; 54 + cargoHash = "sha256-9fZ7zFTqt1VNnmCqFzWrZFD1PQZ7paz7r2Mb+9+C9Rs="; 55 + 56 + env.ZSTD_SYS_USE_PKG_CONFIG = true; 57 + 58 + nativeBuildInputs = [ 59 + pkg-config 60 + rustPlatform.bindgenHook 61 + ]; 62 + 63 + buildInputs = 64 + [ 65 + bzip2 66 + sdl3 67 + zstd 68 + ] 69 + ++ lib.optionals stdenv.hostPlatform.isDarwin [ 70 + moltenvk 71 + ]; 72 + 73 + # these are dlopen-ed during runtime 74 + runtimeDependencies = lib.optionalString stdenv.hostPlatform.isLinux [ 75 + libGL 76 + libxkbcommon 77 + 78 + # for X11 79 + libX11 80 + libXcursor 81 + libXi 82 + 83 + # for wayland 84 + wayland 85 + ]; 86 + 87 + postFixup = lib.optionalString stdenv.hostPlatform.isLinux '' 88 + patchelf $out/bin/gopher64 --add-rpath ${lib.makeLibraryPath finalAttrs.runtimeDependencies} 89 + ''; 90 + 91 + meta = { 92 + changelog = "https://github.com/gopher64/gopher64/releases/tag/${finalAttrs.src.tag}"; 93 + description = "N64 emulator written in Rust"; 94 + homepage = "https://github.com/gopher64/gopher64"; 95 + license = lib.licenses.gpl3Only; 96 + mainProgram = "gopher64"; 97 + maintainers = with lib.maintainers; [ tomasajt ]; 98 + }; 99 + })
+19
pkgs/by-name/go/gopher64/set-git-rev.patch
···
··· 1 + diff --git a/build.rs b/build.rs 2 + index 0b20db2..d904e63 100644 3 + --- a/build.rs 4 + +++ b/build.rs 5 + @@ -163,13 +163,7 @@ fn main() { 6 + simd_build.compile("simd"); 7 + } 8 + 9 + - let git_output = std::process::Command::new("git") 10 + - .args(["rev-parse", "HEAD"]) 11 + - .output() 12 + - .unwrap(); 13 + - 14 + - let git_hash = String::from_utf8(git_output.stdout).unwrap(); 15 + - println!("cargo:rustc-env=GIT_HASH={}", git_hash); 16 + + println!("cargo:rustc-env=GIT_HASH={}", "@GIT_REV@"); 17 + 18 + println!("cargo:rustc-env=N64_STACK_SIZE={}", 8 * 1024 * 1024); 19 + }
+85
pkgs/by-name/go/gopher64/use-sdl3-via-pkg-config.patch
···
··· 1 + diff --git a/Cargo.lock b/Cargo.lock 2 + index 89bc1d0..72b65cd 100644 3 + --- a/Cargo.lock 4 + +++ b/Cargo.lock 5 + @@ -626,15 +626,6 @@ dependencies = [ 6 + "error-code", 7 + ] 8 + 9 + -[[package]] 10 + -name = "cmake" 11 + -version = "0.1.54" 12 + -source = "registry+https://github.com/rust-lang/crates.io-index" 13 + -checksum = "e7caa3f9de89ddbe2c607f4101924c5abec803763ae9534e4f4d7d8f84aa81f0" 14 + -dependencies = [ 15 + - "cc", 16 + -] 17 + - 18 + [[package]] 19 + name = "cobs" 20 + version = "0.2.3" 21 + @@ -3245,12 +3236,6 @@ dependencies = [ 22 + "windows-sys 0.52.0", 23 + ] 24 + 25 + -[[package]] 26 + -name = "rpkg-config" 27 + -version = "0.1.2" 28 + -source = "registry+https://github.com/rust-lang/crates.io-index" 29 + -checksum = "5a2d2f3481209a6b42eec2fbb49063fb4e8d35b57023401495d4fe0f85c817f0" 30 + - 31 + [[package]] 32 + name = "rustc-demangle" 33 + version = "0.1.24" 34 + @@ -3380,21 +3365,13 @@ version = "1.2.0" 35 + source = "registry+https://github.com/rust-lang/crates.io-index" 36 + checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" 37 + 38 + -[[package]] 39 + -name = "sdl3-src" 40 + -version = "3.2.10" 41 + -source = "registry+https://github.com/rust-lang/crates.io-index" 42 + -checksum = "e677fa126db179fb8f03c982163321496ddf57a6d8a1e41eeef4600f956038b1" 43 + - 44 + [[package]] 45 + name = "sdl3-sys" 46 + version = "0.4.7+SDL3-3.2.10" 47 + source = "registry+https://github.com/rust-lang/crates.io-index" 48 + checksum = "f0d16a8a3623a4cb39a3661c81d9d4c5fd77ada27fc056e320b3651bf7bde1b1" 49 + dependencies = [ 50 + - "cmake", 51 + - "rpkg-config", 52 + - "sdl3-src", 53 + + "pkg-config", 54 + ] 55 + 56 + [[package]] 57 + diff --git a/Cargo.toml b/Cargo.toml 58 + index 1f41e04..9d9ea33 100644 59 + --- a/Cargo.toml 60 + +++ b/Cargo.toml 61 + @@ -18,7 +18,7 @@ serde-big-array = "0.5" 62 + eframe = { version = "0.31", default-features = false, features = ["wayland", "x11", "glow"] } 63 + sha2 = "0.10" 64 + ab_glyph = "0.2" 65 + -sdl3-sys = { version = "0.4", features = ["build-from-source-static"] } 66 + +sdl3-sys = { version = "0.4", features = ["use-pkg-config"] } 67 + rfd = { version = "0.15", default-features = false, features = ["xdg-portal", "tokio"] } 68 + tokio = {version = "1.43", features = ["rt-multi-thread", "macros"] } 69 + spin_sleep = "1.3" 70 + diff --git a/build.rs b/build.rs 71 + index 67a6e8d..6c9f63b 100644 72 + --- a/build.rs 73 + +++ b/build.rs 74 + @@ -52,10 +52,7 @@ fn main() { 75 + .include("parallel-rdp/parallel-rdp-standalone/vulkan") 76 + .include("parallel-rdp/parallel-rdp-standalone/vulkan-headers/include") 77 + .include("parallel-rdp/parallel-rdp-standalone/util") 78 + - .include( 79 + - std::path::PathBuf::from(std::env::var("DEP_SDL3_OUT_DIR").to_owned().unwrap()) 80 + - .join("include"), 81 + - ); 82 + + ; 83 + 84 + let os = std::env::var("CARGO_CFG_TARGET_OS").unwrap(); 85 + let arch = std::env::var("CARGO_CFG_TARGET_ARCH").unwrap();