sonic-pi-net / sonic-pi

Code. Music. Live.
https://sonic-pi.net
Other
10.82k stars 922 forks source link

Add Flatpak support #2022

Open Aurnytoraink opened 5 years ago

Aurnytoraink commented 5 years ago

What don't you use Flatpak packages for Linux ? It would be more easy to build and more people will be able to test it.

samaaron commented 5 years ago

@RavengamerSpace if you'd be interestedin creating a Flatpak package for Linux that would be amazing! Unfortunately currently I don't have enough resources to support Linux, I'm hoping that the community might be able to step up and help make this happen :-)

hfiguiere commented 4 years ago

I'm trying to flatpak 3.2.2.

However the build / install doc is lacking or inaccurate (it refer to scripts that no longer exist), and the result is that SonicPi seems to be unable to launch the server.

A few problems:

If I can get it to work I'll definitely submit it to flathub.

hfiguiere commented 4 years ago

Also I'll need to create a .desktop and appstream metainfo file.

samaaron commented 4 years ago

@hfiguiere - awesome that you're looking to get a flatpack version of Sonic Pi.

Apologies that the instructions are slightly outdated. We've gone through significant changes to how we build Sonic Pi. I've personally been focussing on improving the build instructions for macOS and Windows as these are our main supported platforms.

At this stage, I would take the macOS instructions as your starting point before I get round to updating things. I'd also look towards v3.3 as this is not so far from being released. There are just a couple of niggling issues with the new MIDI infrastructure but I don't expect any major changes - just minor tweaks :-)

hfiguiere commented 4 years ago

I would have thought the Raspberry Pi would be supported. That would be a better starting point as all the issues I have encountered are mostly Linux specific.

samaaron commented 4 years ago

I don't personally have the resources to support Raspberry Pi OS or any Linux at this stage. However, @rbnpi has been working extensively on the Pi and is the creator of the v3.2 binary deb that we distribute. He might be able to help you if you're sure you want to work on v3.2.2.

However, as I mentioned v3.3 isn't so far off and the build instructions will be pretty similar to macOS with the exception of having to pull a bunch of deps in - which of course, will vary depending on your linux distro and version.

hfiguiere commented 4 years ago

The policy is to only submit releases so yes I look at 3.2.2. I don't mind changing things if a new version comes out.

SunderB commented 4 years ago

Hi, this sounds like a cool idea :) I've had some experience with building and running sonic pi on linux, but in terms of packaging I don't have any experience. In terms of packages, @rbnpi made a binary .deb package for raspberry pi, and some people have packaged sonic pi for Debian Bullseye (https://packages.debian.org/bullseye/sonic-pi https://salsa.debian.org/multimedia-team/sonic-pi)

When you say the server doesn't start, does the GUI give a boot/startup error? If so could you post it here so we can help debug? (I wouldnt be surprised if it's an issue with starting jack)

Making a .desktop file should be fairly easy (I remember making one for it a while ago) Would we need a different one for flatpak and for a standard system package? (Since the commands to run sonic pi are different)

hfiguiere commented 4 years ago

I found the debian packaging since.

No difference needed for the .desktop file. I'm using the one in the debian package for now.

hfiguiere commented 4 years ago

I found why the server didn't start. Lack of ruby in the runtime (--devel uses the SDK which has it). Problem solved.

hfiguiere commented 4 years ago

As a note the flatpak won't be supported on arm (32 bits) but will be supported aarch64. This is because the SDK/runtime needed is no longer built for arm, and an older SDK can't be used because of JACK.

hfiguiere commented 4 years ago

Concering 3.3 building sp_midi doesn't work because it doesn't find the erl_nif.h header. There is no way to tell it were to find the erlang headers...

SunderB commented 4 years ago

That file is provided on Debian by the erlang-dev package, if that helps?

hfiguiere commented 4 years ago

that doesn't.

  1. there is no Debian here (it's the flatpak runtime, erlang is build from source with Sonic-Pi)
  2. it's not in /usr/include. The other platforms reflect that too: $PREFIX/lib/erlang/usr/include
  3. There is no mechanism to pass it it seems, and I have to patch, hardcode (which is doable) or tweak the install of erlang.
SunderB commented 4 years ago

I was just looking at the json file, and I saw this: https://github.com/flathub/flathub/blob/468b62395a3ab130e6beead0a12b3aeac43da137/net.sonic_pi.SonicPi.json#L70-L74 Could this remove the erlang header files before building sp_midi? (Sorry, I don't know a lot about how flatpaks work)

hfiguiere commented 4 years ago
  1. no. the cleanup phase is run LAST after everything is built. It removes everything that is not needed at runtime.
  2. this is not on this version, I'm trying to see about packaging 3.3 as suggested, even though that's not the one submitted.
  3. I already worked around the problem.
hfiguiere commented 4 years ago

About the erlang path, https://github.com/sonic-pi-net/sonic-pi/issues/2444#issue-638082208 has a command line that could be run in the prebuild script to pass down to the cmake.

hfiguiere commented 4 years ago

I opened #2543 for the erlang path issue.

hfiguiere commented 3 years ago

It's available for x86_64 and aarch64 (ARM 64-bits, which is not the default OS on raspberry pi).

https://flathub.org/apps/details/net.sonic_pi.SonicPi

Note that because of JACK, there are still rough edges with the Flatpak, depending on the host Linux distro.

hfiguiere commented 3 years ago

For reference, the Pipewire issue for the Flatpak + JACK issue https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/446

(Pipewire JACK is what is available to Flatpak apps)