# file : mysql/buildfile # copyright : Copyright (c) 2016-2018 Code Synthesis Ltd # license : GPLv2 with FOSS License Exception; see accompanying COPYING file # Windows-specific utilities. # mysys_win32 = my_winerr my_winfile # Windows-specific named pipe and shared memory based communication channels. # vio_win32 = viopipe vioshm lib{mysqlclient}: {h }{* -version} \ {h }{ version} \ zlib/{h c }{* } \ strings/{h c }{* } \ atomic/{h }{* } \ mysys/{h c }{* -posix_timers -{$mysys_win32}} \ mysys_ssl/{h cxx}{* } \ extra/yassl/{h c hxx cxx}{** } \ vio/{h c }{* -{$vio_win32}} \ sql/{h c hxx cxx}{** } \ sql-common/{h c hxx cxx}{* } \ libmysql/{h c }{* } \ mysql/{h }{** } # Makes sense to distribute READMEs and licenses for the bundled libraries. # lib{mysqlclient}: zlib/file{README* } \ extra/yassl/file{README COPYING FLOSS-EXCEPTIONS} \ extra/yassl/taocrypt/file{README COPYING } tclass = $c.target.class tsys = $c.target.system if ($tclass == 'linux') lib{mysqlclient}: mysys/c{posix_timers} else lib{mysqlclient}: mysys/file{posix_timers.c} if ($tclass == 'windows') lib{mysqlclient}: mysys/{ c }{$mysys_win32} \ vio/{ c }{$vio_win32 } \ libmysql/authentication_win/{h cxx}{* } else lib{mysqlclient}: mysys/file{$regex.apply($mysys_win32, '(.+)', '\1.c')} \ vio/file{$regex.apply($vio_win32, '(.+)', '\1.c')} \ libmysql/authentication_win/file{*.h *.cpp } lib{mysqlclient}: libmysql/file{libmysql_exports_win32.def} # See bootstrap.build for details. # if $version.pre_release lib{mysqlclient}: bin.lib.version = @"-$version.project_id" else lib{mysqlclient}: 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 MYSQL_UNIX_ADDR via configuration # variable config.libmysqlclient.unix_addr. Note that it is set differently # for the upstream package and major Linux distributions: # # Debian/Ubuntu: /var/run/mysqld/mysqld.sock # Fedora/RHEL: /var/lib/mysql/mysql.sock # Source package: /tmp/mysql.sock # # @@ Note that if variable values changes (say install root is reconfigured), # then the version files is not regenerated. Should we store instantiated # variables name/value hash in the dependency file? This will be fixed # as part of the in module. # 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}: VERSION = $version.project h{version}: MYSQL_BASE_VERSION = "$version.major.$version.minor" h{version}: MYSQL_VERSION_MAJOR = $version.major h{version}: MYSQL_VERSION_MINOR = $version.minor h{version}: MYSQL_SERVER_SUFFIX = '' h{version}: DOT_FRM_VERSION = 6 # File format (server-related). h{version}: MYSQL_VERSION_ID = \ "\(10000 * $version.major + 100 * $version.minor + $version.patch\)" h{version}: MYSQL_TCP_PORT = 3306 h{version}: MYSQL_TCP_PORT_DEFAULT = 0 h{version}: MYSQL_UNIX_ADDR = ($tclass != 'windows' ? /tmp/mysql.sock : '') h{version}: COMPILATION_COMMENT = 'Source distribution' h{version}: SYS_SCHEMA_VERSION = '1.5.1' # Server-related. h{version}: MACHINE_TYPE = $c.target.cpu h{version}: SYSTEM_TYPE = $tsys h{version}: DEFAULT_BASEDIR = \ ($install.root != [null] \ ? $regex.replace("$install.resolve($install.root)", '\\', '/') \ : '') h{version}: PLUGINDIR = \ ($install.root != [null] \ ? $regex.replace($install.resolve($install.lib)/mysql/plugin, '\\', '/') \ : '') h{version}: SHAREDIR = \ ($install.root != [null] \ ? $regex.replace($install.resolve($install.data_root)/share/mysql, \ '\\', '/') \ : '') # We have dropped the macro definitions that are not used in the package code: # # -DHAVE_LIBEVENT1 # cc.poptions += -DHAVE_CONFIG_H -DDBUG_OFF if ($tclass != 'windows') { cc.poptions += -D_FILE_OFFSET_BITS=64 if ($tclass == 'linux') cc.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. # cc.poptions += -DWIN32 -D_WINDOWS -D_WIN32_WINNT=0x0601 -DNOGDI -DNOMINMAX \ -DWIN32_LEAN_AND_MEAN -D_MBCS } # Note that we add "-I$src_root" for the headers auto-generating machinery to # work properly. # cc.poptions =+ "-I$out_root" "-I$src_root" "-I$src_base" zlib_poptions = "-I$src_base/zlib" strings_poptions = "-I$src_base/strings" mysys_poptions = "-I$src_base/mysys" # To keep "-I$out_root" "-I$src_root" first we use '+=', rather than '=+' to # append poptions for the target wildcards. # zlib/ cc.poptions += $zlib_poptions mysys/ cc.poptions += $mysys_poptions $zlib_poptions strings/ cc.poptions += $strings_poptions -DDISABLE_MYSQL_THREAD_H yassl_dir = $src_base/extra/yassl taocrypt_dir = $yassl_dir/taocrypt taocrypt_poptions = "-I$taocrypt_dir/include" "-I$taocrypt_dir/mySTL" \ -DHAVE_YASSL -DYASSL_PREFIX -DHAVE_OPENSSL \ -DMULTI_THREADED yassl_poptions = "-I$yassl_dir/include" $taocrypt_poptions extra/yassl/ { taocrypt/ cc.poptions += $taocrypt_poptions cc.poptions += -Dget_tty_password=yassl_mysql_get_tty_password \ -Dget_tty_password_ext=yassl_mysql_get_tty_password_ext \ $yassl_poptions } vio/ cc.poptions += "-I$src_base" $yassl_poptions mysys_ssl/ cc.poptions += "-I$src_base" $yassl_poptions $mysys_poptions # The CLIENT_PROTOCOL_TRACING macro seems to be required for debugging only. # However, the compilation falls apart if undefined, so we keep it. # sql_poptions = "-I$src_base/sql" "-I$src_base/libmysql" \ -DCLIENT_PROTOCOL_TRACING \ $yassl_poptions $zlib_poptions $strings_poptions if ($tclass == 'windows') sql_poptions += -DAUTHENTICATION_WIN sql/ cc.poptions += $sql_poptions sql-common/ cc.poptions += $sql_poptions libmysql/ cc.poptions += $sql_poptions # The upstream package always adds -DDEBUG_ERRROR_LOG -DWINAUTH_USE_DBUG_LIB. # Looks like they are required for debugging only, so let's omit them. # if ($tclass == 'windows') libmysql/authentication_win/ cc.poptions += -DSECURITY_WIN32 if ($c.class == 'msvc') { # Disable warnings that pop up with /W3. # cc.coptions += /wd4311 /wd4113 /wd4996 /wd4244 /wd4267 /wd4334 /wd4800 /wd4091 } elif ($c.class == 'gcc') { # We don't care about C++ ABI specification conformance, especially given # that only C functions are exported. So we omit -fabi-version=2. # cc.coptions += -fno-omit-frame-pointer -fno-strict-aliasing # 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). # cc.coptions += -Wno-all -Wno-extra } if ($tclass != 'windows') { # On Linux the upstream package also passes the cmake-generated # libmysql.ver file. The symbols it contains are hard-coded into # libmysql/CMakeList.txt. We have dropped the file for now. # if ($tclass == 'linux') cc.loptions += -Wl,--no-undefined # Make sure all symbols are resolvable. cc.libs += ($tclass == 'bsd' ? -lexecinfo : -ldl) -lpthread -lm if ($tclass == 'linux') cc.libs += -lrt # Posix timers. } else { cc.libs += advapi32.lib libs{mysqlclient}: \ cc.libs =+ "/DEF:$src_base/libmysql/libmysql_exports_win32.def" } # The library clients must include the API header as . # lib{mysqlclient}: cc.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. # h{*}: install = false hxx{*}: install = false # @@ Fix once LHS pair generation is implemented. # for h: mysql errmsg mysqld_error mysql_time mysql_version mysql_com \ my_list my_alloc my_command binary_log_types typelib \ mysql/client_plugin mysql/plugin_auth_common \ mysql/psi/psi_base mysql/psi/psi_memory { h{$h}@./: install = include/mysql/$path.directory($h) h{$h}@./: install.subdirs = true } # Install into the mysql/ subdirectory of, say, /usr/include. # h{version}: install = include/mysql/