From patchwork Fri Jun 6 12:05:35 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dan Khodabakhsh X-Patchwork-Id: 43034 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 8682A27BC49; Fri, 6 Jun 2025 13:06:44 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=unavailable version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 1604827BC4A for ; Fri, 6 Jun 2025 13:06:44 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uNVq5-0007Ot-Tv; Fri, 06 Jun 2025 08:06:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uNVpl-0007MU-TM for guix-patches@gnu.org; Fri, 06 Jun 2025 08:06:10 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uNVpj-00020U-E3 for guix-patches@gnu.org; Fri, 06 Jun 2025 08:06:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=Date:Mime-Version:From:To:In-Reply-To:References:Subject; bh=lsaghsCkElZWXuo+XasiyCdTJOiz4QSSMVH2DANtEug=; b=lTfONd5kEyTeAIUMTckwpQNKxlbPG3YwgVS5Cxhd+0vC2naCZZmQo3Sd5Cl1aLu6HOZuiAISXBXhWFMHs9/Ib2/GwvrJosHOaUCKp2klTj1Yf6VGy9+bfzZGRzrESNNfO+dOv51/86yiL+lkc5WwofzH/LiRvBmNkmeG13nAGraN+WoNz7w6lsNDavJNtXaDNP3DuDOedppPQt8smxtYgHZVhmcpIgweSrxXdv7XwIm01ODTF2jxWLrx4h08z+J0In/RamkSRavz3FEsQ0puEHxc6br9gG0zxzjJKr40fyqpoHWP+12gVaa/q7BBqKhcCnU4Ov0gpQ/8v12jRnvStg==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1uNVph-0001c7-PZ for guix-patches@gnu.org; Fri, 06 Jun 2025 08:06:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#78183] [PATCH 1/1] gnu: node-esbuild: Replace esbuild-node with node-esbuild References: In-Reply-To: Resent-From: "Dan Khodabakhsh" Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 06 Jun 2025 12:06:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 78183 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: "78183" <78183@debbugs.gnu.org> Received: via spool by 78183-submit@debbugs.gnu.org id=B78183.17492115566192 (code B ref 78183); Fri, 06 Jun 2025 12:06:01 +0000 Received: (at 78183) by debbugs.gnu.org; 6 Jun 2025 12:05:56 +0000 Received: from localhost ([127.0.0.1]:42525 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uNVpb-0001bn-EI for submit@debbugs.gnu.org; Fri, 06 Jun 2025 08:05:56 -0400 Received: from xmbghk7.mail.qq.com ([43.163.128.53]:43013) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uNVpU-0001bF-T7 for 78183@debbugs.gnu.org; Fri, 06 Jun 2025 08:05:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niel.khodabakh.sh; s=xmailafb52b5a; t=1749211537; bh=lsaghsCkElZWXuo+XasiyCdTJOiz4QSSMVH2DANtEug=; h=From:To:Subject:Date; b=VwrqXdapMiqyAPdXO2dEzlljUBrc4aBJkRcbGuWppfQGDACJY7Y4clPklOto4YtzE ocUwSBav7eQW5m6gN/4fAyM41hrlYgwr+sWtrL9EH+R/IIfFY+y9Xv6/J9DDfw6xNK ItwNfOklY2IIkMqKh62yfT+UeL0qOK3x04j8LAjg= X-QQ-XMRINFO: Nq+8W0+stu50PRdwbJxPCL0= X-QQ-XMAILINFO: MMvVzQSdFuTpkBW6Xx/mxTUD77dx23a05X1CXVPpBL3uuUZNpeHxvVpd0kon8k YF9kzQaaCXksp2YKCGQLcw6PKETryOLbFbOaFMvNgECJs228pNpNydT93WRuV0pDPqRrVVsMczKbc tdDD5Fc9YIUhqXym1nSNXMzisyPv8Tfesd+umF8Qb1H41ZQyg3f9+UQxJ4piHuF0k4WuMY4DM8P5p zQ6x6Gf+tVf5MGF7wJ1gQq/0nU+EWg3NHHstsb3HaggLGgBMS6S6OwupOI5M0l70QPzb/rFcXkXyH rm/rAlr61CIY/I5khBGx+Uo/r6uv3C6pLbBf8h9bmntODJS6IXKdQbv1UCxtYNf99e10YyPX1bHnH oPdEE+kcsxxKQEBhFD7k8HX9QoUJpLeml600I3y8DiVYacTumfc4kHcBdK0fwcSBzPv9uPYF9nmHZ dFndwGzWGoi1njeZXrapvBx/NmhJGnJHG+W4zw7HmbKY9vqq01qfo3Mx31K5QP/044MxXPN36WS3j eXGv0oTlRPoRKuaKcVpnaHeDsZ/Szeae2Noqlwla3R5vJ+Eg6FNgKR63f74q1A3qaCSiz9q2SqItG dv5toJUDXOb+TwTL3k2XZK1OnSUxKwYSVVx8yJHzMJxDZBAPHyd35k7Z1ZyoPBUZh/30hchtxdwlC gJd3DpBxUYPI4J+wTtmdkbOZNr4yV/AcHoWYT2N/ggiDvNuqLqAXbf119WN1nLjFYTfryzPKjNX+b TcVkg0yecNWy0Z83AayK9/NyIq3t8o3LvBEl8VzywwC8pLj+UPbVIy+hXufZ7Dwfd7zd7U3OZSy9R CEbSSHQuxZrhqumDL2zI9HtBGcI8REg5XZ4oOqnHlCgg4fi2OsPR8xFan/Urb/Gme9O6mHnIg/Wwf 8dK6Ui3TLWpHoN+1oS51eKzAkXXmIp8dIhd48Zd69Ikd1Z8towDv6EpM5KScPLqBt+McuIMqZ2rBQ kB4mkHVPZ83azvShwBvjbmC7l3/HuX1yt7DiSsXe5KbZDmrk+eNpgfOrhu3iXt7sR1oYZd5qwJ0TC 4zYSKa7fVl8MojCjMM5DMRVRouw== From: "Dan Khodabakhsh" Mime-Version: 1.0 Date: Fri, 6 Jun 2025 12:05:35 +0000 X-Priority: 3 Message-ID: X-QQ-MIME: TCMime 1.0 by Tencent X-Mailer: QQMail 2.x X-QQ-Mailer: QQMail 2.x X-QQ-mid: xmsezc29-1t1749211535tjgplpju6 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches Another change. Finally got around to using this package in another package i'm packaging. There were issues resolving the path to the esbuild binary so I patched the source slightly. From: Daniel Khodabakhsh Date: Thu, 29 May 2025 21:28:53 -0700 Subject: [PATCH] gnu: node-esbuild: Replace esbuild-node with node-esbuild. This change replaces the esbuild-node package with one named node-esbuild: * node-esbuild conforms to the name of node packages. * Uses (guix build-system node) instead of (guix build-system go) which is more appropriate because this is a node package. * Uses esbuild as an input to use its binary so that it isn't rebuilt. * Does not include the go-lang source by default. * Does not include the lib/node_modules/esbuild/bin/esbuild shim javascript file, but instead uses the actual binary. The shim file is supposed to be replaced as part of the node module build process. Here is the structure of node-esbuild: ├── bin │ └── esbuild -> ../lib/node_modules/esbuild/bin/esbuild ├── etc │ └── ld.so.cache ├── lib │ └── node_modules │ └── esbuild │ ├── bin │ │ └── esbuild <- Actual binary │ ├── lib │ │ ├── main.d.ts │ │ └── main.js │ ├── LICENSE.md │ ├── package.json │ └── README.md └── share └── doc └── node-esbuild-0.24.0 └── LICENSE.md Structure of esbuild-node ├── bin │ └── esbuild <- Actual binary ├── etc │ └── ld.so.cache ├── lib │ └── node_modules │ └── esbuild │ ├── bin │ │ └── esbuild <- Javascript file which tries to run /bin/esbuild │ ├── install.js │ ├── lib │ │ ├── main.d.ts │ │ └── main.js │ ├── package.json │ └── README.md ├── share │ └── doc │ └── esbuild-node-0.14.0 │ └── LICENSE.md └── src └── github.com └── evanw └── esbuild └── cmd └── esbuild ├── main.go ├── main_other.go ├── main_wasm.go ├── service.go ├── stdio_protocol.go └── version.go Structure of the NPM package: ├── bin │ └── esbuild <- Actual binary ├── install.js ├── lib │ ├── main.d.ts │ └── main.js ├── LICENSE.md ├── package.json └── README.md Change-Id: I29533e9e1f3165224f7c1581b72e6b4bc53d3c97 --- gnu/packages/cran.scm | 3 +- gnu/packages/web.scm | 101 +++++++++++++++++++++--------------------- 2 files changed, 52 insertions(+), 52 deletions(-) base-commit: b750d54703d849fe58dcacf94f23d34ab85b23a2 diff --git a/gnu/packages/cran.scm b/gnu/packages/cran.scm index 1e674bd14b..a68cb9a5f7 100644 --- a/gnu/packages/cran.scm +++ b/gnu/packages/cran.scm @@ -41,6 +41,7 @@ ;;; Copyright © 2024 Marco Baggio ;;; Copyright © 2024, 2025 Spencer King ;;; Copyright © 2024-2025 Tor-björn Claesson +;;; Copyright © 2025 Daniel Khodabakhsh ;;; ;;; This file is part of GNU Guix. ;;; @@ -6695,7 +6696,7 @@ (define-public r-waiter "inst/assets/garcon/garcon.min.js")))))) (propagated-inputs (list r-htmltools r-r6 r-shiny)) (native-inputs - (list esbuild-node node-lts r-knitr + (list node-esbuild node-lts r-knitr (origin (method git-fetch) (uri (git-reference diff --git a/gnu/packages/web.scm b/gnu/packages/web.scm index 14892c4ef7..9e4dbd0e68 100644 --- a/gnu/packages/web.scm +++ b/gnu/packages/web.scm @@ -70,6 +70,7 @@ ;;; Copyright © 2024 Zheng Junjie <873216071@qq.com> ;;; Copyright © 2024, 2025 Artyom V. Poptsov ;;; Copyright © 2025 Raven Hallsby +;;; Copyright © 2025 Daniel Khodabakhsh ;;; ;;; This file is part of GNU Guix. ;;; @@ -104,6 +105,7 @@ (define-module (gnu packages web) #:use-module (guix build-system gnu) #:use-module (guix build-system go) #:use-module (guix build-system meson) + #:use-module (guix build-system node) #:use-module (guix build-system perl) #:use-module (guix build-system pyproject) #:use-module (guix build-system python) @@ -2198,57 +2200,54 @@ (define-public websockify directions.") (license license:lgpl3))) -;; This is a variant of esbuild that builds and installs the nodejs API. -;; Eventually, this should probably be merged with the esbuild package. -(define-public esbuild-node - (package - (inherit esbuild) - (name "esbuild-node") - (version "0.14.0") - (source - (origin - (method git-fetch) - (uri (git-reference - (url "https://github.com/evanw/esbuild") - (commit (string-append "v" version)))) - (file-name (git-file-name name version)) - (sha256 - (base32 "09r1xy0kk6c9cpz6q0mxr4why373pwxbm439z2ihq3k1d5kk7x4w")) - (modules '((guix build utils))) - (snippet - ;; Remove prebuilt binaries - '(delete-file-recursively "lib/npm/exit0")))) - (arguments - (list - #:import-path "github.com/evanw/esbuild/cmd/esbuild" - #:unpack-path "github.com/evanw/esbuild" - #:phases - #~(modify-phases %standard-phases - (add-after 'build 'build-platform - (lambda* (#:key unpack-path #:allow-other-keys) - (with-directory-excursion (string-append "src/" unpack-path) - ;; Must be writable. - (for-each make-file-writable (find-files "." ".")) - (invoke "node" "scripts/esbuild.js" - (string-append #$output "/bin/esbuild")) - (let ((modules (string-append #$output "/lib/node_modules/esbuild"))) - (mkdir-p modules) - (copy-recursively "npm/esbuild" modules))))) - (replace 'check - (lambda* (#:key tests? unpack-path #:allow-other-keys) - (when tests? - ;; The "Go Race Detector" is only supported on 64-bit - ;; platforms, this variable disables it. - ;; TODO: Causes too many rebuilds, rewrite to limit to x86_64, - ;; aarch64 and ppc64le. - #$(if (target-riscv64?) - `(setenv "ESBUILD_RACE" "") - #~(unless #$(target-64bit?) - (setenv "ESBUILD_RACE" ""))) - (with-directory-excursion (string-append "src/" unpack-path) - (invoke "make" "test-go")))))))) - (native-inputs - (list go-github-com-kylelemons-godebug node-lts)))) +; NOTE: in web.scm because of dependency issues when using (package-* esbuild) +(define-public node-esbuild + (package + (name "node-esbuild") + (version (package-version esbuild)) + (source + (origin + (inherit (package-source esbuild)) + (file-name (git-file-name name version)) + (snippet #f) + (modules '()))) + (build-system node-build-system) + (inputs (list esbuild)) + (arguments (list + #:tests? #f + #:phases #~(modify-phases %standard-phases + (add-after 'unpack 'chdir (lambda _ + (chdir "npm/esbuild"))) + (add-before 'patch-dependencies 'modify-package (lambda _ + (modify-json + (delete-fields '("optionalDependencies" "scripts"))) + (substitute* "../../lib/npm/node-platform.ts" + (("^export var ESBUILD_BINARY_PATH:.+$") + (string-append "export var ESBUILD_BINARY_PATH: string" + " = process.env.ESBUILD_BINARY_PATH" + " || ESBUILD_BINARY_PATH" + " || path.join(__dirname, '..', 'bin', 'esbuild')"))))) + (replace 'build (lambda* (#:key inputs #:allow-other-keys) + ; From scripts/esbuild.js + (invoke + "esbuild" + "../../lib/npm/node.ts" + "--outfile=lib/main.js" + "--bundle" + "--target=node10" + "--define:WASM=false" + (string-append "--define:ESBUILD_VERSION=\"" #$version "\"") + "--external:esbuild" + "--platform=node" + "--log-level=warning") + (copy-file "../../lib/shared/types.ts" "lib/main.d.ts") + (install-file + (string-append (assoc-ref inputs "esbuild") "/bin/esbuild") + "bin")))))) + (home-page (package-home-page esbuild)) + (synopsis "Node module of ESBuild") + (description (package-description esbuild)) + (license (package-license esbuild)))) (define-public wwwoffle (package