From 47a2d457b04e2ac14605fbe3e8c32402ebf90d81 Mon Sep 17 00:00:00 2001 From: Syboxez Blank <@Syboxez:matrix.org> Date: Tue, 25 Apr 2023 00:29:28 -0500 Subject: [PATCH] clonehero: 0.23.2.2 -> 1.0.0.4080 Co-authored-by: Kira Bruneau --- .../manual/release-notes/rl-2311.section.md | 2 +- pkgs/games/clonehero/default.nix | 101 +++++++++++++----- pkgs/games/clonehero/fhs-wrapper.nix | 39 ------- pkgs/games/clonehero/xdg-wrapper.nix | 21 ---- pkgs/top-level/all-packages.nix | 4 +- 5 files changed, 76 insertions(+), 91 deletions(-) delete mode 100644 pkgs/games/clonehero/fhs-wrapper.nix delete mode 100644 pkgs/games/clonehero/xdg-wrapper.nix diff --git a/nixos/doc/manual/release-notes/rl-2311.section.md b/nixos/doc/manual/release-notes/rl-2311.section.md index 7e260d2eca04..d99f4c6ce114 100644 --- a/nixos/doc/manual/release-notes/rl-2311.section.md +++ b/nixos/doc/manual/release-notes/rl-2311.section.md @@ -12,7 +12,7 @@ ## Backward Incompatibilities {#sec-release-23.11-incompatibilities} -- Create the first release note entry in this section! +- The latest version of `clonehero` now stores custom content in `~/.clonehero`. See the [migration instructions](https://clonehero.net/2022/11/29/v23-to-v1-migration-instructions.html). Typically, these content files would exist along side the binary, but the previous build used a wrapper script that would store them in `~/.config/unity3d/srylain Inc_/Clone Hero`. ## Other Notable Changes {#sec-release-23.11-notable-changes} diff --git a/pkgs/games/clonehero/default.nix b/pkgs/games/clonehero/default.nix index cf1fad8d945b..36d76195fb9a 100644 --- a/pkgs/games/clonehero/default.nix +++ b/pkgs/games/clonehero/default.nix @@ -2,24 +2,31 @@ , stdenv , fetchurl , autoPatchelfHook +, gtk3 +, zlib , alsa-lib -, gtk2 +, dbus +, libXcursor +, libXext +, libXi +, libXinerama +, libxkbcommon , libXrandr , libXScrnSaver +, libXxf86vm , udev -, zlib +, vulkan-loader # (not used by default, enable in settings menu) +, wayland # (not used by default, enable with SDL_VIDEODRIVER=wayland - doesn't support HiDPI) +, makeDesktopItem }: -let - name = "clonehero"; -in -stdenv.mkDerivation rec { - pname = "${name}-unwrapped"; - version = "0.23.2.2"; +stdenv.mkDerivation (finalAttrs: { + pname = "clonehero"; + version = "1.0.0.4080"; src = fetchurl { - url = "http://dl.clonehero.net/${name}-v${lib.removePrefix "0" version}/${name}-linux.tar.gz"; - sha256 = "0k9jcnd55yhr42gj8cmysd18yldp4k3cpk4z884p2ww03fyfq7mi"; + url = "https://pubdl.clonehero.net/clonehero-v${finalAttrs.version}-final/clonehero-linux.tar.xz"; + hash = "sha256-YWLV+wgQ9RfKRSSWh/x0PMjB6tFA4YpHb9WtYOOgZZI="; }; outputs = [ "out" "doc" ]; @@ -28,46 +35,86 @@ stdenv.mkDerivation rec { buildInputs = [ # Load-time libraries (loaded from DT_NEEDED section in ELF binary) - gtk2 + alsa-lib + gtk3 stdenv.cc.cc.lib zlib # Run-time libraries (loaded with dlopen) - alsa-lib # ALSA sound - libXrandr # X11 resolution detection - libXScrnSaver # X11 screensaver prevention - udev # udev input drivers + dbus + libXcursor + libXext + libXi + libXinerama + libxkbcommon + libXrandr + libXScrnSaver + libXxf86vm + udev + vulkan-loader + wayland ]; - installPhase = '' - mkdir -p "$out/bin" "$out/share" - install -Dm755 ${name} "$out/bin" - cp -r clonehero_Data "$out/share" + desktopItem = makeDesktopItem { + name = "clonehero"; + desktopName = "Clone Hero"; + comment = finalAttrs.meta.description; + icon = "clonehero"; + exec = "clonehero"; + categories = [ "Game" ]; + }; - mkdir -p "$doc/share/${name}" - cp README.txt "$doc/share/${name}" + installPhase = '' + runHook preInstall + + install -Dm755 clonehero "$out/bin/clonehero" + install -Dm644 UnityPlayer.so "$out/libexec/clonehero/UnityPlayer.so" + + mkdir -p "$out/share/pixmaps" + cp -r clonehero_Data "$out/share/clonehero" + ln -s "$out/share/clonehero" "$out/bin/clonehero_Data" + ln -s "$out/share/clonehero/Resources/UnityPlayer.png" "$out/share/pixmaps/clonehero.png" + install -Dm644 "$desktopItem/share/applications/clonehero.desktop" "$out/share/applications/clonehero.desktop" + + mkdir -p "$doc/share/doc/clonehero" + cp -r CLONE_HERO_MANUAL.{pdf,txt} Custom EULA.txt THIRDPARTY.txt "$doc/share/doc/clonehero" + + runHook postInstall ''; # Patch required run-time libraries as load-time libraries # # Libraries found with: - # > strings clonehero | grep '\.so' - # and - # > strace clonehero 2>&1 | grep '\.so' + # > strings UnityPlayer.so | grep '\.so' + # and: + # > LD_DEBUG=libs clonehero postFixup = '' patchelf \ --add-needed libasound.so.2 \ + --add-needed libdbus-1.so.3 \ + --add-needed libpthread.so.0 \ --add-needed libudev.so.1 \ + --add-needed libvulkan.so.1 \ + --add-needed libwayland-client.so.0 \ + --add-needed libwayland-cursor.so.0 \ + --add-needed libwayland-egl.so.1 \ + --add-needed libX11.so.6 \ + --add-needed libXcursor.so.1 \ + --add-needed libXext.so.6 \ + --add-needed libXi.so.6 \ + --add-needed libXinerama.so.1 \ + --add-needed libxkbcommon.so.0 \ --add-needed libXrandr.so.2 \ --add-needed libXss.so.1 \ - "$out/bin/${name}" + --add-needed libXxf86vm.so.1 \ + "$out/libexec/clonehero/UnityPlayer.so" ''; meta = with lib; { description = "Clone of Guitar Hero and Rockband-style games"; homepage = "https://clonehero.net"; license = licenses.unfree; - maintainers = with maintainers; [ kira-bruneau ]; + maintainers = with maintainers; [ kira-bruneau syboxez ]; platforms = [ "x86_64-linux" ]; }; -} +}) diff --git a/pkgs/games/clonehero/fhs-wrapper.nix b/pkgs/games/clonehero/fhs-wrapper.nix deleted file mode 100644 index 83e9788c39ba..000000000000 --- a/pkgs/games/clonehero/fhs-wrapper.nix +++ /dev/null @@ -1,39 +0,0 @@ -{ clonehero-unwrapped -, makeDesktopItem -, buildFHSEnv -, liberation_ttf -, callPackage -}: - -let - name = "clonehero"; - desktopName = "Clone Hero"; - desktopItem = makeDesktopItem { - inherit name desktopName; - comment = clonehero-unwrapped.meta.description; - exec = name; - icon = name; - categories = [ "Game" ]; - }; -in -buildFHSEnv { - inherit name; - inherit (clonehero-unwrapped) meta; - - # Clone Hero has /usr/share/fonts hard-coded in its binary for looking up fonts. - # This workaround is necessary for rendering text on the keybinding screen (and possibly elsewhere) - # If a better solution is found, the FHS environment can be removed. - extraBuildCommands = '' - chmod +w usr/share - mkdir -p usr/share/fonts/truetype - ln -s ${liberation_ttf}/share/fonts/truetype/* usr/share/fonts/truetype - ''; - - extraInstallCommands = '' - mkdir -p "$out/share/applications" "$out/share/pixmaps" - cp ${desktopItem}/share/applications/* "$out/share/applications" - ln -s ${clonehero-unwrapped}/share/clonehero_Data/Resources/UnityPlayer.png "$out/share/pixmaps/${name}.png" - ''; - - runScript = callPackage ./xdg-wrapper.nix { }; -} diff --git a/pkgs/games/clonehero/xdg-wrapper.nix b/pkgs/games/clonehero/xdg-wrapper.nix deleted file mode 100644 index 2890e469db05..000000000000 --- a/pkgs/games/clonehero/xdg-wrapper.nix +++ /dev/null @@ -1,21 +0,0 @@ -{ stdenv, clonehero-unwrapped, writeScript }: - -# Clone Hero doesn't have an installer, so it just stores configuration & data relative to the binary. -# This wrapper works around that limitation, storing game configuration & data in XDG_CONFIG_HOME. -let - name = "clonehero"; - desktopName = "Clone Hero"; -in -writeScript "${name}-xdg-wrapper-${clonehero-unwrapped.version}" '' - #!${stdenv.shell} -e - configDir="''${XDG_CONFIG_HOME:-$HOME/.config}/unity3d/srylain Inc_/${desktopName}" - mkdir -p "$configDir" - - # Force link shipped clonehero_Data, unless directory already exists (to allow modding) - if [ ! -d "$configDir/clonehero_Data" ] || [ -L "$configDir/clonehero_Data" ]; then - ln -snf ${clonehero-unwrapped}/share/clonehero_Data "$configDir" - fi - - # Fake argv[0] to emulate running in the config directory - exec -a "$configDir/${name}" ${clonehero-unwrapped}/bin/${name} "$@" -'' diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 26e08cfb6996..687991ea6931 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -36285,9 +36285,7 @@ with pkgs; chromium-bsu = callPackage ../games/chromium-bsu { }; - clonehero-unwrapped = callPackage ../games/clonehero { }; - - clonehero = callPackage ../games/clonehero/fhs-wrapper.nix { }; + clonehero = callPackage ../games/clonehero { }; vintagestory = callPackage ../games/vintagestory { };