Skip to content

Commit

Permalink
ada-url 3.0.0
Browse files Browse the repository at this point in the history
ada-url: update build for c++20 support

Signed-off-by: Rui Chen <[email protected]>
  • Loading branch information
BrewTestBot authored and chenrui333 committed Jan 30, 2025
1 parent 8b5ca09 commit 9ac0692
Showing 1 changed file with 24 additions and 4 deletions.
28 changes: 24 additions & 4 deletions Formula/a/ada-url.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
class AdaUrl < Formula
desc "WHATWG-compliant and fast URL parser written in modern C++"
homepage "https://github.com/ada-url/ada"
url "https://github.com/ada-url/ada/archive/refs/tags/v2.9.2.tar.gz"
sha256 "f41575ad7eec833afd9f6a0d6101ee7dc2f947fdf19ae8f1b54a71d59f4ba5ec"
url "https://github.com/ada-url/ada/archive/refs/tags/v3.0.0.tar.gz"
sha256 "3045b370d006798cb502f186b55fc290811f4392a7c11b803a6a6f7dea593fce"
license any_of: ["Apache-2.0", "MIT"]
head "https://github.com/ada-url/ada.git", branch: "main"

Expand All @@ -18,15 +18,35 @@ class AdaUrl < Formula
end

depends_on "cmake" => :build

uses_from_macos "python" => :build

on_macos do
depends_on "llvm" if DevelopmentTools.clang_build_version <= 1500
end

fails_with :clang do
build 1500
cause "Requires C++20 support"
end

fails_with :gcc do
version "11"
cause "Requires C++20"
end


def install
system "cmake", "-B", "build", *std_cmake_args
ENV.llvm_clang if OS.mac? && DevelopmentTools.clang_build_version <= 1500

system "cmake", "-S", ".", "-B", "build", *std_cmake_args
system "cmake", "--build", "build"
system "cmake", "--install", "build"
end

test do
ENV["CXX"] = Formula["llvm"].opt_bin/"clang++" if OS.mac? && DevelopmentTools.clang_build_version <= 1500

(testpath/"test.cpp").write <<~CPP
#include "ada.h"
#include <iostream>
Expand All @@ -39,7 +59,7 @@ def install
}
CPP

system ENV.cxx, "test.cpp", "-std=c++17",
system ENV.cxx, "test.cpp", "-std=c++20",
"-I#{include}", "-L#{lib}", "-lada", "-o", "test"
assert_equal "http:", shell_output("./test").chomp
end
Expand Down

0 comments on commit 9ac0692

Please sign in to comment.