mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-17 07:13:23 +01:00
dolphin-emu-beta: fix darwin build
This commit is contained in:
parent
31946d7d94
commit
5c9d47e225
3 changed files with 163 additions and 29 deletions
|
@ -1,12 +1,60 @@
|
|||
{ lib, stdenv, fetchFromGitHub, pkg-config, cmake
|
||||
, wrapQtAppsHook, qtbase, bluez, ffmpeg, libao, libGLU, libGL, pcre, gettext
|
||||
, libXrandr, libusb1, libpthreadstubs, libXext, libXxf86vm, libXinerama
|
||||
, libSM, libXdmcp, readline, openal, udev, libevdev, portaudio, curl, alsa-lib
|
||||
, miniupnpc, enet, mbedtls, soundtouch, sfml, xz, writeScript
|
||||
, vulkan-loader ? null, libpulseaudio ? null
|
||||
{ lib
|
||||
, stdenv
|
||||
, fetchFromGitHub
|
||||
, pkg-config
|
||||
, cmake
|
||||
, wrapQtAppsHook
|
||||
, qtbase
|
||||
, bluez
|
||||
, ffmpeg
|
||||
, libao
|
||||
, libGLU
|
||||
, libGL
|
||||
, pcre
|
||||
, gettext
|
||||
, libXrandr
|
||||
, libusb1
|
||||
, libpthreadstubs
|
||||
, libXext
|
||||
, libXxf86vm
|
||||
, libXinerama
|
||||
, libSM
|
||||
, libXdmcp
|
||||
, readline
|
||||
, openal
|
||||
, udev
|
||||
, libevdev
|
||||
, portaudio
|
||||
, curl
|
||||
, alsa-lib
|
||||
, miniupnpc
|
||||
, enet
|
||||
, mbedtls
|
||||
, soundtouch
|
||||
, sfml
|
||||
, xz
|
||||
, hidapi
|
||||
, fmt_8
|
||||
, vulkan-loader
|
||||
, libpulseaudio
|
||||
, bzip2
|
||||
|
||||
# - Inputs used for Darwin
|
||||
, CoreBluetooth, ForceFeedback, IOKit, OpenGL, libpng, hidapi }:
|
||||
# Used in passthru
|
||||
, testers
|
||||
, dolphin-emu-beta
|
||||
, writeShellScript
|
||||
, common-updater-scripts
|
||||
, jq
|
||||
|
||||
# Darwin-only dependencies
|
||||
, CoreBluetooth
|
||||
, ForceFeedback
|
||||
, IOKit
|
||||
, VideoToolbox
|
||||
, OpenGL
|
||||
, libpng
|
||||
, moltenvk
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "dolphin-emu";
|
||||
|
@ -20,18 +68,62 @@ stdenv.mkDerivation rec {
|
|||
fetchSubmodules = true;
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ cmake pkg-config ]
|
||||
++ lib.optional stdenv.isLinux wrapQtAppsHook;
|
||||
patches = [
|
||||
# On x86_64-darwin CMake reportedly does not work without this in some cases.
|
||||
# See https://github.com/NixOS/nixpkgs/pull/190373#issuecomment-1241310765
|
||||
./minizip-external-missing-include.patch
|
||||
];
|
||||
|
||||
nativeBuildInputs = [
|
||||
cmake
|
||||
pkg-config
|
||||
wrapQtAppsHook
|
||||
];
|
||||
|
||||
buildInputs = [
|
||||
curl ffmpeg libao libGLU libGL pcre gettext libpthreadstubs libpulseaudio
|
||||
libXrandr libXext libXxf86vm libXinerama libSM readline openal libXdmcp
|
||||
portaudio libusb1 libpng hidapi miniupnpc enet mbedtls soundtouch sfml xz
|
||||
curl
|
||||
ffmpeg
|
||||
libao
|
||||
libGLU
|
||||
libGL
|
||||
pcre
|
||||
gettext
|
||||
libpthreadstubs
|
||||
libpulseaudio
|
||||
libSM
|
||||
readline
|
||||
openal
|
||||
portaudio
|
||||
libusb1
|
||||
libpng
|
||||
hidapi
|
||||
miniupnpc
|
||||
enet
|
||||
mbedtls
|
||||
soundtouch
|
||||
sfml
|
||||
xz
|
||||
qtbase
|
||||
fmt_8
|
||||
bzip2
|
||||
] ++ lib.optionals stdenv.isLinux [
|
||||
bluez udev libevdev alsa-lib vulkan-loader
|
||||
libXrandr
|
||||
libXext
|
||||
libXxf86vm
|
||||
libXinerama
|
||||
libXdmcp
|
||||
bluez
|
||||
udev
|
||||
libevdev
|
||||
alsa-lib
|
||||
vulkan-loader
|
||||
] ++ lib.optionals stdenv.isDarwin [
|
||||
CoreBluetooth OpenGL ForceFeedback IOKit
|
||||
CoreBluetooth
|
||||
OpenGL
|
||||
ForceFeedback
|
||||
IOKit
|
||||
VideoToolbox
|
||||
moltenvk
|
||||
];
|
||||
|
||||
cmakeFlags = [
|
||||
|
@ -42,6 +134,12 @@ stdenv.mkDerivation rec {
|
|||
"-DDOLPHIN_WC_BRANCH=master"
|
||||
] ++ lib.optionals stdenv.isDarwin [
|
||||
"-DOSX_USE_DEFAULT_SEARCH_PATH=True"
|
||||
"-DUSE_BUNDLED_MOLTENVK=OFF"
|
||||
# Bundles the application folder into a standalone executable, so we cannot devendor libraries
|
||||
"-DSKIP_POSTPROCESS_BUNDLE=ON"
|
||||
# Needs xcode so compilation fails with it enabled. We would want the version to be fixed anyways.
|
||||
# Note: The updater isn't available on linux, so we dont need to disable it there.
|
||||
"-DENABLE_AUTOUPDATE=OFF"
|
||||
];
|
||||
|
||||
qtWrapperArgs = lib.optionals stdenv.isLinux [
|
||||
|
@ -51,10 +149,10 @@ stdenv.mkDerivation rec {
|
|||
"--set QT_QPA_PLATFORM xcb"
|
||||
];
|
||||
|
||||
# - Allow Dolphin to use nix-provided libraries instead of building them
|
||||
postPatch = ''
|
||||
sed -i -e 's,DISTRIBUTOR "None",DISTRIBUTOR "NixOS",g' CMakeLists.txt
|
||||
'' + lib.optionalString stdenv.isDarwin ''
|
||||
# Allow Dolphin to use nix-provided libraries instead of submodules
|
||||
sed -i -e 's,if(NOT APPLE),if(true),g' CMakeLists.txt
|
||||
sed -i -e 's,if(LIBUSB_FOUND AND NOT APPLE),if(LIBUSB_FOUND),g' \
|
||||
CMakeLists.txt
|
||||
|
@ -62,26 +160,43 @@ stdenv.mkDerivation rec {
|
|||
|
||||
postInstall = lib.optionalString stdenv.hostPlatform.isLinux ''
|
||||
install -D $src/Data/51-usb-device.rules $out/etc/udev/rules.d/51-usb-device.rules
|
||||
'' + lib.optionalString stdenv.hostPlatform.isDarwin ''
|
||||
# Only gets installed automatically if the standalone executable is used
|
||||
mkdir -p $out/Applications
|
||||
cp -r ./Binaries/Dolphin.app $out/Applications
|
||||
ln -s $out/Applications/Dolphin.app/Contents/MacOS/Dolphin $out/bin
|
||||
'';
|
||||
|
||||
|
||||
passthru.updateScript = writeScript "dolphin-update-script" ''
|
||||
#!/usr/bin/env nix-shell
|
||||
#!nix-shell -i bash -p curl jq common-updater-scripts
|
||||
set -eou pipefail
|
||||
json="$(curl -s https://dolphin-emu.org/update/latest/beta)"
|
||||
version="$(jq -r '.shortrev' <<< "$json")"
|
||||
rev="$(jq -r '.hash' <<< "$json")"
|
||||
update-source-version dolphin-emu-beta "$version" --rev="$rev"
|
||||
'';
|
||||
passthru = {
|
||||
tests.version = testers.testVersion {
|
||||
package = dolphin-emu-beta;
|
||||
command = "dolphin-emu-nogui --version";
|
||||
};
|
||||
|
||||
updateScript = writeShellScript "dolphin-update-script" ''
|
||||
set -eou pipefail
|
||||
export PATH=${lib.makeBinPath [ curl jq common-updater-scripts ]}
|
||||
|
||||
json="$(curl -s https://dolphin-emu.org/update/latest/beta)"
|
||||
version="$(jq -r '.shortrev' <<< "$json")"
|
||||
rev="$(jq -r '.hash' <<< "$json")"
|
||||
update-source-version dolphin-emu-beta "$version" --rev="$rev"
|
||||
'';
|
||||
};
|
||||
|
||||
meta = with lib; {
|
||||
homepage = "https://dolphin-emu.org";
|
||||
description = "Gamecube/Wii/Triforce emulator for x86_64 and ARMv8";
|
||||
license = licenses.gpl2Plus;
|
||||
maintainers = with maintainers; [ MP2E ashkitten xfix ];
|
||||
branch = "master";
|
||||
broken = stdenv.isDarwin;
|
||||
mainProgram = "Dolphin";
|
||||
platforms = platforms.unix;
|
||||
license = licenses.gpl2Plus;
|
||||
maintainers = with maintainers; [
|
||||
MP2E
|
||||
ashkitten
|
||||
xfix
|
||||
ivar
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
commit 5e0cb8066fb1653399c54e93e42375295c2562bd
|
||||
Author: Ivar Scholten <ivar.scholten@protonmail.com>
|
||||
Date: Fri Sep 9 14:27:55 2022 +0200
|
||||
|
||||
Externals/minizip: add missing include to CheckFunctionExists
|
||||
|
||||
diff --git a/Externals/minizip/CMakeLists.txt b/Externals/minizip/CMakeLists.txt
|
||||
index c3d7c5512e..f59f8b295c 100644
|
||||
--- a/Externals/minizip/CMakeLists.txt
|
||||
+++ b/Externals/minizip/CMakeLists.txt
|
||||
@@ -60,6 +60,7 @@ if (HAVE_INTTYPES_H)
|
||||
target_compile_definitions(minizip PRIVATE HAVE_INTTYPES_H)
|
||||
endif()
|
||||
|
||||
+include(CheckFunctionExists)
|
||||
check_function_exists(fseeko HAVE_FSEEKO)
|
||||
if (NOT HAVE_FSEEKO)
|
||||
target_compile_definitions(minizip PRIVATE NO_FSEEKO)
|
|
@ -1657,7 +1657,8 @@ with pkgs;
|
|||
dolphin-emu = callPackage ../applications/emulators/dolphin-emu { };
|
||||
|
||||
dolphin-emu-beta = qt5.callPackage ../applications/emulators/dolphin-emu/master.nix {
|
||||
inherit (darwin.apple_sdk.frameworks) CoreBluetooth ForceFeedback IOKit OpenGL;
|
||||
inherit (darwin.apple_sdk.frameworks) CoreBluetooth ForceFeedback IOKit OpenGL VideoToolbox;
|
||||
inherit (darwin) moltenvk;
|
||||
};
|
||||
|
||||
dolphin-emu-primehack = qt5.callPackage ../applications/emulators/dolphin-emu/primehack.nix {
|
||||
|
|
Loading…
Reference in a new issue