diff --git a/.gitignore b/.gitignore index 339f9ba76..3647d9361 100644 --- a/.gitignore +++ b/.gitignore @@ -112,6 +112,8 @@ heaptrack.* #tap tests test/tap/tap/cpp-dotenv/cpp-dotenv-* +test/tap/tap/cpp-dotenv/static/cpp-dotenv-* +test/tap/tap/cpp-dotenv/dynamic/cpp-dotenv-* *-t test/tap/tests/galera_1_timeout_count test/tap/tests/galera_2_timeout_no_count diff --git a/deps/Makefile b/deps/Makefile index b6bb58ada..2259c855f 100644 --- a/deps/Makefile +++ b/deps/Makefile @@ -151,7 +151,8 @@ curl/curl/lib/.libs/libcurl.a: libssl/openssl/libssl.a ifeq ($(UNAME_S),Darwin) cd curl/curl && patch configure < ../configure.patch endif - cd curl/curl && CFLAGS=-fPIC ./configure --disable-debug --disable-ftp --disable-ldap --disable-ldaps --disable-rtsp --disable-proxy --disable-dict --disable-telnet --disable-tftp --disable-pop3 --disable-imap --disable-smb --disable-smtp --disable-gopher --disable-manual --disable-ipv6 --disable-sspi --disable-ntlm-wb --disable-tls-srp --without-nghttp2 --without-libidn2 --without-libssh2 --without-brotli --without-librtmp --without-libpsl --without-zstd --with-ssl=$(shell pwd)/libssl/openssl/ --enable-shared=no && CC=${CC} CXX=${CXX} ${MAKE} +# cd curl/curl && CFLAGS=-fPIC ./configure --disable-debug --disable-ftp --disable-ldap --disable-ldaps --disable-rtsp --disable-proxy --disable-dict --disable-telnet --disable-tftp --disable-pop3 --disable-imap --disable-smb --disable-smtp --disable-gopher --disable-manual --disable-ipv6 --disable-sspi --disable-ntlm-wb --disable-tls-srp --without-nghttp2 --without-libidn2 --without-libssh2 --without-brotli --without-librtmp --without-libpsl --without-zstd --with-ssl=$(shell pwd)/libssl/openssl/ --enable-shared=no && CC=${CC} CXX=${CXX} ${MAKE} + cd curl/curl && CFLAGS=-fPIC ./configure --disable-debug --disable-ftp --disable-ldap --disable-ldaps --disable-rtsp --disable-proxy --disable-dict --disable-telnet --disable-tftp --disable-pop3 --disable-imap --disable-smb --disable-smtp --disable-gopher --disable-manual --disable-ipv6 --disable-sspi --disable-ntlm-wb --disable-tls-srp --without-nghttp2 --without-libidn2 --without-libssh2 --without-brotli --without-librtmp --without-libpsl --without-zstd --with-ssl=$(shell pwd)/libssl/openssl/ --enable-shared=yes && CC=${CC} CXX=${CXX} ${MAKE} curl: curl/curl/lib/.libs/libcurl.a diff --git a/test/tap/tap/Makefile b/test/tap/tap/Makefile index 14a006581..b1299c6cb 100644 --- a/test/tap/tap/Makefile +++ b/test/tap/tap/Makefile @@ -14,7 +14,7 @@ SQLITE3_DIR=$(DEPS_PATH)/sqlite3/sqlite3 SQLITE3_IDIR=$(SQLITE3_DIR) SQLITE3_LDIR=$(SQLITE3_DIR) -DOTENV_DIR=./cpp-dotenv/cpp-dotenv +DOTENV_DIR=./cpp-dotenv/static/cpp-dotenv DOTENV_IDIR=$(DOTENV_DIR)/include DOTENV_LDIR=$(DOTENV_DIR) @@ -25,27 +25,46 @@ LIBPROXYSQLAR=$(LDIR)/libproxysql.a INCLUDEDIRS=-I$(IDIR) -I$(JSON_IDIR) -I$(MARIADB_IDIR) -I${CURL_IDIR} -I${SQLITE3_IDIR} -I$(DOTENV_IDIR) .PHONY: all -all: libtap.a +all: libtap.a libtap.so .PHONY: clean clean: - rm -f *.o libtap.a || true - find cpp-dotenv/cpp-dotenv/ -name '*.o' -or -name '*.a' -delete || true + rm -f *.o libtap.a libtap.so || true + find cpp-dotenv/dynamic -name '*.o' -or -name '*.a' -delete || true + find cpp-dotenv/static -name '*.o' -or -name '*.a' -delete || true OPT=-O2 debug: OPT = -O0 -DDEBUG -ggdb -debug: libtap.a +debug: libtap.a libtap.so -libtap.a: tap.cpp tap.h command_line.cpp command_line.h utils.cpp utils.h cpp-dotenv - g++ -c tap.cpp command_line.cpp utils.cpp -std=c++11 $(INCLUDEDIRS) $(OPT) +command_line.o: command_line.cpp + g++ -fPIC -c command_line.cpp -std=c++11 $(INCLUDEDIRS) $(OPT) + +utils.o: utils.cpp + g++ -fPIC -c utils.cpp -std=c++11 $(INCLUDEDIRS) $(OPT) + +tap.o: tap.cpp + g++ -fPIC -c tap.cpp -std=c++11 $(INCLUDEDIRS) $(OPT) + +libtap.a: tap.cpp tap.h command_line.cpp command_line.h utils.cpp utils.h tap.o command_line.o utils.o cpp-dotenv/static/cpp-dotenv/libcpp_dotenv.a ar rcs libtap.a tap.o command_line.o utils.o $(SQLITE3_LDIR)/sqlite3.o $$(find $(DOTENV_DIR)/ -name '*.o') -cpp-dotenv/cpp-dotenv/libcpp_dotenv.a: - cd cpp-dotenv && rm -rf cpp-dotenv-*/ || true - cd cpp-dotenv && tar -zxf cpp-dotenv-*.tar.gz - cd cpp-dotenv/cpp-dotenv && patch src/dotenv.cpp < ../dotenv.cpp.patch - cd cpp-dotenv/cpp-dotenv && patch include/dotenv.h < ../dotenv.h.patch - cd cpp-dotenv/cpp-dotenv && cmake . -DBUILD_TESTING=OFF -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Debug - cd cpp-dotenv/cpp-dotenv && CC=${CC} CXX=${CXX} ${MAKE} -cpp-dotenv: cpp-dotenv/cpp-dotenv/libcpp_dotenv.a +libtap.so: tap.cpp tap.h command_line.cpp command_line.h utils.cpp utils.h tap.o command_line.o utils.o cpp-dotenv/dynamic/cpp-dotenv/libcpp_dotenv.so + g++ -shared -o libtap.so tap.o command_line.o utils.o $(SQLITE3_LDIR)/sqlite3.o + +cpp-dotenv/static/cpp-dotenv/libcpp_dotenv.a: + cd cpp-dotenv/static && rm -rf cpp-dotenv-*/ || true + cd cpp-dotenv/static && tar -zxf ../cpp-dotenv-*.tar.gz + cd cpp-dotenv/static/cpp-dotenv && patch src/dotenv.cpp < ../../dotenv.cpp.patch + cd cpp-dotenv/static/cpp-dotenv && patch include/dotenv.h < ../../dotenv.h.patch + cd cpp-dotenv/static/cpp-dotenv && cmake . -DBUILD_TESTING=OFF -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Debug + cd cpp-dotenv/static/cpp-dotenv && CC=${CC} CXX=${CXX} ${MAKE} + +cpp-dotenv/dynamic/cpp-dotenv/libcpp_dotenv.so: + cd cpp-dotenv/dynamic && rm -rf cpp-dotenv-*/ || true + cd cpp-dotenv/dynamic && tar -zxf ../cpp-dotenv-*.tar.gz + cd cpp-dotenv/dynamic/cpp-dotenv && patch src/dotenv.cpp < ../../dotenv.cpp.patch + cd cpp-dotenv/dynamic/cpp-dotenv && patch include/dotenv.h < ../../dotenv.h.patch + cd cpp-dotenv/dynamic/cpp-dotenv && cmake . -DBUILD_TESTING=OFF -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=Debug + cd cpp-dotenv/dynamic/cpp-dotenv && CC=${CC} CXX=${CXX} ${MAKE} diff --git a/test/tap/tap/cpp-dotenv/cpp-dotenv b/test/tap/tap/cpp-dotenv/dynamic/cpp-dotenv similarity index 100% rename from test/tap/tap/cpp-dotenv/cpp-dotenv rename to test/tap/tap/cpp-dotenv/dynamic/cpp-dotenv diff --git a/test/tap/tap/cpp-dotenv/static/cpp-dotenv b/test/tap/tap/cpp-dotenv/static/cpp-dotenv new file mode 120000 index 000000000..fcdbe8d2c --- /dev/null +++ b/test/tap/tap/cpp-dotenv/static/cpp-dotenv @@ -0,0 +1 @@ +cpp-dotenv-1.0.0-alpha \ No newline at end of file diff --git a/test/tap/tests/Makefile b/test/tap/tests/Makefile index 4acb9d280..4ed3c9dc5 100644 --- a/test/tap/tests/Makefile +++ b/test/tap/tests/Makefile @@ -65,14 +65,14 @@ COREDUMPER_DIR=$(DEPS_PATH)/coredumper/coredumper COREDUMPER_IDIR=$(COREDUMPER_DIR)/include COREDUMPER_LDIR=$(COREDUMPER_DIR)/src -DOTENV_DIR=../tap/cpp-dotenv/cpp-dotenv -DOTENV_IDIR=$(DOTENV_DIR)/include -DOTENV_LDIR=$(DOTENV_DIR) - IDIR=../../../include LDIR=../../../lib TAP_LIBDIR=../tap +DOTENV_DYN_DIR=../tap/cpp-dotenv/dynamic/cpp-dotenv +DOTENV_DYN_IDIR=$(DOTENV_DYN_DIR)/include +DOTENV_DYN_LDIR=$(DOTENV_DYN_DIR) + LIBPROXYSQLAR=$(LDIR)/libproxysql.a ODIR=../../../obj @@ -81,8 +81,8 @@ EXECUTABLE=proxysql OBJ=../../../src/obj/proxysql_global.o ../../../src/obj/main.o ../../../src/obj/proxy_tls.o -INCLUDEDIRS=-I../tap -I$(RE2_PATH) -I$(IDIR) -I$(JEMALLOC_IDIR) -I$(SQLITE3_DIR) -I$(MICROHTTPD_IDIR) -I$(LIBHTTPSERVER_IDIR) -I$(CURL_IDIR) -I$(DAEMONPATH_IDIR) -I$(MARIADB_IDIR) -I$(SSL_IDIR) -I$(JSON_IDIR) -I$(LIBCONFIG_IDIR) -I$(PROMETHEUS_IDIR) -I$(EV_IDIR) -I$(DOTENV_IDIR) -LDIRS=-L$(TAP_LIBDIR) -L$(LDIR) -L$(JEMALLOC_LDIR) $(LIBCONFIG_LDIR) -L$(RE2_PATH)/obj -L$(MARIADB_LDIR) -L$(DAEMONPATH_LDIR) -L$(PCRE_LDIR) -L$(MICROHTTPD_LDIR) -L$(LIBHTTPSERVER_LDIR) -L$(LIBINJECTION_LDIR) -L$(CURL_LDIR) -L$(EV_LDIR) -L$(SSL_LDIR) -L$(PROMETHEUS_LDIR) +INCLUDEDIRS=-I../tap -I$(RE2_PATH) -I$(IDIR) -I$(JEMALLOC_IDIR) -I$(SQLITE3_DIR) -I$(MICROHTTPD_IDIR) -I$(LIBHTTPSERVER_IDIR) -I$(CURL_IDIR) -I$(DAEMONPATH_IDIR) -I$(MARIADB_IDIR) -I$(SSL_IDIR) -I$(JSON_IDIR) -I$(LIBCONFIG_IDIR) -I$(PROMETHEUS_IDIR) -I$(EV_IDIR) -I$(DOTENV_DYN_IDIR) +LDIRS=-L$(TAP_LIBDIR) -L$(DOTENV_DYN_LDIR) -L$(LDIR) -L$(JEMALLOC_LDIR) $(LIBCONFIG_LDIR) -L$(RE2_PATH)/obj -L$(MARIADB_LDIR) -L$(DAEMONPATH_LDIR) -L$(PCRE_LDIR) -L$(MICROHTTPD_LDIR) -L$(LIBHTTPSERVER_LDIR) -L$(LIBINJECTION_LDIR) -L$(CURL_LDIR) -L$(EV_LDIR) -L$(SSL_LDIR) -L$(PROMETHEUS_LDIR) UNAME_S := $(shell uname -s) @@ -90,9 +90,10 @@ ifeq ($(UNAME_S),Linux) LDIRS+= -L$(COREDUMPER_LDIR) endif -MYLIBS=-Wl,--export-dynamic -Wl,-Bstatic -lconfig -lproxysql -ldaemon -lconfig++ -lre2 -lpcrecpp -lpcre -ltap -lmariadbclient -lhttpserver -lmicrohttpd -linjection -lcurl -lssl -lcrypto -lev -lprometheus-cpp-pull -lprometheus-cpp-core -luuid -Wl,-Bdynamic -lgnutls -lpthread -lm -lz -lrt -ldl $(EXTRALINK) +MYLIBS=-Wl,--export-dynamic -Wl,-Bdynamic -lssl -lcrypto -lgnutls -ltap -lcpp_dotenv -lcurl -Wl,-Bstatic -lconfig -lproxysql -ldaemon -lconfig++ -lre2 -lpcrecpp -lpcre -lmariadbclient -lhttpserver -lmicrohttpd -linjection -lev -lprometheus-cpp-pull -lprometheus-cpp-core -luuid -Wl,-Bdynamic -lpthread -lm -lz -lrt -ldl $(EXTRALINK) MYLIBSJEMALLOC=-Wl,-Bstatic -ljemalloc -STATIC_LIBS= $(SSL_LDIR)/libssl.a $(SSL_LDIR)/libcrypto.a $(CITYHASH_LDIR)/libcityhash.a +STATIC_LIBS= $(CITYHASH_LDIR)/libcityhash.a +#STATIC_LIBS= $(SSL_LDIR)/libssl.a $(SSL_LDIR)/libcrypto.a $(CITYHASH_LDIR)/libcityhash.a LIBCOREDUMPERAR= @@ -150,7 +151,7 @@ py-%: cp $(patsubst py-%,%,$@) $(patsubst py-%.py,%,$@) chmod +x $(patsubst py-%.py,%,$@) -%-t: %-t.cpp $(TAP_LIBDIR)/libtap.a +%-t: %-t.cpp $(TAP_LIBDIR)/libtap.so $(CXX) -std=c++11 $< $(INCLUDEDIRS) $(LDIRS) $(OPT) $(MYLIBS) $(STATIC_LIBS) -o $@ # $(CXX) -std=c++11 $< $(INCLUDEDIRS) $(LDIRS) $(OPT) $(MYLIBS) -lpthread -ldl $(STATIC_LIBS) $(TAP_LIBDIR)/libtap.a -o $@ @@ -207,20 +208,22 @@ reg_test_3504-change_user_libmariadb_helper: reg_test_3504-change_user_helper.cp reg_test_3504-change_user_libmysql_helper: reg_test_3504-change_user_helper.cpp $(CXX) -DLIBMYSQL_HELPER -DDEBUG reg_test_3504-change_user_helper.cpp -I/usr/include/mysql -I$(CURL_IDIR) -I$(SQLITE3_DIR) -I$(IDIR) -I$(JSON_IDIR) -I../tap -L$(TAP_LIBDIR) -lpthread -ldl -std=c++11 -ltap -lmysqlclient -o reg_test_3504-change_user_libmysql_helper -DGITVERSION=\"$(GIT_VERSION)\" +CUSTOMARGS=-DGITVERSION=\"$(GIT_VERSION)\" -I$(CURL_IDIR) -I$(SQLITE3_DIR) -I$(IDIR) -I$(JSON_IDIR) -I../tap -L$(TAP_LIBDIR) -Wl,-Bstatic -ltap -Wl,-Bdynamic -lpthread -std=c++11 -lcurl -ldl + test_clickhouse_server_libmysql-t: test_clickhouse_server-t.cpp - $(CXX) -DLIBMYSQL_HELPER -DDEBUG test_clickhouse_server-t.cpp -I/usr/include/mysql -I$(CURL_IDIR) -I$(SQLITE3_DIR) -I$(IDIR) -I$(JSON_IDIR) -I../tap -L$(TAP_LIBDIR) -lpthread -ldl -std=c++11 -ltap -lmysqlclient -o test_clickhouse_server_libmysql-t -DGITVERSION=\"$(GIT_VERSION)\" + $(CXX) -DLIBMYSQL_HELPER -DDEBUG test_clickhouse_server-t.cpp -I/usr/include/mysql $(CUSTOMARGS) -lmysqlclient -o test_clickhouse_server_libmysql-t reg_test_stmt_resultset_err_no_rows_libmysql-t: reg_test_stmt_resultset_err_no_rows-t.cpp - $(CXX) -DLIBMYSQL_HELPER reg_test_stmt_resultset_err_no_rows-t.cpp -I/usr/include/mysql -I$(CURL_IDIR) -I$(SQLITE3_DIR) -I$(IDIR) -I$(JSON_IDIR) -I../tap $(OPT) -L$(TAP_LIBDIR) -lpthread -ldl -std=c++11 -ltap -lmysqlclient -o reg_test_stmt_resultset_err_no_rows_libmysql-t -DGITVERSION=\"$(GIT_VERSION)\" + $(CXX) -DLIBMYSQL_HELPER reg_test_stmt_resultset_err_no_rows-t.cpp -I/usr/include/mysql $(CUSTOMARGS) -lmysqlclient -o reg_test_stmt_resultset_err_no_rows_libmysql-t reg_test_mariadb_stmt_store_result_libmysql-t: reg_test_mariadb_stmt_store_result-t.cpp $(TAP_LIBDIR)/libtap.a - $(CXX) -DLIBMYSQL_HELPER reg_test_mariadb_stmt_store_result-t.cpp -I/usr/include/mysql -I$(CURL_IDIR) -I$(SQLITE3_DIR) -I$(IDIR) -I$(JSON_IDIR) -I../tap $(OPT) -L$(TAP_LIBDIR) -lpthread -ldl -std=c++11 -ltap -lmysqlclient -o reg_test_mariadb_stmt_store_result_libmysql-t -DGITVERSION=\"$(GIT_VERSION)\" + $(CXX) -DLIBMYSQL_HELPER reg_test_mariadb_stmt_store_result-t.cpp -I/usr/include/mysql $(CUSTOMARGS) -lmysqlclient -o reg_test_mariadb_stmt_store_result_libmysql-t reg_test_mariadb_stmt_store_result_async-t: reg_test_mariadb_stmt_store_result-t.cpp $(TAP_LIBDIR)/libtap.a - $(CXX) -DASYNC_API reg_test_mariadb_stmt_store_result-t.cpp $(INCLUDEDIRS) $(LDIRS) $(OPT) $(MYLIBS) -lpthread -ldl -std=c++11 -ltap $(STATIC_LIBS) -o reg_test_mariadb_stmt_store_result_async-t -DGITVERSION=\"$(GIT_VERSION)\" + $(CXX) -DASYNC_API reg_test_mariadb_stmt_store_result-t.cpp $(INCLUDEDIRS) $(LDIRS) $(OPT) $(MYLIBS) -lpthread -ldl -std=c++11 -ltap $(STATIC_LIBS) -o reg_test_mariadb_stmt_store_result_async-t prepare_statement_err3024_libmysql-t: prepare_statement_err3024-t.cpp $(TAP_LIBDIR)/libtap.a - $(CXX) -DLIBMYSQL_HELPER prepare_statement_err3024-t.cpp -I/usr/include/mysql -I$(CURL_IDIR) -I$(SQLITE3_DIR) -I$(IDIR) -I$(JSON_IDIR) -I../tap $(OPT) -L$(TAP_LIBDIR) -lpthread -ldl -std=c++11 -ltap -lmysqlclient -o prepare_statement_err3024_libmysql-t -DGITVERSION=\"$(GIT_VERSION)\" + $(CXX) -DLIBMYSQL_HELPER prepare_statement_err3024-t.cpp -I/usr/include/mysql $(CUSTOMARGS) -lmysqlclient -o prepare_statement_err3024_libmysql-t prepare_statement_err3024_async-t: prepare_statement_err3024-t.cpp $(TAP_LIBDIR)/libtap.a $(CXX) -DASYNC_API prepare_statement_err3024-t.cpp $(INCLUDEDIRS) $(LDIRS) $(OPT) $(MYLIBS) -lpthread -ldl -std=c++11 -ltap $(STATIC_LIBS) -o prepare_statement_err3024_async-t -DGITVERSION=\"$(GIT_VERSION)\"