Unverified Commit 79aaddff authored by Sandro Jäckel's avatar Sandro Jäckel Committed by GitHub
Browse files

marble-marcher-ce: 1.4.5 -> 1.4.6, cleanup (#388928)

parents 1b5bf714 88b26784
Loading
Loading
Loading
Loading
+45 −37
Original line number Diff line number Diff line
{
  lib,
  stdenv,
  makeWrapper,
  makeDesktopItem,
  copyDesktopItems,
  fetchFromGitHub,
  sfml,

  # nativeBuildInputs
  cmake,
  copyDesktopItems,
  makeWrapper,

  # buildInputs
  anttweakbar,
  glm,
  eigen,
  glew,
  cmake,
  glm,
  sfml,

  makeDesktopItem,
}:
stdenv.mkDerivation rec {
stdenv.mkDerivation (finalAttrs: {
  pname = "marble-marcher-ce";
  version = "1.4.5";
  version = "1.4.6";

  src = fetchFromGitHub {
    owner = "WAUthethird";
    repo = "Marble-Marcher-Community-Edition";
    rev = version;
    hash = "sha256-m5i/Q4k5S4wcojHqMYS7e1W/Ph7q/95j3oOK2xbrHSk=";
    tag = finalAttrs.version;
    hash = "sha256-xzmbC0CnhHaUJ9UHvLDLJsABD/TaJAl+SLVRQRbD9P8=";
  };

  postPatch =
    # the path /home/MMCE is always added to DESTDIR
    # we change this to a more sensible path
    # see https://github.com/WAUthethird/Marble-Marcher-Community-Edition/issues/23
    ''
      substituteInPlace CMakeLists.txt \
        --replace-fail '/home/MMCE' '/share/MMCE'
    '';

  nativeBuildInputs = [
    cmake
    copyDesktopItems
    makeWrapper
  ];

  buildInputs = [
    sfml
    anttweakbar
    glm
    eigen
    glew
    glm
    sfml
  ];
  nativeBuildInputs = [
    cmake
    makeWrapper
    copyDesktopItems
  ];
  installFlags = [ "DESTDIR=$(out)" ];

  prePatch = ''
    # the path /home/MMCE is always added to DESTDIR
    # we change this to a more sensible path
    # see https://github.com/WAUthethird/Marble-Marcher-Community-Edition/issues/23
    substituteInPlace CMakeLists.txt \
      --replace '/home/MMCE' '/share/MMCE'
  '';
  installFlags = [ "DESTDIR=$(out)" ];

  postInstall = ''
    mkdir $out/bin
    mkdir -p $out/share/icons/
    # The executable has to be run from the same directory the assets are in
    makeWrapper $out/share/MMCE/MarbleMarcher $out/bin/${pname} --chdir $out/share/MMCE
    ln -s $out/share/MMCE/images/MarbleMarcher.png $out/share/icons/${pname}.png
    makeWrapper $out/share/MMCE/MarbleMarcher $out/bin/marble-marcher-ce --chdir $out/share/MMCE
    ln -s $out/share/MMCE/images/MarbleMarcher.png $out/share/icons/marble-marcher-ce.png
  '';

  desktopItems = [
    (makeDesktopItem {
      name = pname;
      exec = pname;
      icon = pname;
      desktopName = pname;
      comment = meta.description;
      name = "marble-marcher-ce";
      exec = "marble-marcher-ce";
      icon = "marble-marcher-ce";
      desktopName = "marble-marcher-ce";
      comment = finalAttrs.meta.description;
      categories = [ "Game" ];
    })
  ];

  meta = with lib; {
  meta = {
    description = "A community-developed version of the original Marble Marcher - a fractal physics game";
    mainProgram = "marble-marcher-ce";
    homepage = "https://michaelmoroz.itch.io/mmce";
    license = with licenses; [
    license = with lib.licenses; [
      gpl2Plus # Code
      cc-by-30 # Assets
      ofl # Fonts
    ];
    maintainers = with maintainers; [ rampoina ];
    platforms = platforms.linux;
    maintainers = with lib.maintainers; [ rampoina ];
    platforms = lib.platforms.linux;
  };
}
})