Skip to content

Commit

Permalink
build mysql-client from mysql-5.7.x sources
Browse files Browse the repository at this point in the history
  • Loading branch information
mirostauder committed Nov 25, 2023
1 parent b71b1e9 commit 4b2483b
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 26 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
24 changes: 17 additions & 7 deletions test/deps/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,23 @@ 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 && 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,7 +47,7 @@ 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
Expand Down
Binary file added test/deps/mysql-5.7.44.tar.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion test/deps/mysql-connector-c/mysql-connector-c
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 4b2483b

Please sign in to comment.