biome: 1.9.2 -> 1.9.3
[NixPkgs.git] / pkgs / applications / science / engineering / brmodelo / default.nix
blob09225fcd5948ce620e6d8526d8c95e6606c03027
1 { lib
2 , stdenv
3 , fetchFromGitHub
4 , fetchpatch
5 , ant
6 , jdk8
7 , makeWrapper
8 , makeDesktopItem
9 , copyDesktopItems
10 , strip-nondeterminism
11 , stripJavaArchivesHook
14 stdenv.mkDerivation (finalAttrs: {
15   pname = "brmodelo";
16   version = "3.31";
18   src = fetchFromGitHub {
19     owner = "chcandido";
20     repo = "brmodelo";
21     rev = finalAttrs.version;
22     hash = "sha256-YJcGfrcB+Qw35bMnqVs/tBzMGVj2DmfhRZ0YsSGGGSc=";
23   };
25   nativeBuildInputs = [
26     ant
27     jdk8
28     makeWrapper
29     copyDesktopItems
30     strip-nondeterminism
31     stripJavaArchivesHook
32   ];
34   patches = [
35     # Fixes for building with Ant.
36     # https://github.com/chcandido/brModelo/pull/22
37     (fetchpatch {
38       name = "fix-self-closing-element-not-allowed.patch";
39       url = "https://github.com/yuuyins/brModelo/commit/0d712b74fd5d29d67be07480ed196da28a77893b.patch";
40       hash = "sha256-yy03arE6xetotzyvpToi9o9crg3KnMRn1J70jDUvSXE=";
41     })
42     (fetchpatch {
43       name = "fix-tag-closing.patch";
44       url = "https://github.com/yuuyins/brModelo/commit/e8530ff75f024cf6effe0408ed69985405e9709c.patch";
45       hash = "sha256-MNuh/ORbaAkB5qDSlA/nPrXN+tqzz4oOglVyEtSangI=";
46     })
47     (fetchpatch {
48       name = "fix-bad-use-greater-than.patch";
49       url = "https://github.com/yuuyins/brModelo/commit/498a6ef8129daff5a472b318f93c8f7f2897fc7f.patch";
50       hash = "sha256-MmAwYUmx38DGRsiSxCWCObtpqxk0ykUQiDSC76bCpFc=";
51     })
52     (fetchpatch {
53       name = "fix-param-errors.patch";
54       url = "https://github.com/yuuyins/brModelo/commit/8a508aaba0bcffe13a3f95cff495230beea36bc4.patch";
55       hash = "sha256-qME9gZChSMzu1vs9HaosD+snb+jlOrQLY97meNoA8oU=";
56     })
58     # Add SVG icons.
59     # https://github.com/chcandido/brModelo/pull/23
60     (fetchpatch {
61       name = "add-brmodelo-logo-icons-svg.patch";
62       url = "https://github.com/yuuyins/brModelo/commit/f260b82b664fad3325bbf3ebd7a15488d496946b.patch";
63       hash = "sha256-UhgcWxsHkNFS1GgaRnmlZohjDR8JwHof2cIb3SBetYs=";
64     })
65   ];
67   buildPhase = ''
68     runHook postBuild
69     ant
70     runHook preBuild
71   '';
73   desktopItems = [
74     (makeDesktopItem {
75       name = "brmodelo";
76       desktopName = "brModelo";
77       genericName = "Entity-relationship diagramming tool";
78       exec = "brmodelo";
79       icon = "brmodelo";
80       comment = finalAttrs.meta.description;
81       categories = [ "Development" "Education" "Database" "2DGraphics" "ComputerScience" "DataVisualization" "Engineering" "Java" ];
82     })
83   ];
85   installPhase = ''
86     runHook preInstall
88     mkdir -p $out/share/doc/brmodelo
89     cp -rv ./dist/javadoc $out/share/doc/brmodelo/
91     install -Dm755 ./dist/brModelo.jar -t $out/share/java/
92     # NOTE: The standard Java GUI toolkit has a
93     # hard-coded list of "non-reparenting" window managers,
94     # which cause issues while running brModelo
95     # in WMs that are not in that list (e.g. XMonad).
96     # Solution/Workaround: set the environment variable
97     # _JAVA_AWT_WM_NONREPARENTING=1.
98     makeWrapper ${jdk8}/bin/java $out/bin/brmodelo \
99        --prefix _JAVA_AWT_WM_NONREPARENTING : 1 \
100        --prefix _JAVA_OPTIONS : "-Dawt.useSystemAAFontSettings=on" \
101        --add-flags "-jar $out/share/java/brModelo.jar"
103     for size in 16 24 32 48 64 128 256; do
104       install -Dm644 ./src/imagens/icone_"$size"x"$size".svg \
105         $out/share/icons/hicolor/"$size"x"$size"/apps/brmodelo.svg
106     done
108     runHook postInstall
109   '';
111   preFixup = ''
112     find $out/share/doc/brmodelo/javadoc -name "*.html" -exec strip-nondeterminism --type javadoc {} +
113   '';
115   meta = with lib; {
116     description = "Entity-relationship diagram tool for making conceptual and logical database models";
117     homepage = "https://github.com/chcandido/brModelo";
118     license = licenses.gpl3;
119     mainProgram = "brmodelo";
120     maintainers = with maintainers; [ yuu ];
121   };