Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 17 Dec 2025 16:59:25 +0000
From:      Adam Weinberger <adamw@FreeBSD.org>
To:        ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org
Cc:        Dave Marker <dave@freedave.net>
Subject:   git: 4955b31ba932 - main - devel/janet-lsp: Compile as a portable "binscript"
Message-ID:  <6942e16d.f9cd.68e722f7@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch main has been updated by adamw:

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

commit 4955b31ba932ba18b6f5c3e58a2c5c1803ec744e
Author:     Dave Marker <dave@freedave.net>
AuthorDate: 2025-12-17 16:55:57 +0000
Commit:     Adam Weinberger <adamw@FreeBSD.org>
CommitDate: 2025-12-17 16:59:15 +0000

    devel/janet-lsp: Compile as a portable "binscript"
    
    Janet can compile to a portable "binscript" or a statically-linked
    executable. The latter allows the LSP to work even without Janet
    installed, but means that the LSP can be out-of-sync if the user
    has a different version of Janet installed (the LSP will be unaware
    of that new Janet and its capabilities).
    
    To guard against such problems, switch to the binscript approach,
    which compiles to an IR. Janet is a required runtime dep now, but
    there's no risk of the LSP getting out-of-sync with the underlying
    toolchain.
    
    Differential Revision:  https://reviews.freebsd.org/D54260
---
 devel/janet-lsp/Makefile                  | 25 +++++++++++++++----------
 devel/janet-lsp/files/janet-lsp.in        | 11 +++++++++++
 devel/janet-lsp/files/patch-project.janet | 29 -----------------------------
 3 files changed, 26 insertions(+), 39 deletions(-)

diff --git a/devel/janet-lsp/Makefile b/devel/janet-lsp/Makefile
index 4e6d46e92a30..89feef4d797b 100644
--- a/devel/janet-lsp/Makefile
+++ b/devel/janet-lsp/Makefile
@@ -1,6 +1,7 @@
 PORTNAME=	janet-lsp
 PORTVERSION=	0.0.11
 DISTVERSIONPREFIX=	v
+PORTREVISION=	1
 CATEGORIES=	devel
 
 MAINTAINER=	dave@freedave.net
@@ -13,6 +14,7 @@ LICENSE_FILE=	${WRKSRC}/LICENSE
 # Technically jpm should depend on janet.
 BUILD_DEPENDS=	janet>=1.17.2:lang/janet \
 		jpm>=1.1.0:lang/jpm
+RUN_DEPENDS=	janet>=1.17.2:lang/janet
 
 USE_GITHUB=	yes
 GH_ACCOUNT=	CFiggers
@@ -29,25 +31,28 @@ GH_TUPLE=	CFiggers:cmd:b0a34d6:cmd \
 		ianthehenry:judge:3b92185:judge \
 		janet-lang:spork:7b780cc:spork
 
-PLIST_FILES=	bin/janet-lsp
+SUB_FILES=	janet-lsp
+
+PLIST_FILES=	bin/janet-lsp \
+		lib/janet/janet-lsp.jimage \
+		lib/janet/.manifests/janet-lsp.jdn
 
-# `jpm install` does not actually install anyway. This does a build (with no
-# dependency checking, which is why order matters) and install to the work
-# "jpm_tree". Which is where all the dependencies and the project expect to find
-# any of their build dependencies.
-#
 # Use GH_TUPLE project-hash as directory to avoid an unnecessary copy.
 do-build:
 .for dep in ${GH_TUPLE:C@^([^:]*):([^:]*):([^:]*):([^:]*)@\2-\3@}
 	cd ${WRKDIR}/${dep} && \
-	${LOCALBASE}/bin/jpm --tree=${WRKSRC}/jpm_tree "install"
+		${LOCALBASE}/bin/jpm --tree=${WRKSRC}/jpm_tree "install"
 .endfor
-	cd ${WRKSRC} && ${LOCALBASE}/bin/jpm --tree=${WRKSRC}/jpm_tree build
+	cd ${WRKSRC} && ${LOCALBASE}/bin/jpm --tree=${WRKSRC}/jpm_tree "install"
 
 do-install:
-	${MKDIR} ${STAGEDIR}/bin
-	${INSTALL_PROGRAM} ${WRKSRC}/build/janet-lsp \
+	${MKDIR} ${STAGEDIR}${PREFIX}/lib/janet/.manifests
+	${INSTALL_SCRIPT} ${WRKDIR}/janet-lsp \
 		${STAGEDIR}${PREFIX}/bin/${PORTNAME}
+	${INSTALL_DATA} ${WRKSRC}/jpm_tree/lib/janet-lsp.jimage \
+		${STAGEDIR}${PREFIX}/lib/janet/janet-lsp.jimage
+	${INSTALL_DATA} ${WRKSRC}/jpm_tree/lib/.manifests/janet-lsp.jdn \
+		${STAGEDIR}${PREFIX}/lib/janet/.manifests/janet-lsp.jdn
 
 do-test:
 	cd ${WRKSRC} && jpm test -l
diff --git a/devel/janet-lsp/files/janet-lsp.in b/devel/janet-lsp/files/janet-lsp.in
new file mode 100644
index 000000000000..69eea77d05c3
--- /dev/null
+++ b/devel/janet-lsp/files/janet-lsp.in
@@ -0,0 +1,11 @@
+@comment | This file is normally created by `jpm install`. The problem is that
+@comment | it uses the path from --tree for janet and the full path to that tree
+@comment | for the image. Both wrong.
+@comment | See work/janet-lsp-*/jpm_tree/bin/janet-lsp for the version with the
+@comment | wrong paths that this replaces. It is this small.
+#!%%LOCALBASE%%/bin/janet
+(import janet-lsp)
+(put root-env :syspath "%%LOCALBASE%%/lib")
+
+(defn main [& args]
+  (janet-lsp/main ;args))
diff --git a/devel/janet-lsp/files/patch-project.janet b/devel/janet-lsp/files/patch-project.janet
deleted file mode 100644
index 90c646d2579e..000000000000
--- a/devel/janet-lsp/files/patch-project.janet
+++ /dev/null
@@ -1,29 +0,0 @@
---- project.janet.orig	2025-09-05 00:00:02 UTC
-+++ project.janet
-@@ -7,16 +7,17 @@
-                  "https://github.com/ianthehenry/judge.git"
-                  "https://github.com/CFiggers/cmd.git"])
- 
--# (def cflags
--#   (case (os/which)
--#     :windows []
--#     ["-s"]))
-+(def cflags
-+  (case (os/which)
-+    :windows []
-+    :freebsd []
-+    ["-s"]))
- 
--# (declare-executable
--#   :name "janet-lsp"
--#   :entry "src/main.janet"
--#   :cflags cflags
--#   :install true)
-+(declare-executable
-+  :name "janet-lsp"
-+  :entry "src/main.janet"
-+  :cflags cflags
-+  :install true)
- 
- (declare-archive
-   :name "janet-lsp"


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6942e16d.f9cd.68e722f7>