Skip to content

Commit 72d0ceb

Browse files
authored
Merge pull request #275692 from Homebrew/dart-sass-1.98.0
dart-sdk: support two level namespace for macOS, dart-sass 1.99.0 (new formula)
2 parents 36aa445 + 32f4fdc commit 72d0ceb

2 files changed

Lines changed: 90 additions & 6 deletions

File tree

Formula/d/dart-sass.rb

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
class DartSass < Formula
2+
desc "Reference implementation of Sass, written in Dart"
3+
homepage "https://sass-lang.com/dart-sass"
4+
url "https://github.com/sass/dart-sass/archive/refs/tags/1.99.0.tar.gz"
5+
sha256 "5f969b2eedf86384d90a9a339824b6652a4600e9e5f32784a7e48e453e145016"
6+
license "MIT"
7+
8+
bottle do
9+
sha256 cellar: :any, arm64_tahoe: "04b68917e5fa15257e4015a7464bd866627c4676c48f0c9c4f42cbdff47c8f10"
10+
sha256 cellar: :any, arm64_sequoia: "504e7c9ab687facfd63978bb335f3bc3cddaedb5c0494093e13b503a0f055d21"
11+
sha256 cellar: :any, arm64_sonoma: "d0ea9ce1bd01db3b76a7c64edb75da8716883d1eca1e7d9e62a11ebcb4e28b6b"
12+
sha256 cellar: :any, sonoma: "74939be86282ef7692b4d0460af6a819aebe8de9efa2ca53d4bff5641bbeb485"
13+
sha256 cellar: :any_skip_relocation, arm64_linux: "c1452e98b3a7c6bfd511cb657a9e91e709bfc60da565c18b77b6ef8f17c70858"
14+
sha256 cellar: :any_skip_relocation, x86_64_linux: "cedfbfb2a3ac93d3a27c965fe8b235ad56d5b17e3a5396660dac891a01e99ec6"
15+
end
16+
17+
depends_on "buf" => :build
18+
depends_on "dart-sdk" => :build
19+
depends_on "dartaotruntime"
20+
21+
resource "language" do
22+
url "https://github.com/sass/sass/archive/refs/tags/embedded-protocol-3.2.0.tar.gz"
23+
sha256 "4e1f81684bc1666f03e52ddc790d0c2c22d99a5313fa2efe1dde4a5b5733c186"
24+
end
25+
26+
def install
27+
ENV["PUB_ENVIRONMENT"] = "homebrew:sass"
28+
ENV["DART_SUPPRESS_ANALYTICS"] = "true"
29+
30+
(buildpath/"build/language").install resource("language")
31+
32+
system "dart", "pub", "get"
33+
with_env(UPDATE_SASS_PROTOCOL: "false") do
34+
system "dart", "run", "grinder", "protobuf"
35+
end
36+
37+
args = %W[
38+
-Dversion=#{version}
39+
-Ddart-version=#{Formula["dart-sdk"].version}
40+
-Dcompiler-version=#{version}
41+
-Dprotocol-version=#{resource("language").version}
42+
]
43+
system "dart", "compile", "aot-snapshot", "--output", "sass.aot", *args, "bin/sass.dart"
44+
libexec.install "sass.aot"
45+
46+
(bin/"sass").write <<~BASH
47+
#!/bin/bash
48+
exec "#{Formula["dartaotruntime"].opt_bin}/dartaotruntime" "#{libexec}/sass.aot" "$@"
49+
BASH
50+
end
51+
52+
test do
53+
assert_match version.to_s, shell_output("#{bin}/sass --version")
54+
55+
(testpath/"test.scss").write(".class {property: 1 + 1}")
56+
assert_match "property: 2;", shell_output("#{bin}/sass test.scss 2>&1")
57+
58+
(testpath/"input.scss").write <<~EOS
59+
div {
60+
img {
61+
border: 0px;
62+
}
63+
}
64+
EOS
65+
66+
assert_equal "div img{border:0px}",
67+
shell_output("#{bin}/sass --style compressed input.scss").strip
68+
end
69+
end

Formula/d/dart-sdk.rb

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@ class DartSdk < Formula
66
license "BSD-3-Clause"
77

88
bottle do
9-
sha256 cellar: :any_skip_relocation, arm64_tahoe: "f6b414553f10ca0477cc6cb4722f796a8f209da0e1d91d90e29bdcbaf3f9fb79"
10-
sha256 cellar: :any_skip_relocation, arm64_sequoia: "0d1dec9eda8ff017c6428e1c2ea18cb8df6ea6e7b0f94d32b62beab5e2886581"
11-
sha256 cellar: :any_skip_relocation, arm64_sonoma: "0e9c798bdebbe115d2a2c408f3ea3362e25ae32a01589ddb1b6f3779e2aa4fd8"
12-
sha256 cellar: :any_skip_relocation, sonoma: "d3e414a09f65ad69a3b667224abd04e43fdc3d996c1fffd05b4ccb6f9b816fda"
13-
sha256 cellar: :any_skip_relocation, arm64_linux: "20fd9ac1cb42af2c1df88ba879ced6b1bbfbeb2e1a24bb3e0eec48a006cbe27e"
14-
sha256 cellar: :any_skip_relocation, x86_64_linux: "a9da7043c34539062cc09bf40fd73663f31a8eaac794757d10117f6dd5e13848"
9+
rebuild 1
10+
sha256 cellar: :any_skip_relocation, arm64_tahoe: "3de15fcf1c8414f305c703d0653f5eea64cb9200b61080038b93a896ae53cdf9"
11+
sha256 cellar: :any_skip_relocation, arm64_sequoia: "028d51c9e3ed5b54d7b43671db16652ed651509f816b5973eb0352db0902b369"
12+
sha256 cellar: :any_skip_relocation, arm64_sonoma: "08654fb65125dc56fdac8594da4918a51825e0839b7aa1420f206410a75360b0"
13+
sha256 cellar: :any_skip_relocation, sonoma: "1288c60dc4d9398f759c0fdc20ff760d6202ab1a8cc1cc2ff44f30dbc9403b6a"
14+
sha256 cellar: :any_skip_relocation, arm64_linux: "07993fd5d586e7bdf7dd8743961232665ec31ecc96314b2b7cca77b49ff1b8fd"
15+
sha256 cellar: :any_skip_relocation, x86_64_linux: "6c3a9a04bab93eea472fc120130a84ab12fb25b89da811ff0aa493666be2d6f6"
1516
end
1617

1718
depends_on "ninja" => :build
@@ -42,6 +43,20 @@ def install
4243
system "gclient", "config", "--name", "sdk", "https://dart.googlesource.com/sdk.git@#{version}"
4344
system "gclient", "sync", "--no-history"
4445

46+
# Workaround for error: 'readdir_r' is deprecated
47+
# Issue ref: https://github.com/dart-lang/sdk/issues/63089
48+
inreplace "sdk/build/config/compiler/BUILD.gn",
49+
"\"-Wno-tautological-constant-compare\",",
50+
"\\0\n \"-Wno-deprecated-declarations\","
51+
52+
# Workaround for dependants audit failure: Libraries were compiled with a flat namespace.
53+
# Issue ref: https://github.com/dart-lang/sdk/issues/63115
54+
# PR ref: https://github.com/dart-lang/sdk/pull/63116
55+
inreplace "sdk/runtime/platform/mach_o.h",
56+
"MH_NO_REEXPORTED_DYLIBS = 0x100000;",
57+
"\\0\nstatic constexpr uint32_t MH_TWOLEVEL = 0x80;"
58+
inreplace "sdk/runtime/vm/mach_o.cc", "MH_NO_REEXPORTED_DYLIBS", "\\0 | mach_o::MH_TWOLEVEL"
59+
4560
chdir "sdk" do
4661
arch = Hardware::CPU.arm? ? "arm64" : "x64"
4762
system "./tools/build.py", "--mode=release", "--arch=#{arch}", "create_sdk"

0 commit comments

Comments
 (0)