libretro: fix build with GCC 14 (#368955)

This commit is contained in:
Thiago Kenji Okada
2024-12-29 13:14:45 +00:00
committed by GitHub
5 changed files with 53 additions and 10 deletions
@@ -2,8 +2,10 @@
lib,
fetchFromGitHub,
mkLibretroCore,
runCommand,
zlib,
}:
mkLibretroCore {
mkLibretroCore rec {
core = "fbalpha2012";
version = "0-unstable-2024-10-21";
@@ -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";
@@ -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 = {
@@ -4,6 +4,7 @@
fetchFromGitHub,
mkLibretroCore,
python3,
rapidjson,
}:
mkLibretroCore {
core = "mame2016";
@@ -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";
@@ -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 = {
@@ -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 =