pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Use HELIX_DEFAULT_RUNTIME. Ensure grammars are built



Module Name:	pkgsrc-wip
Committed By:	atomicules <base%atomicules.co.uk@localhost>
Pushed By:	atomicules
Date:		Wed Nov 12 13:06:17 2025 +0000
Changeset:	eb9106a5944109c7b888cd4d087ec026b63964ea

Modified Files:
	helix/Makefile
	helix/distinfo
Removed Files:
	helix/patches/patch-helix-loader_src_lib.rs

Log Message:
Use HELIX_DEFAULT_RUNTIME. Ensure grammars are built

The use of `HELIX_DEFAULT_RUNTIME` comes from [the docs][1]. We can use
this instead of the lib.rs patch and the `SUBST_DIR` entries; Also worth
mentioning this brings us close to parity with FreeBSD who
[only patch the grammar file now][2].

When running `/usr/pkg/bin/hx --health` we now see:

```
/home/me  $ /usr/pkg/bin/hx --health
Config file: /home/me/.config/helix/config.toml
Language file: /home/me/.config/helix/languages.toml
Log file: /home/me/.cache/helix/helix.log
Runtime directories: /home/me/.config/helix/runtime;/usr/pkg/share/helix/runtime;/usr/pkg/bin/runtime
Runtime directory does not exist: /usr/pkg/bin/runtime
System clipboard provider: tmux (tmux)
```

I.e. we have the default of `/usr/pkg/share/helix/runtime`

Use `CARGO_MANIFEST_DIR` instead of `HELIX_RUNTIME` since it
[has the highest precedence][2] over any other configuration - since
I had built Helix outside of Pkgsrc and already had it installed
with a runtime directory at `/home/me/.config/helix/runtime` it would
assume all grammars were already built when I was testing building
this package; `HELIX_RUNTIME` is third after the user config runtime
directory.

[1]: https://docs.helix-editor.com/building-from-source.html#note-to-packagers
[2]: https://cgit.freebsd.org/ports/tree/editors/helix/files
[3]: https://docs.helix-editor.com/building-from-source.html#multiple-runtime-directories

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=eb9106a5944109c7b888cd4d087ec026b63964ea

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 helix/Makefile                              |  9 ++-------
 helix/distinfo                              |  1 -
 helix/patches/patch-helix-loader_src_lib.rs | 16 ----------------
 3 files changed, 2 insertions(+), 24 deletions(-)

diffs:
diff --git a/helix/Makefile b/helix/Makefile
index 6a7f1fd4c7..32d0481788 100644
--- a/helix/Makefile
+++ b/helix/Makefile
@@ -16,6 +16,7 @@ WRKSRC=		${WRKDIR}/${DISTNAME:S/-source//}
 USE_LANGUAGES=	c c++
 USE_TOOLS+=	git pax
 MAKE_ENV+=	HELIX_DISABLE_AUTO_GRAMMAR_BUILD=1
+MAKE_ENV+=	HELIX_DEFAULT_RUNTIME=${PREFIX}/share/helix/runtime
 
 INSTALLATION_DIRS+=	bin
 INSTALLATION_DIRS+=	share/examples/helix/completion
@@ -31,16 +32,10 @@ post-extract:
 	if [ "${name}" = "tree-sitter-prolog" ]; then ${LN} -s ${WRKDIR}/${name} ${WRKSRC}/runtime/grammars/sources/${path}; else ${LN} -s ${WRKDIR}/${name}-${rev} ${WRKSRC}/runtime/grammars/sources/${path}; fi
 .endfor
 
-SUBST_CLASSES+=		datadir
-SUBST_STAGE.datadir=	pre-configure
-#SUBST_MESSAGE.datadir=	Fixing datadir
-#SUBST_FILES.datadir=	helix-loader/src/lib.rs
-#SUBST_SED.datadir=	-e 's,@DATADIR@,${PREFIX}/share/helix,g'
-
 .include "../../mk/bsd.prefs.mk"
 
 post-build:
-	${RUN} cd ${WRKSRC} && ${SETENV} HELIX_RUNTIME=${WRKSRC}/runtime \
+	${RUN} cd ${WRKSRC} && ${SETENV} CARGO_MANIFEST_DIR=${WRKSRC}/runtime \
 		./target/release/hx --grammar build
 # not under ${PREFIX}/lib, or else lang/rust/cargo.mk would handle it
 .if ${OPSYS} == "Darwin"
diff --git a/helix/distinfo b/helix/distinfo
index b7bd7af83f..ad367971d5 100644
--- a/helix/distinfo
+++ b/helix/distinfo
@@ -1657,5 +1657,4 @@ BLAKE2s (zlib-rs-0.5.0.crate) = 01f0f48c4c414fc797493e288fc2d20f2b46d6e210d0d672
 SHA512 (zlib-rs-0.5.0.crate) = 6cd49a69f7b515c3872ca10975d445badead076159b73d0c9298a2d52ca23d439e5e5408f4359d03f7728f081a50e2ce714f0028dc2ffa0de421c6e89e8d3096
 Size (zlib-rs-0.5.0.crate) = 191547 bytes
 SHA1 (patch-helix-loader_src_grammar.rs) = 4c417c2d50b038e0c2e9f2c8ad31256bcf9e83ac
-SHA1 (patch-helix-loader_src_lib.rs) = 11e213311ee0cc9c260651d4b849ab1deb93b03e
 SHA1 (patch-vendor_gix-index-0.40.0_src_fs.rs) = 9e2251407063d78ad11ec704e7d557a99b16a4eb
diff --git a/helix/patches/patch-helix-loader_src_lib.rs b/helix/patches/patch-helix-loader_src_lib.rs
deleted file mode 100644
index 70b00215a5..0000000000
--- a/helix/patches/patch-helix-loader_src_lib.rs
+++ /dev/null
@@ -1,16 +0,0 @@
-$NetBSD$
-
-Taken from FreeBSD ports, original patch by ashish@.
-
---- helix-loader/src/lib.rs.orig	2025-11-01 21:44:24.442453555 +0000
-+++ helix-loader/src/lib.rs
-@@ -49,9 +49,6 @@ fn prioritize_runtime_dirs() -> Vec<Path
-         rt_dirs.push(path);
-     }
- 
--    let conf_rt_dir = config_dir().join(RT_DIR);
--    rt_dirs.push(conf_rt_dir);
--
-     if let Ok(dir) = std::env::var("HELIX_RUNTIME") {
-         let dir = path::expand_tilde(Path::new(&dir));
-         rt_dirs.push(path::normalize(dir));


Home | Main Index | Thread Index | Old Index