Add a snapcraft.yml for building Snaps
The included snapcraft.yml can be used to build a Snap (the application format used by Canonical's modern package manager) out of Prism. If the project wants in the future, Prism can publish these Snaps to the Snap Store so the Prism Launcher can be installed through the Ubuntu Software app on vanilla Ubuntu. I haven't registered the Snap name, so it's currently free for anyone to reserve. I'd suggest that a Prism developer register the name prismlauncher at https://snapcraft.io/register-snap to ensure the name belongs to the project, even if there are no plans of setting up CI to publish snaps in the short term. I have also modified JavaUtils.cpp to be able to autodetect the Java versions included in the Snap, and added "*.snap" to the .gitignore so the compiled Snap isn't accidentally committed to the repository. Signed-off-by: Piper McCorkle <contact@piperswe.me>
This commit is contained in:
parent
610b971117
commit
2e0f818905
3
.gitignore
vendored
3
.gitignore
vendored
@ -47,3 +47,6 @@ result/
|
||||
# Flatpak
|
||||
.flatpak-builder
|
||||
flatbuild
|
||||
|
||||
# Snap
|
||||
*.snap
|
@ -439,19 +439,28 @@ QList<QString> JavaUtils::FindJavaPaths()
|
||||
javas.append(FS::PathCombine(prefix, "bin/java"));
|
||||
}
|
||||
};
|
||||
// java installed in a snap is installed in the standard directory, but underneath $SNAP
|
||||
auto snap = qEnvironmentVariable("SNAP");
|
||||
auto scanJavaDirs = [&](const QString & dirPath)
|
||||
{
|
||||
scanJavaDir(dirPath);
|
||||
if (!snap.isNull()) {
|
||||
scanJavaDir(snap + dirPath);
|
||||
}
|
||||
};
|
||||
// oracle RPMs
|
||||
scanJavaDir("/usr/java");
|
||||
scanJavaDirs("/usr/java");
|
||||
// general locations used by distro packaging
|
||||
scanJavaDir("/usr/lib/jvm");
|
||||
scanJavaDir("/usr/lib64/jvm");
|
||||
scanJavaDir("/usr/lib32/jvm");
|
||||
scanJavaDirs("/usr/lib/jvm");
|
||||
scanJavaDirs("/usr/lib64/jvm");
|
||||
scanJavaDirs("/usr/lib32/jvm");
|
||||
// javas stored in Prism Launcher's folder
|
||||
scanJavaDir("java");
|
||||
scanJavaDirs("java");
|
||||
// manually installed JDKs in /opt
|
||||
scanJavaDir("/opt/jdk");
|
||||
scanJavaDir("/opt/jdks");
|
||||
scanJavaDirs("/opt/jdk");
|
||||
scanJavaDirs("/opt/jdks");
|
||||
// flatpak
|
||||
scanJavaDir("/app/jdk");
|
||||
scanJavaDirs("/app/jdk");
|
||||
javas = addJavasFromEnv(javas);
|
||||
javas.removeDuplicates();
|
||||
return javas;
|
||||
|
55
snap/snapcraft.yaml
Normal file
55
snap/snapcraft.yaml
Normal file
@ -0,0 +1,55 @@
|
||||
name: prismlauncher
|
||||
license: GPL-3.0-only
|
||||
base: core20
|
||||
website: https://prismlauncher.org/
|
||||
source-code: https://github.com/PrismLauncher/PrismLauncher
|
||||
issues: https://github.com/PrismLauncher/PrismLauncher/issues
|
||||
donation: https://opencollective.com/prismlauncher
|
||||
contact: https://discord.gg/prismlauncher
|
||||
summary: A custom Minecraft launcher with modpack support
|
||||
adopt-info: prismlauncher
|
||||
|
||||
grade: devel
|
||||
confinement: strict
|
||||
|
||||
architectures:
|
||||
- build-on: amd64
|
||||
- build-on: arm64
|
||||
|
||||
parts:
|
||||
prismlauncher:
|
||||
parse-info:
|
||||
- usr/share/metainfo/org.prismlauncher.PrismLauncher.metainfo.xml
|
||||
plugin: cmake
|
||||
build-packages:
|
||||
- default-jdk-headless
|
||||
stage-packages:
|
||||
- openjdk-17-jre
|
||||
- openjdk-8-jre
|
||||
source: .
|
||||
override-pull: |
|
||||
snapcraftctl pull
|
||||
# Fix the icon reference in the desktop file
|
||||
sed -i.bak -e 's|Icon=org.prismlauncher.PrismLauncher|Icon=/usr/share/icons/hicolor/scalable/apps/org.prismlauncher.PrismLauncher.svg|g' program_info/org.prismlauncher.PrismLauncher.desktop.in
|
||||
# Remove the build directory so that local development doesn't interfere with Snap compilation
|
||||
rm -rf build
|
||||
cmake-generator: Ninja
|
||||
cmake-parameters:
|
||||
- "-DCMAKE_INSTALL_PREFIX=/usr"
|
||||
- "-DCMAKE_BUILD_TYPE=RelWithDebInfo"
|
||||
- "-DENABLE_LTO=ON"
|
||||
- "-DLauncher_BUILD_PLATFORM=snap"
|
||||
|
||||
apps:
|
||||
prismlauncher:
|
||||
common-id: org.prismlauncher.PrismLauncher
|
||||
desktop: usr/share/applications/org.prismlauncher.PrismLauncher.desktop
|
||||
command: usr/bin/prismlauncher
|
||||
extensions:
|
||||
- kde-neon
|
||||
plugs:
|
||||
- home
|
||||
- opengl
|
||||
- network
|
||||
- network-bind
|
||||
- audio-playback
|
Loading…
Reference in New Issue
Block a user