Merge pull request #268619 from tweag/lib-descriptions
[NixPkgs.git] / pkgs / applications / science / engineering / brmodelo / default.nix
blobc0573ae131d3c8f50a78fa1ba12c4c0256b6569d
1 { lib
2 , stdenv
3 , fetchFromGitHub
4 , fetchpatch
5 , openjdk8
6 , ant
7 , makeWrapper
8 , makeDesktopItem
9 , copyDesktopItems
12 stdenv.mkDerivation rec {
13   pname = "brmodelo";
14   version = "3.31";
16   src = fetchFromGitHub {
17     owner = "chcandido";
18     repo = pname;
19     rev = version;
20     sha256 = "09qrhqhv264x8phnf3pnb0cwq75l7xdsj9xkwlvhry81nxz0d5v0";
21   };
23   nativeBuildInputs = [ ant makeWrapper copyDesktopItems ];
25   buildInputs = [ openjdk8 ];
27   patches = [
28     # Fixes for building with Ant.
29     # https://github.com/chcandido/brModelo/pull/22
30     (fetchpatch {
31       name = "fix-self-closing-element-not-allowed.patch";
32       url = "https://github.com/yuuyins/brModelo/commit/0d712b74fd5d29d67be07480ed196da28a77893b.patch";
33       sha256 = "sha256-yy03arE6xetotzyvpToi9o9crg3KnMRn1J70jDUvSXE=";
34     })
35     (fetchpatch {
36       name = "fix-tag-closing.patch";
37       url = "https://github.com/yuuyins/brModelo/commit/e8530ff75f024cf6effe0408ed69985405e9709c.patch";
38       sha256 = "sha256-MNuh/ORbaAkB5qDSlA/nPrXN+tqzz4oOglVyEtSangI=";
39     })
40     (fetchpatch {
41       name = "fix-bad-use-greater-than.patch";
42       url = "https://github.com/yuuyins/brModelo/commit/498a6ef8129daff5a472b318f93c8f7f2897fc7f.patch";
43       sha256 = "sha256-MmAwYUmx38DGRsiSxCWCObtpqxk0ykUQiDSC76bCpFc=";
44     })
45     (fetchpatch {
46       name = "fix-param-errors.patch";
47       url = "https://github.com/yuuyins/brModelo/commit/8a508aaba0bcffe13a3f95cff495230beea36bc4.patch";
48       sha256 = "sha256-qME9gZChSMzu1vs9HaosD+snb+jlOrQLY97meNoA8oU=";
49     })
51     # Add SVG icons.
52     # https://github.com/chcandido/brModelo/pull/23
53     (fetchpatch {
54       name = "add-brmodelo-logo-icons-svg.patch";
55       url = "https://github.com/yuuyins/brModelo/commit/f260b82b664fad3325bbf3ebd7a15488d496946b.patch";
56       sha256 = "sha256-UhgcWxsHkNFS1GgaRnmlZohjDR8JwHof2cIb3SBetYs=";
57     })
58   ];
60   buildPhase = ''
61     ant
62   '';
64   desktopItems = [
65     (makeDesktopItem {
66       name = "brmodelo";
67       desktopName = "brModelo";
68       genericName = "Entity-relationship diagramming tool";
69       exec = "brmodelo";
70       icon = "brmodelo";
71       comment = meta.description;
72       categories = [ "Development" "Education" "Database" "2DGraphics" "ComputerScience" "DataVisualization" "Engineering" "Java" ];
73     })
74   ];
76   installPhase = ''
77     install -d $out/bin $out/share/doc/${pname} $out/share/java
79     cp -rv ./dist/javadoc $out/share/doc/${pname}/
81     install -Dm755 ./dist/brModelo.jar -t $out/share/java/
82     # NOTE: The standard Java GUI toolkit has a
83     # hard-coded list of "non-reparenting" window managers,
84     # which cause issues while running brModelo
85     # in WMs that are not in that list (e.g. XMonad).
86     # Solution/Workaround: set the environment variable
87     # _JAVA_AWT_WM_NONREPARENTING=1.
88     makeWrapper ${openjdk8}/bin/java $out/bin/brmodelo \
89        --prefix _JAVA_AWT_WM_NONREPARENTING : 1 \
90        --prefix _JAVA_OPTIONS : "-Dawt.useSystemAAFontSettings=on" \
91        --add-flags "-jar $out/share/java/brModelo.jar"
93     runHook postInstall
94   '';
96   postInstall = ''
97     for size in 16 24 32 48 64 128 256; do
98       install -Dm644 ./src/imagens/icone_"$size"x"$size".svg \
99         $out/share/icons/hicolor/"$size"x"$size"/apps/brmodelo.svg
100     done
101   '';
103   meta = with lib; {
104     description = "Entity-relationship diagram tool for making conceptual and logical database models";
105     homepage = "https://github.com/chcandido/brModelo";
106     license = licenses.gpl3;
107     maintainers = with maintainers; [ yuu ];
108   };