Skip to content

Commit

Permalink
libretro: fix build with GCC 14 (#368955)
Browse files Browse the repository at this point in the history
  • Loading branch information
thiagokokada authored Dec 29, 2024
2 parents 43cb336 + f5d4784 commit 6d37130
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 10 deletions.
27 changes: 25 additions & 2 deletions pkgs/applications/emulators/libretro/cores/fbalpha2012.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
lib,
fetchFromGitHub,
mkLibretroCore,
runCommand,
zlib,
}:
mkLibretroCore {
mkLibretroCore rec {
core = "fbalpha2012";
version = "0-unstable-2024-10-21";

Expand All @@ -14,8 +16,29 @@ mkLibretroCore {
hash = "sha256-giEV09dT/e82bmDlRkxpkW04JcsEZc/enIPecqYtg3c=";
};

sourceRoot = "${src.name}/svn-current/trunk";

# unvendor zlib and broken minizip code
postPatch =
let
minizip-src = runCommand "minizip-src" { } ''
mkdir $out
unpackFile ${zlib.src}
cp */contrib/minizip/{unzip.*,ioapi.*,crypt.h} $out/
'';
in
''
substituteInPlace ${makefile} \
--replace-fail '-I$(FBA_LIB_DIR)/zlib' ""
cp ${minizip-src}/* src/burner
'';

buildInputs = [ zlib ];

makeFlags = [ "EXTERNAL_ZLIB=1" ];

makefile = "makefile.libretro";
preBuild = "cd svn-current/trunk";

meta = {
description = "Port of Final Burn Alpha ~2012 to libretro";
Expand Down
9 changes: 6 additions & 3 deletions pkgs/applications/emulators/libretro/cores/mame2003.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,18 @@
}:
mkLibretroCore {
core = "mame2003";
version = "0-unstable-2024-11-01";
version = "0-unstable-2024-12-10";

src = fetchFromGitHub {
owner = "libretro";
repo = "mame2003-libretro";
rev = "6d543115531fc96422b73c989a628600cacbea50";
hash = "sha256-jFzFQVB0uiSRa82sq1fiMEXyzzDJqRANNgq5hj/ZAl4=";
rev = "b6c6d52d8d630d1a172b6b771443dcbbdb45b76d";
hash = "sha256-E0kymRxy5aubvcwE5sHcS4T3OEY924TAOXtJN69wp+8=";
};

# Fix build with GCC 14
env.NIX_CFLAGS_COMPILE = "-Wno-error=incompatible-pointer-types";

makefile = "Makefile";

meta = {
Expand Down
17 changes: 13 additions & 4 deletions pkgs/applications/emulators/libretro/cores/mame2016.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
fetchFromGitHub,
mkLibretroCore,
python3,
rapidjson,
}:
mkLibretroCore {
core = "mame2016";
Expand All @@ -16,14 +17,22 @@ mkLibretroCore {
hash = "sha256-IsM7f/zlzvomVOYlinJVqZllUhDfy4NNTeTPtNmdVak=";
};

postPatch = ''
rm -r 3rdparty/rapidjson
ln -s ${lib.getInclude rapidjson} 3rdparty/rapidjson
'';

patches = [ ./patches/mame2016-python311.patch ];
extraNativeBuildInputs = [ python3 ];
extraBuildInputs = [ alsa-lib ];
makeFlags = [ "PYTHON_EXECUTABLE=python3" ];
# Build failures when this is set to a bigger number
NIX_BUILD_CORES = 8;
# Fix build errors in GCC13
NIX_CFLAGS_COMPILE = "-Wno-error -fpermissive";

env = {
# Build failures when this is set to a bigger number
NIX_BUILD_CORES = 8;
# Fix build errors in GCC 13
NIX_CFLAGS_COMPILE = "-Wno-error -fpermissive";
};

meta = {
description = "Port of MAME ~2016 to libretro, compatible with MAME 0.174 sets";
Expand Down
6 changes: 6 additions & 0 deletions pkgs/applications/emulators/libretro/cores/np2kai.nix
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ mkLibretroCore rec {
"NP2KAI_HASH=${builtins.substring 0 7 src.rev}"
];

# Fix build with GCC 14
env.NIX_CFLAGS_COMPILE = toString [
"-Wno-error=incompatible-pointer-types"
"-Wno-error=int-conversion"
];

preBuild = "cd sdl";

meta = {
Expand Down
4 changes: 3 additions & 1 deletion pkgs/applications/emulators/libretro/mkLibretroCore.nix
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@ stdenv.mkDerivation (

passthru = {
inherit core libretroCore;
updateScript = unstableGitUpdater { };
# libretro repos sometimes has a fake tag like "Current", ignore
# it by setting hardcodeZeroVersion
updateScript = unstableGitUpdater { hardcodeZeroVersion = true; };
} // (args.passthru or { });

meta =
Expand Down

0 comments on commit 6d37130

Please sign in to comment.