From patchwork Thu Dec 30 07:39:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philip McGrath X-Patchwork-Id: 35785 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 2C46D27BBEA; Thu, 30 Dec 2021 07:45:24 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id A400727BBE9 for ; Thu, 30 Dec 2021 07:45:23 +0000 (GMT) Received: from localhost ([::1]:57558 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n2q7m-0002CT-QO for patchwork@mira.cbaines.net; Thu, 30 Dec 2021 02:45:22 -0500 Received: from eggs.gnu.org ([209.51.188.92]:54314) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n2q6Y-00017Z-62 for guix-patches@gnu.org; Thu, 30 Dec 2021 02:44:06 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:39540) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n2q6X-0001ng-Pp for guix-patches@gnu.org; Thu, 30 Dec 2021 02:44:05 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1n2q6X-0006jE-PB for guix-patches@gnu.org; Thu, 30 Dec 2021 02:44:05 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#51838] [PATCH v6 24/41] gnu: Add node-addon-api. Resent-From: Philip McGrath Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 30 Dec 2021 07:44:05 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 51838 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 51838@debbugs.gnu.org Cc: Timothy Sample , Pierre Langlois , Jelle Licht , Philip McGrath , Liliana Marie Prikler Received: via spool by 51838-submit@debbugs.gnu.org id=B51838.164085020325622 (code B ref 51838); Thu, 30 Dec 2021 07:44:05 +0000 Received: (at 51838) by debbugs.gnu.org; 30 Dec 2021 07:43:23 +0000 Received: from localhost ([127.0.0.1]:51047 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n2q5q-0006f6-Tt for submit@debbugs.gnu.org; Thu, 30 Dec 2021 02:43:23 -0500 Received: from mail-qt1-f175.google.com ([209.85.160.175]:36862) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n2q4v-0006az-2j for 51838@debbugs.gnu.org; Thu, 30 Dec 2021 02:42:25 -0500 Received: by mail-qt1-f175.google.com with SMTP id m18so20594331qtk.3 for <51838@debbugs.gnu.org>; Wed, 29 Dec 2021 23:42:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=philipmcgrath.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ZQNRZ21t1s3mz7sVPdYbg4hetDV2xxZ7/XdItQJKTnA=; b=YtBQAlKIDWMWCzP2MIU8L+r9EQAaKjZhponfZiy//B40nEdN5EWNoBqZKF14OC1zGn gvbnW+Ifq4l/L65oAe+owCZ55fHrLGpzOMPR/a+MBv0mUiLsOB0bRZRjs0ufWZqKOPeV S9v62SyDoGbKfTsSsKiSmXZoQmaTH0yXFWE4T126KD+9BIS3c+TbJUet6bARgOq2IsrS xGZsibm68uMvgaxR6/U5nNQspN4oaoF5iMcoZtB2tzuGnMgpz+f4l+SBp92nr5A/K5kH QJ6BSV54n1AdHmtMsHyzWgmTaZqxpxgnrP4IJNMtqT8OlSC6MOWc7xvKPPd0T/iv8opl jEaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ZQNRZ21t1s3mz7sVPdYbg4hetDV2xxZ7/XdItQJKTnA=; b=r8QU8MS8I5+NjEjGX/v6zoKieAJKAR7abjwa8aST+ZGzzEmxULtvPmasIv1RFahDt7 zUyj6pGwiyoN9MTsGX+LCAXEq2XsfFIKL5Pi4bdTQvRtRenMVF58FtcteteqaawxspJ6 mmBNWuGUXIpZYFNeREJpxbaAHatmV8S8lR2Y9f5wC1PTEzir8GoBSLO8ZUTxDvmq2wpX WXNcSiRRtGRelgyTHPJXkTVwM6okByf2fYkMfh9312d9DlE5KrVzs3JshpbdZAf/C8PM oQ5DbvRxGZ34HTaCH7zkn2Ff5cLXAMaOetkfG/Sdm0fnihgZly+gfbamCLwpAuCr1+5K CgRw== X-Gm-Message-State: AOAM532ih3xnol0m0kZ8G02NmuzAIa79IKlyoXelM3/Vek0T28JEdeDV YZhiwsKqtNSgHrZ19XFJpwNH1G5NHIH3dQ5e X-Google-Smtp-Source: ABdhPJw947eK/A09AgWr9MwFTQp95BSIASw53fgKPYm1PlrvdzvzxbcoymI/ItnLsA9j8mitYkukWg== X-Received: by 2002:a05:622a:590:: with SMTP id c16mr25883665qtb.289.1640850139577; Wed, 29 Dec 2021 23:42:19 -0800 (PST) Received: from localhost (c-73-125-89-242.hsd1.fl.comcast.net. [73.125.89.242]) by smtp.gmail.com with UTF8SMTPSA id br43sm19799938qkb.57.2021.12.29.23.42.18 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 29 Dec 2021 23:42:19 -0800 (PST) From: Philip McGrath Date: Thu, 30 Dec 2021 02:39:02 -0500 Message-Id: <20211230073919.30327-25-philip@philipmcgrath.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211230073919.30327-1-philip@philipmcgrath.com> References: <082a81964a43ae5f735ad2ca433d0dfe00859c35.camel@gmail.com> <20211230073919.30327-1-philip@philipmcgrath.com> MIME-Version: 1.0 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" X-getmail-retrieved-from-mailbox: Patches * gnu/packages/node-xyz.scm (node-addon-api): New variable. --- gnu/packages/node-xyz.scm | 87 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm index 4eda001dc4..656642eb43 100644 --- a/gnu/packages/node-xyz.scm +++ b/gnu/packages/node-xyz.scm @@ -22,6 +22,9 @@ (define-module (gnu packages node-xyz) #:use-module ((guix licenses) #:prefix license:) + #:use-module (gnu packages sqlite) + #:use-module (gnu packages python) + #:use-module (guix gexp) #:use-module (guix packages) #:use-module (guix git-download) #:use-module (guix build-system node)) @@ -642,3 +645,87 @@ (define-public node-nan This project also contains some helper utilities that make addon development a bit more pleasant.") (license license:expat))) + +(define-public node-addon-api + (package + (name "node-addon-api") + (version "4.2.0") + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/nodejs/node-addon-api") + (commit (string-append "v" version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 "1bhvfi2m9nxfz418s619914vmidcnrzbjv6l9nid476c3zlpazch")))) + (inputs + (list python node-safe-buffer)) + (build-system node-build-system) + (arguments + `(#:modules + ((guix build node-build-system) + (srfi srfi-1) + (ice-9 match) + (guix build utils)) + #:phases + (modify-phases %standard-phases + (add-after 'patch-dependencies 'delete-dependencies + (lambda args + (with-atomic-json-file-replacement "package.json" + (lambda (pkg-meta) + (delete-dependencies pkg-meta + `("benchmark" + "bindings" + "clang-format" + "eslint" + "eslint-config-semistandard" + "eslint-config-standard" + "eslint-plugin-import" + "eslint-plugin-node" + "eslint-plugin-promise" + "fs-extra" + "path" + "pre-commit")))))) + (add-after 'unpack 'skip-js-tests + ;; We can't run the js-based tests, + ;; but we can still do the C++ parts + (lambda args + (define new-test-script + "echo stopping after pretest on Guix") + (with-atomic-json-file-replacement "package.json" + (match-lambda + (('@ . pkg-meta-alist) + (cons + '@ + (map (match-lambda + (("scripts" '@ . scripts-alist) + `("scripts" @ ,@(map (match-lambda + (("test" . _) + (cons "test" + new-test-script)) + (other + other)) + scripts-alist))) + (other + other)) + pkg-meta-alist)))))))))) + (home-page "https://github.com/nodejs/node-addon-api") + (synopsis "Node.js API (Node-API) header-only C++ wrappers") + (description "This module contains header-only C++ wrapper classes which +simplify the use of the C based Node-API provided by Node.js when using C++. +It provides a C++ object model and exception handling semantics with low +overhead. + +Node-API is an ABI stable C interface provided by Node.js for building native +addons. It is intended to insulate native addons from changes in the +underlying JavaScript engine and allow modules compiled for one version to run +on later versions of Node.js without recompilation. The @code{node-addon-api} +module, which is not part of Node.js, preserves the benefits of the Node-API +as it consists only of inline code that depends only on the stable API +provided by Node-API. + +It is important to remember that @emph{other} Node.js interfaces such as +@code{libuv} (included in a project via @code{#include }) are not +ABI-stable across Node.js major versions.") + (license license:expat)))