3
0
Fork 0
forked from mirrors/nixpkgs

Merge pull request #229321 from kira-bruneau/clonehero

clonehero: 0.23.2.2 -> 1.0.0.4080
This commit is contained in:
Weijia Wang 2023-05-25 01:03:18 +03:00 committed by GitHub
commit 94dca479f4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 83 additions and 91 deletions

View file

@ -15305,6 +15305,13 @@
githubId = 20063502;
name = "Sybrand Aarnoutse";
};
syboxez = {
email = "syboxez@gmail.com";
matrix = "@Syboxez:matrix.org";
github = "syboxez";
githubId = 12841859;
name = "Syboxez Blank";
};
symphorien = {
email = "symphorien_nixpkgs@xlumurb.eu";
matrix = "@symphorien:xlumurb.eu";

View file

@ -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}

View file

@ -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" ];
};
}
})

View file

@ -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 { };
}

View file

@ -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} "$@"
''

View file

@ -36293,9 +36293,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 { };