itchio / itch

🎮 The best way to play your itch.io games
https://itch.io/app
MIT License
2.33k stars 203 forks source link

Package & distribute Love2D for Linux (properly) #808

Open fasterthanlime opened 8 years ago

fasterthanlime commented 8 years ago

Just opening this issue innocently, nothing to see here...

fasterthanlime commented 8 years ago

🚒 Oh look, it's builds to test!

Went with the shotgun approach for copying libraries (for i in $(ldd love | cut -d ' ' -f 3); do cp $i ~/love/bundle; done) so there might be too many in there. Also, nothing is stripped. And nothing is signed, because, again, Linux.

But, still better than only .debs! 🌈

(see newer versions below)

fasterthanlime commented 8 years ago

(Note: you're going to need to export LD_LIBRARY_PATH=$PWD after cd'ing into the extracted folder for it to pick up the right libraries).

fasterthanlime commented 8 years ago

Mixed results in Fedora 23 64-bit so far:

error-1482405122

fasterthanlime commented 8 years ago

Looks like Fedora really doesn't like libc6, librt and libpthread being bundled.

fasterthanlime commented 8 years ago

YES! Removing libstdc++ and libdl did the trick!

fedora-love-success

fasterthanlime commented 8 years ago

Here are versions without the offending libs:

fasterthanlime commented 8 years ago

Note that love 0.10.1 will complain (ie. print a dialog box that requires clicking ok) about a game that targets love 0.9.2. I might have to do a script to build all versions, now that I've built all the dependencies!

Sarah-Duck commented 8 years ago

I've packaged my own Love2D game, using AppImage. Here's my game, its worked on nearly every distro I've run it on. I don't know if that helps or not. All of the dependancies are bundled into it, bundling some more of the libraries would probably make it run on more systems (one guy couldn't run it until he installed fuse).

fasterthanlime commented 8 years ago

Build works well on Ubuntu 16.04 64-bit!

love2d-ubuntu-16 04

fasterthanlime commented 8 years ago

Tried playing an actual game, Mr. Rescue, and found that having libm and libgcc_s was causing problems (pulse/alsa problems, actually). Removing them works well.

Here's new builds, this time with the RPATH set to $ORIGIN (via patchelf), which means LD_LIBRARY_PATH isn't required anymore.

fasterthanlime commented 8 years ago

New build works great on Ubuntu 16.04 64-bit, and Debian 8.5 64-bit:

mrrescue

RPATH is working as intended, no need to export LD_LIBRARY_PATH anymore.

hishamhm commented 8 years ago

Success running the "Super Toast" demo on GoboLinux 32-bit :)

fasterthanlime commented 8 years ago

@hishamhm good to hear! GoboLinux definitely wasn't on my list ;) I'm testing the following right now:

fasterthanlime commented 8 years ago

For those kindly testing these binaries, your help is also welcome for testing unarchiver binaries, cf. https://github.com/itchio/itch/issues/795

fasterthanlime commented 8 years ago

Works fine on Ubuntu 16.04, 32-bit!

love2d-ubuntu32

MisterDA commented 8 years ago

Are these patched binaries ? What will happen with older/newer versions of LÖVE ? Is the fundamental idea different from funkeh/love-linux-distribution ? And finally, what do you think about project like AppImage, Flatpack, Snap packages for LÖVE packaging ? (Or even standard distro packages ?)

Thank you :smile:

fasterthanlime commented 8 years ago

Hey @MisterDA !

Are these patched binaries ?

No patches whatsoever. I'll upload my build scripts to https://github.com/itchio/love2d-build-scripts as soon as I'm done with them, but basically: I'm taking a few libs (libasound2, libpulse, freetype2, ...) from Debian 7.5, and the rest (SDL2, luajit, physfs, and patchelf to set the rpath since it's not available as a Debian package) is built from source.

The only change I made is add -fPIC to luajit's Makefile so that it could be linked to statically (like love seems to want to do).

What will happen with older/newer versions of LÖVE ?

I want to upload binaries of all versions of LOVE that appear on https://bitbucket.org/rude/love/downloads - maybe starting with 0.9.0 (do you know any games that require love older than 0.9.0 ?). I have VMs at home with the dependencies I listed above installed, and I'm going to write a node.js script (similar to itch's CI scripts) to download, unpack, compile, and package each version of love directly from the BitBucket repository.

When encountering a love game (either a folder or an actual .love file), the itch app will look at the config.lua file to determine which love2D version is needed, and download it, then run the game using it.

Is the fundamental idea different from funkeh/love-linux-distribution ?

I wasn't aware of this project! But it looks like they only support love 0.9.1 and 0.9.2, although 0.10.x has been out for a few months. I don't feel comfortable putting extra pressure on the maintainer to add additional versions, test them on versions of Linux they might not care about, etc. I'm happy to do that myself since so many games on itch.io use love2D :)

And finally, what do you think about project like AppImage, Flatpack, Snap packages for LÖVE packaging ? (Or even standard distro packages ?)

I like AppImage, I dislike Flatpack & Snap, and I strongly advise against anything that requires root access and/or writes to system paths for games (distro packages). I was asked the same question on Reddit and gave some longer thoughts there.

TL;DR - Ethan's approach (MojoSetup = dual executable / archive + ship your libs) is ideal. AppImage is imho slightly inferior, and I don't trust either RedHat or Canonical to do something truly universal. As for distro packages, playing games shouldn't require root password (they shouldn't interfere with the rest of the system anyway).

As far as the itch app is concerned, it should be able to run anything you're able to run without requiring root. So it'll happily run MojoSetup'd games, simple archives with bundled libs, even AppImages, and soon, .love files. If Flatpak & snap end up being easy to install and run without root access, I don't see why I wouldn't add support for them too, although I'll still probably discourage developers from betting everything on either big company.

Hope that's a complete enough answer! Finally, a question you didn't ask explicitly:

Will developers be able to use your love2D builds to ship native Linux versions of their love2D games?

Yes, all builds will be available at dl.itch.ovh as an ibrew repository (not a standard, just a way to organize software builds that the itch app knows how to consume and uses to install dependencies).

Although my priority will be initially on making sure they work great from within the app, I'll happily write instructions later on how to package your games with them (or even provide a tool do so automatically?). If anyone wants to beat me to it, that'd be cool too!

josefnpat commented 8 years ago

Is supporting older versions of love in the works? The easiest way to check the version of a .love file is to read the conf.lua file.

If supporting older versions of love is a "nice to have but probably won't happen", I might update my games to 0.10.1, as there are some API incompatibilities.

fasterthanlime commented 8 years ago

@josefnpat that's the plan I outline in my (too) lengthy response :)

I want to upload binaries of all versions of LOVE that appear on https://bitbucket.org/rude/love/downloads - maybe starting with 0.9.0 (do you know any games that require love older than 0.9.0 ?)

When encountering a love game (either a folder or an actual .love file), the itch app will look at the config.lua file to determine which love2D version is needed, and download it, then run the game using it.

MisterDA commented 8 years ago

Well thank you very much for this very comprehensive answer, and for the project itself ! I plan to integrate this in my tool love-release during the summer.

Sarah-Duck commented 8 years ago

It would be very handy for itch or butler to have something like this integrated, but for all operating systems. Uploading a .love file, and having it automatically create Windows, Mac, and Linux executables would save a lot of time on my end!

fasterthanlime commented 8 years ago

@1029chris isn't that what @MisterDA is working on?