All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Alexis Lothoré via buildroot" <buildroot@buildroot.org>
To: buildroot@buildroot.org
Cc: "Thomas Petazzoni" <thomas.petazzoni@bootlin.com>,
	"Alexis Lothoré" <alexis.lothore@bootlin.com>,
	"Nicolas Carrier" <nicolas.carrier@nav-timing.safrangroup.com>
Subject: [Buildroot] [PATCH 2/2] package/sass: new package
Date: Thu, 06 Aug 2026 23:24:23 +0200	[thread overview]
Message-ID: <20260806-host_tools-v1-2-19c63ecc3b10@bootlin.com> (raw)
In-Reply-To: <20260806-host_tools-v1-0-19c63ecc3b10@bootlin.com>

sass is a css extension adding programming features to css.

https://github.com/sass/dart-sass

The source configured for the package is not a github repository, as the
official sources for sass are in fact in Dart: those sources are
automatically built into a javascript module by the corresponding github
workflow ([1]). Rather than trying to replicate the whole dart build,
this new package just downloads the sources for sass from npmjs
directly.

[1]
https://github.com/sass/dart-sass/blob/main/.github/workflows/release.yml

Signed-off-by: Alexis Lothoré <alexis.lothore@bootlin.com>
---
 DEVELOPERS                                         |  1 +
 package/Config.in.host                             |  1 +
 package/sass/Config.in.host                        |  8 ++++++
 package/sass/sass.hash                             |  3 +++
 package/sass/sass.mk                               | 30 ++++++++++++++++++++++
 support/testing/tests/package/test_sass.py         | 23 +++++++++++++++++
 .../tests/package/test_sass/sample_sass.scss       |  7 +++++
 7 files changed, 73 insertions(+)

diff --git a/DEVELOPERS b/DEVELOPERS
index 3027d1310528..4fee9b978467 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -158,6 +158,7 @@ N: 	Alexis Lothoré <alexis.lothore@bootlin.com>
 F:	package/libxmlsec1/
 F:	package/openscap/
 F: 	package/python-scp/
+F:	package/sass/
 F:	package/uglifyjs/
 
 N:	Alistair Francis <alistair@alistair23.me>
diff --git a/package/Config.in.host b/package/Config.in.host
index 0e4e29cd3514..4c5ed3865cb3 100644
--- a/package/Config.in.host
+++ b/package/Config.in.host
@@ -109,6 +109,7 @@ menu "Host utilities"
 	source "package/rustc/Config.in.host"
 	source "package/s6-rc/Config.in.host"
 	source "package/sam-ba/Config.in.host"
+	source "package/sass/Config.in.host"
 	source "package/sdbus-cpp/Config.in.host"
 	source "package/sdbusplus/Config.in.host"
 	source "package/sentry-cli/Config.in.host"
diff --git a/package/sass/Config.in.host b/package/sass/Config.in.host
new file mode 100644
index 000000000000..13f47efc8e84
--- /dev/null
+++ b/package/sass/Config.in.host
@@ -0,0 +1,8 @@
+config BR2_PACKAGE_HOST_SASS
+	bool "host sass"
+	help
+	  sass is a pure javascript Dart Sass distribution, with Sass
+	  being a CSS preprocessor, allowing to use programming features
+	  with CSS
+
+	  https://github.com/sass/dart-sass
diff --git a/package/sass/sass.hash b/package/sass/sass.hash
new file mode 100644
index 000000000000..d8cce0da9d4a
--- /dev/null
+++ b/package/sass/sass.hash
@@ -0,0 +1,3 @@
+# Locally calculated
+sha256  cc0a9a8f9025c60c13eff214a13f71cbd0b76051dbe6e56f24990da73b85efdb  sass-1.102.0.tgz
+sha256  1523011dc1c6136ac2c4689f93b203f11690848d9641189b7a40848502d21568  LICENSE
diff --git a/package/sass/sass.mk b/package/sass/sass.mk
new file mode 100644
index 000000000000..c79109be44a2
--- /dev/null
+++ b/package/sass/sass.mk
@@ -0,0 +1,30 @@
+################################################################################
+#
+# sass
+#
+################################################################################
+
+SASS_VERSION = 1.102.0
+SASS_SOURCE = sass-$(SASS_VERSION).tgz
+SASS_SITE = https://registry.npmjs.org/sass/-
+SASS_LICENSE = MIT
+SASS_LICENSE_FILES = LICENSE
+HOST_SASS_DEPENDENCIES = host-nodejs
+
+define HOST_SASS_BUILD_CMDS
+	$(HOST_DIR)/bin/npm install \
+		--prefix $(@D) \
+		--production \
+		--no-audit \
+		--no-fund
+endef
+
+define HOST_SASS_INSTALL_CMDS
+	$(INSTALL) -m 0755 -d $(HOST_DIR)/lib/node_modules/sass
+	$(INSTALL) -m 0755 $(@D)/sass.js $(HOST_DIR)/lib/node_modules/sass/
+	$(INSTALL) -m 0755 $(@D)/sass.dart.js $(HOST_DIR)/lib/node_modules/sass/
+	rsync -a $(@D)/node_modules $(HOST_DIR)/lib/node_modules/sass/
+	ln -sf ../lib/node_modules/sass/sass.js $(HOST_DIR)/bin/sass
+endef
+
+$(eval $(host-generic-package))
diff --git a/support/testing/tests/package/test_sass.py b/support/testing/tests/package/test_sass.py
new file mode 100644
index 000000000000..2739eff7f680
--- /dev/null
+++ b/support/testing/tests/package/test_sass.py
@@ -0,0 +1,23 @@
+import os
+import infra
+from pathlib import Path
+
+from infra.basetest import BRTest
+
+INPUT_SAMPLE = Path(__file__).parent / "test_sass/sample_sass.scss"
+
+
+class TestHostSass(BRTest):
+    config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
+        """
+        BR2_PACKAGE_HOST_SASS=y
+        """
+
+    def test_run(self):
+        sass_bin = os.path.join(self.builddir, "host", "bin", "sass")
+
+        cmd = [sass_bin, "--version"]
+        infra.run_cmd_on_host(self.builddir, cmd)
+
+        cmd = [sass_bin, INPUT_SAMPLE, "output.css"]
+        infra.run_cmd_on_host(self.builddir, cmd)
diff --git a/support/testing/tests/package/test_sass/sample_sass.scss b/support/testing/tests/package/test_sass/sample_sass.scss
new file mode 100644
index 000000000000..b8bf7120118c
--- /dev/null
+++ b/support/testing/tests/package/test_sass/sample_sass.scss
@@ -0,0 +1,7 @@
+$font-stack: Helvetica, sans-serif;
+$primary-color: #333;
+
+body {
+  font: 100% $font-stack;
+  color: $primary-color;
+}

-- 
2.55.0

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

  parent reply	other threads:[~2026-08-06 21:24 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-06 21:24 [Buildroot] [PATCH 0/2] package: bring two host tools Alexis Lothoré via buildroot
2026-08-06 21:24 ` [Buildroot] [PATCH 1/2] package/uglifyjs: new package Alexis Lothoré via buildroot
2026-08-07  7:44   ` Thomas Petazzoni via buildroot
2026-08-10  8:44     ` Alexis Lothoré via buildroot
2026-08-06 21:24 ` Alexis Lothoré via buildroot [this message]
2026-08-07  8:29   ` [Buildroot] [PATCH 2/2] package/sass: " Thomas Petazzoni via buildroot
2026-08-07 11:55     ` Thomas Perale via buildroot
2026-08-10 12:25       ` Alexis Lothoré via buildroot
2026-08-10 21:04         ` Thomas Perale via buildroot
2026-08-10  9:29     ` Alexis Lothoré via buildroot
2026-08-10 12:32       ` Thomas Petazzoni via buildroot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260806-host_tools-v1-2-19c63ecc3b10@bootlin.com \
    --to=buildroot@buildroot.org \
    --cc=alexis.lothore@bootlin.com \
    --cc=nicolas.carrier@nav-timing.safrangroup.com \
    --cc=thomas.petazzoni@bootlin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.