-
Notifications
You must be signed in to change notification settings - Fork 2
/
spicy.rb
57 lines (49 loc) · 1.75 KB
/
spicy.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
class Spicy < Formula
desc "C++ parser generator for dissecting protocols & files"
homepage "https://github.com/zeek/spicy"
url "https://github.com/zeek/spicy.git",
tag: "v1.11.3",
revision: "31880e215ff6f85ad95507d7a760e81ae2e0999d"
head "https://github.com/zeek/spicy.git",
branch: "main"
bottle do
root_url "https://github.com/zeek/spicy/releases/download/v1.11.3"
sha256 arm64_sonoma: "51b63ff11d5aea2b1f174a727d839074168ece556e9a250f8f02d89eb4205549"
end
depends_on "bison" => :build
depends_on "cmake" => :build
depends_on "flex" => :build
def install
mkdir "build" do
cmake_args = %W[
-DBUILD_SHARED_LIBS=ON
-DCMAKE_C_COMPILER=/usr/bin/clang
-DCMAKE_CXX_COMPILER=/usr/bin/clang++
-DFLEX_ROOT=#{Formula["flex"].opt_prefix}
-DBISON_ROOT=#{Formula["bison"].opt_prefix}
-DBUILD_TOOLCHAIN=ON
-DHILTI_DEV_PRECOMPILE_HEADERS=OFF
]
system "cmake", "..", *std_cmake_args, *cmake_args
system "make", "install"
end
end
def caveats
<<~EOS
In order to speed up JIT, run 'spicy-precompile-headers' after
installation. This script places precompiled headers used during
JIT in '$HOME/.cache/spicy'.
Per-module JIT results can be cached with ccache which should speed up
subsequent compilations. For that, set
'HILTI_CXX_COMPILER_LAUNCHER=ccache' in your environment and make sure
ccache is installed.
EOS
end
test do
require "fileutils"
File.write("foo.spicy", "module Foo; type Bar = unit {};")
assert_match "module Foo {", shell_output("#{bin}/spicyc -p foo.spicy")
assert shell_output("#{bin}/spicyc -j foo.spicy")
assert shell_output("#{bin}/spicy-build foo.spicy")
end
end