git: 54bba809860b - main - www/deno: Improve port

From: Vladimir Druzenko <vvd_at_FreeBSD.org>
Date: Mon, 06 Jul 2026 23:42:50 UTC
The branch main has been updated by vvd:

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

commit 54bba809860ba886a8d0eedd1c7f4ef2cc31a442
Author:     Vladimir Druzenko <vvd@FreeBSD.org>
AuthorDate: 2026-07-06 23:38:50 +0000
Commit:     Vladimir Druzenko <vvd@FreeBSD.org>
CommitDate: 2026-07-06 23:38:50 +0000

    www/deno: Improve port
    
    - Fix dependencies.
    - Fix PREFIX and LOCALBASE usage.
    - Fix warnings from portclippy.
    - Merge INSTALL_PROGRAMs.
    - Split long line in do-test.
    
    PR:             296548
    Sponsored by:   UNIS Labs
---
 www/deno/Makefile                                  | 48 +++++++++++-----------
 www/deno/files/patch-cli_task__runner.rs           |  8 ++--
 .../files/patch-tests_unit__node_process__test.ts  |  2 +-
 3 files changed, 28 insertions(+), 30 deletions(-)

diff --git a/www/deno/Makefile b/www/deno/Makefile
index 65a2a852238a..6c84c0438ecf 100644
--- a/www/deno/Makefile
+++ b/www/deno/Makefile
@@ -1,6 +1,7 @@
 PORTNAME=	deno
 DISTVERSIONPREFIX=	v
 DISTVERSION=	2.9.1
+PORTREVISION=	1
 CATEGORIES=	www
 
 MAINTAINER=	ports@FreeBSD.org
@@ -16,22 +17,19 @@ BUILD_DEPENDS=	bindgen:devel/rust-bindgen-cli \
 		gn:devel/gn \
 		protoc:devel/protobuf
 LIB_DEPENDS=	libdbus-1.so:devel/dbus \
-		libffi.so:devel/libffi \
 		liblcms2.so:graphics/lcms2 \
-		libonig.so:devel/oniguruma \
 		libzstd.so:archivers/zstd
 
-USES=		cargo cpe gmake gnome llvm:min=21,build ninja:build pkgconfig:build python:build
-
+USES=		cargo cpe gmake llvm:min=21,build ninja:build pkgconfig python:build
 USE_GITHUB=	yes
 GH_ACCOUNT=	denoland
 GH_TUPLE=	denoland:deno_lsp_benchdata:a787434:denolsp/tests/bench/testdata/lsp_benchdata \
 		denoland:node_test:195065d:nodetest/tests/node_compat/runner/suite \
 		denoland:std:9c5b710:denostd/tests/util/std \
 		web-platform-tests:wpt:d85e753e65ee8e9654e76a2b4d62b9b5a0ac51e7:webp/tests/wpt/suite
+USE_LDCONFIG=	yes
 
-USE_GNOME=	glib20
-
+CARGO_INSTALL=	no
 CARGO_ENV+=	V8_FROM_SOURCE=1 \
 		GN=${PREFIX}/bin/gn \
 		NINJA=${NINJA_CMD} \
@@ -40,8 +38,8 @@ CARGO_ENV+=	V8_FROM_SOURCE=1 \
 		LCMS2_LIB_DIR="${LOCALBASE}/lib" \
 		CARGO_PROFILE_RELEASE_LTO="false" \
 		GN_ARGS="clang_use_chrome_plugins=false \
-		extra_cppflags=\"-idirafter ${LOCALBASE}/include -idirafter ${X11BASE}/include\" \
-		extra_ldflags=\"-L${LOCALBASE}/lib -L${X11BASE}/lib\" \
+		extra_cppflags=\"-idirafter ${LOCALBASE}/include\" \
+		extra_ldflags=\"-L${LOCALBASE}/lib\" \
 		fatal_linker_warnings=false \
 		is_clang=true \
 		use_custom_libcxx=true \
@@ -52,29 +50,27 @@ CARGO_ENV+=	V8_FROM_SOURCE=1 \
 		use_glib=false \
 		v8_enable_cet_ibt=true"
 
+WITHOUT_LTO=	yes
+
+BINARY_ALIAS=	python3=${PYTHON_CMD}
+
 PLIST_FILES=	bin/${PORTNAME} \
 		bin/denort \
 		lib/libdenort.so
 
-BINARY_ALIAS=	python3=${PYTHON_CMD}
-
 DENO_CORE_ICUDATA_V=	0.77.0
 V8_CARGO_V=		149.4.0
 
 V8_DISTDIR=	${CARGO_VENDOR_DIR}/v8-${V8_CARGO_V}
 V8_BPGO_DIR=	${V8_DISTDIR}/v8/tools/builtins-pgo
 
-CARGO_INSTALL=	no
-
-WITHOUT_LTO=	yes
-
 post-patch:
-	${REINPLACE_CMD} "s|%%PREFIX%%|${PREFIX}|" \
-		${WRKSRC}/ext/os/lib.rs
-	${REINPLACE_CMD} "s|${PREFIX}|${PREFIX}|" \
+	${REINPLACE_CMD} "s|%%PREFIX%%|${PREFIX}|g" \
 		${WRKSRC}/cli/task_runner.rs \
+		${WRKSRC}/ext/os/lib.rs
+	${REINPLACE_CMD} "s|%%LOCALBASE%%|${LOCALBASE}|g" \
 		${WRKSRC}/tests/unit_node/process_test.ts
-	${REINPLACE_CMD} -e "s|%%LLVM_PREFIX%%|${LLVM_PREFIX}|g" \
+	${REINPLACE_CMD} "s|%%LLVM_PREFIX%%|${LLVM_PREFIX}|g" \
 		${WRKSRC}/cargo-crates/v8-${V8_CARGO_V}/build/toolchain/gcc_toolchain.gni
 	${REINPLACE_CMD} "s|linux|freebsd|g" \
 		${WRKSRC}/tests/ffi/testdata/ffi_callback_errors.ts \
@@ -98,14 +94,16 @@ post-patch:
 	${CP} ${CARGO_VENDOR_DIR}/deno_core_icudata-${DENO_CORE_ICUDATA_V}/src/icudtl.dat \
 		${V8_DISTDIR}/third_party/icu/common/
 
+do-install:
+	${INSTALL_PROGRAM} \
+		${CARGO_TARGET_DIR}/*/deno \
+		${CARGO_TARGET_DIR}/*/denort ${STAGEDIR}${PREFIX}/bin
+	${INSTALL_LIB} ${CARGO_TARGET_DIR}/*/libdenort.so ${STAGEDIR}${PREFIX}/lib
+
 # do not pass RUST_BACKTRACE=1 to cargo test as some tests fails if it's there
 do-test:
-	cd ${WRKSRC} ; \
-		${SETENVI} ${WRK_ENV} ${MAKE_ENV} ${CARGO_ENV:S/RUST_BACKTRACE=1//g} ${CARGO} test -vv ${CARGO_BUILD_ARGS}
-
-do-install:
-	${INSTALL_PROGRAM} ${CARGO_TARGET_DIR}/*/deno ${STAGEDIR}${LOCALBASE}/bin
-	${INSTALL_PROGRAM} ${CARGO_TARGET_DIR}/*/denort ${STAGEDIR}${LOCALBASE}/bin
-	${INSTALL_LIB} ${CARGO_TARGET_DIR}/*/libdenort.so ${STAGEDIR}${LOCALBASE}/lib
+	(cd ${WRKSRC} && \
+		${SETENVI} ${WRK_ENV} ${MAKE_ENV} ${CARGO_ENV:S/RUST_BACKTRACE=1//g} \
+			${CARGO} test -vv ${CARGO_BUILD_ARGS})
 
 .include <bsd.port.mk>
diff --git a/www/deno/files/patch-cli_task__runner.rs b/www/deno/files/patch-cli_task__runner.rs
index 7d5bc4f87b8e..8c78027366fc 100644
--- a/www/deno/files/patch-cli_task__runner.rs
+++ b/www/deno/files/patch-cli_task__runner.rs
@@ -9,7 +9,7 @@ Index: cli/task_runner.rs
 -          .and_then(|p| canonicalize_path(&p))
 -          .unwrap(),
 +          std::env::current_exe()
-+            .unwrap_or_else(|_| PathBuf::from("${PREFIX}/bin/deno")),
++            .unwrap_or_else(|_| PathBuf::from("%%PREFIX%%/bin/deno")),
        )
        .execute(ShellCommandContext {
          args,
@@ -19,7 +19,7 @@ Index: cli/task_runner.rs
        std::env::current_exe()
 -        .and_then(|p| canonicalize_path(&p))
 -        .unwrap(),
-+         .unwrap_or_else(|_| PathBuf::from("${PREFIX}/bin/deno")),
++         .unwrap_or_else(|_| PathBuf::from("%%PREFIX%%/bin/deno")),
      ))
    }
  }
@@ -29,7 +29,7 @@ Index: cli/task_runner.rs
        std::env::current_exe()
 -        .and_then(|p| canonicalize_path(&p))
 -        .unwrap(),
-+        .unwrap_or_else(|_| PathBuf::from("${PREFIX}/bin/deno")),
++        .unwrap_or_else(|_| PathBuf::from("%%PREFIX%%/bin/deno")),
      )
      .execute(ShellCommandContext {
        args,
@@ -39,7 +39,7 @@ Index: cli/task_runner.rs
        std::env::current_exe()
 -        .and_then(|p| canonicalize_path(&p))
 -        .unwrap(),
-+        .unwrap_or_else(|_| PathBuf::from("${PREFIX}/bin/deno")),
++        .unwrap_or_else(|_| PathBuf::from("%%PREFIX%%/bin/deno")),
      );
      // set this environment variable so that the launched process knows the npm command name
      context.state.apply_env_var(
diff --git a/www/deno/files/patch-tests_unit__node_process__test.ts b/www/deno/files/patch-tests_unit__node_process__test.ts
index c7646970148d..f3f625afdf32 100644
--- a/www/deno/files/patch-tests_unit__node_process__test.ts
+++ b/www/deno/files/patch-tests_unit__node_process__test.ts
@@ -5,7 +5,7 @@
      });
  
 -    const shell = "/bin/bash";
-+    const shell = "${PREFIX}/bin/bash";
++    const shell = "%%LOCALBASE%%/bin/bash";
      const cmd =
        `"${Deno.execPath()}" run ${scriptPath} < /dev/tcp/127.0.0.1/9000`;
      const args = ["-c", cmd];