From 176d224b694b4f6ec2933fc9b8e3b76043659744 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Fri, 1 Mar 2024 23:26:43 +0300 Subject: Release version 8.0.15+13 Add mysql-client package. Minor cleanups of the libmysqlclient library. --- README-DEV | 22 +++++-- libmysqlclient/README-DEV | 8 ++- libmysqlclient/build/root.build | 5 +- libmysqlclient/manifest | 6 +- libmysqlclient/mysql/buildfile | 2 +- libmysqlclient/mysql/my_config.h | 36 +++++++---- libmysqlclient/mysql/version.h.in | 1 + mysql-client/.gitignore | 25 ++++++++ mysql-client/INSTALL | 7 ++ mysql-client/LICENSE | 1 + mysql-client/README | 21 ++++++ mysql-client/README-DEV | 15 +++++ mysql-client/build/.gitignore | 3 + mysql-client/build/bootstrap.build | 10 +++ mysql-client/build/export.build | 9 +++ mysql-client/build/root.build | 25 ++++++++ mysql-client/buildfile | 9 +++ mysql-client/manifest | 33 ++++++++++ mysql-client/mysql/.gitattributes | 2 + mysql-client/mysql/.gitignore | 1 + mysql-client/mysql/buildfile | 92 +++++++++++++++++++++++++++ mysql-client/mysql/client/client_priv.h | 1 + mysql-client/mysql/client/completion_hash.cc | 1 + mysql-client/mysql/client/completion_hash.h | 1 + mysql-client/mysql/client/my_readline.h | 1 + mysql-client/mysql/client/mysql.cc | 1 + mysql-client/mysql/client/pattern_matcher.cc | 1 + mysql-client/mysql/client/pattern_matcher.h | 1 + mysql-client/mysql/client/readline.cc | 1 + mysql-client/mysql/config.h | 11 ++++ mysql-client/mysql/downstream/mysql_version.h | 5 ++ mysql-client/mysql/downstream/readline.c | 87 +++++++++++++++++++++++++ mysql-client/mysql/downstream/readline.h | 59 +++++++++++++++++ mysql-client/mysql/include | 1 + mysql-client/mysql/libbinlogevents | 1 + mysql-client/mysql/my_config.h | 1 + mysql-client/mysql/mysqld_error.h | 1 + mysql-client/tests/.gitignore | 4 ++ mysql-client/tests/build/.gitignore | 3 + mysql-client/tests/build/bootstrap.build | 8 +++ mysql-client/tests/build/root.build | 15 +++++ mysql-client/tests/buildfile | 4 ++ mysql-client/tests/help.testscript | 12 ++++ mysql-client/tests/version.testscript | 8 +++ packages.manifest | 2 + repositories.manifest | 4 ++ 46 files changed, 541 insertions(+), 26 deletions(-) create mode 120000 libmysqlclient/mysql/version.h.in create mode 100644 mysql-client/.gitignore create mode 100644 mysql-client/INSTALL create mode 120000 mysql-client/LICENSE create mode 100644 mysql-client/README create mode 100644 mysql-client/README-DEV create mode 100644 mysql-client/build/.gitignore create mode 100644 mysql-client/build/bootstrap.build create mode 100644 mysql-client/build/export.build create mode 100644 mysql-client/build/root.build create mode 100644 mysql-client/buildfile create mode 100644 mysql-client/manifest create mode 100644 mysql-client/mysql/.gitattributes create mode 100644 mysql-client/mysql/.gitignore create mode 100644 mysql-client/mysql/buildfile create mode 120000 mysql-client/mysql/client/client_priv.h create mode 120000 mysql-client/mysql/client/completion_hash.cc create mode 120000 mysql-client/mysql/client/completion_hash.h create mode 120000 mysql-client/mysql/client/my_readline.h create mode 120000 mysql-client/mysql/client/mysql.cc create mode 120000 mysql-client/mysql/client/pattern_matcher.cc create mode 120000 mysql-client/mysql/client/pattern_matcher.h create mode 120000 mysql-client/mysql/client/readline.cc create mode 100644 mysql-client/mysql/config.h create mode 100644 mysql-client/mysql/downstream/mysql_version.h create mode 100644 mysql-client/mysql/downstream/readline.c create mode 100644 mysql-client/mysql/downstream/readline.h create mode 120000 mysql-client/mysql/include create mode 120000 mysql-client/mysql/libbinlogevents create mode 120000 mysql-client/mysql/my_config.h create mode 120000 mysql-client/mysql/mysqld_error.h create mode 100644 mysql-client/tests/.gitignore create mode 100644 mysql-client/tests/build/.gitignore create mode 100644 mysql-client/tests/build/bootstrap.build create mode 100644 mysql-client/tests/build/root.build create mode 100644 mysql-client/tests/buildfile create mode 100644 mysql-client/tests/help.testscript create mode 100644 mysql-client/tests/version.testscript diff --git a/README-DEV b/README-DEV index 8cf054c..a32aef8 100644 --- a/README-DEV +++ b/README-DEV @@ -3,7 +3,8 @@ understanding will be useful when upgrading to a new upstream version. The upstream package contains the MySQL server, libmysqlclient library and a number of client/administrative utilities (mysql, mysqlcheck, etc). Currently, -we only package libmysqlclient (see libmysqlclient/README-DEV for details). +we only package libmysqlclient and mysql utility (see the respective +README-DEV files for details). We add the upstream package as a git submodule and symlink the required files and subdirectories into the build2 package subdirectories. Then, when required, @@ -29,7 +30,7 @@ however, that at the time of this writing the latest packaged versions are different: 5.7.26 on Debian and 8.0.15 on Fedora. These files can be obtained as follows: -$ wget https://download.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/source/tree/Packages/c/community-mysql-8.0.15-1.fc30.src.rpm +$ wget https://kojipkgs.fedoraproject.org/packages/community-mysql/8.0.15/1.fc30/src/community-mysql-8.0.15-1.fc30.src.rpm $ rpm2cpio community-mysql-8.0.15-1.fc30.src.rpm | cpio -civ '*.spec' #$ wget http://deb.debian.org/debian/pool/main/m/mysql-5.7/mysql-5.7_5.7.26-1.debian.tar.xz @@ -38,9 +39,9 @@ $ rpm2cpio community-mysql-8.0.15-1.fc30.src.rpm | cpio -civ '*.spec' As a side note, on Debian and Fedora the source, library, and headers are packaged as follows: - src library headers -Debian/Ubuntu: mysql-5.7 libmysqlclient20 libmysqlclient-dev -Fedora/RHEL: community-mysql community-mysql-libs community-mysql-devel + src library headers client +Debian/Ubuntu: mysql-8.0 libmysqlclient21 libmysqlclient-dev mysql-client-core-8.0 +Fedora/RHEL: community-mysql community-mysql-libs community-mysql-devel community-mysql Search for the Debian and Fedora packages at https://packages.debian.org/search and https://apps.fedoraproject.org/packages/. @@ -67,6 +68,14 @@ external dependencies that are not packaged for build2 we end up with: See the configuration options description at https://dev.mysql.com/doc/refman/8.0/en/source-configuration-options.html +Note that the mysql utility cannot be built on POSIX without the system +Readline or the system or bundled Editline (libedit). None of these libraries +is currently packaged and so we can only use the bundled libedit library. +However, the bundled libedit implementation requires ncurses library, which is +not packaged either. Thus, we bundle our own reduced libedit implementation +based on the libisocline library (see mysql-client/mysql/downstream/readline.h +for details). + Normally, when packaging a cmake-based project, we try to deduce the source file and compilation/linking option sets analyzing the root and feature/component/platform-specific CMakeLists.txt and .cmake files. In @@ -81,7 +90,8 @@ On POSIX: $ mkdir build $ cd build $ cmake -DDOWNLOAD_BOOST=ON -DWITH_BOOST=../boost -DWITHOUT_SERVER=ON \ - -DENABLED_LOCAL_INFILE=ON -DWITH_ZLIB=system -DWITH_SSL=system .. + -DENABLED_LOCAL_INFILE=ON -DWITH_ZLIB=system -DWITH_SSL=system \ + -DWITH_EDITLINE=system .. $ make VERBOSE=1 >build.log 2>&1 diff --git a/libmysqlclient/README-DEV b/libmysqlclient/README-DEV index 4d719ea..b69995c 100644 --- a/libmysqlclient/README-DEV +++ b/libmysqlclient/README-DEV @@ -8,6 +8,7 @@ for auto-generated headers: $ ln -s ../upstream/LICENSE $ ln -s ../../upstream/{vio,sql,mysys,mysys_ssl,libbinlogevents,libmysql} mysql $ ln -s ../../upstream/include mysql/mysql +$ ln -s mysql/mysql_version.h.in mysql/version.h.in Also make sure all source files are UTF-8-encoded: @@ -34,7 +35,7 @@ Note that we unable to generate mysql_version.h directly from the template as it is included as "mysql_version.h" in upstream's source code, which makes impossible using the header-generating machinery. That's why we create mysql/mysql_version.h that includes that we auto-generate -from upstream's mysql/mysql_version.h.in. +from upstream's mysql_version.h.in. $ ln -s libbinlogevents/binlog_config.h.cmake mysql/binlog_config.h.cmake.orig @@ -65,7 +66,8 @@ to, grepping for its usages, for example: grep -e CPU_LEVEL1_DCACHE_LINESIZE `find -L . -name '*.c*' -o -name '*.h*'` -And it may become obvious that the macro is not used in libmysqlclient. +And it may become obvious that the macro is not used in libmysqlclient and +mysql-client. Re-creating mysql/my_config.h from scratch every time we upgrade to a new upstream version would be a real pain. Instead we can only (un)define the @@ -74,7 +76,7 @@ macro sets: $ for m in `cat mysql/{config,binlog_config}.h.cmake.orig | \ sed -n 's/.*#\s*\(define\|cmakedefine\)\s\{1,\}\([_a-zA-Z0-9]\{1,\}\)\(\s.*\)\{0,1\}$/\2/p' | sort -u`; do - if grep -q -e "\b$m\b" `find -L . -name '*.h' -a ! -name my_config.h -a ! -name config.h -o -name '*.c' -o -name '*.cc' -a ! -name mysqld.cc -o -name '*.cpp' -o -name '*.hpp'`; then + if grep -q -e "\b$m\b" `find -L . ../mysql-client -name '*.h' -a ! -name my_config.h -a ! -name config.h -o -name '*.c' -o -name '*.cc' -a ! -name mysqld.cc -o -name '*.cpp' -o -name '*.hpp'`; then echo "$m" fi done >used-macros diff --git a/libmysqlclient/build/root.build b/libmysqlclient/build/root.build index 9c5eb0b..077c13f 100644 --- a/libmysqlclient/build/root.build +++ b/libmysqlclient/build/root.build @@ -8,7 +8,10 @@ using c h{*}: extension = h c{*}: extension = c -cxx.std = latest +# Note that the implementation uses C++14 internally, with some used +# constructs being deprecated/removed from the later versions of the standard. +# +cxx.std = 14 using cxx diff --git a/libmysqlclient/manifest b/libmysqlclient/manifest index 0707937..24a5640 100644 --- a/libmysqlclient/manifest +++ b/libmysqlclient/manifest @@ -3,7 +3,7 @@ name: libmysqlclient # Note: remember to update doc-url below! # -version: 8.0.15+12 +version: 8.0.15+13 project: mysql summary: MySQL C API client library @@ -26,3 +26,7 @@ depends: * bpkg >= 0.15.0 depends: libz ^1.2.1100 depends: libcrypto ^1.1.1 depends: libssl ^1.1.1 + +# System package mapping. +# +fedora-name: community-mysql-devel diff --git a/libmysqlclient/mysql/buildfile b/libmysqlclient/mysql/buildfile index a21aef2..37a627a 100644 --- a/libmysqlclient/mysql/buildfile +++ b/libmysqlclient/mysql/buildfile @@ -67,7 +67,7 @@ lib{mysqlclient}: strings/file{README} # Fedora/RHEL: /var/lib/mysql/mysql.sock # Source package: /tmp/mysql.sock # -h{version}: mysql/in{mysql_version} $src_root/manifest +h{version}: in{version} $src_root/manifest { dist = true clean = ($src_root != $out_root) diff --git a/libmysqlclient/mysql/my_config.h b/libmysqlclient/mysql/my_config.h index be16fe6..7914fcf 100644 --- a/libmysqlclient/mysql/my_config.h +++ b/libmysqlclient/mysql/my_config.h @@ -17,14 +17,15 @@ */ /* - * Auto-generated. Defines the following configuration macros: + * Includes auto-generated version.h. Defines the following configuration + * macros: #define PROTOCOL_VERSION * Keep all the macros listed (in this exact form) for the change tracking * (see README-DEV). */ -#include // PROTOCOL_VERSION, MYSQL_SERVER_VERSION +#include // PROTOCOL_VERSION, MYSQL_SERVER_VERSION /* * Auto-generated. Defines macros that depend on the version and build2 @@ -108,12 +109,9 @@ # define SIZEOF_CHARP SIZEOF_VOIDP #endif -#define HAVE_STRUCT_TIMESPEC - /* * Hard to even find any records of these types. */ -#undef HAVE_UINT #undef HAVE_ULONG /* @@ -180,7 +178,6 @@ #if defined(__FreeBSD__) || defined(__linux__) # define HAVE_CLOCK_GETTIME 1 # define HAVE_CUSERID 1 -# define HAVE_SIGEV_THREAD_ID 1 # define HAVE_POSIX_FALLOCATE 1 #endif @@ -221,8 +218,6 @@ # define HAVE_GETPWUID 1 # define HAVE_GETRLIMIT 1 # define HAVE_GETRUSAGE 1 -# define HAVE_READLINK 1 -# define HAVE_REALPATH 1 # define HAVE_STPCPY 1 # define HAVE_STPNCPY 1 # define HAVE_NL_LANGINFO 1 @@ -234,7 +229,6 @@ # define TIME_WITH_SYS_TIME 1 # define HAVE_ARPA_INET_H 1 # define HAVE_NETINET_IN_H 1 -# define HAVE_CHOWN 1 # define HAVE_FCHMOD 1 # define HAVE_MLOCKALL 1 # define HAVE_SYS_WAIT_H 1 @@ -258,6 +252,18 @@ # define HAVE_BUILTIN_STPCPY 1 /* + * Libedit. + */ +# define USE_LIBEDIT_INTERFACE 1 +# define USE_NEW_EDITLINE_INTERFACE 1 +# define HAVE_HIST_ENTRY 1 +# undef HAVE_TERM_H + +# define GWINSZ_IN_SYS_IOCTL 1 +# define HAVE_INDEX 1 +# define HAVE_INITGROUPS 1 + +/* * Specific for Windows. */ #else @@ -265,6 +271,7 @@ # define HAVE_TELL 1 # define NO_FCNTL_NONBLOCK 1 # define DEFAULT_TMPDIR "" +# define FN_NO_CASE_SENSE 1 #endif #ifdef _WIN32 @@ -278,10 +285,11 @@ /* * Common for all supported OSes/compilers. */ -#define HAVE_STRNLEN 1 -#define MAX_INDEXES 64U -#define HAVE_SYS_TYPES_H 1 -#define STACK_DIRECTION -1 +#define MAX_INDEXES 64U +#define HAVE_SYS_TYPES_H 1 +#define STACK_DIRECTION -1 +#define CPU_LEVEL1_DCACHE_LINESIZE 64 +#define DEFAULT_SECURE_FILE_PRIV_DIR "NULL" /* * Default character set and collation. @@ -318,8 +326,8 @@ #undef HAVE_PRINTSTACK #undef HAVE_GETHRTIME #undef HAVE_GETPASSPHRASE -#undef HAVE_SIGEV_PORT #undef HAVE_SOLARIS_ATOMIC +#undef LINUX_ALPINE /* * The upstream package undefines it for all supported compilers. diff --git a/libmysqlclient/mysql/version.h.in b/libmysqlclient/mysql/version.h.in new file mode 120000 index 0000000..9c69727 --- /dev/null +++ b/libmysqlclient/mysql/version.h.in @@ -0,0 +1 @@ +mysql/mysql_version.h.in \ No newline at end of file diff --git a/mysql-client/.gitignore b/mysql-client/.gitignore new file mode 100644 index 0000000..1c363a0 --- /dev/null +++ b/mysql-client/.gitignore @@ -0,0 +1,25 @@ +# Compiler/linker output. +# +*.d +*.t +*.i +*.i.* +*.ii +*.ii.* +*.o +*.obj +*.gcm +*.pcm +*.ifc +*.so +*.dylib +*.dll +*.a +*.lib +*.exp +*.pdb +*.ilk +*.exe +*.exe.dlls/ +*.exe.manifest +*.pc diff --git a/mysql-client/INSTALL b/mysql-client/INSTALL new file mode 100644 index 0000000..235e581 --- /dev/null +++ b/mysql-client/INSTALL @@ -0,0 +1,7 @@ +The aim of this package is to make reading the INSTALL file unnecessary. So +next time try running: + +$ bpkg build mysql-client + +But if you don't want to use the package manager, then you can also build this +package manually using the standard build2 build system. diff --git a/mysql-client/LICENSE b/mysql-client/LICENSE new file mode 120000 index 0000000..6246057 --- /dev/null +++ b/mysql-client/LICENSE @@ -0,0 +1 @@ +../upstream/LICENSE \ No newline at end of file diff --git a/mysql-client/README b/mysql-client/README new file mode 100644 index 0000000..f2a6666 --- /dev/null +++ b/mysql-client/README @@ -0,0 +1,21 @@ +MySQL is a relational SQL database management system with mysql utility being +its command-line client. It supports interactive and noninteractive use. When +used interactively, query results are presented in an ASCII-table format. When +used noninteractively, the result is presented in tab-separated format. For +more information see: + +https://www.mysql.com + +This package contains the original mysql utility source code overlaid with the +build2-based build system and packaged for the build2 package manager (bpkg). + +See the INSTALL file for the prerequisites and installation instructions. + +Send questions, bug reports, or any other feedback about the utility itself to +the MySQL mailing lists. Send build system and packaging-related feedback to +the packaging@build2.org mailing list (see https://lists.build2.org for +posting guidelines, etc). + +The packaging of mysql utility for build2 is tracked in a Git repository at: + +https://git.build2.org/cgit/packaging/mysql/ diff --git a/mysql-client/README-DEV b/mysql-client/README-DEV new file mode 100644 index 0000000..6259c46 --- /dev/null +++ b/mysql-client/README-DEV @@ -0,0 +1,15 @@ +This document describes how the mysql utility was packaged for build2. In +particular, this understanding will be useful when upgrading to a new upstream +version. See ../README-DEV for general notes on MySQL packaging. + +Symlink the required upstream components: + +$ ln -s ../upstream/LICENSE + +$ mkdir -p mysql/{client,downstream} +$ ln -s ../../../upstream/client/{{mysql,readline,completion_hash,pattern_matcher}.cc,{client_priv,my_readline,pattern_matcher,completion_hash}.h} mysql/client +$ ln -s ../../libmysqlclient/mysql/{my_config,mysqld_error}.h mysql/ +$ ln -s ../../upstream/{include,libbinlogevents} mysql/ + +Create mysql/downstream/mysql_version.h, so it can be found when included as +"mysql_version.h" (which, for example, mysql.h does). diff --git a/mysql-client/build/.gitignore b/mysql-client/build/.gitignore new file mode 100644 index 0000000..4a730a3 --- /dev/null +++ b/mysql-client/build/.gitignore @@ -0,0 +1,3 @@ +config.build +root/ +bootstrap/ diff --git a/mysql-client/build/bootstrap.build b/mysql-client/build/bootstrap.build new file mode 100644 index 0000000..4d085a3 --- /dev/null +++ b/mysql-client/build/bootstrap.build @@ -0,0 +1,10 @@ +# file : build/bootstrap.build +# license : GPLv2 with Universal FOSS Exception; see accompanying LICENSE file + +project = mysql-client + +using version +using config +using dist +using test +using install diff --git a/mysql-client/build/export.build b/mysql-client/build/export.build new file mode 100644 index 0000000..3cef2f9 --- /dev/null +++ b/mysql-client/build/export.build @@ -0,0 +1,9 @@ +# file : build/export.build +# license : GPLv2 with Universal FOSS Exception; see accompanying LICENSE file + +$out_root/ +{ + include mysql/ +} + +export $out_root/mysql/$import.target diff --git a/mysql-client/build/root.build b/mysql-client/build/root.build new file mode 100644 index 0000000..077c13f --- /dev/null +++ b/mysql-client/build/root.build @@ -0,0 +1,25 @@ +# file : build/root.build +# license : GPLv2 with Universal FOSS Exception; see accompanying LICENSE file + +using in + +using c + +h{*}: extension = h +c{*}: extension = c + +# Note that the implementation uses C++14 internally, with some used +# constructs being deprecated/removed from the later versions of the standard. +# +cxx.std = 14 + +using cxx + +hxx{*}: extension = h +cxx{*}: extension = cc + +if ($c.target.system == 'win32-msvc') + cc.poptions += -D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS + +if ($c.class == 'msvc') + cc.coptions += /wd4251 /wd4275 /wd4800 diff --git a/mysql-client/buildfile b/mysql-client/buildfile new file mode 100644 index 0000000..fc7acee --- /dev/null +++ b/mysql-client/buildfile @@ -0,0 +1,9 @@ +# file : buildfile +# license : GPLv2 with Universal FOSS Exception; see accompanying LICENSE file + +./: {*/ -build/} doc{INSTALL README} legal{LICENSE} manifest + +# Don't install tests or the INSTALL file. +# +tests/: install = false +doc{INSTALL}@./: install = false diff --git a/mysql-client/manifest b/mysql-client/manifest new file mode 100644 index 0000000..6dfc33e --- /dev/null +++ b/mysql-client/manifest @@ -0,0 +1,33 @@ +: 1 +name: mysql-client + +# Note: remember to update doc-url and debian-name below! +# +version: 8.0.15+13 + +project: mysql +summary: MySQL command-line client +license: other: GPL-2.0-only with MySQL Universal FOSS Exception +topics: MySQL, SQL, relational database +description-file: README +url: https://www.mysql.com +doc-url: https://dev.mysql.com/doc/refman/8.0/en/mysql.html +src-url: https://git.build2.org/cgit/packaging/mysql/mysql/tree/mysql-client/ +package-url: https://git.build2.org/cgit/packaging/mysql/ +email: mysql@lists.mysql.com ; Mailing list. +package-email: packaging@build2.org ; Mailing list. +build-error-email: builds@build2.org +builds: all +builds: -wasm +builds: -( +windows &gcc ) ; MinGW GCC is not supported. +builds: -static ; Implementation uses C++ and requires special linking steps. +depends: * build2 >= 0.15.0 +depends: * bpkg >= 0.15.0 +depends: libmysqlclient == $ +depends: libcrypto ^1.1.1 +depends: libisocline >= 1.0.9 ? ($c.target.class != 'windows') + +# System package mapping. +# +debian-name: mysql-client-core-8.0 +fedora-name: community-mysql diff --git a/mysql-client/mysql/.gitattributes b/mysql-client/mysql/.gitattributes new file mode 100644 index 0000000..d84f83a --- /dev/null +++ b/mysql-client/mysql/.gitattributes @@ -0,0 +1,2 @@ +include symlink=dir +libbinlogevents symlink=dir diff --git a/mysql-client/mysql/.gitignore b/mysql-client/mysql/.gitignore new file mode 100644 index 0000000..0416ee9 --- /dev/null +++ b/mysql-client/mysql/.gitignore @@ -0,0 +1 @@ +/mysql diff --git a/mysql-client/mysql/buildfile b/mysql-client/mysql/buildfile new file mode 100644 index 0000000..654758d --- /dev/null +++ b/mysql-client/mysql/buildfile @@ -0,0 +1,92 @@ +# file : mysql/buildfile +# license : GPLv2 with Universal FOSS Exception; see accompanying LICENSE file + +tclass = $c.target.class + +windows = ($tclass == 'windows') + +# Note that the mysql utility source code directly refers to the +# libmysqlclient's implementations details quite a lot. Thus, we just use the +# libmysqlclient static library in combination with the private headers. Also +# note that the upstream's mysql utility doesn't link the shared +# libmysqlclient either. +# +import libs = libmysqlclient%liba{mysqlclient} + +# Note that the mysql utility doesn't use openssl directly. We however import +# libcrypto so that the included by some common headers +# can be found. +# +import libs += libcrypto%lib{crypto} + +if! $windows + import libs += libisocline%liba{isocline} + +# Note that some of the include/**.h files are C++ headers and some are C +# headers. We will assume all of them as C headers, which is a bit of a hack +# but doing it properly is too painful. +# +exe{mysql}: {h c }{* } \ + client/{ hxx cxx}{* } \ + downstream/{h c }{* -readline} \ + include/{h }{** } \ +libbinlogevents/{h }{** } + +exe{mysql}: downstream/{h c}{readline}: include = (!$windows) + +exe{mysql}: $libs + +# Build options. +# +# We have dropped the macro definitions that are not used in the package code: +# +# -DRAPIDJSON_NO_SIZETYPEDEFINE +# -DUNISTR_FROM_CHAR_EXPLICIT=explicit +# -DUNISTR_FROM_STRING_EXPLICIT=explicit +# -DHAVE_LIBEVENT2 +# -DNO_FSEEKO +# +cc.poptions += -DHAVE_CONFIG_H \ + -DHAVE_OPENSSL \ + -D__STDC_LIMIT_MACROS \ + -D__STDC_FORMAT_MACROS \ + -D_USE_MATH_DEFINES \ + -DDBUG_OFF + +switch $tclass +{ + case 'windows' + cc.poptions += -DWIN32 -D_WINDOWS -D_WIN32_WINNT=0x0601 -DNOGDI \ + -DNOMINMAX -DWIN32_LEAN_AND_MEAN -D_MBCS + + case 'linux' + cc.poptions += -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE + + default + cc.poptions += -D_FILE_OFFSET_BITS=64 +} + +# 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/downstream" \ + "-I$src_base/include" \ + "-I$src_base/libbinlogevents/export" \ + "-I$src_base" + +switch $c.class +{ + case 'gcc' + { + cc.coptions += -ffunction-sections -fdata-sections -fno-omit-frame-pointer + } + case 'msvc' + { + cc.coptions += /GS /fp:precise /Zc:wchar_t /Zc:forScope + + # Disable warnings that pop up with /W3. + # + cc.coptions += /wd4996 + } +} diff --git a/mysql-client/mysql/client/client_priv.h b/mysql-client/mysql/client/client_priv.h new file mode 120000 index 0000000..3fbd2c6 --- /dev/null +++ b/mysql-client/mysql/client/client_priv.h @@ -0,0 +1 @@ +../../../upstream/client/client_priv.h \ No newline at end of file diff --git a/mysql-client/mysql/client/completion_hash.cc b/mysql-client/mysql/client/completion_hash.cc new file mode 120000 index 0000000..908a80f --- /dev/null +++ b/mysql-client/mysql/client/completion_hash.cc @@ -0,0 +1 @@ +../../../upstream/client/completion_hash.cc \ No newline at end of file diff --git a/mysql-client/mysql/client/completion_hash.h b/mysql-client/mysql/client/completion_hash.h new file mode 120000 index 0000000..bb56925 --- /dev/null +++ b/mysql-client/mysql/client/completion_hash.h @@ -0,0 +1 @@ +../../../upstream/client/completion_hash.h \ No newline at end of file diff --git a/mysql-client/mysql/client/my_readline.h b/mysql-client/mysql/client/my_readline.h new file mode 120000 index 0000000..7056e16 --- /dev/null +++ b/mysql-client/mysql/client/my_readline.h @@ -0,0 +1 @@ +../../../upstream/client/my_readline.h \ No newline at end of file diff --git a/mysql-client/mysql/client/mysql.cc b/mysql-client/mysql/client/mysql.cc new file mode 120000 index 0000000..89983e9 --- /dev/null +++ b/mysql-client/mysql/client/mysql.cc @@ -0,0 +1 @@ +../../../upstream/client/mysql.cc \ No newline at end of file diff --git a/mysql-client/mysql/client/pattern_matcher.cc b/mysql-client/mysql/client/pattern_matcher.cc new file mode 120000 index 0000000..1b84867 --- /dev/null +++ b/mysql-client/mysql/client/pattern_matcher.cc @@ -0,0 +1 @@ +../../../upstream/client/pattern_matcher.cc \ No newline at end of file diff --git a/mysql-client/mysql/client/pattern_matcher.h b/mysql-client/mysql/client/pattern_matcher.h new file mode 120000 index 0000000..770da27 --- /dev/null +++ b/mysql-client/mysql/client/pattern_matcher.h @@ -0,0 +1 @@ +../../../upstream/client/pattern_matcher.h \ No newline at end of file diff --git a/mysql-client/mysql/client/readline.cc b/mysql-client/mysql/client/readline.cc new file mode 120000 index 0000000..d41de28 --- /dev/null +++ b/mysql-client/mysql/client/readline.cc @@ -0,0 +1 @@ +../../../upstream/client/readline.cc \ No newline at end of file diff --git a/mysql-client/mysql/config.h b/mysql-client/mysql/config.h new file mode 100644 index 0000000..0e71bcf --- /dev/null +++ b/mysql-client/mysql/config.h @@ -0,0 +1,11 @@ +/* + * file : mysql/config.h + * license : GPLv2 with Universal FOSS Exception; see accompanying LICENSE file + */ + +/* This file is included by my_config.h, which is symlinked from the + * libmysqlclient's source tree. In contrast to libmysqlclient, which + * generates this file based on the upstream's template, we can keep it empty + * since the mysql utility's source code don't use any configuration macros + * besides those defined in my_config.h. + */ diff --git a/mysql-client/mysql/downstream/mysql_version.h b/mysql-client/mysql/downstream/mysql_version.h new file mode 100644 index 0000000..fd4471b --- /dev/null +++ b/mysql-client/mysql/downstream/mysql_version.h @@ -0,0 +1,5 @@ +/* file : mysql/downstream/mysql_version.h + * license : GPLv2 with Universal FOSS Exception; see accompanying LICENSE file + */ + +#include diff --git a/mysql-client/mysql/downstream/readline.c b/mysql-client/mysql/downstream/readline.c new file mode 100644 index 0000000..7522be5 --- /dev/null +++ b/mysql-client/mysql/downstream/readline.c @@ -0,0 +1,87 @@ +/* file : mysql/downstream/readline.h + * license : GPLv2 with Universal FOSS Exception; see accompanying LICENSE file + */ + +#include + +#include + +char* rl_readline_name = NULL; +rl_completion_func_t* rl_attempted_completion_function = NULL; +rl_compentry_func_t* rl_completion_entry_function = NULL; + +int history_length = 0; + +/* Perform some basic libisocline initialization on the first readline() call. + */ +static int init = 1; + +#define UNUSED(x) (void)(x) + +char* +readline (const char* prompt) +{ + if (init) + { + init = 0; + + ic_set_prompt_marker("" /* prompt_marker */, + NULL /* continuation_prompt_marker */); + + } + + return ic_readline (prompt); +} + +int +add_history (const char* command) +{ + UNUSED (command); + return 1; /* Unsupported */ +} + +int +read_history (const char* file) +{ + UNUSED (file); + return 1; /* Unsupported */ +} + +int +write_history (const char* command) +{ + UNUSED (command); + return 1; /* Unsupported */ +} + +HIST_ENTRY* +history_get (int offset) +{ + UNUSED (offset); + return NULL; +} + +int +rl_insert (int count, int chr) +{ + UNUSED (count); + UNUSED (chr); + return 1; /* Unsupported */ +} + +int +rl_add_defun (const char* name, rl_command_func_t* f, int chr) +{ + UNUSED (name); + UNUSED (f); + UNUSED (chr); + return 1; /* Unsupported */ +} + +char** +rl_completion_matches (const char* str, rl_compentry_func_t* f) +{ + UNUSED (str); + UNUSED (f); + return NULL; +} diff --git a/mysql-client/mysql/downstream/readline.h b/mysql-client/mysql/downstream/readline.h new file mode 100644 index 0000000..1540200 --- /dev/null +++ b/mysql-client/mysql/downstream/readline.h @@ -0,0 +1,59 @@ +/* file : mysql/downstream/readline.h + * license : GPLv2 with Universal FOSS Exception; see accompanying LICENSE file + */ + +#ifndef MYSQL_DOWNSTREAM_READLINE_H +#define MYSQL_DOWNSTREAM_READLINE_H + +/* + * Reduced implementation of the libedit library based on libisocline. + * + * Specially, only the basic line editing functionality is supported (no + * completion, history, etc). + */ +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Thin wrapper around libisocline's ic_readline(). + */ +char* +readline (const char* prompt); + +/* + * Reading function stubs. + */ +typedef char** rl_completion_func_t (const char*, int, int); +typedef char* rl_compentry_func_t (const char*, int); +typedef int rl_command_func_t (int, int); +typedef char* rl_compentry_func_t (const char*, int); + +int rl_insert (int, int); +int rl_add_defun (const char*, rl_command_func_t*, int); +char** rl_completion_matches (const char*, rl_compentry_func_t*); + +extern char* rl_readline_name; +extern rl_completion_func_t* rl_attempted_completion_function; +extern rl_compentry_func_t* rl_completion_entry_function; + +/* + * Hstory function stubs. + */ +typedef struct _hist_entry { + const char *line; + const char *data; +} HIST_ENTRY; + +int add_history (const char*); +int read_history (const char*); +int write_history (const char*); +HIST_ENTRY* history_get (int); + +extern int history_length; + +#ifdef __cplusplus +} +#endif + +#endif /* MYSQL_DOWNSTREAM_READLINE_H */ diff --git a/mysql-client/mysql/include b/mysql-client/mysql/include new file mode 120000 index 0000000..01fbb48 --- /dev/null +++ b/mysql-client/mysql/include @@ -0,0 +1 @@ +../../upstream/include \ No newline at end of file diff --git a/mysql-client/mysql/libbinlogevents b/mysql-client/mysql/libbinlogevents new file mode 120000 index 0000000..2a2879b --- /dev/null +++ b/mysql-client/mysql/libbinlogevents @@ -0,0 +1 @@ +../../upstream/libbinlogevents \ No newline at end of file diff --git a/mysql-client/mysql/my_config.h b/mysql-client/mysql/my_config.h new file mode 120000 index 0000000..168261b --- /dev/null +++ b/mysql-client/mysql/my_config.h @@ -0,0 +1 @@ +../../libmysqlclient/mysql/my_config.h \ No newline at end of file diff --git a/mysql-client/mysql/mysqld_error.h b/mysql-client/mysql/mysqld_error.h new file mode 120000 index 0000000..74d62ad --- /dev/null +++ b/mysql-client/mysql/mysqld_error.h @@ -0,0 +1 @@ +../../libmysqlclient/mysql/mysqld_error.h \ No newline at end of file diff --git a/mysql-client/tests/.gitignore b/mysql-client/tests/.gitignore new file mode 100644 index 0000000..ce6eed8 --- /dev/null +++ b/mysql-client/tests/.gitignore @@ -0,0 +1,4 @@ +# Testscript output directories (can be symlinks). +# +test +test-* diff --git a/mysql-client/tests/build/.gitignore b/mysql-client/tests/build/.gitignore new file mode 100644 index 0000000..4a730a3 --- /dev/null +++ b/mysql-client/tests/build/.gitignore @@ -0,0 +1,3 @@ +config.build +root/ +bootstrap/ diff --git a/mysql-client/tests/build/bootstrap.build b/mysql-client/tests/build/bootstrap.build new file mode 100644 index 0000000..c2ad98f --- /dev/null +++ b/mysql-client/tests/build/bootstrap.build @@ -0,0 +1,8 @@ +# file : tests/build/bootstrap.build +# license : GPLv2 with Universal FOSS Exception; see accompanying LICENSE file + +project = # Unnamed tests subproject. + +using config +using test +using dist diff --git a/mysql-client/tests/build/root.build b/mysql-client/tests/build/root.build new file mode 100644 index 0000000..4a6bd2c --- /dev/null +++ b/mysql-client/tests/build/root.build @@ -0,0 +1,15 @@ +# file : tests/build/root.build +# license : GPLv2 with Universal FOSS Exception; see accompanying LICENSE file + +# We need to configure C module to obtain the target information (see below). +# +using c.config + +# Setup the mysql program that we are testing. +# +import mysql = mysql-client%exe{mysql} +testscript{*}: test = $mysql + +# Specify the test target for cross-testing. +# +test.target = $c.target diff --git a/mysql-client/tests/buildfile b/mysql-client/tests/buildfile new file mode 100644 index 0000000..2d136c5 --- /dev/null +++ b/mysql-client/tests/buildfile @@ -0,0 +1,4 @@ +# file : tests/buildfile +# license : GPLv2 with Universal FOSS Exception; see accompanying LICENSE file + +./: testscript{*} $mysql diff --git a/mysql-client/tests/help.testscript b/mysql-client/tests/help.testscript new file mode 100644 index 0000000..67a9331 --- /dev/null +++ b/mysql-client/tests/help.testscript @@ -0,0 +1,12 @@ +# file : tests/help.testscript +# license : GPLv2 with Universal FOSS Exception; see accompanying LICENSE file + +: basics +: +: Test that stdout contains at least one non-empty line. +: +$* --help >>~%EOO% + %.* + %.+% + %.* + EOO diff --git a/mysql-client/tests/version.testscript b/mysql-client/tests/version.testscript new file mode 100644 index 0000000..ce45628 --- /dev/null +++ b/mysql-client/tests/version.testscript @@ -0,0 +1,8 @@ +# file : tests/version.testscript +# license : GPLv2 with Universal FOSS Exception; see accompanying LICENSE file + +: basics +: +$* --version >>~%EOO% + %.*mysql.+% + EOO diff --git a/packages.manifest b/packages.manifest index d73d77a..fa972fd 100644 --- a/packages.manifest +++ b/packages.manifest @@ -1,2 +1,4 @@ : 1 location: libmysqlclient/ +: +location: mysql-client/ diff --git a/repositories.manifest b/repositories.manifest index b497312..d61e2dd 100644 --- a/repositories.manifest +++ b/repositories.manifest @@ -8,3 +8,7 @@ location: ../../openssl/openssl.git##HEAD : role: prerequisite location: ../../zlib/zlib.git##HEAD + +: +role: prerequisite +location: https://github.com/build2-packaging/isocline.git##HEAD -- cgit v1.1