Skip to content

Commit

Permalink
build mysql-client from mysql-boost-5.7.x source
Browse files Browse the repository at this point in the history
  • Loading branch information
mirostauder committed Nov 25, 2023
1 parent b71b1e9 commit 4d614cf
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 31 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ heaptrack.*

# test deps
test/deps/mariadb-connector-c/mariadb-connector-c-*/
test/deps/mysql-connector-c/mysql-connector-c-*src/
test/deps/mysql-connector-c/mysql-5.7.*/

#tap tests
test/tap/tap/cpp-dotenv/cpp-dotenv-*
Expand Down
37 changes: 25 additions & 12 deletions test/deps/Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#!/bin/make -f


targets := mariadb_client mysql_client

.PHONY: default
default: $(targets)
default: all

.PHONY: all
all: mariadb_client mysql_client


### test deps targets
Expand All @@ -20,13 +21,25 @@ mariadb-connector-c/mariadb-connector-c/libmariadb/libmariadbclient.a:
mariadb_client: mariadb-connector-c/mariadb-connector-c/libmariadb/libmariadbclient.a


#mysql-connector-c/mysql-connector-c/libmysql/libmysqlclient.a:
# cd mysql-connector-c && rm -rf mysql-connector-c-*-src/ || true
# cd mysql-connector-c && tar -zxf mysql-connector-c-*-src.tar.gz
# cd mysql-connector-c/mysql-connector-c && patch -p0 < ../CMakeLists.txt.patch
# cd mysql-connector-c/mysql-connector-c && patch -p0 < ../install_macros.cmake.patch
# cd mysql-connector-c/mysql-connector-c && cmake . -DCMAKE_BUILD_TYPE=RelWithDebInfo -DOPENSSL_ROOT_DIR=$(DEPS_PATH)/libssl/openssl
# cd mysql-connector-c/mysql-connector-c && CC=${CC} CXX=${CXX} ${MAKE} mysqlclient mysql

mysql-connector-c/mysql-connector-c/libmysql/libmysqlclient.a:
cd mysql-connector-c && rm -rf mysql-connector-c-*-src/ || true
cd mysql-connector-c && tar -zxf mysql-connector-c-*-src.tar.gz
cd mysql-connector-c/mysql-connector-c && patch -p0 < ../CMakeLists.txt.patch
cd mysql-connector-c/mysql-connector-c && patch -p0 < ../install_macros.cmake.patch
cd mysql-connector-c/mysql-connector-c && cmake . -DCMAKE_BUILD_TYPE=RelWithDebInfo -DOPENSSL_ROOT_DIR=$(DEPS_PATH)/libssl/openssl
cd mysql-connector-c/mysql-connector-c && CC=${CC} CXX=${CXX} ${MAKE} mysqlclient
cd mysql-connector-c && curl -C - -O -s https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-boost-5.7.44.tar.gz || true
cd mysql-connector-c && wget -nc -q https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-boost-5.7.44.tar.gz || true
cd mysql-connector-c && rm -rf mysql-*/ || true
cd mysql-connector-c && tar -zxf mysql-boost-5.7.*.tar.gz
cd mysql-connector-c && ln -fsT $$(ls -1d mysql-5.7.*/) mysql-connector-c
# cd mysql-connector-c/mysql-connector-c && patch -p0 < ../CMakeLists.txt.patch
# cd mysql-connector-c/mysql-connector-c && patch -p0 < ../install_macros.cmake.patch
cd mysql-connector-c/mysql-connector-c && cmake . -DWITH_BOOST=./boost -DCMAKE_BUILD_TYPE=RelWithDebInfo -DOPENSSL_ROOT_DIR=$(DEPS_PATH)/libssl/openssl
cd mysql-connector-c/mysql-connector-c && CC=${CC} CXX=${CXX} ${MAKE} mysqlclient mysql
cd mysql-connector-c/mysql-connector-c && cp archive_output_directory/libmysqlclient.a libmysql/

mysql_client: mysql-connector-c/mysql-connector-c/libmysql/libmysqlclient.a

Expand All @@ -37,12 +50,12 @@ mysql_client: mysql-connector-c/mysql-connector-c/libmysql/libmysqlclient.a
.PHONY: cleanall
cleanall:
cd mariadb-connector-c && rm -rf mariadb-connector-c-*/ || true
cd mysql-connector-c && rm -rf mysql-connector-c-*-src/ || true
cd mysql-connector-c && rm -rf mysql-5.7.*/ || true

.SILENT: clean
.PHONY: clean
clean:
cd mariadb-connector-c/mariadb-connector-c && $(MAKE) clean || true
cd mariadb-connector-c/mariadb-connector-c && rm -f CMakeCache.txt
cd mariadb-connector-c/mariadb-connector-c && rm -f CMakeCache.txt || true
cd mysql-connector-c/mysql-connector-c && $(MAKE) clean || true
cd mysql-connector-c/mysql-connector-c && rm -f CMakeCache.txt
cd mysql-connector-c/mysql-connector-c && rm -f CMakeCache.txt || true
2 changes: 1 addition & 1 deletion test/deps/mysql-connector-c/mysql-connector-c
Binary file not shown.
11 changes: 6 additions & 5 deletions test/tap/tests/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ TEST_MARIADB_LDIR := $(TEST_MARIADB_PATH)/libmariadb

TEST_MYSQL_PATH := $(TEST_DEPS_PATH)/mysql-connector-c/mysql-connector-c
TEST_MYSQL_IDIR := $(TEST_MYSQL_PATH)/include
TEST_MYSQL_EDIR := $(TEST_MYSQL_PATH)/libbinlogevents/export/
TEST_MYSQL_LDIR := $(TEST_MYSQL_PATH)/libmysql

LIBPROXYSQLAR := $(PROXYSQL_LDIR)/libproxysql.a
Expand Down Expand Up @@ -266,22 +267,22 @@ reg_test_3504-change_user_libmariadb_helper: reg_test_3504-change_user_helper.cp
$(CXX) $< $(IDIRS) $(LDIRS) $(OPT) $(MYLIBS) $(STATIC_LIBS) -o $@

reg_test_3504-change_user_libmysql_helper: reg_test_3504-change_user_helper.cpp $(TAP_LDIR)/libtap.so
$(CXX) -DLIBMYSQL_HELPER $< -I$(TEST_MYSQL_IDIR) -L$(TEST_MYSQL_LDIR) -lmysqlclient $(CUSTOMARGS) -o $@
$(CXX) -DLIBMYSQL_HELPER $< -I$(TEST_MYSQL_IDIR) -I$(TEST_MYSQL_EDIR) -L$(TEST_MYSQL_LDIR) -lmysqlclient $(CUSTOMARGS) -o $@

test_clickhouse_server_libmysql-t: test_clickhouse_server-t.cpp $(TAP_LDIR)/libtap.so
$(CXX) -DLIBMYSQL_HELPER $< -I$(TEST_MYSQL_IDIR) -L$(TEST_MYSQL_LDIR) -lmysqlclient $(CUSTOMARGS) -o $@
$(CXX) -DLIBMYSQL_HELPER $< -I$(TEST_MYSQL_IDIR) -I$(TEST_MYSQL_EDIR) -L$(TEST_MYSQL_LDIR) -lmysqlclient $(CUSTOMARGS) -o $@

reg_test_stmt_resultset_err_no_rows_libmysql-t: reg_test_stmt_resultset_err_no_rows-t.cpp $(TAP_LDIR)/libtap.so
$(CXX) -DLIBMYSQL_HELPER $< -I$(TEST_MYSQL_IDIR) -L$(TEST_MYSQL_LDIR) -lmysqlclient $(CUSTOMARGS) -o $@
$(CXX) -DLIBMYSQL_HELPER $< -I$(TEST_MYSQL_IDIR) -I$(TEST_MYSQL_EDIR) -L$(TEST_MYSQL_LDIR) -lmysqlclient $(CUSTOMARGS) -o $@

reg_test_mariadb_stmt_store_result_libmysql-t: reg_test_mariadb_stmt_store_result-t.cpp $(TAP_LDIR)/libtap.so
$(CXX) -DLIBMYSQL_HELPER $< -I$(TEST_MYSQL_IDIR) -L$(TEST_MYSQL_LDIR) -lmysqlclient $(CUSTOMARGS) -o $@
$(CXX) -DLIBMYSQL_HELPER $< -I$(TEST_MYSQL_IDIR) -I$(TEST_MYSQL_EDIR) -L$(TEST_MYSQL_LDIR) -lmysqlclient $(CUSTOMARGS) -o $@

reg_test_mariadb_stmt_store_result_async-t: reg_test_mariadb_stmt_store_result-t.cpp $(TAP_LDIR)/libtap.so
$(CXX) -DASYNC_API $< $(IDIRS) $(LDIRS) $(OPT) $(MYLIBS) $(STATIC_LIBS) -o $@

prepare_statement_err3024_libmysql-t: prepare_statement_err3024-t.cpp $(TAP_LDIR)/libtap.so
$(CXX) -DLIBMYSQL_HELPER $< -I$(TEST_MYSQL_IDIR) -L$(TEST_MYSQL_LDIR) -lmysqlclient $(CUSTOMARGS) -o $@
$(CXX) -DLIBMYSQL_HELPER $< -I$(TEST_MYSQL_IDIR) -I$(TEST_MYSQL_EDIR) -L$(TEST_MYSQL_LDIR) -lmysqlclient $(CUSTOMARGS) -o $@

prepare_statement_err3024_async-t: prepare_statement_err3024-t.cpp $(TAP_LDIR)/libtap.so
$(CXX) -DASYNC_API $< $(IDIRS) $(LDIRS) $(OPT) $(MYLIBS) $(STATIC_LIBS) -o $@
Expand Down
27 changes: 15 additions & 12 deletions test/tap/tests_with_deps/deprecate_eof_support/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ TEST_MARIADB_LDIR := $(TEST_MARIADB_PATH)/libmariadb

TEST_MYSQL_PATH := $(TEST_DEPS_PATH)/mysql-connector-c/mysql-connector-c
TEST_MYSQL_IDIR := $(TEST_MYSQL_PATH)/include
TEST_MYSQL_EDIR := $(TEST_MYSQL_PATH)/libbinlogevents/export
TEST_MYSQL_LDIR := $(TEST_MYSQL_PATH)/libmysql

### detect compiler support for c++11/17
Expand Down Expand Up @@ -72,16 +73,17 @@ IDIRS += -I$(DEPS_PATH)/curl/curl/include
default: all

.PHONY: all
all: build_test_deps tests
all: tests

.PHONY: debug
debug: DEBUG := -DDEBUG
debug: OPT := $(STDCPP) -O0 -DDEBUG -ggdb -Wl,--no-as-needed -Wl,-rpath,$(TAP_LDIR) $(WGCOV) $(WASAN)
debug: build_test_deps tests
debug: tests


### test deps targets

#.PHONY: build_test_deps
build_test_deps: $(TAP_LDIR)/libtap.so $(TEST_MARIADB_LDIR)/libmariadbclient.a $(TEST_MYSQL_LDIR)/libmysqlclient.a

$(TAP_LDIR)/libtap.so:
Expand All @@ -96,37 +98,38 @@ $(TEST_MYSQL_LDIR)/libmysqlclient.a:

### test and helper targets

tests: build_test_deps
tests: $(patsubst %.cpp,%,$(wildcard *-t.cpp)) fwd_eof_query fwd_eof_ok_query

COMMONARGS := $(OPT) -I$(TAP_IDIR) -L$(TAP_LDIR) -ltap -lcpp_dotenv -lz -ldl -lpthread -DGITVERSION=\"$(GIT_VERSION)\"

ok_packet_mixed_queries-t: eof_packet_mixed_queries-t.cpp build_test_deps
ok_packet_mixed_queries-t: eof_packet_mixed_queries-t.cpp
$(CXX) $< $(IDIRS) -I$(TEST_MARIADB_IDIR) -L$(TEST_MARIADB_LDIR) -lmariadbclient $(COMMONARGS) -o $@

eof_packet_mixed_queries-t: eof_packet_mixed_queries-t.cpp build_test_deps
eof_packet_mixed_queries-t: eof_packet_mixed_queries-t.cpp
$(CXX) -DNON_EOF_SUPPORT $< $(IDIRS) -I$(TEST_MARIADB_IDIR) -L$(TEST_MARIADB_LDIR) -lmariadbclient $(COMMONARGS) -o $@

fwd_eof_query: fwd_eof_query.cpp build_test_deps
fwd_eof_query: fwd_eof_query.cpp
$(CXX) -DNON_EOF_SUPPORT $< $(IDIRS) -I$(TEST_MARIADB_IDIR) -L$(TEST_MARIADB_LDIR) -lmariadbclient $(COMMONARGS) -o $@

# NOTE: Compilation with 'libmysql' instead of 'libmariadb' client to confirm packet sequence id isn't check by 'libmariadb'
fwd_eof_ok_query: fwd_eof_query.cpp build_test_deps
$(CXX) $< $(IDIRS) -I$(MARIADB_IDIR) -I$(TEST_MYSQL_IDIR) -L$(TEST_MYSQL_LDIR) -lmysqlclient $(COMMONARGS) -o $@
fwd_eof_ok_query: fwd_eof_query.cpp
$(CXX) $< $(IDIRS) -I$(TEST_MARIADB_IDIR) -I$(TEST_MYSQL_IDIR) -I$(TEST_MYSQL_EDIR) -L$(TEST_MYSQL_LDIR) -lmysqlclient $(COMMONARGS) -o $@
# NOTE end

deprecate_eof_cache-t: deprecate_eof_cache-t.cpp build_test_deps
deprecate_eof_cache-t: deprecate_eof_cache-t.cpp
$(CXX) $< $(IDIRS) -I$(TEST_MARIADB_IDIR) -L$(TEST_MARIADB_LDIR) -lmariadbclient -L$(PROXYSQL_LDIR) -lproxysql $(COMMONARGS) -o $@

eof_cache_mixed_flags-t: eof_cache_mixed_flags-t.cpp build_test_deps
eof_cache_mixed_flags-t: eof_cache_mixed_flags-t.cpp
$(CXX) $< $(IDIRS) -I$(TEST_MARIADB_IDIR) -L$(TEST_MARIADB_LDIR) -lmariadbclient $(COMMONARGS) -o $@

eof_mixed_flags_queries-t: eof_mixed_flags_queries-t.cpp build_test_deps
eof_mixed_flags_queries-t: eof_mixed_flags_queries-t.cpp
$(CXX) $< $(IDIRS) -I$(TEST_MARIADB_IDIR) -L$(TEST_MARIADB_LDIR) -lmariadbclient $(COMMONARGS) -o $@

eof_conn_options_check-t: eof_conn_options_check-t.cpp build_test_deps
eof_conn_options_check-t: eof_conn_options_check-t.cpp
$(CXX) $< $(IDIRS) -I$(TEST_MARIADB_IDIR) -L$(TEST_MARIADB_LDIR) -lmariadbclient $(COMMONARGS) -o $@

eof_fast_forward-t: eof_fast_forward-t.cpp build_test_deps
eof_fast_forward-t: eof_fast_forward-t.cpp
$(CXX) $< $(IDIRS) -I$(TEST_MARIADB_IDIR) -L$(TEST_MARIADB_LDIR) -lmariadbclient $(COMMONARGS) -o $@


Expand Down

0 comments on commit 4d614cf

Please sign in to comment.