diff --git a/.gitignore b/.gitignore index 559ebd12f..2496c06b0 100644 --- a/.gitignore +++ b/.gitignore @@ -89,3 +89,5 @@ crashlytics-build.properties fabric.properties openrocket.log + +*.snap diff --git a/snap/gui/openrocket.desktop b/snap/gui/openrocket.desktop new file mode 100644 index 000000000..cdb7b8b65 --- /dev/null +++ b/snap/gui/openrocket.desktop @@ -0,0 +1,8 @@ +[Desktop Entry] +Type=Application +Name=openrocket +Comment=Design and simulate model rockets +Icon=${SNAP}/meta/gui/openrocket.png +Exec=openrocket +Terminal=false +Categories=Utility; diff --git a/snap/gui/openrocket.png b/snap/gui/openrocket.png new file mode 100644 index 000000000..c2170d358 Binary files /dev/null and b/snap/gui/openrocket.png differ diff --git a/snap/local/launcher b/snap/local/launcher new file mode 100755 index 000000000..92937808f --- /dev/null +++ b/snap/local/launcher @@ -0,0 +1,13 @@ +#!/bin/sh + +JAVA_BIN="$JAVA_HOME/bin/java" + +export DESKTOP_SESSION=gnome +export XDG_SESSION_DESKTOP=gnome +export XDG_CURRENT_DESKTOP=GNOME + +# Fix font / theme +export _JAVA_OPTIONS='-Dsun.java2d.xrender=true -Dprism.useFontConfig=false -Dawt.useSystemAAFontSettings=on -Dswing.aatext=true -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel -Dswing.crossplatformlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel' +export JAVA_FONTS=$SNAP/usr/share/fonts/truetype +exec $JAVA_BIN -jar $SNAP/OpenRocket.jar "$@" + diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml new file mode 100644 index 000000000..8b508e151 --- /dev/null +++ b/snap/snapcraft.yaml @@ -0,0 +1,77 @@ +name: openrocket +adopt-info: openrocket +grade: stable +summary: A free, fully featured model rocket simulator. +description: | + OpenRocket is a free, fully featured model rocket simulator that allows you + to design and simulate your rockets before actually building and flying them. + + The main features include + + * Six-degree-of-freedom flight simulation + * Automatic design optimization + * Realtime simulated altitude, velocity and acceleration display + * Staging and clustering support + * Cross-platform (Java-based) + * Read more about it on the OpenRocket.info. +license: GPL-3.0 +base: core18 + +grade: stable +confinement: strict + +apps: + openrocket: + extensions: + - gnome-3-28 + command: bin/launcher + plugs: + - home + - network + - cups-control + - opengl + environment: + JAVA_HOME: "$SNAP/usr/lib/jvm/java-11-openjdk-amd64" + +parts: + openrocket: + plugin: ant + source: . + ant-build-targets: + - clean + - check + - unittest + - jar + override-pull: | + # Override the pull in order to set the version and the grade. + # In the future, the releases can be annotated tags and snapcraft + # will use those for the version numbers. + # + # This can be extended to other parts of OpenRocket (to use the + # git describe --tags command) but the build should be updated at + # the same time so its consistent across all artifacts. Will defer + # that to a later pull request. + # + # Until then, just use the build.version value + snapcraftctl pull + VERSION=$(cat core/resources/build.properties | awk -F'=' '/build\.version/ { print $2 }') + snapcraftctl set-version "$VERSION" + override-build: | + snapcraftctl build + mv swing/build/jar/OpenRocket.jar $SNAPCRAFT_PART_INSTALL/OpenRocket.jar + build-packages: + - wget + stage-packages: + - openjdk-11-jre + - ca-certificates + - ca-certificates-java + prime: + - -usr/lib/jvm/java-*/lib/security/cacerts + - -usr/lib/jvm/java-*/jre/lib/security/cacerts + + launcher: + plugin: dump + source: snap/local + organize: + 'launcher': 'bin/' +