# file : mysql/buildfile # copyright : Copyright (c) 2016-2017 Code Synthesis Ltd # license : GPLv2 with FOSS License Exception; see accompanying COPYING file define def: file def{*}: extension = def # Note that the upstream package links the target library entirely from the # "convenience" libraries, and to prevent linker from creating an empty target # it also adds auto-generated libmysql_exports_file.cc dummy file. # # @@ Not all headers are covered. # mysys_win32 = my_winerr my_winfile vio_win32 = viopipe vioshm lib{mysqlclient}: zlib/{h c }{* } \ strings/{h c }{* } \ mysys/{h c }{* -posix_timers -{$mysys_win32}} \ mysys_ssl/{h cxx}{* } \ dbug/{h c }{* } \ extra/yassl/taocrypt/src/{ hxx cxx}{* } \ extra/yassl/src/{h c hxx cxx}{* } \ vio/{h c }{* -{$vio_win32}} \ sql/{h c hxx cxx}{** } \ sql-common/{h c hxx cxx}{* } \ libmysql/{h c }{* } \ {h }{* -version} \ {h }{ version} \ mysql/{h }{** } \ atomic/{h }{* } tclass = $c.target.class tsys = $c.target.system if ($tclass == "linux") lib{mysqlclient}: mysys/c{posix_timers} if ($tclass == "windows") { lib{mysqlclient}: mysys/{ c }{$mysys_win32 } \ vio/{ c }{$vio_win32 } \ libmysql/authentication_win/{h cxx }{* } \ libmysql/{ def}{libmysql_exports} } # 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). # h{version}: in{version} $src_root/file{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 = /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 # We drop 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 will use '+=', rather than '=+' # to append poptions for the target wildcards. # zlib/obj{*}: cc.poptions += $zlib_poptions mysys/obj{*}: cc.poptions += $mysys_poptions $zlib_poptions strings/obj{*}: 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 extra/yassl/taocrypt/src/obj{*}: cc.poptions += $taocrypt_poptions yassl_poptions = "-I$yassl_dir/include" $taocrypt_poptions extra/yassl/src/obj{*}: \ cc.poptions += -Dget_tty_password=yassl_mysql_get_tty_password \ -Dget_tty_password_ext=yassl_mysql_get_tty_password_ext \ $yassl_poptions vio/obj{*}: cc.poptions += "-I$src_base" $yassl_poptions mysys_ssl/obj{*}: cc.poptions += "-I$src_base" $yassl_poptions $mysys_poptions # @@ Should we omit -DCLIENT_PROTOCOL_TRACING? Seems like for debugging only. # 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/obj{*}: cc.poptions += $sql_poptions sql-common/obj{*}: cc.poptions += $sql_poptions libmysql/obj{*}: 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/obj{*}: cc.poptions += -DSECURITY_WIN32 if ($tsys == "win32-msvc") { # Disable warnings that pop up with /W3. # cc.coptions += /wd4311 /wd4113 } else { cc.coptions += -fno-omit-frame-pointer -fno-strict-aliasing if ($cxx.id.type == 'gcc') cc.coptions += -fabi-version=2 # Disable warnings that pop up with -W -Wall. # cc.coptions += -Wno-unused-parameter -Wno-unused-variable \ -Wno-unused-const-variable -Wno-unused-but-set-variable \ -Wno-maybe-uninitialized -Wno-unknown-warning-option } if ($tclass != "windows") { # On Linux the upstream package also passes the cmake-generated # libmysql.ver file. The symbols it contains are hard-coded into the # libmysql/CMakeList.txt. We will not pull that into our buildfile and just # drop the .ver file for now. # if ($tclass == "linux") cc.loptions += "-Wl,--no-undefined" if ($tclass == "linux") cc.libs += -ldl if ($tclass == "bsd") cc.libs += -lexecinfo if ($tclass != "macos") cc.libs += -lpthread -lm -lrt } else { def = $src_base/libmysql/libmysql_exports.def cc.libs += advapi32.lib cc.loptions += "/DEF:$def" } # The library clients are supposed to include the API header as # only. # lib{mysqlclient}: cc.export.poptions = "-I$out_root" "-I$src_root"