homebrew-core/Formula/pegtl.rb

38 lines
1.2 KiB
Ruby

class Pegtl < Formula
desc "Parsing Expression Grammar Template Library"
homepage "https://github.com/taocpp/PEGTL"
url "https://github.com/taocpp/PEGTL/archive/3.2.1.tar.gz"
sha256 "af33818352bc0b73c66aa9bc037735ce43d471533f1078ee828ba7e09962847d"
license "MIT"
bottle do
sha256 cellar: :any_skip_relocation, all: "4751694ed5e233b46d8cf428145a506f488b9544e0f46b791ea2e2e660edae92"
end
depends_on "cmake" => :build
if MacOS.version <= :mojave
depends_on "gcc"
fails_with :clang do
cause "'path' is unavailable in c++ < 17: introduced in macOS 10.15"
end
end
def install
mkdir "build" do
system "cmake", "..", *std_cmake_args,
"-DPEGTL_BUILD_TESTS=OFF",
"-DPEGTL_BUILD_EXAMPLES=OFF",
"-DCMAKE_CXX_STANDARD=17"
system "make", "install"
end
rm "src/example/pegtl/CMakeLists.txt"
(pkgshare/"examples").install (buildpath/"src/example/pegtl").children
end
test do
system ENV.cxx, pkgshare/"examples/hello_world.cpp", "-std=c++17", "-o", "helloworld"
assert_equal "Good bye, homebrew!\n", shell_output("./helloworld 'Hello, homebrew!'")
end
end