Bug 278837 - editors/lapce: Update to 0.4.2
Summary: editors/lapce: Update to 0.4.2
Status: Open
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Nuno Teixeira
URL:
Keywords:
Depends on: 280490 280685
Blocks:
  Show dependency treegraph
 
Reported: 2024-05-07 13:52 UTC by Mikael Urankar
Modified: 2024-10-20 12:41 UTC (History)
0 users

See Also:
eduardo: maintainer-feedback+


Attachments
v0 (167.77 KB, patch)
2024-05-07 13:52 UTC, Mikael Urankar
no flags Details | Diff
v1: reformat patches, fix hardcoded prefix in fontsdb patch (385.15 KB, patch)
2024-05-08 09:26 UTC, Nuno Teixeira
no flags Details | Diff
v0 (2.86 KB, patch)
2024-06-21 12:41 UTC, Mikael Urankar
no flags Details | Diff
v0: Update to 0.4.1 (70.08 KB, patch)
2024-08-08 10:02 UTC, Nuno Teixeira
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mikael Urankar freebsd_committer freebsd_triage 2024-05-07 13:52:59 UTC
Created attachment 250512 [details]
v0

patch-Cargo.toml is a bit hackish but I couldn't find a better way to build with the ports framework.

This version builds with rust 1.78.0, not tested with 1.77.0
Comment 1 Nuno Teixeira freebsd_committer freebsd_triage 2024-05-07 19:32:35 UTC
(In reply to Mikael Urankar from comment #0)

Hello Mikael!

Nice that you find a way to buuld it.

Testport are OK with rust 1.77.0 on main and supported releases amd64. Will test aarch64 later.

Doubts:

1- openssl vendored

It seems that it is building with openssl vendored. Tomorrow I will hack it so it uses base ossl instead and then do a run test with both versions.

-------
Please make sure this port uses the system OpenSSL and consider removing
CARGO_CRATES=openssl-src-300.2.3+3.2.1 (a vendored copy of OpenSSL) from the
build, e.g., by patching Cargo.toml appropriately.
-------

What's your opinion on this?

2- patch-Cargo.toml: fix "key rev is ignored for dependency (tracing)"

There is an open PR at https://github.com/lapce/lapce/issues/3215
It would be nice that this could be fixed upstream to prevent future problems.

Tomorrow I will dig into it and try to understand how this was fixed since I didn't found a port with similar problems.

Cheers
Comment 2 Nuno Teixeira freebsd_committer freebsd_triage 2024-05-07 19:33:33 UTC
(In reply to Nuno Teixeira from comment #1)
(...)

Tomorrow I will do run tests.
Comment 3 Mikael Urankar freebsd_committer freebsd_triage 2024-05-08 08:27:41 UTC
(In reply to Nuno Teixeira from comment #1)
1) It'd nice if you manage to build it with base ossl. I didnt' spend too much time on it TBH
2) It's our ports framework that is problematic. It comments out the "git" line in the workspace (dunno why). You can see it by yourself with:
make extract
cp xxx/Cargo.toml xxx/Cargo.toml.1
make configure
diff -dup xxx/Cargo.toml.1 xxx/Cargo.toml
Comment 4 Mikael Urankar freebsd_committer freebsd_triage 2024-05-08 08:51:18 UTC
Bonus point if you remove the hardcoded /usr/local in patch-cargo-crates_fontdb*
Comment 5 Nuno Teixeira freebsd_committer freebsd_triage 2024-05-08 08:52:30 UTC
(In reply to Mikael Urankar from comment #3)

Related to Cargo.toml hack that you provided, I did uploaded to upstream to check their opion on that.
But yes, for what you tolding me, our framework is interfering with configure.

Run test shows me:
-no errors or warning at start
- menus doesn't work at all
- it opens a file in command line: `lapce example.txt`

It's broken, but at least it builds! I don't know why I care so much because I only use nvi from base :)

-----
openssl-vendored hack:

I reaply patch to remove openssl vendored and results changed from:

vendored openssl:

=>> Checking shared library dependencies
 0x0000000000000001 NEEDED               Shared library: [libc++.so.1]
 0x0000000000000001 NEEDED               Shared library: [libc.so.7]
 0x0000000000000001 NEEDED               Shared library: [libcxxrt.so.1]
 0x0000000000000001 NEEDED               Shared library: [libgcc_s.so.1]
 0x0000000000000001 NEEDED               Shared library: [libgit2.so.1.7]
 0x0000000000000001 NEEDED               Shared library: [libm.so.5]
 0x0000000000000001 NEEDED               Shared library: [libssh2.so.1]
 0x0000000000000001 NEEDED               Shared library: [libthr.so.3]
 0x0000000000000001 NEEDED               Shared library: [libutil.so.9]

builded on 14.0 (openssl3 base):

=>> Checking shared library dependencies
 0x0000000000000001 NEEDED               Shared library: [libc++.so.1]
 0x0000000000000001 NEEDED               Shared library: [libc.so.7]
 0x0000000000000001 NEEDED               Shared library: [libcrypto.so.30]
 0x0000000000000001 NEEDED               Shared library: [libcxxrt.so.1]
 0x0000000000000001 NEEDED               Shared library: [libgcc_s.so.1]
 0x0000000000000001 NEEDED               Shared library: [libgit2.so.1.7]
 0x0000000000000001 NEEDED               Shared library: [libm.so.5]
 0x0000000000000001 NEEDED               Shared library: [libssh2.so.1]
 0x0000000000000001 NEEDED               Shared library: [libssl.so.30]
 0x0000000000000001 NEEDED               Shared library: [libthr.so.3]
 0x0000000000000001 NEEDED               Shared library: [libutil.so.9]

builded on 13.2 (openssl1 base)

=>> Checking shared library dependencies
 0x0000000000000001 NEEDED               Shared library: [libc++.so.1]
 0x0000000000000001 NEEDED               Shared library: [libc.so.7]
 0x0000000000000001 NEEDED               Shared library: [libcrypto.so.111]
 0x0000000000000001 NEEDED               Shared library: [libcxxrt.so.1]
 0x0000000000000001 NEEDED               Shared library: [libgcc_s.so.1]
 0x0000000000000001 NEEDED               Shared library: [libgit2.so.1.7]
 0x0000000000000001 NEEDED               Shared library: [libm.so.5]
 0x0000000000000001 NEEDED               Shared library: [libssh2.so.1]
 0x0000000000000001 NEEDED               Shared library: [libssl.so.111]
 0x0000000000000001 NEEDED               Shared library: [libthr.so.3]
 0x0000000000000001 NEEDED               Shared library: [libutil.so.9]

It confirms that it is working.
Comment 6 Nuno Teixeira freebsd_committer freebsd_triage 2024-05-08 09:00:19 UTC
(In reply to Mikael Urankar from comment #4)

> Bonus point if you remove the hardcoded /usr/local in patch-cargo-crates_fontdb*

yes, I know. I could use a reinplace to fix that. Working on that and do more tests.

Also, upstream sugested to use vendor tarball that includes all build deps.
I will check how to use it.

Cheers
Comment 7 Nuno Teixeira freebsd_committer freebsd_triage 2024-05-08 09:26:41 UTC
Created attachment 250526 [details]
v1: reformat patches, fix hardcoded prefix in fontsdb patch
Comment 8 Nuno Teixeira freebsd_committer freebsd_triage 2024-05-08 09:27:43 UTC
(In reply to Nuno Teixeira from comment #7)
(...)

+ reaply openssl-vendored removal
Comment 9 Nuno Teixeira freebsd_committer freebsd_triage 2024-05-08 10:29:39 UTC
Interesting vendor tarball: https://github.com/lapce/lapce/releases/download/v0.4.0/vendor.tar.gz

It have all crates that build needs. Thinking how to integrate them...
Comment 10 Mikael Urankar freebsd_committer freebsd_triage 2024-05-09 07:55:03 UTC
(In reply to Nuno Teixeira from comment #5)
I don't have the menu with lapce 0.3.1, so it's not a regression ;)
Comment 11 Nuno Teixeira freebsd_committer freebsd_triage 2024-05-09 08:32:34 UTC
(In reply to Mikael Urankar from comment #10)

Ok.

I'm thinking following nightly builds so we can track changes more frequently.
One good thing about it is that upstream is using:

$ git describe --tags 985b07c
$ v0.4.0-16-g985b07cc

What means that from time to time I could commit updates respecting port version:

0.4.0 -> 0.4.0.16 -> 0.4.1 -> 0.4.*

Tomorrow I will test vendor tarball by extracting it to $wrksrc/cargo-crates and deleting Makefile.crates and see how it goes.

For what I've read vendor tarball was created to help pkg builders that do not support cargo-crates fetching like our does.

If it works it will be awesome!

Thanks
Comment 12 Mikael Urankar freebsd_committer freebsd_triage 2024-05-09 09:45:22 UTC
(In reply to Nuno Teixeira from comment #11)
I've built lapce without our ports tree and the menu is still missing.

We also lack https://github.com/lapce/tree-sitter-grammars.git
https://github.com/lapce/lapce/blob/master/lapce-app/src/app.rs#L3960
Comment 13 commit-hook freebsd_committer freebsd_triage 2024-05-09 11:43:10 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=247d5632499f0905ad3d3f6de67dbd83417dee08

commit 247d5632499f0905ad3d3f6de67dbd83417dee08
Author:     Mikael Urankar <mikael@FreeBSD.org>
AuthorDate: 2024-05-09 11:40:26 +0000
Commit:     Nuno Teixeira <eduardo@FreeBSD.org>
CommitDate: 2024-05-09 11:41:55 +0000

    editors/lapce: Update to latest commit 0.4.0-16

    ChangeLog:
    https://github.com/lapce/lapce/compare/v0.3.1...0.4.0-16-g985b07c

    PR:             278837

 editors/lapce/Makefile                             |   15 +-
 editors/lapce/Makefile.crates                      |  512 +-
 editors/lapce/distinfo                             | 1030 ++-
 editors/lapce/files/patch-Cargo.lock               |   16 +-
 editors/lapce/files/patch-Cargo.toml (new)         |   46 +
 ...osmic-text-0.7.2_src_font_fallback_mod.rs (new) |   11 +
 ...ch-cargo-crates_fontdb-0.16.0_src_lib.rs (gone) |   13 -
 ...tch-cargo-crates_fontdb-0.16.2_src_lib.rs (new) |   22 +
 ...tch-cargo-crates_slotmap-1.0.7_src_lib.rs (new) |   11 +
 editors/lapce/files/patch-cosmic (gone)            |   11 -
 editors/lapce/files/patch-drm-sys (gone)           | 6727 --------------------
 editors/lapce/files/patch-lapce-proxy_Cargo.toml   |   12 +-
 12 files changed, 870 insertions(+), 7556 deletions(-)
Comment 14 Nuno Teixeira freebsd_committer freebsd_triage 2024-05-09 11:46:45 UTC
I decided to commit with hope that more people could test. I will do some publicity on matrix chat :)

> We also lack https://github.com/lapce/tree-sitter-grammars.git
> https://github.com/lapce/lapce/blob/master/lapce-app/src/app.rs#L3960
Yes I noticed when run `lapce -w`
Comment 15 Nuno Teixeira freebsd_committer freebsd_triage 2024-05-09 11:52:09 UTC
(In reply to Nuno Teixeira from comment #14)
(...)

Let's get this PR open and see if anyone shows up.
Comment 16 Nuno Teixeira freebsd_committer freebsd_triage 2024-05-09 11:54:46 UTC
Related to vendor tarball, I've didn't get it to work yet.

https://github.com/lapce/lapce/issues/2247
Comment 17 commit-hook freebsd_committer freebsd_triage 2024-06-14 20:52:44 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=ae461f0a85b8e1732bdc0707d063eaa931fe3479

commit ae461f0a85b8e1732bdc0707d063eaa931fe3479
Author:     Nuno Teixeira <eduardo@FreeBSD.org>
AuthorDate: 2024-06-14 20:46:54 +0000
Commit:     Nuno Teixeira <eduardo@FreeBSD.org>
CommitDate: 2024-06-14 20:51:49 +0000

    editors/lapce: Update to latest commit 0.4.0-94

    Comment Cargo.toml patch about our ports framework doing unexpected
    changes during configure.

    ChangeLog:
    https://github.com/lapce/lapce/compare/0.4.0-24-g9d016feb..0.4.0-94-gdc9a24d8

    PR:             278837

 editors/lapce/Makefile               |   4 +-
 editors/lapce/Makefile.crates        | 103 +++++++----------
 editors/lapce/distinfo               | 208 ++++++++++++++---------------------
 editors/lapce/files/patch-Cargo.lock |   6 +-
 editors/lapce/files/patch-Cargo.toml |  17 ++-
 5 files changed, 145 insertions(+), 193 deletions(-)
Comment 18 Mikael Urankar freebsd_committer freebsd_triage 2024-06-21 12:41:34 UTC
Created attachment 251602 [details]
v0

Here is a patch to add support for tree-sitter grammars on FreeBSD, it needs these 2 ports to go in (and tested / reviewed):
https://github.com/MikaelUrankar/tree-sitter-ports
Comment 19 Nuno Teixeira freebsd_committer freebsd_triage 2024-06-22 09:24:47 UTC
(In reply to Mikael Urankar from comment #18)

Hello Michael,

Actual lapce version uses/downloads tree-sitter-0.20.10 as listed in Makefile.crates.

To test your changes should I use your ports as build deps (tree-sitter-cli and tree-sitter-grammars) and patch lapce to not use "internal" tree-sitter-0.20.10?

Cheers
Comment 20 Mikael Urankar freebsd_committer freebsd_triage 2024-06-23 16:01:43 UTC
(In reply to Nuno Teixeira from comment #19)
I don't know what is the tree-sittre crates.

My ports allow us to provide the binaries found in https://github.com/lapce/tree-sitter-grammars/releases/tag/v0.0.1  grammars-linux-x86_64.zip, which are donwloaded with https://github.com/lapce/lapce/blob/v0.4.0/lapce-app/src/app.rs#L3953
Comment 21 Nuno Teixeira freebsd_committer freebsd_triage 2024-06-23 19:21:01 UTC
(In reply to Mikael Urankar from comment #20)

Ok, I'm building your patch with run depends on:
+               tree-sitter-cli>0:devel/tree-sitter-cli \
+               tree-sitter-grammars>0:textproc/tree-sitter-grammars

tree-sitter-grammars-0.0.1.16:

===>  Building packages for tree-sitter-grammars-0.0.1.16
===>   Building tree-sitter-grammars-0.0.1.16
pkg-static: Unable to access file /wrkdirs/usr/ports/textproc/tree-sitter-grammars/work/stage/usr/local/lib/tree-sitter-swift.so:No such file or directory
*** Error code 1

Any clues?
Comment 22 Mikael Urankar freebsd_committer freebsd_triage 2024-06-24 08:45:13 UTC
(In reply to Nuno Teixeira from comment #21)
Fixed with
https://github.com/MikaelUrankar/tree-sitter-ports/commit/c4bc3393a3f52cdf06074e9982d53678c5a22798
Comment 23 Nuno Teixeira freebsd_committer freebsd_triage 2024-06-24 13:27:05 UTC
(In reply to Mikael Urankar from comment #22)

Just playing with tree-sitter and gramars:

lapce complains:
2024-06-24T13:19:44.049555Z ERROR lapce_app::app: failed to fetch grammars: can't find support grammars

It seems that we need to generate or build some stuff so lapce fetches from:
+    const SYSTEM_QUERIES_DIRECTORY: &'static str = "%%PREFIX%%/share/tree-sitter/grammars";

Right?

running:

% tree-sitter generate
Failed to load grammar.js

Caused by:
    0: Failed to run `node`
    1: No such file or directory (os error 2)

I suspect that port needs USES+=nodejs (implicit build and run deps) instead of just USES+=nodejs:build

Tomorrow I will continue testing with node installed.

Cheers
Comment 24 Mikael Urankar freebsd_committer freebsd_triage 2024-06-24 15:34:27 UTC
> Just playing with tree-sitter and gramars:
>
> lapce complains:
> 2024-06-24T13:19:44.049555Z ERROR lapce_app::app: failed to fetch grammars: can't find support grammars

that's normal, lapce try to download the grammars libraries named grammars-freebsd-x86_64.zip but it doesn't
exist [1]. This is why I've created textproc/tree-sitter-grammars


>
> It seems that we need to generate or build some stuff so lapce fetches from:
> +    const SYSTEM_QUERIES_DIRECTORY: &'static str = "%%PREFIX%%/share/tree-sitter/grammars";
>
> Right?

"Queries" seem OS agnostic and are downloaded from https://github.com/lapce/tree-sitter-grammars/releases/tag/v0.0.1 queries.zip
and extracted in the user home directory: ~/.local/share/lapce-nightly/queries

>
> running:
>
> % tree-sitter generate
> Failed to load grammar.js
>
> Caused by:
>     0: Failed to run `node`
>     1: No such file or directory (os error 2)
>
> I suspect that port needs USES+=nodejs (implicit build and run deps) instead of just USES+=nodejs:build

This tool is only used to build the textproc/tree-sitter-grammars port

[1] https://github.com/lapce/lapce/blob/v0.4.0/lapce-app/src/app.rs#L3977-L3980
Comment 25 Nuno Teixeira freebsd_committer freebsd_triage 2024-08-08 10:02:26 UTC
Created attachment 252606 [details]
v0: Update to 0.4.1

What's changed:

- lib depends devel/libgit2 >= 1.8.1
  I'm working on it and I will update this PR with link to that update.
  status: builds OK, testunit OK

- Build fails on floem_renderer and I suspect that upstream is using rust-nightly again or a newer rust version is needed:

Compiling floem_renderer v0.1.1 (/wrkdirs/usr/ports/editors/lapce/work/floem-54f0d1bcf0e1a91d82492ee7300a526adb60eb5c/renderer)
<snip>
error[E0658]: use of unstable library feature 'lazy_cell'
 --> /wrkdirs/usr/ports/editors/lapce/work/floem-54f0d1bcf0e1a91d82492ee7300a526adb60eb5c/renderer/src/text/layout.rs:1:23
  |
1 | use std::{ops::Range, sync::LazyLock};
  |                       ^^^^^^^^^^^^^^
  |
  = note: see issue #109736 <https://github.com/rust-lang/rust/issues/109736> for more information
  = help: add `#![feature(lazy_cell)]` to the crate attributes to enable
  = note: this compiler was built on 2024-06-10; consider upgrading it if it is out of date

error[E0658]: use of unstable library feature 'lazy_cell'
  --> /wrkdirs/usr/ports/editors/lapce/work/floem-54f0d1bcf0e1a91d82492ee7300a526adb60eb5c/renderer/src/text/layout.rs:11:25
   |
11 | pub static FONT_SYSTEM: LazyLock<Mutex<FontSystem>> = LazyLock::new(|| {
   |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: see issue #109736 <https://github.com/rust-lang/rust/issues/109736> for more information
   = help: add `#![feature(lazy_cell)]` to the crate attributes to enable
   = note: this compiler was built on 2024-06-10; consider upgrading it if it is out of date
<snip>
Comment 26 Nuno Teixeira freebsd_committer freebsd_triage 2024-08-08 10:35:11 UTC
(In reply to Nuno Teixeira from comment #25)
(...)

Confirmed that rust 1.80.0 is required:
https://blog.rust-lang.org/2024/07/25/Rust-1.80.0.html#lazycell-and-lazylock
Comment 27 commit-hook freebsd_committer freebsd_triage 2024-10-20 10:22:43 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=e83fb24c1963419f4142b646529c5bfd8f90878b

commit e83fb24c1963419f4142b646529c5bfd8f90878b
Author:     Nuno Teixeira <eduardo@FreeBSD.org>
AuthorDate: 2024-10-20 09:11:22 +0000
Commit:     Nuno Teixeira <eduardo@FreeBSD.org>
CommitDate: 2024-10-20 10:22:10 +0000

    editors/lapce: Update to 0.4.2

    ChangeLog:      https://github.com/lapce/lapce/releases/tag/v0.4.2
                    https://github.com/lapce/lapce/releases/tag/v0.4.1
    PR:             278837

 editors/lapce/Makefile                             |   7 +-
 editors/lapce/Makefile.crates                      | 140 +++++-----
 editors/lapce/distinfo                             | 286 ++++++++++-----------
 editors/lapce/files/patch-Cargo.toml               |  37 ++-
 ...es_cosmic-text-0.12.1_src_font_fallback_mod.rs} |   6 +-
 .../files/patch-lapce-proxy_Cargo.toml (gone)      |  11 -
 editors/lapce/files/patch-rust-1.80.0 (gone)       |  25 --
 7 files changed, 236 insertions(+), 276 deletions(-)
Comment 28 Nuno Teixeira freebsd_committer freebsd_triage 2024-10-20 12:41:21 UTC
Hello Mikael,

For what I see there is some stabilization in upstream and small changes were needed for 0.4.1 and latest 0.4.2.
I think it's time to get highlight funcionality to work.

How is your support for tree-sitter grammars is going?

Cheers