chunky-dev / chunky

A path tracer to create realistic images of your Minecraft worlds.
https://chunky-dev.github.io/docs
GNU General Public License v3.0
637 stars 76 forks source link

Flatpak #1685

Open JakobDev opened 6 months ago

JakobDev commented 6 months ago

I have created a Flatpak for Chunky. This makes it way easier for Linux User to install Chunky. If you publish it on Flathub, it's just a single click. The Flatpak ships with Java and OpenJFX, so there is nothing the User need to do. Just install it and start it from the Menu.

Here are the build files. Currently it skips the Launcher, as it needs extra arguments to find OpenJFX, so it needs a little bit of work before publishing it. Tell me, if you are interested.

Peregrine05 commented 6 months ago

Chunky itself relies on some dependencies, which are automatically downloaded and added to the classpath by the Launcher.

The Launcher only requires the --module-path and --add-modules arguments to point to JavaFX, just like Chunky itself does.

The Launcher can also be started with -Dchunky.home= to set the settings directory. The only subdirectories that users would ever typically need to access are the plugins directory and the scenes directory, both of which are accessible from within the Launcher and Chunky, respectively.

JakobDev commented 6 months ago

You can use the Launcher in the Flatpak, if you want, but you currently need to configure the Java Arguments in the Launcher, otherwise Chunky doesn't find OpenJFX. The Launcher also asks you were you which directory should be used, even if -Dchunky.home= is set. You can look at the Manifest if you want.

leMaik commented 6 months ago

We should fix the -Dchunky.home issue then.

@Peregrine05 created a new repository for the flat pack config. Feel free to PR against it, @JakobDev 🚀

JakobDev commented 6 months ago

You should also hide some technical config option e.g. Java Arguments when running inside a Flatpak

leMaik commented 6 months ago

Okay, so the launcher needs to be aware that it is running in flatpak mode.

JakobDev commented 6 months ago

Okay, so the launcher needs to be aware that it is running in flatpak mode.

Just check if the file /.flatpak-info exists. You can use the build files I provided to test it. They are just shell commands, so it should be easy to understand and modify.

matthew55 commented 3 months ago

You can use the Launcher in the Flatpak, if you want, but you currently need to configure the Java Arguments in the Launcher, otherwise Chunky doesn't find OpenJFX. The Launcher also asks you were you which directory should be used, even if -Dchunky.home= is set. You can look at the Manifest if you want.

Without even realizing you guys were discussing this, I ran into the same issue (#1720) when trying to use the XDG Base Directory Specification for the AUR package of chunky-launcher and fixed it in this pr: #1721

leMaik commented 3 months ago

The Launcher also asks you were you which directory should be used, even if -Dchunky.home= is set.

@JakobDev This just got fixed, what would be the next steps?

JakobDev commented 3 months ago

If everything works, you can submit Chunky to Flathub

matthew55 commented 3 months ago

@JakobDev If the plan is to show the launcher then not everything works right now.

One possible plan is to update the Chunky Launcher URL build so the latest commit d6c2fad is applied and the #1720 bug is fixed. The Manifest would have to be updated to use this different download source and the --launcher flag.

leMaik commented 3 months ago

@matthew55 The update site is mine, i can deploy a new version. I guess we should specify -Dchunky.home so that the setup window is not shown in the flat pack version?

Maybe we should hide the Java path option when running with flatpack, ie. if /.flatpak-info exists?

matthew55 commented 3 months ago

I guess we should specify -Dchunky.home so that the setup window is not shown in the flat pack version?

-Dchunky.home is current specified in the manifest but since the current jar being used (latest release 2.4.6) doesn't have the bug fix where the setup window is skipped I am suggesting we could just update the Chunky Launcher jar to avoid having to push a new release for this bug fix. The only work that needs done to the Manifest is adding a --launcher flag when running Chinky to use the launcher.

Maybe we should hide the Java path option when running with flatpack, ie. if /.flatpak-info exists?

I can create a pull request to hide options like Java path and Java arts so the users don't accidentally break their configurations if ./.flatpak-info exists. Would you like me to work on this?

matthew55 commented 3 months ago

Maybe we should hide the Java path option when running with flatpack, ie. if /.flatpak-info exists?

I can create a pull request to hide options like Java path and Java arts so the users don't accidentally break their configurations if ./.flatpak-info exists. Would you like me to work on this?

You know what? I actually have use for a feature like this on my AUR package for Chunky. Is this something that we could turn into a flag so that it can be used for more than if a ./.flatpak-info file exists or would that be a flag you are not willing to add?

leMaik commented 3 months ago

@matthew55 PR welcome! Maybe chunky.hideJvmPath?

I'll postpone the launcher release until that's implemented.

JakobDev commented 3 months ago

The only work that needs done to the Manifest is adding a --launcher flag when running Chinky to use the launcher.

Is the launcher needed for something like Flatpak, where most of the options are hidden anyways?

leMaik commented 3 months ago

@JakobDev The launcher is the preferred way to get and launch Chunky. Best way to get updates, nightly builds and PR builds without downstream packages (eg. flatpack or AUR) having to be rebuilt frequently.

JakobDev commented 3 months ago

Teh I will update the Manifest to use the Launcher, once a new JAR is released.