Merge pull request #215170 from auroraanna/structorizer

This commit is contained in:
Sandro 2023-02-16 23:16:07 +01:00 committed by GitHub
commit 0debd5333f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 191 additions and 0 deletions

View file

@ -0,0 +1,104 @@
{ stdenv
, lib
, fetchFromGitHub
, jdk11
, makeDesktopItem
, makeWrapper
, copyDesktopItems
}:
stdenv.mkDerivation rec {
pname = "structorizer";
version = "3.32-11";
desktopItems = [
(makeDesktopItem {
type = "Application";
name = "Structorizer";
desktopName = "Structorizer";
genericName = "Diagram creator";
comment = meta.description;
icon = pname;
exec = pname;
terminal = false;
mimeTypes = [ "application/nsd" ];
categories = [
"Development"
"Graphics"
"VectorGraphics"
"RasterGraphics"
"ComputerScience"
];
keywords = [ "nsd" "diagrams" ];
})
];
src = fetchFromGitHub {
owner = "fesch";
repo = "Structorizer.Desktop";
rev = version;
hash = "sha256-rGyeOcGm6uBplgTjMIOy/xRekfHacwDy9kkMigmRSdk=";
};
patches = [ ./makeStructorizer.patch ./makeBigJar.patch ];
strictDeps = true;
nativeBuildInputs = [ jdk11 makeWrapper copyDesktopItems ];
buildInputs = [ jdk11 ];
postPatch = ''
chmod +x makeStructorizer
chmod +x makeBigJar
patchShebangs --build makeStructorizer
patchShebangs --build makeBigJar
'';
buildPhase = ''
runHook preBuild
./makeStructorizer
./makeBigJar
runHook postBuild
'';
installPhase = ''
runHook preInstall
install -d $out/bin $out/share/mime/packages
install -D ${pname}.jar -t $out/share/java/
makeWrapper ${jdk11}/bin/java $out/bin/${pname} \
--add-flags "-jar $out/share/java/${pname}.jar"
cat << EOF > $out/share/mime/packages/structorizer.xml
<?xml version="1.0" encoding="UTF-8"?>
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
<mime-type type="application/nsd">
<comment xml:lang="en">Nassi-Shneiderman diagram</comment>
<comment xml:lang="de">Nassi-Shneiderman-Diagramm</comment>
<glob pattern="*.nsd"/>
</mime-type>
</mime-info>
EOF
cd src/lu/fisch/${pname}/gui
install -vD icons/000_${pname}.png $out/share/icons/hicolor/16x16/apps/${pname}.png
for icon_width in 24 32 48 64 128 256; do
install -vD icons_"$icon_width"/000_${pname}.png $out/share/icons/hicolor/"$icon_width"x"$icon_width"/apps/${pname}.png
done
runHook postInstall
'';
meta = with lib; {
description = "Create Nassi-Shneiderman diagrams (NSD)";
homepage = "https://structorizer.fisch.lu";
license = licenses.gpl3Plus;
platforms = platforms.all;
maintainers = with maintainers; [ annaaurora ];
};
}

View file

@ -0,0 +1,31 @@
Reason: Running the program in a headless environment fails. Besides, tests should be conducted in passthru.tests anyway. There is also no AppleStructorizerApplication.class, only the jar.
diff --git a/makeBigJar b/makeBigJar
index 25547020..c34d0d9c 100644
--- a/makeBigJar
+++ b/makeBigJar
@@ -75,9 +75,8 @@ jars="bsh-2.1.0 \
freehep-xml-2.1.1 \
freehep"
-# Apple specific stuff is only used if it exists and the compiled class is available
-if test -f ../bin/lu/fisch/structorizer/application/AppleStructorizerApplication.class -a \
- -f AppleJavaExtensions.jar; then
+# Apple specific stuff is only used if the jar is available
+if test -f lib/AppleJavaExtensions.jar; then
jars="$jars AppleJavaExtensions"
fi
@@ -114,12 +113,3 @@ echo "Done"
# remove the jar-directory
rm -R jar/
-if test -n "$start_compiled"; then
- # execute the archive
- echo; echo "Running Structorizer from all-in-one jar"
- if test "$start_compiled" = "s"; then
- java -jar structorizer.jar
- else
- java -jar structorizer.jar &
- fi
-fi # start block end

View file

@ -0,0 +1,54 @@
Reason: There is no StructorizerApplet.java anywhere in the source, no .cgt files and running the program in a headless environment fails. Besides, tests should be conducted in passthru.tests anyway. There is also no AppleStructorizerApplication.java, only the jar.
diff --git a/makeStructorizer b/makeStructorizer
index 99a5e8d3..e954be13 100644
--- a/makeStructorizer
+++ b/makeStructorizer
@@ -117,18 +117,6 @@ echo "Done"
echo; echo "Compiling Structorizer..."
javac $str_javac_opts -classpath "$str_classpath" Structorizer.java
echo "Done"
-echo; echo "Compiling Structorizer Applet..."
-javac $str_javac_opts -classpath "$str_classpath" StructorizerApplet.java
-echo "Done"
-
-# OS specific classes
-if test -n "$do_apple"; then
- echo; echo "Compiling Apple specific code..."
- javac $str_javac_opts -classpath "$str_classpath" lu/fisch/structorizer/application/AppleStructorizerApplication.java
- echo "Done"
-else
- echo; echo "Apple specific code skipped"
-fi
# copying some other files to binary tree
echo; echo "Copying resources..."
@@ -147,7 +135,6 @@ cp lu/fisch/structorizer/gui/*.txt ../bin/lu/fisch/structorizer/gui/
cp lu/fisch/structorizer/gui/*.xml ../bin/lu/fisch/structorizer/gui/
cp lu/fisch/structorizer/locales/*.txt ../bin/lu/fisch/structorizer/locales/
cp lu/fisch/structorizer/generators/*.txt ../bin/lu/fisch/structorizer/generators/
-cp lu/fisch/structorizer/parsers/*.cgt ../bin/lu/fisch/structorizer/parsers/
cp lu/fisch/structorizer/parsers/*.egt ../bin/lu/fisch/structorizer/parsers/
cp lu/fisch/structorizer/parsers/*.grm ../bin/lu/fisch/structorizer/parsers/
cp lu/fisch/structorizer/parsers/*.xsd ../bin/lu/fisch/structorizer/parsers/
@@ -155,20 +142,5 @@ cp lu/fisch/structorizer/parsers/*.nsd ../bin/lu/fisch/structorizer/parsers/
cp lu/fisch/structorizer/*.properties ../bin/lu/fisch/structorizer/
echo "Done"
-if test -n "$start_compiled"; then
-
- # changing into binary directory
- cd ../bin/
-
- # run the application
- echo; echo "Running Structorizer from compiled class files"
- if test "$start_compiled" = "s"; then
- java -cp $str_classpath Structorizer
- else
- java -cp $str_classpath Structorizer &
- fi
-
-fi # start block end
-
# move back into the folder where we started
popd >/dev/null

View file

@ -12200,6 +12200,8 @@ with pkgs;
strip-nondeterminism = perlPackages.strip-nondeterminism;
structorizer = callPackage ../applications/graphics/structorizer { };
structure-synth = callPackage ../tools/graphics/structure-synth { };
su-exec = callPackage ../tools/security/su-exec {};