python312Packages.comicon: 1.2.0 -> 1.2.1 (#361860)
[NixPkgs.git] / pkgs / by-name / sc / scenebuilder / package.nix
blob7f650a7085018c62b9bc548087b3eb42ca251b99
1 { lib
2 , jdk21
3 , maven
4 , fetchFromGitHub
5 , makeDesktopItem
6 , copyDesktopItems
7 , glib
8 , makeWrapper
9 , wrapGAppsHook3
12 let
13   jdk = jdk21.override {
14     enableJavaFX = true;
15   };
17 maven.buildMavenPackage rec {
18   pname = "scenebuilder";
19   version = "21.0.1";
21   src = fetchFromGitHub {
22     owner = "gluonhq";
23     repo = "scenebuilder";
24     rev = version;
25     hash = "sha256-YEcW1yQK6RKDqSstsrpdOqMt972ZagenGDxcJ/gP+SA=";
26   };
28   patches = [
29     # makes the mvnHash platform-independent
30     ./pom-remove-javafx.patch
32     # makes sure that maven upgrades don't change the mvnHash
33     ./fix-default-maven-plugin-versions.patch
34   ];
36   postPatch = ''
37     # set the build timestamp to $SOURCE_DATE_EPOCH
38     substituteInPlace app/pom.xml \
39         --replace-fail "\''${maven.build.timestamp}" "$(date -d "@$SOURCE_DATE_EPOCH" '+%Y-%m-%d %H:%M:%S')"
40   '';
42   mvnJdk = jdk;
43   mvnParameters = toString [
44     "-Dmaven.test.skip"
45     "-Dproject.build.outputTimestamp=1980-01-01T00:00:02Z"
46   ];
48   mvnHash = "sha256-fS7dS2Q4ORThLBwDOzJJnRboNNRmhp0RG6Dae9fl+pw=";
50   nativeBuildInputs = [
51     copyDesktopItems
52     glib
53     makeWrapper
54     wrapGAppsHook3
55   ];
57   dontWrapGApps = true; # prevent double wrapping
59   installPhase = ''
60     runHook preInstall
62     install -Dm644 app/target/lib/scenebuilder-${version}-SNAPSHOT-all.jar $out/share/scenebuilder/scenebuilder.jar
63     install -Dm644 app/src/main/resources/com/oracle/javafx/scenebuilder/app/SB_Logo.png $out/share/icons/hicolor/128x128/apps/scenebuilder.png
65     runHook postInstall
66   '';
68   postFixup = ''
69     makeWrapper ${jdk}/bin/java $out/bin/scenebuilder \
70       --add-flags "--add-modules javafx.web,javafx.fxml,javafx.swing,javafx.media" \
71       --add-flags "--add-opens=javafx.fxml/javafx.fxml=ALL-UNNAMED" \
72       --add-flags "-jar $out/share/scenebuilder/scenebuilder.jar" \
73       "''${gappsWrapperArgs[@]}"
74   '';
76   desktopItems = [
77     (makeDesktopItem {
78       name = "scenebuilder";
79       exec = "scenebuilder";
80       icon = "scenebuilder";
81       comment = "A visual, drag'n'drop, layout tool for designing JavaFX application user interfaces.";
82       desktopName = "Scene Builder";
83       mimeTypes = [ "application/java" "application/java-vm" "application/java-archive" ];
84       categories = [ "Development" ];
85     })
86   ];
88   meta = with lib; {
89     changelog = "https://github.com/gluonhq/scenebuilder/releases/tag/${src.rev}";
90     description = "Visual, drag'n'drop, layout tool for designing JavaFX application user interfaces";
91     homepage = "https://gluonhq.com/products/scene-builder/";
92     license = licenses.bsd3;
93     mainProgram = "scenebuilder";
94     maintainers = with maintainers; [ wirew0rm ];
95     platforms = jdk.meta.platforms;
96     sourceProvenance = with sourceTypes; [
97       fromSource
98       binaryBytecode # deps
99     ];
100   };