[Backport release-26.05] gopher64: 1.0.17 -> 1.1.20 (#533949)

This commit is contained in:
Toma 2026-06-21 16:00:50 +00:00 committed by GitHub
commit d767a5ce1c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 271 additions and 145 deletions

View file

@ -1,12 +0,0 @@
diff --git a/src/device/cart.rs b/src/device/cart.rs
index 97bf09f..4406fec 100644
--- a/src/device/cart.rs
+++ b/src/device/cart.rs
@@ -21,6 +21,7 @@ const JDT_EEPROM_16K: u16 = 0xc000; /* 16k EEPROM */
const EEPROM_BLOCK_SIZE: usize = 8;
pub const EEPROM_MAX_SIZE: usize = 0x800;
+#[allow(warnings)]
#[derive(serde::Serialize, serde::Deserialize)]
pub enum CicType {
CicNus6101,

View file

@ -0,0 +1,29 @@
--- a/build.rs
+++ b/build.rs
@@ -278,26 +278,6 @@
.compile("simd");
}
- let mut git_output = std::process::Command::new("git");
- git_output.args(["describe", "--dirty"]);
-
- let git_describe = if let Ok(git_output) = git_output.output()
- && git_output.status.success()
- {
- String::from_utf8(git_output.stdout).unwrap()
- } else if let Ok(git_output) = git_output.args(["--always"]).output()
- && git_output.status.success()
- {
- format!(
- "v{}-{}",
- env!("CARGO_PKG_VERSION"),
- String::from_utf8(git_output.stdout).unwrap()
- )
- } else {
- panic!("Failed to get git describe");
- };
- println!("cargo:rustc-env=GIT_DESCRIBE={git_describe}");
-
println!("cargo:rerun-if-env-changed=NETPLAY_ID");
let netplay_id = std::env::var("NETPLAY_ID").unwrap_or("gopher64".to_string());
println!("cargo:rustc-env=NETPLAY_ID={netplay_id}");

View file

@ -0,0 +1,8 @@
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -59,5 +59,4 @@
identifier = "io.github.gopher64.gopher64"
category = "public.app-category.games"
icon = ["data/icon/gopher64_128x128.png","data/icon/gopher64_256x256.png","data/icon/gopher64_512x512.png"]
-osx_frameworks = ["/opt/homebrew/opt/molten-vk/lib/libMoltenVK.dylib","/opt/homebrew/opt/freetype/lib/libfreetype.6.dylib","/opt/homebrew/opt/libpng/lib/libpng16.16.dylib"]
osx_minimum_system_version = "15.0"

View file

@ -0,0 +1,14 @@
--- a/build.rs
+++ b/build.rs
@@ -150,11 +143,6 @@
println!("cargo:rustc-link-lib=dylib=freetype");
}
- volk_build.flag("-flto=thin");
- rdp_build.flag("-flto=thin");
- simd_build.flag("-flto=thin");
- retroachievements_build.flag("-flto=thin");
-
volk_build.compile("volk");
rdp_build.compile("parallel-rdp");
retroachievements_build.compile("retroachievements");

View file

@ -1,38 +1,46 @@
{
lib,
stdenv,
rustPlatform,
clangStdenv,
linkFarm,
llvmPackages,
fetchFromGitHub,
pkg-config,
fetchgit,
runCommand,
rustPlatform,
bzip2,
libGL,
libx11,
libxcursor,
libxkbcommon,
libxi,
# nativeBuildInputs
cargo-bundle,
cctools,
gn,
ninja,
pkg-config,
python3,
# buildInputs
fontconfig,
moltenvk,
sdl3,
wayland,
sdl3-ttf,
zstd,
}:
rustPlatform.buildRustPackage (finalAttrs: {
# nativeInstallCheckInputs
versionCheckHook,
}:
let
stdenv = clangStdenv;
in
rustPlatform.buildRustPackage.override { inherit stdenv; } (finalAttrs: {
pname = "gopher64";
version = "1.0.17";
version = "1.1.20";
__structuredAttrs = true;
src = fetchFromGitHub {
owner = "gopher64";
repo = "gopher64";
tag = "v${finalAttrs.version}";
hash = "sha256-DDFtPISV17jQMECBIqYbbGhZpjYXuNnOq7EiEVtSzgc=";
fetchSubmodules = true;
leaveDotGit = true;
postFetch = ''
cd "$out"
git rev-parse HEAD > $out/GIT_REV
find "$out" -name .git -print0 | xargs -0 rm -rf
'';
hash = "sha256-gss0ZGTptk5O67SS+r3i3Caf9I7GQxP0RlHx7GfBihw=";
};
cargoPatches = [
@ -40,61 +48,104 @@ rustPlatform.buildRustPackage (finalAttrs: {
# this patch makes it use the SDL3 library provided by nixpkgs
./use-sdl3-via-pkg-config.patch
# make the build script use the @GIT_REV@ string that will be substituted in the logic below
./set-git-rev.patch
# enum CicType is not used, but dead code is treated as an error
./allow-unused-type.patch
./no-lto.patch
./no-git-describe.patch
./volk-linking-order.patch
./no-homebrew.patch
];
postPatch = ''
# use the file generated in the fetcher to supply the git revision
substituteInPlace build.rs \
--replace-fail "@GIT_REV@" $(cat GIT_REV)
'';
cargoHash = "sha256-rmt2b8lk/9ts8v33yguuSFcbFvUX00icg1onmhCbDTQ=";
cargoHash = "sha256-31kEYwlDA6iYcwPZyQU4gM/VLfPNeYcDKhhBqzNp/QE=";
env = {
# See pkgs/by-name/ne/neovide/package.nix
SKIA_SOURCE_DIR =
let
repo = fetchFromGitHub {
owner = "rust-skia";
repo = "skia";
# see rust-skia:skia-bindings/Cargo.toml#package.metadata skia
tag = "m142-0.89.1";
hash = "sha256-J7mBQ124/dODxX6MsuMW1NHizCMATAqdSzwxpP2afgk=";
};
# The externals for skia are taken from skia/DEPS
externals = linkFarm "skia-externals" (
lib.mapAttrsToList (name: value: {
inherit name;
path = fetchgit value;
}) (lib.importJSON ./skia-externals.json)
);
in
runCommand "source" { } ''
cp -R ${repo} $out
chmod -R +w $out
ln -s ${externals} $out/third_party/externals
'';
env.ZSTD_SYS_USE_PKG_CONFIG = true;
SKIA_GN_COMMAND = lib.getExe gn;
SKIA_NINJA_COMMAND = lib.getExe ninja;
ZSTD_SYS_USE_PKG_CONFIG = true;
LIBCLANG_PATH = "${lib.getLib llvmPackages.libclang}/lib";
GIT_DESCRIBE = finalAttrs.version;
};
nativeBuildInputs = [
pkg-config
rustPlatform.bindgenHook
python3
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
cargo-bundle
cctools.libtool
];
buildInputs = [
bzip2
fontconfig
sdl3
sdl3-ttf
zstd
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
moltenvk
];
# these are dlopen-ed during runtime
runtimeDependencies = lib.optionalString stdenv.hostPlatform.isLinux [
libGL
libxkbcommon
# no checks
doCheck = false;
# for X11
libx11
libxcursor
libxi
installPhase = lib.optionalString stdenv.hostPlatform.isDarwin ''
runHook preInstall
# for wayland
wayland
];
# cargo-bundle expects the binary in target/release
release_target="target/${stdenv.hostPlatform.rust.cargoShortTarget}/release"
mv $release_target/gopher64 target/release/gopher64
postFixup = lib.optionalString stdenv.hostPlatform.isLinux ''
patchelf $out/bin/gopher64 --add-rpath ${lib.makeLibraryPath finalAttrs.runtimeDependencies}
export CARGO_BUNDLE_SKIP_BUILD=true
app_path=$(cargo bundle --release | xargs)
mkdir -p $out/Applications $out/bin
mv $app_path $out/Applications/
ln -s $out/Applications/Gopher64.app/Contents/MacOS/gopher64 $out/bin/gopher64
runHook postInstall
'';
postFixup = lib.optionalString stdenv.hostPlatform.isDarwin ''
install_name_tool $out/Applications/Gopher64.app/Contents/MacOS/gopher64 \
-add_rpath "${lib.makeLibraryPath [ moltenvk ]}"
'';
# Error: Os { code: 1, kind: PermissionDenied, message: "Operation not permitted" }
doInstallCheck = !stdenv.hostPlatform.isDarwin;
nativeInstallCheckInputs = [ versionCheckHook ];
meta = {
changelog = "https://github.com/gopher64/gopher64/releases/tag/${finalAttrs.src.tag}";
description = "N64 emulator written in Rust";
homepage = "https://github.com/gopher64/gopher64";
description = "N64 emulator";
homepage = "https://loganmc10.itch.io/gopher64";
downloadPage = "https://github.com/gopher64/gopher64/releases";
changelog = "https://github.com/gopher64/gopher64/releases/tag/v${finalAttrs.version}";
license = lib.licenses.gpl3Only;
maintainers = with lib.maintainers; [
prince213
tomasajt
];
mainProgram = "gopher64";
maintainers = with lib.maintainers; [ tomasajt ];
};
})

View file

@ -1,19 +0,0 @@
diff --git a/build.rs b/build.rs
index 0b20db2..d904e63 100644
--- a/build.rs
+++ b/build.rs
@@ -163,13 +163,7 @@ fn main() {
simd_build.compile("simd");
}
- let git_output = std::process::Command::new("git")
- .args(["rev-parse", "HEAD"])
- .output()
- .unwrap();
-
- let git_hash = String::from_utf8(git_output.stdout).unwrap();
- println!("cargo:rustc-env=GIT_HASH={}", git_hash);
+ println!("cargo:rustc-env=GIT_HASH={}", "@GIT_REV@");
println!("cargo:rustc-env=N64_STACK_SIZE={}", 8 * 1024 * 1024);
}

View file

@ -0,0 +1,42 @@
{
"expat": {
"url": "https://chromium.googlesource.com/external/github.com/libexpat/libexpat.git",
"rev": "8e49998f003d693213b538ef765814c7d21abada",
"hash": "sha256-zP2kiB4nyLi0/I8OsRhxKG0qRGPe2ALLQ+HHfqlBJ6Y="
},
"harfbuzz": {
"url": "https://chromium.googlesource.com/external/github.com/harfbuzz/harfbuzz.git",
"rev": "08b52ae2e44931eef163dbad71697f911fadc323",
"hash": "sha256-sP9FQLUEgTZFlvfYqSZnzZqBMxVotzD0FKKsu3/OdUw="
},
"icu": {
"url": "https://chromium.googlesource.com/chromium/deps/icu.git",
"rev": "364118a1d9da24bb5b770ac3d762ac144d6da5a4",
"hash": "sha256-frsmwYMiFixEULsE91x5+p98DvkyC0s0fNupqjoRnvg="
},
"libjpeg-turbo": {
"url": "https://chromium.googlesource.com/chromium/deps/libjpeg_turbo.git",
"rev": "e14cbfaa85529d47f9f55b0f104a579c1061f9ad",
"hash": "sha256-Ig+tmprZDvlf/M72/DTar2pbxat9ZElgSqdXdoM0lPs="
},
"libpng": {
"url": "https://skia.googlesource.com/third_party/libpng.git",
"rev": "ed217e3e601d8e462f7fd1e04bed43ac42212429",
"hash": "sha256-Mo1M8TuVaoSIb7Hy2u6zgjZ1DKgpmgNmGRP6dGg/aTs="
},
"vulkanmemoryallocator": {
"url": "https://chromium.googlesource.com/external/github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator",
"rev": "a6bfc237255a6bac1513f7c1ebde6d8aed6b5191",
"hash": "sha256-urUebQaPTgCECmm4Espri1HqYGy0ueAqTBu/VSiX/8I="
},
"wuffs": {
"url": "https://skia.googlesource.com/external/github.com/google/wuffs-mirror-release-c.git",
"rev": "e3f919ccfe3ef542cfc983a82146070258fb57f8",
"hash": "sha256-373d2F/STcgCHEq+PO+SCHrKVOo6uO1rqqwRN5eeBCw="
},
"zlib": {
"url": "https://chromium.googlesource.com/chromium/src/third_party/zlib",
"rev": "646b7f569718921d7d4b5b8e22572ff6c76f2596",
"hash": "sha256-jNj6SuTZ5/a7crtYhxW3Q/TlfRMNMfYIVxDlr7bYdzQ="
}
}

View file

@ -1,85 +1,86 @@
diff --git a/Cargo.lock b/Cargo.lock
index 81c7e20..6ae0a17 100644
--- a/build.rs
+++ b/build.rs
@@ -63,14 +63,7 @@
.include("parallel-rdp/parallel-rdp-standalone/volk")
.include("parallel-rdp/parallel-rdp-standalone/vulkan")
.include("parallel-rdp/parallel-rdp-standalone/vulkan-headers/include")
- .include("parallel-rdp/parallel-rdp-standalone/util")
- .include(
- std::path::PathBuf::from(std::env::var("DEP_SDL3_OUT_DIR").unwrap()).join("include"),
- )
- .include(
- std::path::PathBuf::from(std::env::var("DEP_SDL3_TTF_OUT_DIR").unwrap())
- .join("include"),
- );
+ .include("parallel-rdp/parallel-rdp-standalone/util");
let mut retroachievements_build = cc::Build::new();
retroachievements_build
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -611,15 +611,6 @@ dependencies = [
"error-code",
@@ -4782,12 +4782,6 @@
]
-[[package]]
-name = "cmake"
-version = "0.1.54"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e7caa3f9de89ddbe2c607f4101924c5abec803763ae9534e4f4d7d8f84aa81f0"
-dependencies = [
- "cc",
-]
-
[[package]]
name = "cobs"
version = "0.2.3"
@@ -3243,12 +3234,6 @@ dependencies = [
"windows-sys 0.52.0",
]
-[[package]]
-name = "rpkg-config"
-version = "0.1.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5a2d2f3481209a6b42eec2fbb49063fb4e8d35b57023401495d4fe0f85c817f0"
-
[[package]]
name = "rustc-demangle"
version = "0.1.24"
@@ -3370,21 +3355,13 @@ version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
-[[package]]
-name = "sdl3-src"
-version = "3.2.16"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c5b5d192485408fa251477ea1dfb4778d864efaec72f730ce3a753deaffb27bb"
-
[[package]]
name = "sdl3-sys"
version = "0.5.2+SDL3-3.2.16"
name = "rspolib"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f0a31799d7cbd36f2b187c32a56975fbdd371c200a91b01d4ed0faf0012bcf9c"
@@ -5002,28 +4996,10 @@
]
[[package]]
-name = "sdl3-src"
-version = "3.4.8"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "997bff4c8d3d9d1e846d7ad8caa33e6fe18a07ec9dc474e1efbbb20923d87bd9"
-
-[[package]]
name = "sdl3-sys"
version = "0.6.5+SDL-3.4.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "51ca7a36c908d1d2b6c259d426a5000fbb70e764dcc430f6a373cc151f614f68"
-dependencies = [
- "cc",
- "cmake",
- "rpkg-config",
- "sdl3-src",
-]
-
-[[package]]
-name = "sdl3-ttf-src"
-version = "3.2.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f28923d2ce72ff317d8eb7cec97ddfb8f351c330d7bcbf8c76e91332122c93b3"
[[package]]
name = "sdl3-ttf-sys"
@@ -5031,10 +5007,7 @@
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c30da3dcd7e062f19350b47a532f7629c42801b801687535fd31e8ba2adfd71d"
dependencies = [
- "cmake",
- "rpkg-config",
- "sdl3-src",
+ "pkg-config",
"sdl3-sys",
- "sdl3-ttf-src",
]
[[package]]
diff --git a/Cargo.toml b/Cargo.toml
index 82d8e99..8b15aad 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -18,7 +18,7 @@ serde-big-array = "0.5"
eframe = { version = "0.31", default-features = false, features = ["wayland", "x11", "glow"] }
sha2 = "0.10"
ab_glyph = "0.2"
-sdl3-sys = { version = "0.5", features = ["build-from-source-static"] }
+sdl3-sys = { version = "0.5", features = ["use-pkg-config"] }
rfd = { version = "0.15", default-features = false, features = ["xdg-portal", "tokio"] }
tokio = {version = "1.45", features = ["rt-multi-thread", "macros"] }
@@ -19,8 +19,8 @@
slint = { version = "1.16", default-features = false, features = ["compat-1-2", "std", "unstable-winit-030", "backend-winit", "renderer-skia", "accessibility"], optional = true }
open = "5.3"
sha2 = "0.11"
-sdl3-sys = { version = "0.6", features = ["build-from-source-static"] }
-sdl3-ttf-sys = { version = "0.6", features = ["build-from-source-static", "no-sdlttf-harfbuzz", "no-sdlttf-plutosvg"] }
+sdl3-sys = { version = "0.6" }
+sdl3-ttf-sys = { version = "0.6" }
rfd = {version = "0.17", optional = true }
tokio = {version = "1.46", features = ["rt-multi-thread", "macros", "fs", "process"] }
spin_sleep = "1.3"
diff --git a/build.rs b/build.rs
index f0c6d21..fa28e25 100644
--- a/build.rs
+++ b/build.rs
@@ -52,10 +52,7 @@ fn main() {
.include("parallel-rdp/parallel-rdp-standalone/vulkan")
.include("parallel-rdp/parallel-rdp-standalone/vulkan-headers/include")
.include("parallel-rdp/parallel-rdp-standalone/util")
- .include(
- std::path::PathBuf::from(std::env::var("DEP_SDL3_OUT_DIR").to_owned().unwrap())
- .join("include"),
- );
+ ;
let os = std::env::var("CARGO_CFG_TARGET_OS").unwrap();
let arch = std::env::var("CARGO_CFG_TARGET_ARCH").unwrap();

View file

@ -0,0 +1,12 @@
--- a/build.rs
+++ b/build.rs
@@ -155,8 +155,8 @@
simd_build.flag("-flto=thin");
retroachievements_build.flag("-flto=thin");
- volk_build.compile("volk");
rdp_build.compile("parallel-rdp");
+ volk_build.compile("volk");
retroachievements_build.compile("retroachievements");
let out_path = std::path::PathBuf::from(std::env::var("OUT_DIR").unwrap());