Skip to content

Commit

Permalink
clonehero: 0.23.2.2 -> 1.0.0.4080
Browse files Browse the repository at this point in the history
Co-authored-by: Kira Bruneau <[email protected]>
  • Loading branch information
Syboxez Blank and kira-bruneau committed May 24, 2023
1 parent dfe6d81 commit 47a2d45
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 90 deletions.
2 changes: 1 addition & 1 deletion nixos/doc/manual/release-notes/rl-2311.section.md
Original file line number Diff line number Diff line change
Expand Up @@ -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}

Expand Down
99 changes: 73 additions & 26 deletions pkgs/games/clonehero/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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" ];
Expand All @@ -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
];

desktopItem = makeDesktopItem {
name = "clonehero";
desktopName = "Clone Hero";
comment = finalAttrs.meta.description;
icon = "clonehero";
exec = "clonehero";
categories = [ "Game" ];
};

installPhase = ''
mkdir -p "$out/bin" "$out/share"
install -Dm755 ${name} "$out/bin"
cp -r clonehero_Data "$out/share"
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"
mkdir -p "$doc/share/${name}"
cp README.txt "$doc/share/${name}"
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" ];
};
}
})
39 changes: 0 additions & 39 deletions pkgs/games/clonehero/fhs-wrapper.nix

This file was deleted.

21 changes: 0 additions & 21 deletions pkgs/games/clonehero/xdg-wrapper.nix

This file was deleted.

4 changes: 1 addition & 3 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 { };

Expand Down

0 comments on commit 47a2d45

Please sign in to comment.