minecraft: 2015-07-24 -> 2.1.5965

switched to the new official launcher, renamed to minecraft-launcher,
and added an update script
This commit is contained in:
hyperfekt 2019-09-05 23:23:51 +02:00
parent 7d5375ebf4
commit 3a635da857
2 changed files with 121 additions and 28 deletions

View File

@ -1,51 +1,137 @@
{ stdenv, fetchurl, makeDesktopItem, makeWrapper { stdenv
, jdk, jre, libpulseaudio, libXxf86vm , fetchurl
, makeDesktopItem
, makeWrapper
, jre # old or modded versions of the game may require Java 8 (https://aur.archlinux.org/packages/minecraft-launcher/#pinned-674960)
, xorg
, zlib
, nss
, nspr
, fontconfig
, gnome2
, cairo
, expat
, alsaLib
, cups
, dbus
, atk
, gtk2-x11
, gdk-pixbuf
, glib
, curl
, freetype
, libpulseaudio
, systemd
, flite ? null
, libXxf86vm ? null
}: }:
let let
desktopItem = makeDesktopItem { desktopItem = makeDesktopItem {
name = "minecraft"; name = "minecraft-launcher";
exec = "minecraft"; exec = "minecraft-launcher";
icon = "minecraft"; icon = "minecraft-launcher";
comment = "A sandbox-building game"; comment = "Official launcher for Minecraft, a sandbox-building game";
desktopName = "Minecraft"; desktopName = "Minecraft Launcher";
genericName = "minecraft"; categories = "Game;Application;";
categories = "Game;";
}; };
libPath = stdenv.lib.makeLibraryPath [ envLibPath = stdenv.lib.makeLibraryPath [
libpulseaudio curl
libXxf86vm # Needed only for versions <1.13 libpulseaudio
]; systemd
alsaLib # needed for narrator
flite # needed for narrator
libXxf86vm # needed only for versions <1.13
];
in stdenv.mkDerivation { libPath = stdenv.lib.makeLibraryPath ([
name = "minecraft-2015-07-24"; alsaLib
atk
cairo
cups
dbus
expat
fontconfig
freetype
gdk-pixbuf
glib
gnome2.GConf
gnome2.pango
gtk2-x11
nspr
nss
stdenv.cc.cc
zlib
] ++
(with xorg; [
libX11
libxcb
libXcomposite
libXcursor
libXdamage
libXext
libXfixes
libXi
libXrandr
libXrender
libXtst
libXScrnSaver
]));
in
stdenv.mkDerivation rec {
pname = "minecraft-launcher";
version = "2.1.5965";
src = fetchurl { src = fetchurl {
url = "https://s3.amazonaws.com/Minecraft.Download/launcher/Minecraft.jar"; url = "https://launcher.mojang.com/download/linux/x86_64/minecraft-launcher_${version}.tar.gz";
sha256 = "04pj4l5q0a64jncm2kk45r7nxnxa2z9n110dcxbbahdi6wk0png8"; sha256 = "0wlc49s541li4cbxdmlw8fp34hp1q9m6ngr7l5hfdhv1i13s5845";
};
icon = fetchurl {
url = "https://launcher.mojang.com/download/minecraft-launcher.svg";
sha256 = "0w8z21ml79kblv20wh5lz037g130pxkgs8ll9s3bi94zn2pbrhim";
}; };
nativeBuildInputs = [ makeWrapper ]; nativeBuildInputs = [ makeWrapper ];
unpackPhase = "${jdk}/bin/jar xf $src favicon.png"; sourceRoot = ".";
dontConfigure = true;
dontBuild = true;
installPhase = '' installPhase = ''
mkdir -p $out/bin $out/share/minecraft mkdir -p $out/opt
mv minecraft-launcher $out/opt
makeWrapper ${jre}/bin/java $out/bin/minecraft \ ${desktopItem.buildCommand}
--add-flags "-jar $out/share/minecraft/minecraft.jar" \ install -D $icon $out/share/icons/hicolor/symbolic/apps/minecraft-launcher.svg
--suffix LD_LIBRARY_PATH : ${libPath}
cp $src $out/share/minecraft/minecraft.jar makeWrapper $out/opt/minecraft-launcher/minecraft-launcher $out/bin/minecraft-launcher \
cp -r ${desktopItem}/share/applications $out/share --prefix LD_LIBRARY_PATH : ${envLibPath} \
install -D favicon.png $out/share/icons/hicolor/32x32/apps/minecraft.png --prefix PATH : ${stdenv.lib.makeBinPath [ jre ]}
'';
preFixup = ''
patchelf \
--set-interpreter ${stdenv.cc.bintools.dynamicLinker} \
--set-rpath '$ORIGIN/'":${libPath}" \
$out/opt/minecraft-launcher/minecraft-launcher
patchelf \
--set-rpath '$ORIGIN/'":${libPath}" \
$out/opt/minecraft-launcher/libcef.so
patchelf \
--set-rpath '$ORIGIN/'":${libPath}" \
$out/opt/minecraft-launcher/liblauncher.so
''; '';
meta = with stdenv.lib; { meta = with stdenv.lib; {
description = "A sandbox-building game"; description = "Official launcher for Minecraft, a sandbox-building game";
homepage = https://minecraft.net; homepage = "https://minecraft.net";
maintainers = with maintainers; [ cpages ryantm infinisil ]; maintainers = with maintainers; [ cpages ryantm infinisil ];
license = licenses.unfreeRedistributable; license = licenses.unfree;
}; };
passthru.updateScript = ./update.sh;
} }

7
pkgs/games/minecraft/update.sh Executable file
View File

@ -0,0 +1,7 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p curl jq gnugrep common-updater-scripts
set -eu -o pipefail
version=$(curl -s 'https://aur.archlinux.org/rpc/?v=5&type=info&arg[]=minecraft-launcher' | jq '.results[0].Version' | grep -Po '[.\d]*(?=-)')
update-source-version minecraft "$version"