haskell / haskell-platform

Distribution of Haskell with batteries included
http://www.haskell.org/platform/
Other
380 stars 91 forks source link

Flatpak/AppImage/Snap distribution #259

Open edgmnt opened 8 years ago

edgmnt commented 8 years ago

Consider packaging Haskell Platform for Flatpak, AppImage or Snap as Linux distribution-agnostic variants. It may even serve as a reference platform or testbed, since it's a better-controlled environment.

gbaz commented 8 years ago

On initial inspection, it's not clear to me if appimage is distribution agnostic. Because it doesn't bundle everything there's the possibility of version mismatches? Flatpak looks more possible. That said, do you have examples of other compilers packaged in such a way? Distributing compilers this way feels somewhat different than distributing end-user applications -- some examples of how people have done this for one of these systems would be nice, to take inspiration from.

probonopd commented 8 years ago

On initial inspection, it's not clear to me if appimage is distribution agnostic. Because it doesn't bundle everything there's the possibility of version mismatches?

AppImage is basically just a self-mounting filesystem that contains what you put in there. So, if you put the generic binaries from https://www.haskell.org/platform/#linux-generic inside an AppImage, the result should be no more and no less distribution agnostic than the generic binaries you used.

probonopd commented 8 years ago

I have it working in principle, but I can't get Haskell Platform activated as non-root. Can someone help me here? This has nothing to do with AppImage specifically - imagine you extract the generic binaries from https://www.haskell.org/platform/#linux-generic at some random location in your $HOME and want to activate/use them on a per-user basis, without being root. What are you supposed to do?

In case you are curious, here is the .yml file that puts together the AppImage, and here is the file that runs it.

gbaz commented 8 years ago

This ticket seems to be relevant: https://github.com/haskell/haskell-platform/issues/234

gbaz commented 8 years ago

(It would be great if en passant to appimages or the like we also solved that more general non-root/relocatable problem in general)

probonopd commented 8 years ago

I don't entirely understand the script in https://github.com/haskell/haskell-platform/issues/234#issuecomment-191046183 - where does this need to go? Do I have to run any other activate script in addition to it?

gbaz commented 8 years ago

Not sure which script you mean. There, the script that's run on installing the generic distro is https://github.com/haskell/haskell-platform/blob/master/hptool/os-extras/posix/installer/install-haskell-platform.sh.mu

The suggestion is to then do a global find and replace on the bin subdirectory to fix up the following snippet, which is not a script per se, but is the header of each executable (since each are wrapped by a script that sets up their environment, and that script is hardcoded to the install location).

Its a bit weird to explain, but it makes sense once you just poke at the product of a generic install :-)

probonopd commented 8 years ago

Each executable is wrapped in a script? Why that? Couldn't something like patchelf be used instead to set the library search path to $ORIGIN/../lib or something along these lines?

gbaz commented 8 years ago

This sets a variety of paths, not just library search paths. As to exactly why and how its done the way it is -- you'd have to ask the GHC team. To the best of my knowledge this is already the way ghc does things, and the platform just wraps it...

amigalemming commented 5 years ago

It sounds like a good way to install multiple versions of GHC on any Linux system, not only Ubuntu via ppa:hvr/ghc.