pulsar icon indicating copy to clipboard operation
pulsar copied to clipboard

Generate a AUR, snap, and flatpak package

Open kaosine opened this issue 3 years ago • 25 comments
trafficstars

Summary

We need to cover the other bases for the build with linux. Namely, AUR, Snap, and flatpak. Especially so that we could get at least posted into the beta branch of flatpak if not the same elsewhere with it labeled as such.

Motivation

This just allows us to better support other platforms. Seeing as right now we kinda cut out a lot of people. Especially those who prefer that containerized workflow.

kaosine avatar Sep 18 '22 22:09 kaosine

Why AUR? As the actual maintainers of the software wouldn't you want it to be in the actual Arch repos rather than the AUR?

Daeraxa avatar Sep 19 '22 01:09 Daeraxa

Eh you knew what I meant...my brain didn't function since I don't know arch XD

kaosine avatar Sep 19 '22 01:09 kaosine

I try not to assume as most people know now than I. Some people genuinely do go for the AUR as a 'reduced hassle' way of releasing but as the maintainers I'm pretty sure it can go to the main repo with a binary rather than always having to build from pkgbuild - if the project wants to maintain it of course.

Daeraxa avatar Sep 19 '22 02:09 Daeraxa

So I made the following one which is working (with electron12) with the binary build on cirrus:


_appname=pulsar
_reponame=pulsar-edit
_datetag=2022091704
_electron=electron12

pkgname="${_appname}-bin"
pkgver="1.63.${_datetag}"
pkgrel=1
pkgdesc="Community build of the hackable text editor, built on Electron"
arch=(x86_64)
url="https://github.com/${_reponame}/${_appname}"
license=(MIT)
depends=($_electron libxkbfile ripgrep)
optdepends=("ctags: symbol indexing support"
            "git: Git and GitHub integration"
            "hunspell: spell check integration")
#makedepends=(git node-gyp nodejs-lts-gallium npm)
provides=("${_appname}")
conflicts=("${_appname}")
options=('!strip')
source=("https://api.cirrus-ci.com/v1/artifact/task/6260636639297536/binary/binaries/${_appname}_${pkgver}_amd64.deb")
md5sums=("SKIP")

package() {
    echo "  -> Extracting the data.tar.xz..."
    bsdtar -xf data.tar.xz -C "$pkgdir/"
}

But there's a problem with the build itself because when extracted it's more than 800 MB. We discussed it on discord, but I couldn't find the messages anymore (don't know why, but never mind, I don't like to talk about issues on discord, this is the proper place).

Builds need cleanup. It seems some dependency (apm/ppm) are duplicated and can be removed to shrink the final size.

Why AUR? As the actual maintainers of the software wouldn't you want it to be in the actual Arch repos rather than the AUR?

Sure, but at the moment it's missing in AUR too.

If someone is interested in maintaining an AUR entry (related to the binary build, the compiling one is another story), please keep inspiration from the text above.

It should be easy to update. Just go here: https://cirrus-ci.com/task/6260636639297536

In binary->binaries, download the deb package. Unfortunately you cannot copy the URL link. But if you did it with a with Chromium based browser, press CTRL+J after the download is completed and copy the link from the download list.

With this link you can extract the new $_datetag for the PKGBUILD. And maybe the code in the URL before binary (I hope it remains the same). Anyway it is doable.

In the future it will be better and easier to have them directly on Github.

Digitalone1 avatar Sep 21 '22 21:09 Digitalone1

I also think that appimage should be a priority target for distribution. Has plenty of benefits, (mostly) distro agnostic, portable (if XDG base spec is properly implemented) and doesn't need a package manager or repository - just a direct download.

Daeraxa avatar Sep 22 '22 01:09 Daeraxa

I think we could just make a generic package plus deb and rpm. Then if some volunteers wants to add appimage, snap and flatpak, they can make pull requests.

PKGBUILD doesn't even need to be provided here. Just push an archive (generic, deb or rpm), then it can be done upon it by volunteers on AUR.

The real priority now is to clean up the builds on cirrus to not make them being 800+ MB after extraction.

Digitalone1 avatar Sep 22 '22 21:09 Digitalone1

I did a flatpak package - https://github.com/vrutkovs/flatpak-pulsar - which simply extracts DEB, but it may need additional patches to carry (like run with "--no-sandbox" automatically)

vrutkovs avatar Oct 09 '22 08:10 vrutkovs

Electron apps with version <= 12 should not work with the new glibc for a note: https://bugs.archlinux.org/task/75902

So you should update the Electron first, I guess, before publishing AUR package.

AlexWayfer avatar Oct 10 '22 11:10 AlexWayfer

We're already on 12 and working on 13 and beyond ;)

kaosine avatar Oct 10 '22 13:10 kaosine

We're already on 12

Yeah, I saw it, but it's not enough, as you can see.

and working on 13 and beyond ;)

That's great, can I track it somewhere?

AlexWayfer avatar Oct 10 '22 13:10 AlexWayfer

Check the electron 13 branch. Issue is that native packages need to be updated and I think superstring is in the middle of being converted to napi so we don't have issues anymore with it? Since we can't just replace that with something else apparently....

kaosine avatar Oct 10 '22 13:10 kaosine

Check the electron 13 branch.

I can't track branches automatically (receive update emails), as I know, only PRs or issues… OK, thank you, I'll wait.

AlexWayfer avatar Oct 10 '22 13:10 AlexWayfer

What I meant is this branch. Bookmark it and check either discussions for the org or join us on discord.

https://github.com/pulsar-edit/pulsar/tree/bump-electron-13

It's been giving us a lot of issues since originally the thought was to bump it to 15 directly from 12 but failed miserably because of breaking changes that hit then. Since I think the current issue is converting all the native add-ons to be context aware and to be in napi since it's a lot better than nan....

kaosine avatar Oct 10 '22 13:10 kaosine

@AlexWayfer a little more in-depth explanation:

Some native modules crash the Electron process. Not "cause an exception that we can backtrace", they straight up crash the whole renderer process. I found that there are two libraries that are the most problematic: tree-sitter and superstring. Luckily, somebody did start a convertion to NAPI on tree-sitter in the past, I just piggie-backed on it and now it works (didn't test all features yet, but at least it doesn't crash the renderer anymore)

As for superstring, that's a a different story. We have 3 possible paths to it: either we fix the Nan version (the library, to be faster, copies memory with memcpy and Electron doesn't like that) or we convert to NAPI. I tried to fix the Nan thing, but it didn't work (and the feedback cycle is horrible: make the changes, see if tests pass, insert the new version into Pulsar, rebuild for Electron, run the editor, see it crash); so I thought maybe we can be luckier by migration to NAPI.

Finally we can also use the WASM (webassembly) version of superstring. This is... a little weird, because it was not updated in a while, but I was able to make a build and... the editor actually works! Now there's a catch: this WASM version does not implement all features that the "native" one does, so I'm unsure if we're missing features.

Anyway: Electron 13 is almost working so far: it boots, we can type text in the editor without crashing, and we have autocomplete and most other features. We can't open files yet, because we're missing a superstring API on WASM, but we're getting close :)

mauricioszabo avatar Oct 12 '22 15:10 mauricioszabo

@mauricioszabo wow, amazing, thank you for such detailed description and this amount of work and experiments.

AlexWayfer avatar Oct 12 '22 19:10 AlexWayfer

@Digitalone1 I have created an AUR package using your build file https://aur.archlinux.org/packages/pulsar-bin and listed you as a contributor. I used you public email on github. If you want me to use something else, I can change it.

jonian avatar Nov 07 '22 13:11 jonian

Thank you @jonian

Unfortunately I've been quite busy in the last weeks so I didn't look at it, but the last time I checked there were a couple of things to do in order to cleanup the package because some unneeded files were installed.

Anyway this PKGBUILD is a good start and the binary package can be improved in the future.

Digitalone1 avatar Nov 07 '22 17:11 Digitalone1

@jonian Thank you for the cleanup of unneeded files waiting for #143 to be fixed.

Anyway shouldn't the PKGBUILD list also electron12 as dependency?

Digitalone1 avatar Nov 25 '22 07:11 Digitalone1

@Digitalone1 I don't think it is needed, pulsar (electron-builder) bundles electron with the binary.

jonian avatar Nov 25 '22 07:11 jonian

@Digitalone1 I don't think it is needed, pulsar (electron-builder) bundles electron with the binary.

Oh, I didn't know that. :)

So I will uninstall electron12.

Digitalone1 avatar Nov 25 '22 07:11 Digitalone1

@Digitalone1 I have created an AUR package using your build file https://aur.archlinux.org/packages/pulsar-bin and listed you as a contributor. I used you public email on github. If you want me to use something else, I can change it.

@pulsar-edit/documentation Should we look at adding info like this to our installation instructions?

confused-Techie avatar Nov 25 '22 09:11 confused-Techie

@confused-Techie the link does not work, anyway it's the PKGBUILD for installation, it only contains the parameters and the scripts to build on Arch.

Digitalone1 avatar Nov 25 '22 11:11 Digitalone1

Hi @kaosine, what about creating AppImage for Pulsar as it will be more convenient to ship the application. I think recently Arduino 2.0 and a good deal of software are shipping their application in AppImage format.

utkarsh-singh07 avatar Dec 08 '22 16:12 utkarsh-singh07

Hi @kaosine, what about creating AppImage for Pulsar as it will be more convenient to ship the application. I think recently Arduino 2.0 and a good deal of software are shipping their application in AppImage format.

There are currently AppImage, rpm, deb and tarball builds for Linux

Spiker985 avatar Dec 08 '22 16:12 Spiker985

Hi @kaosine, what about creating AppImage for Pulsar as it will be more convenient to ship the application. I think recently Arduino 2.0 and a good deal of software are shipping their application in AppImage format.

I've also opened a discussion topic for all the different potential packages and repositories we may wish to (or not) support with our current ones marked.

Daeraxa avatar Dec 08 '22 16:12 Daeraxa

@jonian we have an icon, can you please update the AUR script to include a desktop file?

Here is a sample: https://github.com/pulsar-edit/pulsar/blob/master/resources/linux/pulsar.desktop.in

Here is the icon: https://github.com/pulsar-edit/pulsar/blob/master/resources/pulsar.png

It's 137 KB, should be enough to be updated on AUR alongside the pulsar.desktop file

Digitalone1 avatar Dec 24 '22 13:12 Digitalone1

@Digitalone1 the deb package that is used to generate the AUR package, already includes the icon, but it is in the wrong folder.

# Wrong path
/usr/share/icons/hicolor/0x0/apps/pulsar.png

# Correct path
/usr/share/icons/hicolor/scalable/apps/pulsar.png

I have fixed this issue in the AUR package, but it should be also fixed upstream. Also the icon has artifacts and should be fixed (cleaned up):

pulsar-icon-artifacts

jonian avatar Dec 24 '22 18:12 jonian

@jonian I made a request to provide an SVG icon, so we could include it inside the .desktop file. Thanks for the fix.

Digitalone1 avatar Dec 24 '22 18:12 Digitalone1

Here an SVG icon https://github.com/wincelau/pulsar/blob/master/resources/pulsar.svg and the PR https://github.com/pulsar-edit/pulsar/pull/275

wincelau avatar Dec 29 '22 09:12 wincelau

@jonian for the next release you can remove the icon fix since it has been corrected here.

Besides, in resources path under /opt there's the SVG icon that you can move under /usr/share/icons/hicolor/scalable/apps. If we want also the SVG icon, this is needed to do manually because electron-builder is able to include PNG icons only. Thanks.

Digitalone1 avatar Jan 15 '23 23:01 Digitalone1