Merge pull request #294619 from TomaSajt/jameica

jameica: make deterministic and clean up
This commit is contained in:
Florian Klink 2024-03-10 10:01:58 +02:00 committed by GitHub
commit 49845b5bb4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,4 +1,17 @@
{ lib, stdenv, fetchFromGitHub, makeDesktopItem, makeWrapper, wrapGAppsHook, ant, jdk, jre, gtk2, glib, xorg, Cocoa }:
{ lib
, stdenv
, fetchFromGitHub
, makeDesktopItem
, makeWrapper
, wrapGAppsHook
, ant
, jdk
, jre
, gtk2
, glib
, libXtst
, Cocoa
}:
let
_version = "2.10.4";
@ -26,10 +39,6 @@ stdenv.mkDerivation rec {
pname = "jameica";
inherit version;
nativeBuildInputs = [ ant jdk wrapGAppsHook makeWrapper ];
buildInputs = lib.optionals stdenv.isLinux [ gtk2 glib xorg.libXtst ]
++ lib.optional stdenv.isDarwin Cocoa;
src = fetchFromGitHub {
owner = "willuhn";
repo = "jameica";
@ -37,15 +46,29 @@ stdenv.mkDerivation rec {
hash = "sha256-MSVSd5DyVL+dcfTDv1M99hxickPwT2Pt6QGNsu6DGZI=";
};
postPatch = ''
# Fix jar timestamps for reproducibility
substituteInPlace build/build.xml \
--replace-fail '<jar ' '<jar modificationtime="0" '
'';
nativeBuildInputs = [ ant jdk wrapGAppsHook makeWrapper ];
buildInputs = lib.optionals stdenv.isLinux [ gtk2 glib libXtst ]
++ lib.optional stdenv.isDarwin Cocoa;
dontWrapGApps = true;
# there is also a build.gradle, but it only seems to be used to vendor 3rd party libraries
# and is not able to build the application itself
buildPhase = ''
(cd build; ant -Dsystem.version=${version} init compile jar)
runHook preBuild
ant -f build -Dsystem.version=${version} init compile jar
runHook postBuild
'';
installPhase = ''
runHook preInstall
mkdir -p $out/libexec $out/lib $out/bin $out/share/{applications,jameica-${version},java}/
# copy libraries except SWT
@ -57,6 +80,8 @@ stdenv.mkDerivation rec {
install -Dm644 plugin.xml $out/share/java/
install -Dm644 build/jameica-icon.png $out/share/pixmaps/jameica.png
cp ${desktopItem}/share/applications/* $out/share/applications/
runHook postInstall
'';
postFixup = ''