From 94bd5e84067ae9c37b73fef0f3e7636d91555926 Mon Sep 17 00:00:00 2001 From: Ruoyu Zhong Date: Wed, 18 Oct 2023 00:53:54 +0800 Subject: [PATCH 1/6] node@20 20.8.1 (new formula) --- Formula/n/node@20.rb | 144 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 144 insertions(+) create mode 100644 Formula/n/node@20.rb diff --git a/Formula/n/node@20.rb b/Formula/n/node@20.rb new file mode 100644 index 0000000000000..4356abd9fcc3c --- /dev/null +++ b/Formula/n/node@20.rb @@ -0,0 +1,144 @@ +class NodeAT20 < Formula + desc "Platform built on V8 to build network applications" + homepage "https://nodejs.org/" + url "https://nodejs.org/dist/v20.8.1/node-v20.8.1.tar.xz" + sha256 "f799c66f6a6386bb8ac2c75a378f740c455e97f1fe964393dd39c9f9f6efbc70" + license "MIT" + + livecheck do + url "https://nodejs.org/dist/" + regex(%r{href=["']?v?(20(?:\.\d+)+)/?["' >]}i) + end + + keg_only :versioned_formula + + # https://nodejs.org/en/about/releases/ + # disable! date: "2026-04-30", because: :unsupported + deprecate! date: "2024-10-22", because: :unsupported + + depends_on "pkg-config" => :build + depends_on "python-setuptools" => :build + depends_on "python@3.12" => :build + depends_on "brotli" + depends_on "c-ares" + depends_on "icu4c" + depends_on "libnghttp2" + depends_on "libuv" + depends_on "openssl@3" + + uses_from_macos "python", since: :catalina + uses_from_macos "zlib" + + on_macos do + depends_on "llvm" => [:build, :test] if DevelopmentTools.clang_build_version <= 1100 + end + + fails_with :clang do + build 1100 + cause <<~EOS + error: calling a private constructor of class 'v8::internal::(anonymous namespace)::RegExpParserImpl' + EOS + end + + fails_with gcc: "5" + + # Support Python 3.12 + patch :DATA + + def install + ENV.llvm_clang if OS.mac? && (DevelopmentTools.clang_build_version <= 1100) + + # The new linker crashed during LTO due to high memory usage. + ENV.append "LDFLAGS", "-Wl,-ld_classic" if DevelopmentTools.clang_build_version >= 1500 + + # make sure subprocesses spawned by make are using our Python 3 + ENV["PYTHON"] = which("python3.12") + + args = %W[ + --prefix=#{prefix} + --with-intl=system-icu + --shared-libuv + --shared-nghttp2 + --shared-openssl + --shared-zlib + --shared-brotli + --shared-cares + --shared-libuv-includes=#{Formula["libuv"].include} + --shared-libuv-libpath=#{Formula["libuv"].lib} + --shared-nghttp2-includes=#{Formula["libnghttp2"].include} + --shared-nghttp2-libpath=#{Formula["libnghttp2"].lib} + --shared-openssl-includes=#{Formula["openssl@3"].include} + --shared-openssl-libpath=#{Formula["openssl@3"].lib} + --shared-brotli-includes=#{Formula["brotli"].include} + --shared-brotli-libpath=#{Formula["brotli"].lib} + --shared-cares-includes=#{Formula["c-ares"].include} + --shared-cares-libpath=#{Formula["c-ares"].lib} + --openssl-use-def-ca-store + ] + + # Enabling LTO errors on Linux with: + # terminate called after throwing an instance of 'std::out_of_range' + # Pre-Catalina macOS also can't build with LTO + # LTO is unpleasant if you have to build from source. + args << "--enable-lto" if MacOS.version >= :catalina && build.bottle? + + system "./configure", *args + system "make", "install" + end + + def post_install + (lib/"node_modules/npm/npmrc").atomic_write("prefix = #{HOMEBREW_PREFIX}\n") + end + + test do + # Make sure Mojave does not have `CC=llvm_clang`. + ENV.clang if OS.mac? + + path = testpath/"test.js" + path.write "console.log('hello');" + + output = shell_output("#{bin}/node #{path}").strip + assert_equal "hello", output + output = shell_output("#{bin}/node -e 'console.log(new Intl.NumberFormat(\"en-EN\").format(1234.56))'").strip + assert_equal "1,234.56", output + + output = shell_output("#{bin}/node -e 'console.log(new Intl.NumberFormat(\"de-DE\").format(1234.56))'").strip + assert_equal "1.234,56", output + + # make sure npm can find node + ENV.prepend_path "PATH", opt_bin + ENV.delete "NVM_NODEJS_ORG_MIRROR" + assert_equal which("node"), opt_bin/"node" + assert_predicate bin/"npm", :exist?, "npm must exist" + assert_predicate bin/"npm", :executable?, "npm must be executable" + npm_args = ["-ddd", "--cache=#{HOMEBREW_CACHE}/npm_cache", "--build-from-source"] + system bin/"npm", *npm_args, "install", "npm@latest" + system bin/"npm", *npm_args, "install", "ref-napi" unless head? + assert_predicate bin/"npx", :exist?, "npx must exist" + assert_predicate bin/"npx", :executable?, "npx must be executable" + assert_match "< hello >", shell_output("#{bin}/npx --yes cowsay hello") + end +end + +__END__ +diff --git a/configure b/configure +index fefb313c..711a3014 100755 +--- a/configure ++++ b/configure +@@ -4,6 +4,7 @@ + # Note that the mix of single and double quotes is intentional, + # as is the fact that the ] goes on a new line. + _=[ 'exec' '/bin/sh' '-c' ''' ++command -v python3.12 >/dev/null && exec python3.12 "$0" "$@" + command -v python3.11 >/dev/null && exec python3.11 "$0" "$@" + command -v python3.10 >/dev/null && exec python3.10 "$0" "$@" + command -v python3.9 >/dev/null && exec python3.9 "$0" "$@" +@@ -23,7 +24,7 @@ except ImportError: + from distutils.spawn import find_executable as which + + print('Node.js configure: Found Python {}.{}.{}...'.format(*sys.version_info)) +-acceptable_pythons = ((3, 11), (3, 10), (3, 9), (3, 8), (3, 7), (3, 6)) ++acceptable_pythons = ((3, 12), (3, 11), (3, 10), (3, 9), (3, 8), (3, 7), (3, 6)) + if sys.version_info[:2] in acceptable_pythons: + import configure + else: From 2285e35dfb7bd05105e55b746e2637a53d4a5b97 Mon Sep 17 00:00:00 2001 From: Ruoyu Zhong Date: Mon, 23 Oct 2023 02:03:02 +0800 Subject: [PATCH 2/6] node-sass: switch to `node@20` Signed-off-by: Rui Chen --- Formula/n/node-sass.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Formula/n/node-sass.rb b/Formula/n/node-sass.rb index 01428e8b0cfe7..9f850711d4250 100644 --- a/Formula/n/node-sass.rb +++ b/Formula/n/node-sass.rb @@ -6,6 +6,7 @@ class NodeSass < Formula url "https://registry.npmjs.org/sass/-/sass-1.69.4.tgz" sha256 "ce91baadd5f9b0dda64ab97f76d34755ef20d37fbf5567ba0996b63bc4851579" license "MIT" + revision 1 bottle do sha256 cellar: :any_skip_relocation, arm64_sonoma: "9985861e06afa8993b7f9474c206b5c709f9ceae0589a7bae06c8ff89ad5a39c" @@ -17,7 +18,7 @@ class NodeSass < Formula sha256 cellar: :any_skip_relocation, x86_64_linux: "6db7aa70660bcaeed2167b2c631f9f4ece1767256789ba54c5733a5c8cebf807" end - depends_on "node" + depends_on "node@20" def install system "npm", "install", *Language::Node.std_npm_install_args(libexec) @@ -25,6 +26,8 @@ def install end test do + ENV.prepend_path "PATH", Formula["node@20"].bin + (testpath/"test.scss").write <<~EOS div { img { From 344e9eaec92187ac84524cbe7dc4a2bd07d01529 Mon Sep 17 00:00:00 2001 From: Ruoyu Zhong Date: Mon, 23 Oct 2023 02:03:14 +0800 Subject: [PATCH 3/6] quicktype: switch to `node@20` Signed-off-by: Rui Chen --- Formula/q/quicktype.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Formula/q/quicktype.rb b/Formula/q/quicktype.rb index 81f3331ea7469..b1901f5894d15 100644 --- a/Formula/q/quicktype.rb +++ b/Formula/q/quicktype.rb @@ -6,6 +6,7 @@ class Quicktype < Formula url "https://registry.npmjs.org/quicktype/-/quicktype-23.0.76.tgz" sha256 "00cbdb63d80196669ae7fddfa17a1ad39a69db32566a92d558ea92ff6d16b821" license "Apache-2.0" + revision 1 head "https://github.com/quicktype/quicktype.git", branch: "master" bottle do @@ -18,7 +19,7 @@ class Quicktype < Formula sha256 cellar: :any_skip_relocation, x86_64_linux: "2e16bf0a4bef00d435af28ee4172b3e4b84289684e69e39946c2186aab6eb959" end - depends_on "node" + depends_on "node@20" def install system "npm", "install", *Language::Node.std_npm_install_args(libexec) @@ -26,6 +27,8 @@ def install end test do + ENV.prepend_path "PATH", Formula["node@20"].bin + (testpath/"sample.json").write <<~EOS { "i": [0, 1], From 3103c1635f6c551b99279792b396dd86726dc833 Mon Sep 17 00:00:00 2001 From: Patrick Linnane Date: Sun, 22 Oct 2023 23:11:25 +0000 Subject: [PATCH 4/6] node@20: add 20.8.1 bottle. --- Formula/n/node@20.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Formula/n/node@20.rb b/Formula/n/node@20.rb index 4356abd9fcc3c..0a5f9ccb3d983 100644 --- a/Formula/n/node@20.rb +++ b/Formula/n/node@20.rb @@ -10,6 +10,16 @@ class NodeAT20 < Formula regex(%r{href=["']?v?(20(?:\.\d+)+)/?["' >]}i) end + bottle do + sha256 arm64_sonoma: "90457fea276a285c7c50facc1a4c3bcf1185c450c3d101bc07bd318a53a98e1c" + sha256 arm64_ventura: "fc31441cb84987270d3ea897ecbc3edab6f3826e44d7b10d7b2d9f80713134e0" + sha256 arm64_monterey: "c840e438adf6475d01721b3805aa065ce88c20845cc7315efc6473f6f91d7869" + sha256 sonoma: "5fb752db4c331ba4278f64c6ebbe695d34f62a11930cd62b506fd74ff7e55d85" + sha256 ventura: "1c2c5b0c5b99275308781998875828f6aedb4539f031a490e9d7e9254f962568" + sha256 monterey: "0285b304cbe9feeb6e2bfc2a6a359b1bd3cde7ec83a7893583382e7a86c835fd" + sha256 x86_64_linux: "6025742b665ccc1ccf8cc14fa7f4ef00f86e05e88aba498805ff968aeba687fc" + end + keg_only :versioned_formula # https://nodejs.org/en/about/releases/ From 4e5b4fc3e301a8db5a7214b836bf96b524a1c9ff Mon Sep 17 00:00:00 2001 From: Patrick Linnane Date: Sun, 22 Oct 2023 23:11:27 +0000 Subject: [PATCH 5/6] node-sass: update 1.69.4_1 bottle. --- Formula/n/node-sass.rb | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Formula/n/node-sass.rb b/Formula/n/node-sass.rb index 9f850711d4250..753ee1514f1fe 100644 --- a/Formula/n/node-sass.rb +++ b/Formula/n/node-sass.rb @@ -9,13 +9,13 @@ class NodeSass < Formula revision 1 bottle do - sha256 cellar: :any_skip_relocation, arm64_sonoma: "9985861e06afa8993b7f9474c206b5c709f9ceae0589a7bae06c8ff89ad5a39c" - sha256 cellar: :any_skip_relocation, arm64_ventura: "9985861e06afa8993b7f9474c206b5c709f9ceae0589a7bae06c8ff89ad5a39c" - sha256 cellar: :any_skip_relocation, arm64_monterey: "9985861e06afa8993b7f9474c206b5c709f9ceae0589a7bae06c8ff89ad5a39c" - sha256 cellar: :any_skip_relocation, sonoma: "9985861e06afa8993b7f9474c206b5c709f9ceae0589a7bae06c8ff89ad5a39c" - sha256 cellar: :any_skip_relocation, ventura: "9985861e06afa8993b7f9474c206b5c709f9ceae0589a7bae06c8ff89ad5a39c" - sha256 cellar: :any_skip_relocation, monterey: "9985861e06afa8993b7f9474c206b5c709f9ceae0589a7bae06c8ff89ad5a39c" - sha256 cellar: :any_skip_relocation, x86_64_linux: "6db7aa70660bcaeed2167b2c631f9f4ece1767256789ba54c5733a5c8cebf807" + sha256 cellar: :any_skip_relocation, arm64_sonoma: "1a2399a1e01ec77fa937c782e3551c92db2fd3b2dff5698d3b915162af243ede" + sha256 cellar: :any_skip_relocation, arm64_ventura: "1a2399a1e01ec77fa937c782e3551c92db2fd3b2dff5698d3b915162af243ede" + sha256 cellar: :any_skip_relocation, arm64_monterey: "1a2399a1e01ec77fa937c782e3551c92db2fd3b2dff5698d3b915162af243ede" + sha256 cellar: :any_skip_relocation, sonoma: "1a2399a1e01ec77fa937c782e3551c92db2fd3b2dff5698d3b915162af243ede" + sha256 cellar: :any_skip_relocation, ventura: "1a2399a1e01ec77fa937c782e3551c92db2fd3b2dff5698d3b915162af243ede" + sha256 cellar: :any_skip_relocation, monterey: "1a2399a1e01ec77fa937c782e3551c92db2fd3b2dff5698d3b915162af243ede" + sha256 cellar: :any_skip_relocation, x86_64_linux: "1756c911227e6263e6e593fa25f63117d0181f4e40c147e236a5e32d519294ac" end depends_on "node@20" From 620efe70ed43fb7f4349449f692aa4fff48f1e7d Mon Sep 17 00:00:00 2001 From: Patrick Linnane Date: Sun, 22 Oct 2023 23:11:27 +0000 Subject: [PATCH 6/6] quicktype: update 23.0.76_1 bottle. --- Formula/q/quicktype.rb | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Formula/q/quicktype.rb b/Formula/q/quicktype.rb index b1901f5894d15..7c4945ab1a821 100644 --- a/Formula/q/quicktype.rb +++ b/Formula/q/quicktype.rb @@ -10,13 +10,13 @@ class Quicktype < Formula head "https://github.com/quicktype/quicktype.git", branch: "master" bottle do - sha256 cellar: :any_skip_relocation, arm64_sonoma: "2e16bf0a4bef00d435af28ee4172b3e4b84289684e69e39946c2186aab6eb959" - sha256 cellar: :any_skip_relocation, arm64_ventura: "2e16bf0a4bef00d435af28ee4172b3e4b84289684e69e39946c2186aab6eb959" - sha256 cellar: :any_skip_relocation, arm64_monterey: "2e16bf0a4bef00d435af28ee4172b3e4b84289684e69e39946c2186aab6eb959" - sha256 cellar: :any_skip_relocation, sonoma: "96e7edb41408254c774ffb3ae3725b8cbdc6c256d1752febebc53afbb1548ac2" - sha256 cellar: :any_skip_relocation, ventura: "96e7edb41408254c774ffb3ae3725b8cbdc6c256d1752febebc53afbb1548ac2" - sha256 cellar: :any_skip_relocation, monterey: "96e7edb41408254c774ffb3ae3725b8cbdc6c256d1752febebc53afbb1548ac2" - sha256 cellar: :any_skip_relocation, x86_64_linux: "2e16bf0a4bef00d435af28ee4172b3e4b84289684e69e39946c2186aab6eb959" + sha256 cellar: :any_skip_relocation, arm64_sonoma: "e00c9f9da34e799fc9a850a3871a9b746f7ef546bade2131d1a7b2c1d601560b" + sha256 cellar: :any_skip_relocation, arm64_ventura: "e00c9f9da34e799fc9a850a3871a9b746f7ef546bade2131d1a7b2c1d601560b" + sha256 cellar: :any_skip_relocation, arm64_monterey: "e00c9f9da34e799fc9a850a3871a9b746f7ef546bade2131d1a7b2c1d601560b" + sha256 cellar: :any_skip_relocation, sonoma: "ff77eabb6fdb07d6caf308e851fbb48ddddd88615efa4d48ce02c818bc8c88c8" + sha256 cellar: :any_skip_relocation, ventura: "ff77eabb6fdb07d6caf308e851fbb48ddddd88615efa4d48ce02c818bc8c88c8" + sha256 cellar: :any_skip_relocation, monterey: "ff77eabb6fdb07d6caf308e851fbb48ddddd88615efa4d48ce02c818bc8c88c8" + sha256 cellar: :any_skip_relocation, x86_64_linux: "e00c9f9da34e799fc9a850a3871a9b746f7ef546bade2131d1a7b2c1d601560b" end depends_on "node@20"