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