/
mysql@8.0.rb
224 lines (194 loc) 路 7.34 KB
/
mysql@8.0.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
class MysqlAT80 < Formula
desc "Open source relational database management system"
homepage "https://dev.mysql.com/doc/refman/8.0/en/"
# TODO: Check if we can use unversioned `protobuf` at version bump
# https://bugs.mysql.com/bug.php?id=111469
# https://bugs.mysql.com/bug.php?id=113045
url "https://cdn.mysql.com/Downloads/MySQL-8.0/mysql-boost-8.0.36.tar.gz"
sha256 "429c5f69f3722e31807e74119d157a023277af210bfee513443cae60ebd2a86d"
license "GPL-2.0-only" => { with: "Universal-FOSS-exception-1.0" }
revision 1
livecheck do
url "https://dev.mysql.com/downloads/mysql/8.0.html?tpl=files&os=src&version=8.0"
regex(/href=.*?mysql[._-](?:boost[._-])?v?(8\.0(?:\.\d+)*)\.t/i)
end
bottle do
sha256 arm64_sonoma: "5fc45cd3f05a90ec9e572c8a112e29d49d2bf6460a609b3acbbe365b26c7d6de"
sha256 arm64_ventura: "2302a9ed7a433c8ed4230c8feb83e511f55aeafe991396f2c2e57fb2cf95ecad"
sha256 arm64_monterey: "c6a57a7c679048f8dd97a0320fd297f9959a4b4648c152286d268cfe65766bf1"
sha256 sonoma: "fde93fb1abdb21a4b4579794f5d62a6cfb8e97645ac94e22cddf95fc779e84ce"
sha256 ventura: "ddb12093e5d7e0519b9fb1c427dc6c65006602a7f017561d1ca24f36a9967abd"
sha256 monterey: "31db9d660d865b0ef5f647cf5f2ff1f46a48b3e5f46895eee9375a08f32da830"
sha256 x86_64_linux: "7fb607a17ef32a4ba508648281755b39fb4a94b6d62ad49432a30af8686970ac"
end
keg_only :versioned_formula
depends_on "bison" => :build
depends_on "cmake" => :build
depends_on "pkg-config" => :build
depends_on "icu4c"
depends_on "libevent"
depends_on "libfido2"
depends_on "lz4"
depends_on "openssl@3"
depends_on "protobuf@21" # https://bugs.mysql.com/bug.php?id=113045
depends_on "zlib" # Zlib 1.2.12+
depends_on "zstd"
uses_from_macos "curl"
uses_from_macos "cyrus-sasl"
uses_from_macos "libedit"
on_linux do
depends_on "patchelf" => :build
depends_on "libtirpc"
end
fails_with gcc: "5" # for C++17
# Patch out check for Homebrew `boost`.
# This should not be necessary when building inside `brew`.
# https://github.com/Homebrew/homebrew-test-bot/pull/820
patch :DATA
def datadir
var/"mysql"
end
def install
if OS.linux?
# Fix libmysqlgcs.a(gcs_logging.cc.o): relocation R_X86_64_32
# against `_ZN17Gcs_debug_options12m_debug_noneB5cxx11E' can not be used when making
# a shared object; recompile with -fPIC
ENV.append_to_cflags "-fPIC"
# Disable ABI checking
inreplace "cmake/abi_check.cmake", "RUN_ABI_CHECK 1", "RUN_ABI_CHECK 0"
end
# -DINSTALL_* are relative to `CMAKE_INSTALL_PREFIX` (`prefix`)
args = %W[
-DCOMPILATION_COMMENT=Homebrew
-DINSTALL_DOCDIR=share/doc/#{name}
-DINSTALL_INCLUDEDIR=include/mysql
-DINSTALL_INFODIR=share/info
-DINSTALL_MANDIR=share/man
-DINSTALL_MYSQLSHAREDIR=share/mysql
-DINSTALL_PLUGINDIR=lib/plugin
-DMYSQL_DATADIR=#{datadir}
-DSYSCONFDIR=#{etc}
-DWITH_SYSTEM_LIBS=ON
-DWITH_BOOST=boost
-DWITH_EDITLINE=system
-DWITH_FIDO=system
-DWITH_ICU=system
-DWITH_LIBEVENT=system
-DWITH_LZ4=system
-DWITH_PROTOBUF=system
-DWITH_SSL=system
-DWITH_ZLIB=system
-DWITH_ZSTD=system
-DWITH_UNIT_TESTS=OFF
-DWITH_INNODB_MEMCACHED=ON
]
system "cmake", "-S", ".", "-B", "build", *args, *std_cmake_args
system "cmake", "--build", "build"
system "cmake", "--install", "build"
(prefix/"mysql-test").cd do
system "./mysql-test-run.pl", "status", "--vardir=#{Dir.mktmpdir}"
end
# Remove the tests directory
rm_rf prefix/"mysql-test"
# Don't create databases inside of the prefix!
# See: https://github.com/Homebrew/homebrew/issues/4975
rm_rf prefix/"data"
# Fix up the control script and link into bin.
inreplace "#{prefix}/support-files/mysql.server",
/^(PATH=".*)(")/,
"\\1:#{HOMEBREW_PREFIX}/bin\\2"
bin.install_symlink prefix/"support-files/mysql.server"
# Install my.cnf that binds to 127.0.0.1 by default
(buildpath/"my.cnf").write <<~EOS
# Default Homebrew MySQL server config
[mysqld]
# Only allow connections from localhost
bind-address = 127.0.0.1
mysqlx-bind-address = 127.0.0.1
EOS
etc.install "my.cnf"
end
def post_install
# Make sure the var/mysql directory exists
(var/"mysql").mkpath
# Don't initialize database, it clashes when testing other MySQL-like implementations.
return if ENV["HOMEBREW_GITHUB_ACTIONS"]
unless (datadir/"mysql/general_log.CSM").exist?
ENV["TMPDIR"] = nil
system bin/"mysqld", "--initialize-insecure", "--user=#{ENV["USER"]}",
"--basedir=#{prefix}", "--datadir=#{datadir}", "--tmpdir=/tmp"
end
end
def caveats
s = <<~EOS
We've installed your MySQL database without a root password. To secure it run:
mysql_secure_installation
MySQL is configured to only allow connections from localhost by default
To connect run:
mysql -u root
EOS
if (my_cnf = ["/etc/my.cnf", "/etc/mysql/my.cnf"].find { |x| File.exist? x })
s += <<~EOS
A "#{my_cnf}" from another install may interfere with a Homebrew-built
server starting up correctly.
EOS
end
s
end
service do
run [opt_bin/"mysqld_safe", "--datadir=#{var}/mysql"]
keep_alive true
working_dir var/"mysql"
end
test do
(testpath/"mysql").mkpath
(testpath/"tmp").mkpath
system bin/"mysqld", "--no-defaults", "--initialize-insecure", "--user=#{ENV["USER"]}",
"--basedir=#{prefix}", "--datadir=#{testpath}/mysql", "--tmpdir=#{testpath}/tmp"
port = free_port
fork do
system "#{bin}/mysqld", "--no-defaults", "--user=#{ENV["USER"]}",
"--datadir=#{testpath}/mysql", "--port=#{port}", "--tmpdir=#{testpath}/tmp"
end
sleep 5
assert_match "information_schema",
shell_output("#{bin}/mysql --port=#{port} --user=root --password= --execute='show databases;'")
system "#{bin}/mysqladmin", "--port=#{port}", "--user=root", "--password=", "shutdown"
end
end
__END__
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 42e63d0..5d21cc3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1942,31 +1942,6 @@ MYSQL_CHECK_RAPIDJSON()
MYSQL_CHECK_FIDO()
MYSQL_CHECK_FIDO_DLLS()
-IF(APPLE)
- GET_FILENAME_COMPONENT(HOMEBREW_BASE ${HOMEBREW_HOME} DIRECTORY)
- IF(EXISTS ${HOMEBREW_BASE}/include/boost)
- FOREACH(SYSTEM_LIB ICU LIBEVENT LZ4 PROTOBUF ZSTD FIDO)
- IF(WITH_${SYSTEM_LIB} STREQUAL "system")
- MESSAGE(FATAL_ERROR
- "WITH_${SYSTEM_LIB}=system is not compatible with Homebrew boost\n"
- "MySQL depends on ${BOOST_PACKAGE_NAME} with a set of patches.\n"
- "Including headers from ${HOMEBREW_BASE}/include "
- "will break the build.\n"
- "Please use WITH_${SYSTEM_LIB}=bundled\n"
- "or do 'brew uninstall boost' or 'brew unlink boost'"
- )
- ENDIF()
- ENDFOREACH()
- ENDIF()
- # Ensure that we look in /usr/local/include or /opt/homebrew/include
- FOREACH(SYSTEM_LIB ICU LIBEVENT LZ4 PROTOBUF ZSTD FIDO)
- IF(WITH_${SYSTEM_LIB} STREQUAL "system")
- INCLUDE_DIRECTORIES(SYSTEM ${HOMEBREW_BASE}/include)
- BREAK()
- ENDIF()
- ENDFOREACH()
-ENDIF()
-
IF(WITH_AUTHENTICATION_FIDO OR WITH_AUTHENTICATION_CLIENT_PLUGINS)
IF(WITH_FIDO STREQUAL "system" AND
NOT WITH_SSL STREQUAL "system")