From patchwork Thu Nov 16 19:15:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Philip McGrath X-Patchwork-Id: 56525 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 C928327BBE9; Thu, 16 Nov 2023 19:17:46 +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,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 BAFBA27BBE2 for ; Thu, 16 Nov 2023 19:17:44 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r3hrN-0003Yb-JI; Thu, 16 Nov 2023 14:17:05 -0500 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 1r3hrM-0003Xy-5I for guix-patches@gnu.org; Thu, 16 Nov 2023 14:17:04 -0500 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 1r3hrL-0003Dc-TE for guix-patches@gnu.org; Thu, 16 Nov 2023 14:17:03 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1r3hrL-0003lS-87 for guix-patches@gnu.org; Thu, 16 Nov 2023 14:17:03 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#67019] [PATCH v2 03/16] gnu: Add lessc. Resent-From: Philip McGrath Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 16 Nov 2023 19:17:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 67019 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 67019@debbugs.gnu.org Cc: Philip McGrath , Liliana Marie Prikler Received: via spool by 67019-submit@debbugs.gnu.org id=B67019.170016220714371 (code B ref 67019); Thu, 16 Nov 2023 19:17:03 +0000 Received: (at 67019) by debbugs.gnu.org; 16 Nov 2023 19:16:47 +0000 Received: from localhost ([127.0.0.1]:44548 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r3hr3-0003jN-RO for submit@debbugs.gnu.org; Thu, 16 Nov 2023 14:16:47 -0500 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:49843) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r3hr0-0003i9-D2 for 67019@debbugs.gnu.org; Thu, 16 Nov 2023 14:16:43 -0500 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 763D85C01DC; Thu, 16 Nov 2023 14:16:37 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Thu, 16 Nov 2023 14:16:37 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= philipmcgrath.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm1; t=1700162197; x=1700248597; bh=Xv OdDLqITROSIaJCOiKqKZz7yf9S3X44B15JWjrJT20=; b=JhYAaRDghhdFWTa6IV BcL+qt6Gyj2u0t4xZSLPMV0biVHSzXAD5CQeTyZ8OtwYiUdP5RVCZfyRu3mCe8zP kkt/2N/dKau9U5jYxRaKBz0yTFY2EiY+jFcez3da+7i1xcXrnW0UaF5GhW7tWcub zHSjEboVYpSBD2hKWvwRnfee2s8Pbbz7uz6nWeDpEAHcYE5dVpl7GVbI3B2OppVf ObE8yX0q7DccQNHN9fNxsECookk90K1QzuR71VxIzkTff9ZvseR353VplwTz4lGK 4d0r8jckdV2HEQgJD2JZSWkVVocVdXJG9JXSRVOt/MJV9BJfnxM8XEkTpOhi6TIc AGoQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1700162197; x=1700248597; bh=XvOdDLqITROSIaJCOiKqKZz7yf9S3X44B15 JWjrJT20=; b=L1McXzZQiMmDvzfgNP1pfcwZZYSpo8eW4jKOPg2Ti5I2LytWzoN 8hCFtjm0BoDdae+dBDRZ38ErYAj3Unu46j7I0nFBjPWuIcMSnXMW1tHDqICdNLqx QqEZXOMvOi5L8xxj2IecalVs2DfLEjcLBM3b8daiLAEEFfABB6hMVzeS3Pd3Hojb X2Hy4L66ADepG4wL4YeL1Alkxrln7Tz+N2AutIwoUnnIiDvxMW/KeA7kPsVVU23f ezewgRPLgHd/dOP/mpET7ghCkIBNxxSZ1kGhJMHLNnucP2MNLovXEDu8/wLVax2k LnYs5K4mqQtYdSYP75ltguf8urqwW9R1mMg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrudefkedguddvtdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefhvfevufffkffojghfgggtgfesthekredtredtjeenucfhrhhomheprfhh ihhlihhpucfotgfirhgrthhhuceophhhihhlihhpsehphhhilhhiphhmtghgrhgrthhhrd gtohhmqeenucggtffrrghtthgvrhhnpefhgfekhfdtgfeitdetuefhvedvteefvdevuddt kefgvdevhfekveejuefgfeekheenucffohhmrghinhepghhithhhuhgsrdgtohhmpdhlvg hsshgtshhsrdhorhhgnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghi lhhfrhhomhepphhhihhlihhpsehphhhilhhiphhmtghgrhgrthhhrdgtohhm X-ME-Proxy: Feedback-ID: i2b1146f3:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 16 Nov 2023 14:16:36 -0500 (EST) From: Philip McGrath Date: Thu, 16 Nov 2023 14:15:41 -0500 Message-ID: <83a3e16cf7d86bb07f6cf728acf3872dcae604dc.1700161584.git.philip@philipmcgrath.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: References: 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-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * gnu/packages/web.scm (lessc): New variable. --- gnu/packages/web.scm | 183 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 183 insertions(+) diff --git a/gnu/packages/web.scm b/gnu/packages/web.scm index 389f7d1375..9efc6ebc9d 100644 --- a/gnu/packages/web.scm +++ b/gnu/packages/web.scm @@ -65,6 +65,7 @@ ;;; Copyright © 2023 Christopher Howard ;;; Copyright © 2023 Felix Lechner ;;; Copyright © 2023 Evgeny Pisemsky +;;; Copyright © 2023 Philip McGrath ;;; ;;; This file is part of GNU Guix. ;;; @@ -99,6 +100,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) @@ -169,6 +171,7 @@ (define-module (gnu packages web) #:use-module (gnu packages ncurses) #:use-module (gnu packages networking) #:use-module (gnu packages node) + #:use-module (gnu packages node-xyz) #:use-module (gnu packages nss) #:use-module (gnu packages openldap) #:use-module (gnu packages openstack) @@ -2344,6 +2347,186 @@ (define-public sassc/libsass-3.5 "0830pjcvhzxh6yixj82x5k5r1xnadjqzi16kp53213icbly0r9ma"))))))) (properties '((hidden? . #t))))) +(define-public lessc + (package + (name "lessc") + (version "4.2.0") + (source + (origin (method git-fetch) + (uri (git-reference + (url "https://github.com/less/less.js") + (commit (string-append "v" version)))) + (sha256 + (base32 "1b6anlafk7lnayxy3vhsi474jcdah2ffaw2qyac5s2ibxb1wmr54")) + (snippet + #~(begin + (use-modules (guix build utils)) + (delete-file-recursively "packages/less/dist"))) + (file-name (git-file-name name version)))) + (build-system node-build-system) + (native-inputs (list esbuild)) + (inputs (list node-copy-anything)) + (arguments + (list + #:tests? #f ; many more dependencies + #:modules + `((guix build node-build-system) + (ice-9 match) + (guix build utils)) + #:phases + #~(modify-phases %standard-phases + (add-after 'unpack 'chdir + (lambda args + (chdir "packages/less"))) + (add-after 'patch-dependencies 'delete-dependencies + (lambda args + (delete-dependencies + '(;; dependencies + "parse-node-version" ; patched out + "tslib" ; probably not needed w/ esbuild + ;; devDependencies + "@less/test-data" + "@less/test-import-module" + "@rollup/plugin-commonjs" + "@rollup/plugin-json" + "@rollup/plugin-node-resolve" + "@typescript-eslint/eslint-plugin" + "@typescript-eslint/parser" + "benny" + "bootstrap-less-port" + "chai" + "cross-env" + "diff" + "eslint" + "fs-extra" + "git-rev" + "globby" + "grunt" + "grunt-cli" + "grunt-contrib-clean" + "grunt-contrib-connect" + "grunt-eslint" + "grunt-saucelabs" + "grunt-shell" + "html-template-tag" + "jit-grunt" + "less-plugin-autoprefix" + "less-plugin-clean-css" + "minimist" + "mocha" + "mocha-headless-chrome" + "mocha-teamcity-reporter" + "nock" + "npm-run-all" + "performance-now" + "phin" + "promise" + "read-glob" + "resolve" + "rollup" + "rollup-plugin-terser" + "rollup-plugin-typescript2" + "semver" + "shx" + "time-grunt" + "ts-node" + "typescript" + "uikit" + ;; optionalDependencies + "errno" + "graceful-fs" + "image-size" + "make-dir" + "mime" + "needle" + "source-map")))) + (add-after 'delete-dependencies 'avoid-parse-node-version + (lambda args + (define version + #$(package-version this-package)) + (substitute* "src/less/index.js" + (("import [{] version [}]" orig) + (string-append "// " orig)) + (("import parseVersion from 'parse-node-version';" orig) + (string-append "// " orig)) + (("const v = parseVersion[(]`v\\$[{]version[}]`[)];" orig) + (string-append "// " orig)) + (("(version: )(\\[v\\.major, v\\.minor, v\\.patch],)" _ lhs rhs) + (string-append + lhs + "[" + (string-join + (list-head (string-split + version (char-set-complement char-set:digit)) + 3) + ", ") + "], // " + rhs))))) + (add-after 'avoid-parse-node-version 'do-not-target-es5 + (lambda args + ;; esbuild can't compile all features to ES5 + (with-atomic-json-file-replacement "tsconfig.json" + (match-lambda + (('@ . alist) + (cons '@ + (map (match-lambda + (("compilerOptions" '@ . alist) + `("compilerOptions" @ ,@(delete '("target" . "ES5") + alist))) + (other + other)) + alist))))))) + (add-after 'do-not-target-es5 'patch-build-script + (lambda args + (define new-build-script + (string-join + `("esbuild" + "--platform=node" + "--format=cjs" + "--outdir=lib" + ,@(find-files "src/less" "\\.js$") + ,@(find-files "src/less-node" "\\.js$")))) + (with-atomic-json-file-replacement "package.json" + (match-lambda + (('@ . alist) + (cons '@ + (map (match-lambda + (("scripts" @ . alist) + `("scripts" @ ,@(map (match-lambda + (("build" . _) + (cons "build" + new-build-script)) + (other + other)) + alist))) + (other + other)) + alist))))))) + (add-after 'build 'build-browser + (lambda args + (invoke "esbuild" + "--bundle" + "--platform=browser" + "--format=cjs" + "--outfile=dist/less.js" + "src/less-browser/bootstrap.js") + (invoke "esbuild" + "--bundle" + "--minify" + "--sourcemap" + "--platform=browser" + "--format=cjs" + "--outfile=dist/less.min.js" + "src/less-browser/bootstrap.js")))))) + (home-page "https://lesscss.org") + (synopsis "Compiler for @acronym{Less} @acronym{CSS} language extension") + ;; XXX: @abbr{} seems better for Less (which is always capitalized that + ;; way), but it is rejected as invalid Texinfo markup here. + (description "@acronym{Less, Leaner Style Sheets} is a +backwards-compatible language extension for @acronym{CSS}. This package +provides @command{lessc}, which compiles Less files to plain @acronym{CSS}.") + (license license:asl2.0))) + (define-public perl-apache-logformat-compiler (package