Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 69 additions & 0 deletions Formula/d/dart-sass.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
class DartSass < Formula
desc "Reference implementation of Sass, written in Dart"
homepage "https://sass-lang.com/dart-sass"
url "https://github.com/sass/dart-sass/archive/refs/tags/1.99.0.tar.gz"
sha256 "5f969b2eedf86384d90a9a339824b6652a4600e9e5f32784a7e48e453e145016"
license "MIT"

bottle do
sha256 cellar: :any, arm64_tahoe: "04b68917e5fa15257e4015a7464bd866627c4676c48f0c9c4f42cbdff47c8f10"
sha256 cellar: :any, arm64_sequoia: "504e7c9ab687facfd63978bb335f3bc3cddaedb5c0494093e13b503a0f055d21"
sha256 cellar: :any, arm64_sonoma: "d0ea9ce1bd01db3b76a7c64edb75da8716883d1eca1e7d9e62a11ebcb4e28b6b"
sha256 cellar: :any, sonoma: "74939be86282ef7692b4d0460af6a819aebe8de9efa2ca53d4bff5641bbeb485"
sha256 cellar: :any_skip_relocation, arm64_linux: "c1452e98b3a7c6bfd511cb657a9e91e709bfc60da565c18b77b6ef8f17c70858"
sha256 cellar: :any_skip_relocation, x86_64_linux: "cedfbfb2a3ac93d3a27c965fe8b235ad56d5b17e3a5396660dac891a01e99ec6"
end

depends_on "buf" => :build
depends_on "dart-sdk" => :build
depends_on "dartaotruntime"

resource "language" do
url "https://github.com/sass/sass/archive/refs/tags/embedded-protocol-3.2.0.tar.gz"
sha256 "4e1f81684bc1666f03e52ddc790d0c2c22d99a5313fa2efe1dde4a5b5733c186"
end

def install
ENV["PUB_ENVIRONMENT"] = "homebrew:sass"
ENV["DART_SUPPRESS_ANALYTICS"] = "true"

(buildpath/"build/language").install resource("language")

system "dart", "pub", "get"
with_env(UPDATE_SASS_PROTOCOL: "false") do
system "dart", "run", "grinder", "protobuf"
end

args = %W[
-Dversion=#{version}
-Ddart-version=#{Formula["dart-sdk"].version}
-Dcompiler-version=#{version}
-Dprotocol-version=#{resource("language").version}
]
system "dart", "compile", "aot-snapshot", "--output", "sass.aot", *args, "bin/sass.dart"
libexec.install "sass.aot"

(bin/"sass").write <<~BASH
#!/bin/bash
exec "#{Formula["dartaotruntime"].opt_bin}/dartaotruntime" "#{libexec}/sass.aot" "$@"
BASH
end

test do
assert_match version.to_s, shell_output("#{bin}/sass --version")

(testpath/"test.scss").write(".class {property: 1 + 1}")
assert_match "property: 2;", shell_output("#{bin}/sass test.scss 2>&1")

(testpath/"input.scss").write <<~EOS
div {
img {
border: 0px;
}
}
EOS

assert_equal "div img{border:0px}",
shell_output("#{bin}/sass --style compressed input.scss").strip
end
end
27 changes: 21 additions & 6 deletions Formula/d/dart-sdk.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ class DartSdk < Formula
license "BSD-3-Clause"

bottle do
sha256 cellar: :any_skip_relocation, arm64_tahoe: "f6b414553f10ca0477cc6cb4722f796a8f209da0e1d91d90e29bdcbaf3f9fb79"
sha256 cellar: :any_skip_relocation, arm64_sequoia: "0d1dec9eda8ff017c6428e1c2ea18cb8df6ea6e7b0f94d32b62beab5e2886581"
sha256 cellar: :any_skip_relocation, arm64_sonoma: "0e9c798bdebbe115d2a2c408f3ea3362e25ae32a01589ddb1b6f3779e2aa4fd8"
sha256 cellar: :any_skip_relocation, sonoma: "d3e414a09f65ad69a3b667224abd04e43fdc3d996c1fffd05b4ccb6f9b816fda"
sha256 cellar: :any_skip_relocation, arm64_linux: "20fd9ac1cb42af2c1df88ba879ced6b1bbfbeb2e1a24bb3e0eec48a006cbe27e"
sha256 cellar: :any_skip_relocation, x86_64_linux: "a9da7043c34539062cc09bf40fd73663f31a8eaac794757d10117f6dd5e13848"
rebuild 1
sha256 cellar: :any_skip_relocation, arm64_tahoe: "3de15fcf1c8414f305c703d0653f5eea64cb9200b61080038b93a896ae53cdf9"
sha256 cellar: :any_skip_relocation, arm64_sequoia: "028d51c9e3ed5b54d7b43671db16652ed651509f816b5973eb0352db0902b369"
sha256 cellar: :any_skip_relocation, arm64_sonoma: "08654fb65125dc56fdac8594da4918a51825e0839b7aa1420f206410a75360b0"
sha256 cellar: :any_skip_relocation, sonoma: "1288c60dc4d9398f759c0fdc20ff760d6202ab1a8cc1cc2ff44f30dbc9403b6a"
sha256 cellar: :any_skip_relocation, arm64_linux: "07993fd5d586e7bdf7dd8743961232665ec31ecc96314b2b7cca77b49ff1b8fd"
sha256 cellar: :any_skip_relocation, x86_64_linux: "6c3a9a04bab93eea472fc120130a84ab12fb25b89da811ff0aa493666be2d6f6"
end

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

# Workaround for error: 'readdir_r' is deprecated
# Issue ref: https://github.com/dart-lang/sdk/issues/63089
inreplace "sdk/build/config/compiler/BUILD.gn",
"\"-Wno-tautological-constant-compare\",",
"\\0\n \"-Wno-deprecated-declarations\","

# Workaround for dependants audit failure: Libraries were compiled with a flat namespace.
# Issue ref: https://github.com/dart-lang/sdk/issues/63115
# PR ref: https://github.com/dart-lang/sdk/pull/63116
inreplace "sdk/runtime/platform/mach_o.h",
"MH_NO_REEXPORTED_DYLIBS = 0x100000;",
"\\0\nstatic constexpr uint32_t MH_TWOLEVEL = 0x80;"
inreplace "sdk/runtime/vm/mach_o.cc", "MH_NO_REEXPORTED_DYLIBS", "\\0 | mach_o::MH_TWOLEVEL"

chdir "sdk" do
arch = Hardware::CPU.arm? ? "arm64" : "x64"
system "./tools/build.py", "--mode=release", "--arch=#{arch}", "create_sdk"
Expand Down
Loading