This repository has been archived by the owner on Aug 25, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathhhvm-4.155.rb
275 lines (237 loc) · 9.59 KB
/
hhvm-4.155.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
#
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
class Hhvm4155 < Formula
desc "JIT compiler and runtime for the Hack language"
homepage "http://hhvm.com/"
head "https://github.com/facebook/hhvm.git"
url "https://dl.hhvm.com/source/hhvm-4.155.0.tar.gz"
sha256 "5ecf6c514b3e25c6362d2b98ffc4ae9ddc6bcfc67d3699440d5646cc478edaa5"
bottle do
root_url "https://dl.hhvm.com/homebrew-bottles"
sha256 catalina: "a077da19bc4c594e22c67fc1f1d717b219a747534ec143b1b8cd61f94731db86"
end
option "with-debug", <<~EOS
Make an unoptimized build with assertions enabled. This will run PHP and
Hack code dramatically slower than a release build, and is suitable mostly
for debugging HHVM itself.
EOS
# Needs very recent xcode
depends_on :macos => :sierra
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "bison" => :build
depends_on "cmake" => :build
depends_on "dwarfutils"
depends_on "gawk" => :build
depends_on "libelf" => :build
depends_on "libtool" => :build
depends_on "md5sha1sum" => :build
depends_on "pkg-config" => :build
depends_on "re2c" => :build
depends_on "wget" => :build
# Provides the CLI utility `realpath`
depends_on "aardvark_shell_utils" => :build
# We statically link against icu4c as every non-bugfix release is not
# backwards compatible; needing to rebuild for every release is too
# brittle
depends_on "icu4c" => :build
depends_on "boost"
depends_on "double-conversion"
depends_on "freetype"
depends_on "fribidi"
depends_on "gd"
depends_on "gettext"
depends_on "glog"
depends_on "gmp"
depends_on "imagemagick@6"
depends_on "jemalloc"
depends_on "jpeg"
depends_on "krb5"
depends_on "libevent"
depends_on "libmemcached"
depends_on "libsodium"
depends_on "libpng"
depends_on "libxml2"
depends_on "libzip"
depends_on "lz4"
depends_on "mcrypt"
depends_on "oniguruma"
depends_on "[email protected]"
depends_on "pcre" # Used for Hack but not HHVM build - see #116
depends_on "postgresql"
depends_on "sqlite"
depends_on "tbb@2020"
depends_on "zstd"
def install
cmake_args = std_cmake_args + %W[
-DCMAKE_INSTALL_SYSCONFDIR=#{etc}
-DDEFAULT_CONFIG_DIR=#{etc}/hhvm
]
# Force use of bundled PCRE to workaround #116
cmake_args += %W[
-DSYSTEM_PCRE_HAS_JIT=0
]
# Features which don't work on OS X yet since they haven't been ported yet.
cmake_args += %W[
-DENABLE_MCROUTER=OFF
-DENABLE_EXTENSION_MCROUTER=OFF
-DENABLE_EXTENSION_IMAP=OFF
]
# Required to specify a socket path if you are using the bundled async SQL
# client (which is very strongly recommended).
cmake_args << "-DMYSQL_UNIX_SOCK_ADDR=/tmp/mysql.sock"
# LZ4 warning macros are currently incompatible with clang
cmake_args << "-DCMAKE_C_FLAGS=-DLZ4_DISABLE_DEPRECATE_WARNINGS=1"
cmake_args << "-DCMAKE_CXX_FLAGS=-DLZ4_DISABLE_DEPRECATE_WARNINGS=1 -DU_USING_ICU_NAMESPACE=1"
# Debug builds. This switch is all that's needed, it sets all the right
# cflags and other config changes.
if build.with? "debug"
cmake_args << "-DCMAKE_BUILD_TYPE=Debug"
else
cmake_args << "-DCMAKE_BUILD_TYPE=RelWithDebInfo"
end
# Statically link libICU
cmake_args += %W[
-DICU_INCLUDE_DIR=#{Formula["icu4c"].opt_include}
-DICU_I18N_LIBRARY=#{Formula["icu4c"].opt_lib}/libicui18n.a
-DICU_LIBRARY=#{Formula["icu4c"].opt_lib}/libicuuc.a
-DICU_DATA_LIBRARY=#{Formula["icu4c"].opt_lib}/libicudata.a
]
# TBB looks for itself in a different place than brew installs to.
ENV["TBB_ARCH_PLATFORM"] = "."
cmake_args += %W[
-DTBB_INCLUDE_DIR=#{Formula["tbb@2020"].opt_include}
-DTBB_INSTALL_DIR=#{Formula["tbb@2020"].opt_prefix}
-DTBB_LIBRARY=#{Formula["tbb@2020"].opt_lib}/libtbb.dylib
-DTBB_LIBRARY_DEBUG=#{Formula["tbb@2020"].opt_lib}/libtbb.dylib
-DTBB_LIBRARY_DIR=#{Formula["tbb@2020"].opt_lib}
-DTBB_MALLOC_LIBRARY=#{Formula["tbb@2020"].opt_lib}/libtbbmalloc.dylib
-DTBB_MALLOC_LIBRARY_DEBUG=#{Formula["tbb@2020"].opt_lib}/libtbbmalloc.dylib
]
system "cmake", *cmake_args, '.'
system "make", "-j1", "hack_rust_ffi_bridge_targets"
system "make" # pickups up -jN from MAKEFLAGS from brew
system "make", "install"
tp_notices = (share/"doc/third_party_notices.txt")
(share/"doc").install "third-party/third_party_notices.txt"
(share/"doc/third_party_notices.txt").append_lines <<EOF
-----
The following software may be included in this product: icu4c. This Software contains the following license and notice below:
Unicode Data Files include all data files under the directories
http://www.unicode.org/Public/, http://www.unicode.org/reports/,
http://www.unicode.org/cldr/data/, http://source.icu-project.org/repos/icu/, and
http://www.unicode.org/utility/trac/browser/.
Unicode Data Files do not include PDF online code charts under the
directory http://www.unicode.org/Public/.
Software includes any source code published in the Unicode Standard
or under the directories
http://www.unicode.org/Public/, http://www.unicode.org/reports/,
http://www.unicode.org/cldr/data/, http://source.icu-project.org/repos/icu/, and
http://www.unicode.org/utility/trac/browser/.
NOTICE TO USER: Carefully read the following legal agreement.
BY DOWNLOADING, INSTALLING, COPYING OR OTHERWISE USING UNICODE INC.'S
DATA FILES ("DATA FILES"), AND/OR SOFTWARE ("SOFTWARE"),
YOU UNEQUIVOCALLY ACCEPT, AND AGREE TO BE BOUND BY, ALL OF THE
TERMS AND CONDITIONS OF THIS AGREEMENT.
IF YOU DO NOT AGREE, DO NOT DOWNLOAD, INSTALL, COPY, DISTRIBUTE OR USE
THE DATA FILES OR SOFTWARE.
COPYRIGHT AND PERMISSION NOTICE
Copyright © 1991-2017 Unicode, Inc. All rights reserved.
Distributed under the Terms of Use in http://www.unicode.org/copyright.html.
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Unicode data files and any associated documentation
(the "Data Files") or Unicode software and any associated documentation
(the "Software") to deal in the Data Files or Software
without restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, and/or sell copies of
the Data Files or Software, and to permit persons to whom the Data Files
or Software are furnished to do so, provided that either
(a) this copyright and permission notice appear with all copies
of the Data Files or Software, or
(b) this copyright and permission notice appear in associated
Documentation.
THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT OF THIRD PARTY RIGHTS.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS
NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL
DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THE DATA FILES OR SOFTWARE.
Except as contained in this notice, the name of a copyright holder
shall not be used in advertising or otherwise to promote the sale,
use or other dealings in these Data Files or Software without prior
written authorization of the copyright holder.
EOF
ini = etc/"hhvm"
(ini/"php.ini").write php_ini unless File.exist? (ini/"php.ini")
(ini/"server.ini").write server_ini unless File.exist? (ini/"server.ini")
end
test do
(testpath/"test.php").write <<~EOS
<?php
exit(is_integer(HHVM_VERSION_ID) ? 0 : 1);
EOS
system "#{bin}/hhvm", testpath/"test.php"
end
plist_options :manual => "hhvm -m daemon -c #{HOMEBREW_PREFIX}/etc/hhvm/php.ini -c #{HOMEBREW_PREFIX}/etc/hhvm/server.ini"
def plist
<<~EOS
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>#{plist_name}</string>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<true/>
<key>ProgramArguments</key>
<array>
<string>#{opt_bin}/hhvm</string>
<string>-m</string>
<string>server</string>
<string>-c</string>
<string>#{etc}/hhvm/php.ini</string>
<string>-c</string>
<string>#{etc}/hhvm/server.ini</string>
</array>
<key>WorkingDirectory</key>
<string>#{HOMEBREW_PREFIX}</string>
</dict>
</plist>
EOS
end
# https://github.com/hhvm/packaging/blob/master/hhvm/deb/skeleton/etc/hhvm/php.ini
def php_ini
<<~EOS
; php options
session.save_handler = files
session.save_path = #{var}/lib/hhvm/sessions
session.gc_maxlifetime = 1440
; hhvm specific
hhvm.log.always_log_unhandled_exceptions = true
hhvm.log.runtime_error_reporting_level = 8191
hhvm.mysql.typed_results = false
EOS
end
# https://github.com/hhvm/packaging/blob/master/hhvm/deb/skeleton/etc/hhvm/server.ini
def server_ini
<<~EOS
; php options
pid = #{var}/run/hhvm/pid
; hhvm specific
hhvm.server.port = 9000
hhvm.server.default_document = index.php
hhvm.log.use_log_file = true
hhvm.log.file = #{var}/log/hhvm/error.log
hhvm.repo.central.path = #{var}/run/hhvm/hhvm.hhbc
EOS
end
end