audiobookshelf: 2.18.1 -> 2.19.0 (#378967)
[NixPkgs.git] / pkgs / by-name / ne / netbeans / package.nix
blob2f8be3be2c306ba9f522e46ec2c4951195b8cd89
2   lib,
3   stdenv,
4   fetchurl,
5   makeWrapper,
6   makeDesktopItem,
7   which,
8   unzip,
9   libicns,
10   imagemagick,
11   jdk21,
12   perl,
15 let
16   version = "24";
17   desktopItem = makeDesktopItem {
18     name = "netbeans";
19     exec = "netbeans";
20     comment = "Integrated Development Environment";
21     desktopName = "Apache NetBeans IDE";
22     genericName = "Integrated Development Environment";
23     categories = [ "Development" ];
24     icon = "netbeans";
25   };
27 stdenv.mkDerivation {
28   pname = "netbeans";
29   inherit version;
30   src = fetchurl {
31     url = "mirror://apache/netbeans/netbeans/${version}/netbeans-${version}-bin.zip";
32     hash = "sha256-mzmviZuyS68SZhOAzwWOdZLveOTS5UOgY1oW+oAv9Gs=";
33   };
35   buildCommand = ''
36     # Unpack and perform some path patching.
37     unzip $src
38     patchShebangs .
40     rm netbeans/bin/*.exe
42     # Copy to installation directory and create a wrapper capable of starting
43     # it.
44     mkdir -pv $out/bin
45     cp -a netbeans $out
46     makeWrapper $out/netbeans/bin/netbeans $out/bin/netbeans \
47       --prefix PATH : ${
48         lib.makeBinPath [
49           jdk21
50           which
51         ]
52       } \
53       --prefix JAVA_HOME : ${jdk21.home} \
54       --add-flags "--jdkhome ${jdk21.home} \
55       -J-Dawt.useSystemAAFontSettings=on -J-Dswing.aatext=true"
57     # Extract pngs from the Apple icon image and create
58     # the missing ones from the 1024x1024 image.
59     icns2png --extract $out/netbeans/nb/netbeans.icns
60     for size in 16 24 32 48 64 128 256 512 1024; do
61       mkdir -pv $out/share/icons/hicolor/"$size"x"$size"/apps
62       if [ -e netbeans_"$size"x"$size"x32.png ]
63       then
64         mv netbeans_"$size"x"$size"x32.png $out/share/icons/hicolor/"$size"x"$size"/apps/netbeans.png
65       else
66         convert -resize "$size"x"$size" netbeans_1024x1024x32.png $out/share/icons/hicolor/"$size"x"$size"/apps/netbeans.png
67       fi
68     done;
70     # Create desktop item, so we can pick it from the KDE/GNOME menu
71     mkdir -pv $out/share/applications
72     ln -s ${desktopItem}/share/applications/* $out/share/applications
73   '';
75   nativeBuildInputs = [
76     makeWrapper
77     unzip
78   ];
79   buildInputs = [
80     perl
81     libicns
82     imagemagick
83   ];
85   meta = {
86     description = "Integrated development environment for Java, C, C++ and PHP";
87     homepage = "https://netbeans.apache.org/";
88     license = lib.licenses.asl20;
89     sourceProvenance = with lib.sourceTypes; [
90       binaryBytecode
91       binaryNativeCode
92     ];
93     maintainers = with lib.maintainers; [
94       sander
95       rszibele
96       kashw2
97     ];
98     platforms = lib.platforms.unix;
99     mainProgram = "netbeans";
100   };