/
Portfile
351 lines (295 loc) · 14.9 KB
/
Portfile
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
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
PortSystem 1.0
PortGroup legacysupport 1.1
# CLOCK_REALTIME
legacysupport.newest_darwin_requires_legacy 15
name mariadb-10.4
set name_mysql ${name}
version 10.4.27
set version_branch [join [lrange [split ${version} .] 0 1] .]
# Please set revision_client and revision_server to 0 if you bump
# version; these can be changed independently for the 2 subports, but
# can be changed at the same time if that's what's required.
set revision_client 0
set revision_server 0
categories databases
platforms darwin
license GPL-2
maintainers {michaelld @michaelld} openmaintainer
if {$subport eq $name} {
PortGroup cmake 1.0
PortGroup select 1.0
PortGroup github 1.0
PortGroup compiler_blacklist_versions 1.0
PortGroup boost 1.0
boost.version 1.78
compiler.cxx_standard 2011
# https://trac.macports.org/ticket/60805
compiler.blacklist-append {clang < 900}
github.setup MariaDB server ${version} mariadb-
revision ${revision_client}
license GPL-2
description Multithreaded SQL database server
long_description Mariadb is a fork of the MySQL server, a multi-threaded SQL database.
cmake.out_of_source yes
use_parallel_build yes
# mariadb-connector-c, wsrep-lib and wsrep-API are submodules,
# but because we're not
# cloning into a GIT module in the first place, we can't use the
# git submodule feature. Have to download separately and install
# into the correct location to get this port to work! Which means
# we need a mariadb-connector-c branch and so forth ... basically
# replicate what the github PG does but without using it since it
# is not designed to be used for multiple downloads.
set libmariadb_github_author MariaDB
set libmariadb_github_project mariadb-connector-c
set libmariadb_github_branch 7fdb3eab66384a355475704332d11cc1ab82499a
set wsrep_github_author codership
set wsrep_github_project wsrep-lib
set wsrep_github_branch 8bfce04189671eb1f06e0fa83dff8c880f31088f
set wsrep_api_github_author codership
set wsrep_api_github_project wsrep-API
set wsrep_api_github_branch 02ed17238cee97b5a3ea2495ca87b63570403f01
set main_distname ${distname}
set main_distfile ${distfiles}
set libmariadb_distname ${libmariadb_github_project}-${libmariadb_github_branch}
set libmariadb_distfile ${libmariadb_distname}${extract.suffix}
set wsrep_distname ${wsrep_github_project}-${wsrep_github_branch}
set wsrep_distfile ${wsrep_distname}${extract.suffix}
set wsrep_api_distname ${wsrep_api_github_project}-${wsrep_api_github_branch}
set wsrep_api_distfile ${wsrep_api_distname}${extract.suffix}
distfiles ${main_distfile}:tagone \
${libmariadb_distfile}:tagtwo \
${wsrep_distfile}:tagthree \
${wsrep_api_distfile}:tagfour
master_sites ${github.homepage}/archive/${git.branch}:tagone \
https://github.com/${libmariadb_github_author}/${libmariadb_github_project}/archive/${libmariadb_github_branch}:tagtwo \
https://github.com/${wsrep_github_author}/${wsrep_github_project}/archive/${wsrep_github_branch}:tagthree \
https://github.com/${wsrep_api_github_author}/${wsrep_api_github_project}/archive/${wsrep_api_github_branch}:tagfour
checksums ${main_distfile} \
rmd160 2860e1dcd533c9b7d1b6de3ca81f48d824d1c52b \
sha256 36800ce43a26af3a014abc9676c0947434f8427020b725378ee7101d68228562 \
size 64687881 \
${libmariadb_distfile} \
rmd160 c63e8387fa7bf3f2d6d4d7db87835f01875fcccf \
sha256 37902fbad5b55968e297b071819228a0b58f253d82d2813f249a7ba230d71019 \
size 1191573 \
${wsrep_distfile} \
rmd160 f5c1f52a07dcccd4babb0e4da5ddca52cd78c8e7 \
sha256 8a64fbb42a76c9839e2aaf43ebeb143f39c2842874084b7f1f7ba1f842b7d052 \
size 176413 \
${wsrep_api_distfile} \
rmd160 996ddebec67793a0b15d9e2cff9aa70e7760550e \
sha256 99960eb0ccb4dff5eb354289b0a8ec2ecb0dcc246f54edf292f69f340a916ee4 \
size 91283
worksrcdir ${github.project}-${git.branch}
post-extract {
# put the libmariadb_github_project directory into position
# remove the original directory
ui_debug "delete ${worksrcpath}/libmariadb"
delete ${worksrcpath}/libmariadb
ui_debug "move ${workpath}/${libmariadb_distname} ${worksrcpath}/libmariadb"
move ${workpath}/${libmariadb_distname} ${worksrcpath}/libmariadb
# put the wsrep_github_project directory into position
# remove the original directory
ui_debug "delete ${worksrcpath}/wsrep-lib"
delete ${worksrcpath}/wsrep-lib
ui_debug "move ${workpath}/${wsrep_distname} ${worksrcpath}/wsrep-lib"
move ${workpath}/${wsrep_distname} ${worksrcpath}/wsrep-lib
# put the wsrep_api_github_project directory into position
# remove the original directory
ui_debug "delete ${worksrcpath}/wsrep-lib/wsrep-API/v26"
delete ${worksrcpath}/wsrep-lib/wsrep-API/v26
ui_debug "move ${workpath}/${wsrep_api_distname} ${worksrcpath}/wsrep-lib/wsrep-API/v26"
move ${workpath}/${wsrep_api_distname} ${worksrcpath}/wsrep-lib/wsrep-API/v26
}
depends_build-append port:bison
depends_lib-append port:zlib port:tcp_wrappers port:ncurses port:judy \
port:openssl11 port:libxml2 port:pcre
depends_run-append port:mysql_select
select.group mysql
select.file ${filespath}/${name_mysql}
post-extract {
file mkdir ${cmake.build_dir}/macports
copy ${filespath}/macports-default.cnf \
${filespath}/my.cnf \
${cmake.build_dir}/macports/
}
patch.pre_args -p1
patchfiles patch-cmake-install_layout.cmake.diff \
patch-CMakeLists.txt.diff \
patch-libmariadb_cmake_install.cmake.diff \
patch-libmariadb_libmariadb_CMakeLists.txt.diff \
patch-cmake_mysql_version.cmake.diff \
patch-SSL_INCLUDES_first.diff
# patch to provide minimum changes required for ARM64 support;
# guessing this will be fixed in the next release.
patchfiles-append patch-include_my_global.h.diff
post-patch {
reinplace "s|@NAME@|${name_mysql}|g" \
${worksrcpath}/cmake/install_layout.cmake
reinplace "s|@NAME@|${name_mysql}|g" \
${worksrcpath}/libmariadb/cmake/install.cmake
reinplace "s|@NAME@|${name_mysql}|g" \
${cmake.build_dir}/macports/macports-default.cnf \
${cmake.build_dir}/macports/my.cnf
reinplace "s|@PREFIX@|${prefix}|g" \
${cmake.build_dir}/macports/macports-default.cnf \
${cmake.build_dir}/macports/my.cnf
move ${worksrcpath}/VERSION ${worksrcpath}/VERSION.txt
}
configure.cppflags-delete -I${prefix}/include
configure.args-delete \
-DCMAKE_INSTALL_NAME_DIR=${prefix}/lib
configure.args-append \
-DCMAKE_INSTALL_NAME_DIR:STRING=${prefix}/lib/${name_mysql}/mysql \
-DINSTALL_LAYOUT:STRING=MACPORTS \
-DSYSCONFDIR:PATH=${prefix}/etc/${name_mysql} \
-DMYSQL_UNIX_ADDR:PATH=${prefix}/var/run/${name_mysql}/mysqld.sock \
-DMYSQL_DATADIR:PATH=${prefix}/var/db/${name_mysql} \
-DDEFAULT_CHARSET:STRING=utf8 \
-DDEFAULT_COLLATION:STRING=utf8_general_ci \
-DWITH_EMBEDDED_SERVER:BOOL=ON \
-DWITH_ZLIB:STRING=system \
-DWITH_UNIT_TESTS:BOOL=ON \
-DWITHOUT_CASSANDRA_STORAGE_ENGINE:BOOL=ON \
-DWITHOUT_MROONGA_STORAGE_ENGINE:BOOL=ON \
-DWITHOUT_ROCKSDB_STORAGE_ENGINE:BOOL=ON \
-DWITHOUT_TOKUDB_STORAGE_ENGINE:BOOL=ON \
-DENABLE_GCOV:BOOL=OFF \
-DENABLE_DTRACE:BOOL=OFF \
-DWITH_READLINE:BOOL=ON \
-DWITH_LIBWRAP:BOOL=ON \
-DWITH_SSL:STRING=${prefix}/libexec/openssl11 \
-DMYSQL_MAINTAINER_MODE:STRING=AUTO \
-DICONV_LIBRARIES=${prefix}/lib/libiconv.dylib \
-DICONV_INCLUDE_DIR:PATH=${prefix}/include \
-DCONNECT_WITH_JDBC=OFF \
-DCONNECT_WITH_LIBXML2=ON \
-DCONNECT_WITH_MONGO=OFF \
-DCONNECT_WITH_ODBC=OFF \
-DCONNECT_WITH_REST=OFF \
-DWITH_PCRE=system \
-DBISON_EXECUTABLE=${prefix}/bin/bison
configure.checks.implicit_function_declaration.whitelist-append select
post-destroot {
# proc portdestroot::destroot_finish fails to find and compress our man pages
# so borrow the compress command and run on our files now.
set manpath "${destroot}${prefix}/share/man"
set gzip [findBinary gzip ${portutil::autoconf::gzip_path}]
foreach manpage [glob -type f ${destroot}${prefix}/share/man/${name_mysql}/man\[1-9\]/*] {
# Fix paths in manpages
reinplace -q "s|/etc/|${prefix}/etc/${name_mysql}/|g" ${manpage}
# Compress all manpages with gzip
system "$gzip -9vf ${manpage}"
}
#foreach samp_conffile [glob -type f ${destroot}${prefix}/share/${name_mysql}/support-files/my-*.cnf] {
# # Fix paths in sample configuration files
# reinplace -q "s|/etc/my.cnf|${prefix}/etc/${name_mysql}/my.cnf|g" ${samp_conffile}
#}
xinstall -m 755 -o root -d \
${destroot}${prefix}/etc/${name_mysql}
copy ${cmake.build_dir}/macports/macports-default.cnf \
${destroot}${prefix}/etc/${name_mysql}/
xinstall -m 755 -o root -d \
${destroot}${prefix}/share/${name_mysql}/support-files/macports
copy ${cmake.build_dir}/macports/my.cnf \
${destroot}${prefix}/share/${name_mysql}/support-files/macports/
}
post-install {
if {![file exists ${prefix}/etc/LaunchDaemons/org.macports.${name_mysql}/org.macports.${name_mysql}-server.plist]} {
ui_msg "The ${name_mysql} client has been installed."
ui_msg "To install the ${name_mysql} server, install the ${name_mysql}-server port."
}
}
post-activate {
if {![file exists ${prefix}/etc/${name_mysql}/my.cnf]} {
copy ${prefix}/share/${name_mysql}/support-files/macports/my.cnf \
${prefix}/etc/${name_mysql}/
}
}
variant system_readline description {Use system readline instead of bundled readline} {
# Add readline support.
# "-DWITH_READLINE:BOOL=OFF" has the peculiar meaning "do not use the bundled copy
# of readline but use the system's (i.e. MacPorts') copy of readline"
depends_lib-append port:readline
configure.args-delete -DWITH_READLINE:BOOL=ON
configure.args-append -DWITH_READLINE:BOOL=OFF
}
notes "
On activation if no ${prefix}/etc/${name_mysql}/my.cnf file exists one
will be created which loads
${prefix}/etc/${name_mysql}/macports-default.cnf.
If a ${prefix}/etc/${name_mysql}/my.cnf file exists MacPorts does not
touch it and any changes you make to ${prefix}/etc/${name_mysql}/my.cnf
will be preserved (e.g., during port upgrades, deactivations or
activations). ${prefix}/etc/${name_mysql}/my.cnf is a good place to
customize your ${name_mysql} installation.
Any changes made to ${prefix}/etc/${name_mysql}/macports-default.cnf
will be lost during port upgrades, deactivations or activations so you
are advised to not make changes here. Currently
${prefix}/etc/${name_mysql}/macports-default.cnf contains only one
directive; to disable networking. With disabled networking it is
possible to install and have running all the MacPorts mysql ports
simultaneously.
"
github.livecheck.regex (${version_branch}\\.\[0-9\]+)
}
subport ${name_mysql}-server {
revision ${revision_server}
license BSD
description (Beta version) Run ${name_mysql} as server
long_description {*}${description}
supported_archs noarch
distfiles
depends_run port:${name_mysql}
if {"darwin" eq ${os.platform} && ${os.major} > 8} {
set mysqluser _mysql
} else {
set mysqluser mysql
}
add_users ${mysqluser} group=${mysqluser} realname=MySQL\ Server
pre-extract {
copy ${filespath}/org.macports.mysql-server.plist ${workpath}/org.macports.${subport}.plist
}
post-patch {
reinplace "s|@NAMEMYSQL@|${name_mysql}|g" \
${workpath}/org.macports.${subport}.plist
reinplace "s|@PREFIX@|${prefix}|g" \
${workpath}/org.macports.${subport}.plist
reinplace "s|@SUBPORT@|${subport}|g" \
${workpath}/org.macports.${subport}.plist
reinplace "s|@USER@|${mysqluser}|g" \
${workpath}/org.macports.${subport}.plist
reinplace "s|@GROUP@|${mysqluser}|g" \
${workpath}/org.macports.${subport}.plist
}
use_configure no
build {}
destroot {
xinstall -d -m 755 ${destroot}${prefix}/etc/LaunchDaemons/org.macports.${subport}
xinstall -m 0644 -o root -W ${workpath} \
org.macports.${subport}.plist \
${destroot}${prefix}/etc/LaunchDaemons/org.macports.${subport}
xinstall -d -m 755 ${destroot}/Library/LaunchDaemons
ln -s ${prefix}/etc/LaunchDaemons/org.macports.${subport}/org.macports.${subport}.plist \
${destroot}/Library/LaunchDaemons/org.macports.${subport}.plist
xinstall -m 755 -o root -d \
${destroot}${prefix}/var/run
xinstall -m 755 -o ${mysqluser} -g ${mysqluser} -d \
${destroot}${prefix}/etc/${name_mysql} \
${destroot}${prefix}/var/db/${name_mysql} \
${destroot}${prefix}/var/log/${name_mysql} \
${destroot}${prefix}/var/run/${name_mysql}
destroot.keepdirs-append \
${destroot}${prefix}/var/db/${name_mysql} \
${destroot}${prefix}/var/log/${name_mysql} \
${destroot}${prefix}/var/run/${name_mysql}
}
notes "
If this is a new install you might want to run:
\$ sudo -u ${mysqluser} ${prefix}/lib/${name_mysql}/bin/mysql_install_db
"
livecheck.type none
}
homepage https://mariadb.org/