biglybt: 3.5.0.0 -> 3.6.0.0
[NixPkgs.git] / pkgs / applications / office / jameica / default.nix
blob66d2a80c5555083d6f137ed74475f36f6e5207bf
1 { lib
2 , stdenv
3 , fetchFromGitHub
4 , makeDesktopItem
5 , makeWrapper
6 , wrapGAppsHook
7 , stripJavaArchivesHook
8 , ant
9 , jdk
10 , jre
11 , gtk2
12 , glib
13 , libXtst
14 , Cocoa
17 let
18   _version = "2.10.4";
19   _build = "487";
20   version = "${_version}-${_build}";
22   swtSystem =
23     if stdenv.hostPlatform.system == "i686-linux" then "linux"
24     else if stdenv.hostPlatform.system == "x86_64-linux" then "linux64"
25     else if stdenv.hostPlatform.system == "aarch64-linux" then "linux-arm64"
26     else if stdenv.hostPlatform.system == "x86_64-darwin" then "macos64"
27     else throw "Unsupported system: ${stdenv.hostPlatform.system}";
29   desktopItem = makeDesktopItem {
30     name = "jameica";
31     exec = "jameica";
32     comment = "Free Runtime Environment for Java Applications.";
33     desktopName = "Jameica";
34     genericName = "Jameica";
35     icon = "jameica";
36     categories = [ "Office" ];
37   };
39 stdenv.mkDerivation rec {
40   pname = "jameica";
41   inherit version;
43   src = fetchFromGitHub {
44     owner = "willuhn";
45     repo = "jameica";
46     rev = "V_${builtins.replaceStrings ["."] ["_"] _version}_BUILD_${_build}";
47     hash = "sha256-MSVSd5DyVL+dcfTDv1M99hxickPwT2Pt6QGNsu6DGZI=";
48   };
50   nativeBuildInputs = [ ant jdk wrapGAppsHook makeWrapper stripJavaArchivesHook ];
51   buildInputs = lib.optionals stdenv.isLinux [ gtk2 glib libXtst ]
52     ++ lib.optional stdenv.isDarwin Cocoa;
54   dontWrapGApps = true;
56   # there is also a build.gradle, but it only seems to be used to vendor 3rd party libraries
57   # and is not able to build the application itself
58   buildPhase = ''
59     runHook preBuild
60     ant -f build -Dsystem.version=${version} init compile jar
61     runHook postBuild
62   '';
64   installPhase = ''
65     runHook preInstall
67     mkdir -p $out/libexec $out/lib $out/bin $out/share/{applications,jameica-${version},java}/
69     # copy libraries except SWT
70     cp $(find lib -type f -iname '*.jar' | grep -ve 'swt/.*/swt.jar') $out/share/jameica-${version}/
71     # copy platform-specific SWT
72     cp lib/swt/${swtSystem}/swt.jar $out/share/jameica-${version}/
74     install -Dm644 releases/${_version}-*/jameica/jameica.jar $out/share/java/
75     install -Dm644 plugin.xml $out/share/java/
76     install -Dm644 build/jameica-icon.png $out/share/pixmaps/jameica.png
77     cp ${desktopItem}/share/applications/* $out/share/applications/
79     runHook postInstall
80   '';
82   postFixup = ''
83     makeWrapper ${jre}/bin/java $out/bin/jameica \
84       --add-flags "-cp $out/share/java/jameica.jar:$out/share/jameica-${version}/* ${
85         lib.optionalString stdenv.isDarwin ''-Xdock:name="Jameica" -XstartOnFirstThread''
86       } de.willuhn.jameica.Main" \
87       --prefix LD_LIBRARY_PATH : ${lib.escapeShellArg (lib.makeLibraryPath buildInputs)} \
88       --chdir "$out/share/java/" \
89       "''${gappsWrapperArgs[@]}"
90   '';
92   meta = with lib; {
93     homepage = "https://www.willuhn.de/products/jameica/";
94     description = "Free Runtime Environment for Java Applications";
95     longDescription = ''
96       Runtime Environment for plugins like Hibiscus (HBCI Online Banking),
97       SynTAX (accounting) and JVerein (club management).
98     '';
99     sourceProvenance = with sourceTypes; [
100       fromSource
101       binaryBytecode # source bundles dependencies as jars
102     ];
103     license = licenses.gpl2Plus;
104     platforms = [ "x86_64-linux" "i686-linux" "x86_64-darwin" "aarch64-linux" ];
105     maintainers = with maintainers; [ flokli r3dl3g ];
106     mainProgram = "jameica";
107   };