about summary refs log tree commit diff
path: root/pkgs/applications/emulators
diff options
context:
space:
mode:
authorZhaofeng Li <hello@zhaofeng.li>2022-10-31 14:01:48 -0600
committerZhaofeng Li <hello@zhaofeng.li>2022-10-31 14:03:26 -0600
commitced4404934f2e55e2cba5aae092f9de4ed5051df (patch)
treebd56bf0f9d100280efe3ca24cd9b845f2f211432 /pkgs/applications/emulators
parent9ae40c06b0ceded6d02eb4f92d0a86145e1eddcf (diff)
downloadnixlib-ced4404934f2e55e2cba5aae092f9de4ed5051df.tar
nixlib-ced4404934f2e55e2cba5aae092f9de4ed5051df.tar.gz
nixlib-ced4404934f2e55e2cba5aae092f9de4ed5051df.tar.bz2
nixlib-ced4404934f2e55e2cba5aae092f9de4ed5051df.tar.lz
nixlib-ced4404934f2e55e2cba5aae092f9de4ed5051df.tar.xz
nixlib-ced4404934f2e55e2cba5aae092f9de4ed5051df.tar.zst
nixlib-ced4404934f2e55e2cba5aae092f9de4ed5051df.zip
cemu: init at 2.0-10
Diffstat (limited to 'pkgs/applications/emulators')
-rw-r--r--pkgs/applications/emulators/cemu/cmakelists.patch12
-rw-r--r--pkgs/applications/emulators/cemu/default.nix119
2 files changed, 131 insertions, 0 deletions
diff --git a/pkgs/applications/emulators/cemu/cmakelists.patch b/pkgs/applications/emulators/cemu/cmakelists.patch
new file mode 100644
index 000000000000..a337484277ef
--- /dev/null
+++ b/pkgs/applications/emulators/cemu/cmakelists.patch
@@ -0,0 +1,12 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 4b2b789..48d9be0 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -92,6 +92,7 @@ find_package(pugixml REQUIRED)
+ find_package(RapidJSON REQUIRED)
+ find_package(Boost COMPONENTS program_options filesystem nowide REQUIRED)
+ find_package(libzip REQUIRED)
++find_package(SPIRV-Tools-opt REQUIRED)
+ find_package(glslang REQUIRED)
+ find_package(ZLIB REQUIRED)
+ find_package(zstd MODULE REQUIRED) # MODULE so that zstd::zstd is available
diff --git a/pkgs/applications/emulators/cemu/default.nix b/pkgs/applications/emulators/cemu/default.nix
new file mode 100644
index 000000000000..8ab669afee00
--- /dev/null
+++ b/pkgs/applications/emulators/cemu/default.nix
@@ -0,0 +1,119 @@
+{ lib, stdenv, fetchFromGitHub
+, addOpenGLRunpath
+, wrapGAppsHook
+, cmake
+, glslang
+, nasm
+, pkg-config
+
+, SDL2
+, boost
+, cubeb
+, curl
+, fmt_9
+, glm
+, gtk3
+, imgui
+, libpng
+, libzip
+, libXrender
+, pugixml
+, rapidjson
+, vulkan-headers
+, wxGTK32
+, zarchive
+
+, vulkan-loader
+}:
+
+stdenv.mkDerivation rec {
+  pname = "cemu";
+  version = "2.0-10";
+
+  src = fetchFromGitHub {
+    owner = "cemu-project";
+    repo = "Cemu";
+    rev = "v${version}";
+    hash = "sha256-GJA/lJJqShuHeYirBW1kyVsU44kMpmAn916PSGOnKkY=";
+  };
+
+  patches = [
+    # glslangTargets want SPIRV-Tools-opt to be defined:
+    # > The following imported targets are referenced, but are missing:
+    # > SPIRV-Tools-opt
+    ./cmakelists.patch
+  ];
+
+  nativeBuildInputs = [
+    addOpenGLRunpath
+    wrapGAppsHook
+    cmake
+    glslang
+    nasm
+    pkg-config
+  ];
+
+  buildInputs = [
+    SDL2
+    boost
+    cubeb
+    curl
+    fmt_9
+    glm
+    gtk3
+    imgui
+    libpng
+    libzip
+    libXrender
+    pugixml
+    rapidjson
+    vulkan-headers
+    wxGTK32
+    zarchive
+  ];
+
+  cmakeFlags = [
+    "-DCMAKE_C_FLAGS_RELEASE=-DNDEBUG"
+    "-DCMAKE_CXX_FLAGS_RELEASE=-DNDEBUG"
+    "-DENABLE_VCPKG=OFF"
+
+    # PORTABLE:
+    # "All data created and maintained by Cemu will be in the directory where the executable file is located"
+    "-DPORTABLE=OFF"
+  ];
+
+  preConfigure = ''
+    rm -rf dependencies/imgui
+    ln -s ${imgui}/include/imgui dependencies/imgui
+  '';
+
+  installPhase = ''
+    runHook preInstall
+
+    install -Dm755 ../bin/Cemu_release $out/bin/Cemu
+    ln -s $out/bin/Cemu $out/bin/cemu
+
+    mkdir -p $out/share/applications
+    substitute ../dist/linux/info.cemu.Cemu.desktop $out/share/applications/info.cemu.Cemu.desktop \
+      --replace "Exec=Cemu" "Exec=$out/bin/Cemu"
+
+    install -Dm644 ../dist/linux/info.cemu.Cemu.metainfo.xml -t $out/share/metainfo
+    install -Dm644 ../src/resource/logo_icon.png $out/share/icons/hicolor/128x128/apps/info.cemu.Cemu.png
+
+    runHook postInstall
+  '';
+
+  preFixup = let
+    libs = [ vulkan-loader ] ++ cubeb.passthru.backendLibs;
+  in ''
+    gappsWrapperArgs+=(--prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath libs}")
+  '';
+
+  meta = with lib; {
+    description = "Cemu is a Wii U emulator";
+    homepage = "https://cemu.info";
+    license = licenses.mpl20;
+    platforms = [ "x86_64-linux" ];
+    maintainers = with maintainers; [ zhaofengli baduhai ];
+  };
+}