itchio / itch

๐ŸŽฎ The best way to play your itch.io games
https://itch.io/app
MIT License
2.37k stars 210 forks source link

๐Ÿ๐ŸŽ๐Ÿง Add Mono to prerequisites list #1606

Open aaronfranke opened 6 years ago

aaronfranke commented 6 years ago

OpenRA requires the Mono framework (>= 3.2) to be installed. Other games likely need it too.

https://github.com/OpenRA/OpenRA/wiki/Installation

https://itch.io/docs/itch/integrating/prereqs/

https://github.com/itchio/itch/issues?q=label%3Aprereqs

On Windows, Mono is available as an MSI package. However, on Windows, many Mono games, including OpenRA, can also be ran if the .NET framework is installed. We could either have Itch install Mono regardless of .NET, install Mono if .NET is missing, or install .NET when Mono is listed as a prerequisite. To be safe, it would make sense to install Mono regardless.

On MacOS, Mono is available as a PKG package. Once installed, the executable is located at
/Library/Frameworks/Mono.framework/Versions/Current/bin/mono

On Ubuntu & Debian, Itch could just run sudo apt install mono-complete -y to install Mono via apt. For other Linux distributions, Mono is probably also offered through the package manager.
Once installed, the executable is located at /usr/bin/mono

As you've already ported the install logic to butler (https://github.com/itchio/itch/issues/1530) this should be implementable now.

aaronfranke commented 6 years ago

The Godot engine is currently built against Mono 5.12. Exporting games is currently not available, but when exporting is available, games using Mono in Godot will probably require Mono >= 5.12.

See: https://github.com/godotengine/godot/issues/15923

fasterthanlime commented 6 years ago

Although I have many reservations, I have been thinking about interfacing with apt-get for some dependencies. I was hoping most Mono games/apps would eventually adopt something like MonoKickstart and not need a system-wide Mono installed.

My reservations are as follows:

aaronfranke commented 6 years ago

I believe Mono apps should not have a problem with forwards compatibility. OpenRA, a Mono 3.2 app, runs just fine with Ubuntu 16.04's Mono, 4.2.1.

EDIT: I also installed Mono 5.8.0.127 (as Godot requires >= 5.4.1) and I can confirm that OpenRA, using Mono 3.2, still works just fine on 5.8.

2nd EDIT: 5.10 also works.

In my experiments with OpenRA, trying to call the system's Mono directly (/usr/bin/mono) via Itch with an Itch app manifest will set the working directory to /usr/bin which is obviously not right. When I tried to call it indirectly, with Itch calling a script which calls Mono, it just opens the script in a text file.

The method I'm using right now is to have a file called mono which is a symlink to /usr/bin/mono and ship this with the game. Then the Itch manifest calls "mono game.exe" This is obviously not ideal.

fasterthanlime commented 6 years ago

I agree (also the /usr/bin CWD is a straight up bug, you're right).

I'll look into making prerequisites platform-agnostic in my re-implementation (see #1642), we need to figure out a transition plan because right now the redist specification format assumes windows: http://dl.itch.ovh/itch-redists/info.json - and I'd like to deploy the new system side-by-side with v23, so the format needs to retain old fields for a while.

Maybe I'll move to windows, linux and osx subfields, and copy the windows fields to the top-level as well so the old app keeps working.

aaronfranke commented 6 years ago

Zero-K is another game on Itch that uses Mono. Like OpenRA, they're on GitHub and currently do not ship Linux builds via archives: https://github.com/ZeroK-RTS/Zero-K/issues/2820

fasterthanlime commented 6 years ago

Maybe I'll move to windows, linux and osx subfields, and copy the windows fields to the top-level as well so the old app keeps working.

Quick status update: I've done that a while ago! Also:

I'm still hesitant to fully jump on the "let's install native OS packages" train for Linux, but I do think we need a clear plan for Zero-K & OpenRA, I'd like to have @granpc's input on this!

aaronfranke commented 6 years ago

Indeed, and now I'm also thinking it may not be the best idea. The Godot engine devs are thinking about ways to handle exporting Mono projects right now, you should probably read up on their ideas.

They want to "Bundle all the assemblies that can break compatibility between versions of mono" but it sounds like they still would require having Mono installed for Godot/C# games. I am curious which assemblies they are referring to, as while OpenRA and Zero-K seem to work fine with Mono 5.10 when they were designed for earlier versions, perhaps more complex projects would break between versions.

Using native OS packages is normal on Linux, but it's completely understandable if this doesn't work for all cases or if you want to use the same method on Windows/Mac/Linux.

fasterthanlime commented 6 years ago

Well, I've pinged @granpc because he's working on a linux prereq plan that involves having our own copies of various libraries (downloaded on demand) in some itch-owned directory (rather than system-wide).

The nice thing about this approach is that it doesn't interfere with the rest of the system at all. I'm not sure it's doable for mono because - even though I haven't looked closely - I suppose it's not just a neatly folded bunch of ELF files, but probably has config files in various places, etc. - so we might have to "fake" a lot more things for it to get to run from a local prefix.

aaronfranke commented 6 years ago

Do let me know how that goes. There are advantages to each approach, I would love to know how well an "Itch runtime" project would turn out.

Steam does have Steam runtime, however, I should point out that some Linux users have issues with it and specifically choose to disable it or override it with system libraries. Either the self-contained runtime approach has serious issues, or Steam's implementation is flawed.

fasterthanlime commented 6 years ago

Either the self-contained runtime approach has serious issues, or Steam's implementation is flawed.

The truth is probably somewhere in the middle - it's a hard problem, and afaict Steam chose to ship a lot of libraries, including stuff like libstdc++.

Quick update btw, Zero-K made a version that doesn't require Mono to be installed: https://itch.io/post/408768 - if only OpenRA & Godot could follow suit, we could put this ugly business behind us :)

aaronfranke commented 6 years ago

This may be useful: https://www.mono-project.com/docs/about-mono/versioning/

The major version number [X in X.Y.Z] is used to indicate which ABI/API version Mono uses. When it changes, there is no guarantee that existing code will continue to work (though the utmost effort will be made to maintain compatibility). The major version changes infrequently.

Ellpeck commented 5 years ago

Are there any news about this? I'd also appreciate having a prereq for Mono.

fasterthanlime commented 5 years ago

Are there any news about this?

Not at the moment, sorry.

aaronfranke commented 4 years ago

@fasterthanlime Any update on this? OpenRA now has automated uploading of builds to Itch.io as of https://github.com/OpenRA/OpenRA/pull/18227, but they still depend on the system having the correct libraries. A Mono prereq would remove the need for a portable installation (and a portable installation would increase the app download size and each update would be slower vs if it was a prereq).

Coincidentally, it has been 1 year since you were last pinged about this :)

fasterthanlime commented 4 years ago

Hey @aaronfranke!

Unfortunately, still not a high priority, and I'm still not keen on shipping prereqs for non-Windows platforms. I'll let you know if anything changes. Right now I'm focused on some security stuff, and then shipping v26.

Mailaender commented 3 years ago

but they still depend on the system having the correct libraries

That is actually not true. Mono is bundled for both Linux and macOS.