keybase / client

Keybase Go Library, Client, Service, OS X, iOS, Android, Electron
BSD 3-Clause "New" or "Revised" License
8.92k stars 1.23k forks source link

Please allow desktop app to be built without requiring electron downloads. #10546

Open eli-schwartz opened 6 years ago

eli-schwartz commented 6 years ago

When running yarn run package --platform linux --appVersion=${tagname#v} to build the desktop app (this seems to be handled in https://github.com/keybase/client/blob/master/shared/desktop/package.js) this really only has one option and that is to download prebuilt electron packages and build everything into some vendored binary distribution in shared/desktop/release/linux-x64/Keybase-linux-x64/

The only thing that is really needed is shared/desktop/release/linux-x64/Keybase-linux-x64/resources/app/, and from a distro packaging perspective it is far superior to e.g. package this as /usr/lib/keybase/ and use a launcher script that runs electron /usr/lib/keybase/ via a system electron installation.

I would appreciate if there was some (documented) method to simply generate the app directory without requiring all that extra work, and thereby simplifying the process of distro packaging for Keybase.

eli-schwartz commented 6 years ago

https://www.archlinux.org/packages/?q=keybase

Arch Linux now (after keybase/kbfs#1487) ships a keybase package containing the main binary and messaging host, and a kbfs package containing the kbfsfuse and git-remote-keybase utilities for KBFS integration. I'd like to add the electron GUI as well, if possible.

eli-schwartz commented 6 years ago

So I've been looking into this (with some help from @tensor5).

And it looks like the app -- usually created in shared/desktop/release/linux-x64/Keybase-linux-x64/resources/app/ -- is first generated in shared/desktop/build/, and, critically, that is created before electron gets messed with at all.

By using this patch: https://github.com/eli-schwartz/client/commit/dd702aa897b36ee758b21d369c3fb66e967b411d I can trick yarn install && yarn run package into creating the app, but quitting before it tries to mess with electron.

@oconnor663, would it be possible to make this easier to do without patching the source, e.g. provide a dedicated target to build the app without automatically trying to import or execute electron-packager or shared/desktop/yarn-helper/electron.js? (Perhaps it could be an optional dependency? I'm not sure what the current split is between devDependencies and regular dependencies.)

oconnor663 commented 6 years ago

I will be on the road tomorrow, but I will take a look at this on this bus :)

eli-schwartz commented 6 years ago

Also I don't know why https://github.com/keybase/client/blob/6e95ab068a0144cf9f9eaad843d9cb322493702d/shared/desktop/package.desktop.js#L120 copies these files over here, as they're not used by the production electron app and aside from this copy action, the build/ folder is a 1-to-1 match for the final app that is run by electron, or, alternatively, stored in the electron-packager generated package's "resources" folder.

What I'd currently do, I guess, is copy the whole thing then delete that one folder, which is sort of what electron-packager does with its ignore keyword.

eli-schwartz commented 6 years ago

@oconnor663 since we don't package the redirector or anything and the run_keybase script seems to do... kind of a lot... I'm probably just going to provide a wrapper script which exec electron /usr/share/keybase-app/

Is there anything you'd really consider important for it to do, other than that?

eli-schwartz commented 6 years ago

I've now uploaded https://www.archlinux.org/packages/community/x86_64/keybase-gui/ using my experimental patch. Arch Linux users can now install the entire keybase stack, minus the run_keybase script (which I've expressed my opinion on before).

The keybase-gui script I packaged instead is here: https://git.archlinux.org/svntogit/community.git/tree/trunk/keybase-gui?h=packages/keybase