shattered-pixel-dungeon: 0.7.5f -> 0.8.0b

The desktop and mobile versions are now unified. This required a few
changes to dependencies and patching.
This commit is contained in:
Francesco Gazzetta 2020-05-16 15:22:38 +02:00
parent a9e3b1103c
commit 376a013dac

View File

@ -1,29 +1,29 @@
{ stdenv { stdenv
, fetchurl
, makeWrapper , makeWrapper
, fetchFromGitHub , fetchFromGitHub
, gradle_5 , gradle_5
, perl , perl
, jre , jre
, xorg , libpulseaudio
, openal
}: }:
let let
pname = "shattered-pixel-dungeon"; pname = "shattered-pixel-dungeon";
version = "0.7.5f"; version = "0.8.0b";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "00-Evan"; owner = "00-Evan";
repo = "shattered-pixel-dungeon-gdx"; repo = "shattered-pixel-dungeon";
rev = "v${version}"; rev = "v${version}";
sha256 = "05awbbc7np9li50shdbpv9dgdgry6lra8d5gibwn578m2g9srbxx"; sha256 = "1qi90qw2xp56wai4gn39rpwh3gs3kx2zcpbni861f7hl9hnf87bf";
}; };
postPatch = '' postPatch = ''
# disable gradle plugins with native code and their targets # disable gradle plugins with native code and their targets
perl -i.bak1 -pe "s#(^\s*id '.+' version '.+'$)#// \1#" build.gradle perl -i.bak1 -pe "s#(^\s*id '.+' version '.+'$)#// \1#" build.gradle
perl -i.bak2 -pe "s#(.*)#// \1# if /^(buildscript|task portable|task nsis|task proguard|task tgz|task\(afterEclipseImport\)|launch4j|macAppBundle|buildRpm|buildDeb|shadowJar)/ ... /^}/" build.gradle perl -i.bak2 -pe "s#(.*)#// \1# if /^(buildscript|task portable|task nsis|task proguard|task tgz|task\(afterEclipseImport\)|launch4j|macAppBundle|buildRpm|buildDeb|shadowJar)/ ... /^}/" build.gradle
# Remove unbuildable android stuff
rm android/build.gradle
''; '';
# fake build to pre-download deps into fixed-output derivation # fake build to pre-download deps into fixed-output derivation
@ -33,7 +33,7 @@ let
nativeBuildInputs = [ gradle_5 perl ]; nativeBuildInputs = [ gradle_5 perl ];
buildPhase = '' buildPhase = ''
export GRADLE_USER_HOME=$(mktemp -d) export GRADLE_USER_HOME=$(mktemp -d)
gradle --no-daemon desktop:dist gradle --no-daemon desktop:release
''; '';
# perl code mavenizes pathes (com.squareup.okio/okio/1.13.0/a9283170b7305c8d92d25aff02a6ab7e45d06cbe/okio-1.13.0.jar -> com/squareup/okio/okio/1.13.0/okio-1.13.0.jar) # perl code mavenizes pathes (com.squareup.okio/okio/1.13.0/a9283170b7305c8d92d25aff02a6ab7e45d06cbe/okio-1.13.0.jar -> com/squareup/okio/okio/1.13.0/okio-1.13.0.jar)
installPhase = '' installPhase = ''
@ -43,7 +43,7 @@ let
''; '';
outputHashAlgo = "sha256"; outputHashAlgo = "sha256";
outputHashMode = "recursive"; outputHashMode = "recursive";
outputHash = "1k0v5scadw9ziq4dw2rckmh8x2xlmxslfsxmpw79zg78n3hvwhf1"; outputHash = "0ih10c6c85vhrqgilqmkzqjx3dc8cscvs9wkh90zgdj10qv0iba3";
}; };
in stdenv.mkDerivation rec { in stdenv.mkDerivation rec {
@ -54,21 +54,21 @@ in stdenv.mkDerivation rec {
buildPhase = '' buildPhase = ''
export GRADLE_USER_HOME=$(mktemp -d) export GRADLE_USER_HOME=$(mktemp -d)
# point to offline repo # point to offline repo
sed -ie "s#mavenLocal()#mavenLocal(); maven { url '${deps}' }#g" build.gradle sed -ie "s#repositories {#repositories { maven { url '${deps}' };#g" build.gradle
gradle --offline --no-daemon desktop:dist gradle --offline --no-daemon desktop:release
''; '';
installPhase = '' installPhase = ''
install -Dm644 desktop/build/libs/desktop-${version}.jar $out/share/shattered-pixel-dungeon.jar install -Dm644 desktop/build/libs/desktop-${version}.jar $out/share/shattered-pixel-dungeon.jar
mkdir $out/bin mkdir $out/bin
makeWrapper ${jre}/bin/java $out/bin/shattered-pixel-dungeon \ makeWrapper ${jre}/bin/java $out/bin/shattered-pixel-dungeon \
--prefix LD_LIBRARY_PATH : ${xorg.libXxf86vm}/lib:${openal}/lib \ --prefix LD_LIBRARY_PATH : ${libpulseaudio}/lib \
--add-flags "-jar $out/share/shattered-pixel-dungeon.jar" --add-flags "-jar $out/share/shattered-pixel-dungeon.jar"
''; '';
meta = with stdenv.lib; { meta = with stdenv.lib; {
homepage = "https://shatteredpixel.com/"; homepage = "https://shatteredpixel.com/";
downloadPage = "https://github.com/00-Evan/shattered-pixel-dungeon-gdx/releases"; downloadPage = "https://github.com/00-Evan/shattered-pixel-dungeon/releases";
description = "Traditional roguelike game with pixel-art graphics and simple interface"; description = "Traditional roguelike game with pixel-art graphics and simple interface";
license = licenses.gpl3; license = licenses.gpl3;
maintainers = with maintainers; [ fgaz ]; maintainers = with maintainers; [ fgaz ];