homebrew-core/Formula/pegtl.rb

37 lines
1.1 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.5.tar.gz"
sha256 "4ecefe4151b14684a944dde57e68c98e00224e5fea055c263e1bfbed24a99827"
license "BSL-1.0"
bottle do
sha256 cellar: :any_skip_relocation, all: "4dc4bafe8b8cfe160fe41341ee919b88afdf891e5a3e187af4f7a8470642fa18"
end
depends_on "cmake" => :build
on_linux do
depends_on "gcc"
end
fails_with gcc: "5"
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