flathub / ch.protonmail.protonmail-bridge

https://flathub.org/apps/details/ch.protonmail.protonmail-bridge
11 stars 7 forks source link

Build from source #28

Open A6GibKm opened 4 years ago

A6GibKm commented 4 years ago

The source for protonmail-bridge has recently ben released at github.com/ProtonMail/proton-bridge.

I am not familiar to building packages using golang, any help would be appreciated, this might fix issues related to the build being created with libraries older than the ones provided by the flatpak runtime.

tristan957 commented 4 years ago

@A6GibKm I am familiar with Go and can help you out.

tristan957 commented 4 years ago

So first thing is we need to probably start using the icons provided by the repository instead of the svg in this repo, unless for some reason you wanted to keep it.

After that, all you need is to run go build after adding the bridge repo as a source. Does not look like they have releases just yet. All your Go dependencies will be fetched automatically and you will end up with a statically linked binary (most likely). If any of the dependencies wrap C libs, they may be dynamically linked. Unsure on that part.

A6GibKm commented 4 years ago

The icon is generated when buidling as far as I remember, currently I am using the one in this repo because the one that comes in the debfile cannot be put in \app because it is part of extra-data. A temporal solution could be to use https://github.com/ProtonMail/proton-bridge/blob/master/internal/frontend/share/icons/logo.svg, but that path could change and using an specific commit is no better than the current solution.

On the go side, as I understand it flatpak-builder builds without internet so you have to manually add sources for all dependencies and put them in a path where go knows they are installed.

besides the go libs, libGL.so is also needed, idk if the runtime bundles it.

tristan957 commented 4 years ago

I spent most of the night working on it and I have to say this is the worst tech stack in the world. I have built electron and it was easier than this. I'll keep trying tomorrow but my god I am running out of ideas and the proton-bridge repo has zero instructions for building as far as I can tell. Great software all around.

A6GibKm commented 4 years ago

Well the instructions are make build, which do work after pulling a few dependencies. Here is how I build it https://github.com/A6GibKm/protonmail-bridge.spec/blob/master/protonmail-bridge.spec (note that the rpm doesn't work since I am not installing in the system all the Qt libs that are generated together with protonmail-bridge).

Also note that the installer will use the env variable VERSION which should be set to 1.2.6 or the like, and will fail if it contains spaces, which is the case of Fedora (workstation, silverblue, toolbox but NOT the container image).

tristan957 commented 4 years ago

It is tough because you have to vendor the go dependencies for flatpak, which is really annoying with the way therecipe/qt works.

A6GibKm commented 4 years ago

Here therecipe/qt is builded, it migth help.

MatMaul commented 4 years ago

The easiest would be that the authors provides all the vendor dependencies in the release tarball, when they do one, otherwise it will be a nightmare. I will open a ticket.

sergeyklay commented 3 years ago

Could someone explain me what is the difficulty? I have compile protonmail bridge many times on my machine (Gentoo) and have never experienced any issue. By the way, all dependencies are defined here: https://github.com/ProtonMail/proton-bridge/blob/master/go.sum

tristan957 commented 3 years ago

Building in Flatpak is the issue

A6GibKm commented 3 years ago

To build a flatpak you don't have internet during the process. So you have to specify everything that will be downloaded prior to the m̀ake part, this might not pair very well with certain make files.

On the other hand go packaging is a mess and I don't know much go anyways. The bridge builds the entire Qt stack so that might be hard to track in terms of dependencies. If I were a little more comfortable with go modules I would try this again, but for the moment I haven't found the time.

Again, I would highly appreciate if someone makes some progress.

sergeyklay commented 3 years ago

Go base app, build from source: https://github.com/flathub/io.github.mki1967.mki3dgame/blob/master/io.github.mki1967.mki3dgame.json

A6GibKm commented 3 years ago

I will look at it later, the problem is not making a manifest with the ~300 modules (listed in your link) and their respective hashes/commits etc, but knowing what to do with those, and for the time being go modules are a mystery to me.

A6GibKm commented 3 years ago

Some progress at #46. What is missing is to add sources to the manifest. I am not able to get docker-credential-helpers tho

go install -v -tags=no_env github.com/therecipe/qt/cmd/...
go: github.com/ProtonMail/docker-credential-helpers@v1.1.0: Get "https://proxy.golang.org/github.com/%21proton%21mail/docker-credential-helpers/@v/v1.1.0.mod": dial tcp: lookup proxy.golang.org on 10.43.255.252:53: dial udp 10.43.255.252:53: connect: network is unreachable
make: *** [Makefile:112: prepare-vendor] Error 1
Error: module protonmail-bridge: Child process exited with code 2
Avamander commented 3 years ago

Any progress with this, or was it too difficult to achieve?

A6GibKm commented 3 years ago

None. More than difficult I lack the knowledge for distributing a go program, but it certainly is not straightforward.

tristan957 commented 3 years ago

ProtonMail needs to come forward and support the Flatpak distribution. The bridge project is just too much work to distribute from source. Their Go/Qt toolchain is so hard to work with. People using Go + Qt must hate themselves.

julianfairfax commented 3 months ago

If this is big concern, it's relatively easy to build the CLI version of Proton Bridge. I also have this automated (may only work on Debian, needs testing).