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
|
# file : mysql/buildfile
# copyright : Copyright (c) 2016-2019 Code Synthesis Ltd
# license : LGPLv2.1; see accompanying COPYING file
# Windows-specific named pipe and shared memory based communication plugins.
#
pvio_win32 = pvio/pvio_npipe pvio/pvio_shmem
lib{mariadb}: zlib/{c}{* } \
plugins/{c}{** -{$pvio_win32}} \
libmariadb/{c}{* -ma_tls -ma_client_plugin} \
libmariadb/{c}{ ma_client_plugin} \
{h}{** -version} \
{h}{ version}
tclass = $c.target.class
tsys = $c.target.system
windows = ($tclass == 'windows')
lib{mariadb}: win-iconv/{h c }{* } \
plugins/{ c }{$pvio_win32 }: include = $windows
# The upstream package, by default, builds without SSL on POSIX systems, and
# with bundled SSL on Windows. However, it fails to build against MinGW API
# that doesn't implement some "bleeding edge" features used, like the
# SecPkgContext_CipherInfo type. So we only enable SSL for VC.
#
# @@ TODO: need to enable SSL by default on POSIX.
#
with_ssl = ($tsys == 'win32-msvc')
lib{mariadb}: libmariadb/{ c}{ma_tls} \
libmariadb/secure/{h c}{* }: include = $with_ssl
# Symbol exporting on Windows is done via the .def file.
#
lib{mariadb}: libmariadb/def{mariadbclient}: include = $windows
libmariadb/def{mariadbclient}: libmariadb/in{mariadbclient_win32}
libmariadb/def{mariadbclient}: mariadb_deinitialize_ssl = \
($with_ssl ? 'mariadb_deinitialize_ssl' : '')
# Makes sense to distribute README for the bundled library.
#
lib{mariadb}: zlib/file{README}
# See bootstrap.build for details.
#
if $version.pre_release
lib{mariadb}: bin.lib.version = @"-$version.project_id"
else
lib{mariadb}: bin.lib.version = @"-$abi_version"
# Include the generated version header into the distribution (so that we don't
# pick up an installed one) and don't remove it when cleaning in src (so that
# clean results in a state identical to distributed).
#
# @@ We should probably allow to configure MARIADB_UNIX_ADDR (used as a last
# resort) via configuration variable config.libmariadb.unix_addr. Note that
# it is set differently for the upstream package and the major Linux
# distributions:
#
# Debian/Ubuntu: /var/run/mysqld/mysqld.sock
# Fedora/RHEL: /var/lib/mysql/mysql.sock
# Source package: /tmp/mysql.sock
#
h{version}: in{version} $src_root/manifest
h{version}: dist = true
h{version}: clean = ($src_root != $out_root)
h{version}: in.symbol = '@'
h{version}: PROTOCOL_VERSION = $protocol_version
h{version}: MARIADB_CLIENT_VERSION = $version.project
h{version}: MARIADB_BASE_VERSION = "mariadb-$version.major.$version.minor"
h{version}: MARIADB_VERSION_ID = \
"\(10000 * $version.major + 100 * $version.minor + $version.patch\)"
h{version}: MYSQL_VERSION_ID = $MARIADB_VERSION_ID
h{version}: MARIADB_PORT = 3306
h{version}: MARIADB_UNIX_ADDR = ($windows ? '': /tmp/mysql.sock)
h{version}: CPACK_PACKAGE_VERSION = "$client_major.$client_minor.$client_patch"
h{version}: MARIADB_PACKAGE_VERSION_ID = \
"\(10000 * $client_major + 100 * $client_minor + $client_patch\)"
h{version}: CMAKE_SYSTEM_NAME = $tsys
h{version}: CMAKE_SYSTEM_PROCESSOR = $c.target.cpu
h{version}: PLUGINDIR = \
($install.root != [null] \
? $regex.replace($install.resolve($install.lib)/mariadb/plugin, '\\', '/') \
: '')
h{version}: default_charset = ''
h{version}: CC_SOURCE_REVISION = ''
libmariadb/c{ma_client_plugin}: libmariadb/in{ma_client_plugin}
libmariadb/c{ma_client_plugin}: in.symbol = '@'
libmariadb/c{ma_client_plugin}: in.substitution = lax
libmariadb/c{ma_client_plugin}: EXTERNAL_PLUGINS = ''
libmariadb/c{ma_client_plugin}: BUILTIN_PLUGINS = ''
for p: 'pvio_socket' 'native_password_client' 'old_password_client' \
($windows ? 'pvio_npipe' 'pvio_shmem' : )
{
libmariadb/c{ma_client_plugin}: EXTERNAL_PLUGINS = "$EXTERNAL_PLUGINS
extern struct st_mysql_client_plugin $(p)_plugin;"
libmariadb/c{ma_client_plugin}: BUILTIN_PLUGINS = "$BUILTIN_PLUGINS
\(struct st_mysql_client_plugin *\)&$(p)_plugin,"
}
# We have dropped the macro definitions that are not used in the package code:
#
# -DHAVE_AUTH_CLEARTEXT=1 -DHAVE_AUTH_DIALOG=1 -DHAVE_AUTH_NATIVE=1
# -DHAVE_AUTH_OLDPASSWORD=1 -DHAVE_AURORA=1 -DHAVE_REPLICATION=1
# -DHAVE_TRACE_EXAMPLE=1
#
# Here are VC-specific macros dropped:
#
# /D sha256_password_EXPORTS /D HAVE_NPIPE=1 /D HAVE_SHMEM=1
# /D HAVE_AUTH_SHA256PW=1 /D HAVE_AUTH_GSSAPI=1
# /D HAVE_AUTH_GSSAPI_DYNAMIC=1 /D HAVE_DIALOG_DYNAMIC=1
# /D HAVE_SHA256PW_DYNAMIC=1 /D HAVE_CLEARTEXT_DYNAMIC=1 /D _WINDLL
#
# Note that we add "-I$src_root" for the headers auto-generating machinery to
# work properly.
#
# Also note that we add -DLIBICONV_PLUG not to let the GNU's libiconv header to
# rename iconv*() functions to libiconv*(). Not doing so breaks the linkage
# against non-GNU libc, implementing iconv API, if GNU libiconv is installed in
# the system and its header is picked up instead of the system one.
#
mariadb_poptions = "-I$out_root" "-I$src_root" "-I$src_base" \
-DHAVE_SOCKET=1 -DHAVE_COMPRESS -DENABLED_LOCAL_INFILE \
-DLIBMARIADB -DTHREAD -DLIBICONV_PLUG -DDBUG_OFF
if! $windows
{
if ($tclass == 'linux')
mariadb_poptions += -D_GNU_SOURCE
}
else
{
# Note that the original package defines the WIN32 macro for VC only, relying
# on the fact that MinGW GCC defines it by default. However, the macro
# disappears from the default ones if to compile with -std=c9x (as we do). So
# we define it for both VC and MinGW GCC.
#
c.poptions += -DWIN32 -D_WINDOWS -D_MBCS
# Using CancelIoEx() in mysql/plugins/pvio/pvio_socket.c requires at least
# Windows Vista/Server 2008 (_WIN32_WINNT >= 0x0600). Note that Windows Kits
# (used by VC) default _WIN32_WINNT to the most current version.
#
c.poptions += -D_WIN32_WINNT=0x0600
# Declaration visibility attribute is not supported.
#
c.poptions += -DNO_VIZ
if $with_ssl
mariadb_poptions += -DHAVE_SCHANNEL -DHAVE_TLS
}
zlib_poptions = "-I$src_base/zlib"
# Note that the bundled win-iconv header is included as a quoted (relative)
# path, so no need for -I option.
#
zlib/ c.poptions =+ $zlib_poptions
plugins/ c.poptions =+ $mariadb_poptions
libmariadb/ c.poptions =+ $mariadb_poptions $zlib_poptions
if ($c.class == 'msvc')
{
# Disable warnings that pop up with /W3.
#
c.coptions += /wd4996 /wd4267
}
elif ($c.class == 'gcc')
{
# Disable warnings that pop up with -Wall -Wextra. Upstream doesn't seem to
# care about these and it is not easy to disable specific warnings in a way
# that works across compilers/version (some -Wno-* options are only
# recognized in newer versions). There are still some warnings left that
# appear for certain platforms/compilers. We pass them through but disable
# treating them as errors.
#
c.coptions += -Wno-all -Wno-extra -Wno-error
}
if! $windows
{
# On Linux the upstream package also passes the cmake-generated
# mariadbclient.def version script file. The symbols it contains are
# hard-coded into libmariadb/libmariadb/CMakeList.txt. We drop the file for
# now.
#
if ($tclass == 'linux')
{
# Make sure all symbols are resolvable.
#
libs{mariadb}: c.loptions += -Wl,--no-undefined
}
elif ($tclass == 'macos')
libs{mariadb}: c.loptions += -compatibility_version "$abi_version.0.0" \
-current_version "$abi_version.0.0"
c.libs += -lpthread -lm
# Drop the redundant linkage of libnsl.
#
# The upstream package looks for gethostbyname_r() in libnsl and links it even
# though it doesn't export the symbol (that actually is not even used in
# libmariadb).
#
# Note that glibc 2.26 deprecates libnsl and doesn't install it by default, so
# its linkage just fails.
#
# if ($tclass == 'linux')
# c.libs += -lnsl
if ($tclass != 'bsd')
c.libs += -ldl
if ($tclass == 'macos')
c.libs += -liconv
}
else
# @@ secur32
#
c.libs += $regex.apply(ws2_32 shlwapi advapi32 version, \
'(.+)', \
$tsys == 'mingw32' ? '-l\1' : '\1.lib')
# The library clients must include the API header as <mysql/mysql.h>.
#
lib{mariadb}: c.export.poptions = "-I$out_root" "-I$src_root"
# Let's install the bare minimum of headers: mysql.h, errmsg.h, mysqld_error.h
# and headers they recursively include.
#
# Note that we don't install dyncol and client plugin API headers. Including
# them wouldn't work out of the box anyway, as they include prerequisite
# headers without mysql/ prefix. These headers don't look important as seems
# to be broken anyway for the upstream package (they reference non-installed
# headers and non-exported functions).
#
h{*}: install = false
# @@ Fix once LHS pair generation is implemented.
#
for h: mysql errmsg mysqld_error mariadb_version mariadb_com ma_list \
mariadb_ctype mariadb_stmt
h{$h}@./: install = include/mysql/
# Install into the mysql/ subdirectory of, say, /usr/include.
#
h{version}: install = include/mysql/
|