azahar: fix build on darwin

Signed-off-by: Marcin Serwin <marcin@serwin.dev>
This commit is contained in:
Marcin Serwin
2025-07-23 12:24:43 +02:00
parent 25ce4c87c9
commit dbb72a5384
2 changed files with 71 additions and 22 deletions
+28 -22
View File
@@ -1,5 +1,4 @@
{
alsa-lib,
boost,
catch2_3,
cmake,
@@ -12,16 +11,14 @@
fetchzip,
fmt,
ffmpeg_6-headless,
gamemode,
glslang,
httplib,
inih,
lib,
libGL,
libjack2,
libpulseaudio,
libunwind,
libusb1,
moltenvk,
nlohmann_json,
openal,
openssl,
@@ -30,7 +27,6 @@
portaudio,
robin-map,
SDL2,
sndio,
spirv-tools,
soundtouch,
stdenv,
@@ -45,10 +41,13 @@
useDiscordRichPresence ? true,
rapidjson,
enableSSE42 ? true, # Disable if your hardware doesn't support SSE 4.2 (mainly CPUs before 2011)
gamemode,
enableGamemode ? lib.meta.availableOn stdenv.hostPlatform gamemode,
}:
let
inherit (lib)
optionals
optionalString
cmakeBool
getLib
;
@@ -71,7 +70,6 @@ stdenv.mkDerivation (finalAttrs: {
buildInputs =
[
alsa-lib
boost
catch2_3
cryptopp
@@ -84,33 +82,35 @@ stdenv.mkDerivation (finalAttrs: {
httplib
inih
libGL
libjack2
libpulseaudio
libunwind
libusb1
nlohmann_json
openal
openssl
pipewire
portaudio
robin-map
qt6.qtbase
qt6.qtmultimedia
qt6.qttools
qt6.qtwayland
soundtouch
SDL2
sndio
spirv-tools
vulkan-headers
xbyak
xorg.libX11
xorg.libXext
zstd
]
++ optionals enableQtTranslations [ qt6.qttools ]
++ optionals enableCubeb [ cubeb ]
++ optionals useDiscordRichPresence [ rapidjson ];
++ optionals useDiscordRichPresence [ rapidjson ]
++ optionals stdenv.hostPlatform.isLinux [
pipewire
qt6.qtwayland
xorg.libX11
xorg.libXext
]
++ optionals stdenv.hostPlatform.isDarwin [
moltenvk
];
patches = [
# Fix boost errors
@@ -124,17 +124,22 @@ stdenv.mkDerivation (finalAttrs: {
url = "https://raw.githubusercontent.com/Tatsh/tatsh-overlay/5c4497d9b67fa6f2fa327b2f2ce4cb5be8c9f2f7/games-emulation/lime3ds/files/lime3ds-0003-boost-1.87-fixes.patch";
hash = "sha256-mwfI7fTx9aWF/EjMW3bxoz++A+6ONbNA70tT5nkhDUU=";
})
# https://github.com/azahar-emu/azahar/pull/1165
./update-cmake-lists.patch
];
postPatch = ''
# We already know the submodules are present
substituteInPlace CMakeLists.txt \
--replace-fail "check_submodules_present()" ""
postPatch =
''
# We already know the submodules are present
substituteInPlace CMakeLists.txt \
--replace-fail "check_submodules_present()" ""
''
# Add gamemode
substituteInPlace externals/gamemode/include/gamemode_client.h \
--replace-fail "libgamemode.so.0" "${getLib gamemode}/lib/libgamemode.so.0"
'';
+ optionalString enableGamemode ''
substituteInPlace externals/gamemode/include/gamemode_client.h \
--replace-fail "libgamemode.so.0" "${getLib gamemode}/lib/libgamemode.so.0"
'';
cmakeFlags = [
(cmakeBool "USE_SYSTEM_LIBS" true)
@@ -155,5 +160,6 @@ stdenv.mkDerivation (finalAttrs: {
marcin-serwin
];
mainProgram = "azahar";
platforms = with lib.platforms; linux ++ darwin;
};
})
@@ -0,0 +1,43 @@
From d9e7361a174f0f491c49fe78cd96a823c65e97dd Mon Sep 17 00:00:00 2001
From: qr243vbi <uiguruigurovich@gmail.com>
Date: Sat, 7 Jun 2025 01:18:03 +0300
Subject: [PATCH 1/2] Update CMakeLists.txt
---
CMakeLists.txt | 1 +
1 file changed, 1 insertion(+)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 54051a4ef2..531c46abbe 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -16,6 +16,7 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules")
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/externals/cmake-modules")
include(DownloadExternals)
include(CMakeDependentOption)
+include(FindPkgConfig)
project(citra LANGUAGES C CXX ASM)
From 679a4036e2fbb96d1d6a803f3f59ae8f01f9e691 Mon Sep 17 00:00:00 2001
From: qr243vbi <uiguruigurovich@gmail.com>
Date: Sat, 7 Jun 2025 12:49:07 +0300
Subject: [PATCH 2/2] Add missing find_package directive
---
src/citra_qt/CMakeLists.txt | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/citra_qt/CMakeLists.txt b/src/citra_qt/CMakeLists.txt
index 1b78605a0a..de00dc4609 100644
--- a/src/citra_qt/CMakeLists.txt
+++ b/src/citra_qt/CMakeLists.txt
@@ -273,6 +273,7 @@ if (ENABLE_VULKAN)
endif()
if (NOT WIN32)
+ find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
target_include_directories(citra_qt PRIVATE ${Qt6Gui_PRIVATE_INCLUDE_DIRS})
endif()