ares: 141 -> 143, switch to CMake build system (#379702)

This commit is contained in:
Sandro 2025-02-17 23:18:36 +01:00 committed by GitHub
commit 6a63e52b84
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 114 additions and 61 deletions

View File

@ -0,0 +1,25 @@
diff --git a/cmake/macos/compilerconfig.cmake b/cmake/macos/compilerconfig.cmake
index 99272c662..50f94db37 100644
--- a/cmake/macos/compilerconfig.cmake
+++ b/cmake/macos/compilerconfig.cmake
@@ -27,7 +27,7 @@ message(DEBUG "macOS SDK Path: ${CMAKE_OSX_SYSROOT}")
string(REGEX MATCH ".+/SDKs/MacOSX([0-9]+\\.[0-9])+\\.sdk$" _ ${CMAKE_OSX_SYSROOT})
set(_ares_macos_current_sdk ${CMAKE_MATCH_1})
message(DEBUG "macOS SDK version: ${_ares_macos_current_sdk}")
-if(_ares_macos_current_sdk VERSION_LESS _ares_macos_minimum_sdk)
+if(FALSE)
message(
FATAL_ERROR
"Your macOS SDK version (${_ares_macos_current_sdk}) is too low. "
diff --git a/cmake/macos/helpers.cmake b/cmake/macos/helpers.cmake
index 864a629f0..f455345bf 100644
--- a/cmake/macos/helpers.cmake
+++ b/cmake/macos/helpers.cmake
@@ -35,7 +35,6 @@ function(ares_configure_executable target)
endif()
endif()
- _bundle_dependencies(${target})
install(TARGETS ${target} BUNDLE DESTINATION "." COMPONENT Application)
endif()

View File

@ -2,7 +2,8 @@
lib,
SDL2,
alsa-lib,
autoPatchelfHook,
apple-sdk_14,
cmake,
fetchFromGitHub,
gtk3,
gtksourceview3,
@ -11,42 +12,39 @@
libX11,
libXv,
libao,
libicns,
libpulseaudio,
libretro-shaders-slang,
librashader,
ninja,
moltenvk,
openal,
pkg-config,
stdenv,
udev,
vulkan-loader,
which,
wrapGAppsHook3,
zlib,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "ares";
version = "141";
version = "143";
src = fetchFromGitHub {
owner = "ares-emulator";
repo = "ares";
rev = "v${finalAttrs.version}";
hash = "sha256-iNcoNdGw/DfYc9tsOGsPYoZLhVwNzJe8bVotx6Rl0j4=";
tag = "v${finalAttrs.version}";
hash = "sha256-uuFKbS7WvxkTyyQfuQ6iKPvRt+54zUPdjUlQ/ohBAr8=";
};
patches = [
./patches/001-dont-rebuild-on-install.patch
];
nativeBuildInputs =
[
autoPatchelfHook
cmake
ninja
pkg-config
which
wrapGAppsHook3
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
libicns
++ lib.optionals stdenv.hostPlatform.isLinux [
wrapGAppsHook3
];
buildInputs =
@ -54,6 +52,12 @@ stdenv.mkDerivation (finalAttrs: {
SDL2
libao
librashader
vulkan-loader
zlib
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
apple-sdk_14
moltenvk
]
++ lib.optionals stdenv.hostPlatform.isLinux [
alsa-lib
@ -68,31 +72,48 @@ stdenv.mkDerivation (finalAttrs: {
udev
];
appendRunpaths = [
(lib.makeLibraryPath [
librashader
vulkan-loader
])
patches = [
./darwin-build-fixes.patch
];
makeFlags =
lib.optionals stdenv.hostPlatform.isLinux [
"hiro=gtk3"
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
"hiro=cocoa"
"lto=false"
"vulkan=false"
]
++ [
"local=false"
"openmp=true"
"prefix=$(out)"
];
cmakeFlags = [
(lib.cmakeBool "ARES_BUILD_LOCAL" false)
(lib.cmakeBool "ARES_SKIP_DEPS" true)
];
enableParallelBuilding = true;
postInstall =
if stdenv.hostPlatform.isDarwin then
''
mkdir $out/Applications
cp -a desktop-ui/ares.app $out/Applications/ares.app
# Shaders directory is already populated with Metal shaders, so can't simply symlink the slang shaders directory itself
for f in ${libretro-shaders-slang}/share/libretro/shaders/shaders_slang/*; do
ln -s "$f" $out/Applications/ares.app/Contents/Resources/Shaders/
done
''
else
''
ln -s ${libretro-shaders-slang}/share/libretro $out/share/libretro
'';
env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.hostPlatform.isDarwin "-mmacosx-version-min=10.14";
postFixup =
if stdenv.hostPlatform.isDarwin then
''
install_name_tool \
-add_rpath ${librashader}/lib \
-add_rpath ${moltenvk}/lib \
$out/Applications/ares.app/Contents/MacOS/ares
''
else
''
patchelf $out/bin/.ares-wrapped \
--add-rpath ${
lib.makeLibraryPath [
librashader
vulkan-loader
]
}
'';
meta = {
homepage = "https://ares-emu.net";
@ -103,8 +124,5 @@ stdenv.mkDerivation (finalAttrs: {
Madouura
];
platforms = lib.platforms.unix;
broken = stdenv.hostPlatform.isDarwin;
};
})
# TODO: select between Qt and GTK3
# TODO: call Darwin hackers to deal with specific errors

View File

@ -1,22 +0,0 @@
From 65cc7647110edd768e7baa7991143014316e655a Mon Sep 17 00:00:00 2001
From: Madoura <93990818+Madouura@users.noreply.github.com>
Date: Mon, 9 May 2022 10:17:06 -0500
Subject: [PATCH] Update GNUmakefile
---
desktop-ui/GNUmakefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/desktop-ui/GNUmakefile b/desktop-ui/GNUmakefile
index 8e27b11d3..0bee561fb 100644
--- a/desktop-ui/GNUmakefile
+++ b/desktop-ui/GNUmakefile
@@ -106,7 +106,7 @@ endif
$(call rdelete,$(object.path))
$(call rdelete,$(output.path))
-install: all
+install:
ifeq ($(platform),windows)
$(call mkdir,$(prefix)/$(name)/)
else ifeq ($(shell id -un),root)

View File

@ -0,0 +1,32 @@
{
lib,
fetchFromGitHub,
stdenvNoCC,
unstableGitUpdater,
}:
stdenvNoCC.mkDerivation {
pname = "libretro-shaders-slang";
version = "0-unstable-2025-02-14";
src = fetchFromGitHub {
owner = "libretro";
repo = "slang-shaders";
rev = "130f589cd5a2f3e5df1d6607b82b6771bc8b8446";
hash = "sha256-ig+cE6MZNeY1Rx6ciSvLuxU0UyLPQLP5c5+lKpq4skA=";
};
dontConfigure = true;
dontBuild = true;
installFlags = "PREFIX=${placeholder "out"}";
passthru.updateScript = unstableGitUpdater { };
meta = {
description = "Slang shaders for use with RetroArch's shader system";
homepage = "https://github.com/libretro/slang-shaders";
license = lib.licenses.gpl3Only;
maintainers = [ lib.maintainers.nadiaholmquist ];
platforms = lib.platforms.all;
};
}