Skip to content

Commit

Permalink
Dynamic openssl changes for tap tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
yashwantsahu20 authored and mirostauder committed Nov 14, 2024
1 parent 06a85ee commit c9b72da
Show file tree
Hide file tree
Showing 7 changed files with 76 additions and 29 deletions.
10 changes: 8 additions & 2 deletions lib/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,14 @@ COREDUMPER_IDIR := $(COREDUMPER_DIR)/include
CURL_DIR := $(DEPS_PATH)/curl/curl
CURL_IDIR := $(CURL_DIR)/include

SSL_DIR := $(DEPS_PATH)/libssl/openssl/
SSL_IDIR := $(SSL_DIR)/include
ssl_header_path := $(shell find /usr /usr/local /opt -name "ssl.h" -path "*/openssl/*" 2>/dev/null | head -n 1)

ifneq ($(ssl_header_path),)
SSL_IDIR := $(shell dirname $(ssl_header_path))
$(info Found OpenSSL headers at $(SSL_IDIR))
else
$(error Warning: OpenSSL headers not found. exiting, please install openssl.)
endif

EV_DIR := $(DEPS_PATH)/libev/libev/
EV_IDIR := $(EV_DIR)
Expand Down
10 changes: 8 additions & 2 deletions test/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,14 @@ MICROHTTPD_IDIR := $(MICROHTTPD_PATH)/src/include
CURL_PATH := $(DEPS_PATH)/curl/curl
CURL_IDIR := -I$(CURL_PATH)/include

SSL_PATH := $(DEPS_PATH)/libssl/openssl/
SSL_IDIR := $(SSL_PATH)/include
ssl_header_path := $(shell find /usr /usr/local /opt -name "ssl.h" -path "*/openssl/*" 2>/dev/null | head -n 1)

ifneq ($(ssl_header_path),)
SSL_IDIR := $(shell dirname $(ssl_header_path))
$(info Found OpenSSL headers at $(SSL_IDIR))
else
$(error Warning: OpenSSL headers not found. exiting, please install openssl.)
endif

EV_PATH := $(DEPS_PATH)/libev/libev/
EV_IDIR := $(EV_PATH)
Expand Down
6 changes: 3 additions & 3 deletions test/deps/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ mariadb-connector-c/mariadb-connector-c/libmariadb/libmariadbclient.a:
cd mariadb-connector-c && tar -zxf mariadb-connector-c-*.tar.gz
cd mariadb-connector-c/mariadb-connector-c && patch -p0 < ../CMakeLists.txt.patch
cd mariadb-connector-c/mariadb-connector-c && patch -p0 < ../ConnectorName.cmake.patch
cd mariadb-connector-c/mariadb-connector-c && cmake . -DCMAKE_BUILD_TYPE=RelWithDebInfo -DOPENSSL_ROOT_DIR=$(DEPS_PATH)/libssl/openssl/
cd mariadb-connector-c/mariadb-connector-c && cmake . -DCMAKE_BUILD_TYPE=RelWithDebInfo
cd mariadb-connector-c/mariadb-connector-c && CC=${CC} CXX=${CXX} ${MAKE} mariadbclient

mariadb_client: mariadb-connector-c/mariadb-connector-c/libmariadb/libmariadbclient.a
Expand All @@ -32,7 +32,7 @@ mysql-connector-c/mysql-connector-c/libmysql/libmysqlclient.a: mysql-connector-c
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 && cmake . -DWITH_BOOST=./boost -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="-O0 -ggdb -DNDEBUG -fPIC" -DOPENSSL_ROOT_DIR=$(DEPS_PATH)/libssl/openssl
cd mysql-connector-c/mysql-connector-c && cmake . -DWITH_BOOST=./boost -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="-O0 -ggdb -DNDEBUG -fPIC"
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/

Expand All @@ -47,7 +47,7 @@ mysql-connector-c-8.4.0/mysql-connector-c/libmysql/libmysqlclient.a: mysql-conne
cd mysql-connector-c-8.4.0 && ln -fsT $$(ls -1d mysql-8.4.*/) mysql-connector-c
cd mysql-connector-c-8.4.0/mysql-connector-c && cmake . -DFORCE_INSOURCE_BUILD=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DWITHOUT_SERVER=ON -DDOWNLOAD_BOOST=1 -DWITH_BOOST=./mysql-server/downloads/ -DWITH_UNIT_TESTS=OFF \
-DCMAKE_CXX_FLAGS_RELWITHDEBINFO="-O0 -ggdb -DNDEBUG -fPIC" -DOPENSSL_ROOT_DIR=$(DEPS_PATH)/libssl/openssl
-DCMAKE_CXX_FLAGS_RELWITHDEBINFO="-O0 -ggdb -DNDEBUG -fPIC"
cd mysql-connector-c-8.4.0/mysql-connector-c && CC=${CC} CXX=${CXX} ${MAKE}
cd mysql-connector-c-8.4.0/mysql-connector-c && cp archive_output_directory/libmysqlclient.a libmysql/

Expand Down
19 changes: 6 additions & 13 deletions test/tap/tap/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -92,27 +92,26 @@ default: all

.PHONY: all
all: libtap_mariadb.a libtap_mysql57.a libtap_mysql8.a \
libtap.so libssl.so.3 libcrypto.so.3 libcpp_dotenv.so libre2.so
libtap.so libcpp_dotenv.so libre2.so

debug: OPT := $(STDCPP) -O0 -DDEBUG -ggdb -Wl,--no-as-needed $(WASAN)
debug: libtap_mariadb.a libtap_mysql57.a libtap_mysql8.a libtap.so


### helper targets

command_line.o: command_line.cpp cpp-dotenv/static/cpp-dotenv/libcpp_dotenv.a libcurl.so libssl.so.3 libcrypto.so.3 libcpp_dotenv.so
command_line.o: command_line.cpp cpp-dotenv/static/cpp-dotenv/libcpp_dotenv.a libcurl.so -lssl -lcrypto libcpp_dotenv.so
$(CXX) -fPIC -c command_line.cpp $(IDIRS) $(OPT)

utils_mariadb.o: utils.cpp cpp-dotenv/static/cpp-dotenv/libcpp_dotenv.a libcurl.so libssl.so.3 libcrypto.so.3 libcpp_dotenv.so
utils_mariadb.o: utils.cpp cpp-dotenv/static/cpp-dotenv/libcpp_dotenv.a libcurl.so -lssl -lcrypto libcpp_dotenv.so
$(CXX) -fPIC -c utils.cpp $(IDIRS) -I$(MARIADB_IDIR) $(OPT) -o $@

utils_mysql57.o: utils.cpp cpp-dotenv/static/cpp-dotenv/libcpp_dotenv.a libcurl.so libssl.so.3 libcrypto.so.3 libcpp_dotenv.so
utils_mysql57.o: utils.cpp cpp-dotenv/static/cpp-dotenv/libcpp_dotenv.a libcurl.so -lssl -lcrypto libcpp_dotenv.so
$(CXX) -DDISABLE_WARNING_COUNT_LOGGING -fPIC -c utils.cpp $(IDIRS) -I$(TEST_MYSQL_IDIR) -I$(TEST_MYSQL_EDIR) $(OPT) -o $@

utils_mysql8.o: utils.cpp cpp-dotenv/static/cpp-dotenv/libcpp_dotenv.a libcurl.so libssl.so.3 libcrypto.so.3 libcpp_dotenv.so
utils_mysql8.o: utils.cpp cpp-dotenv/static/cpp-dotenv/libcpp_dotenv.a libcurl.so -lssl -lcrypto libcpp_dotenv.so
$(CXX) -DDISABLE_WARNING_COUNT_LOGGING -fPIC -c utils.cpp $(IDIRS) -I$(TEST_MYSQL8_IDIR) -I$(TEST_MYSQL_EDIR) $(OPT) -o $@

tap.o: tap.cpp cpp-dotenv/static/cpp-dotenv/libcpp_dotenv.a libcurl.so libssl.so.3 libcrypto.so.3 libcpp_dotenv.so
tap.o: tap.cpp cpp-dotenv/static/cpp-dotenv/libcpp_dotenv.a libcurl.so -lssl -lcrypto libcpp_dotenv.so
$(CXX) -fPIC -c tap.cpp $(IDIRS) $(OPT)

libtap_mariadb.a: tap.o command_line.o utils_mariadb.o cpp-dotenv/static/cpp-dotenv/libcpp_dotenv.a
Expand All @@ -130,12 +129,6 @@ libtap.so: libtap_mariadb.a cpp-dotenv/dynamic/cpp-dotenv/libcpp_dotenv.so libre

### tap deps targets

libssl.so.3: $(DEPS_PATH)/libssl/openssl/libssl.so.3
cp -a $(DEPS_PATH)/libssl/openssl/libssl.so* .

libcrypto.so.3: $(DEPS_PATH)/libssl/openssl/libcrypto.so.3
cp -a $(DEPS_PATH)/libssl/openssl/libcrypto.so* .

libcpp_dotenv.so: cpp-dotenv/dynamic/cpp-dotenv/libcpp_dotenv.so
find cpp-dotenv/dynamic/cpp-dotenv/ -name '*.so' -exec cp -a {} . \;

Expand Down
20 changes: 17 additions & 3 deletions test/tap/tests/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,23 @@ LIBINJECTION_DIR := $(DEPS_PATH)/libinjection/libinjection
LIBINJECTION_IDIR := $(LIBINJECTION_DIR)/src
LIBINJECTION_LDIR := $(LIBINJECTION_DIR)/src

SSL_DIR := $(DEPS_PATH)/libssl/openssl/
SSL_IDIR := $(SSL_DIR)/include
SSL_LDIR := $(SSL_DIR)
libssl_path := $(shell find /usr /usr/local /opt -name "libssl.so" 2>/dev/null | head -n 1)

ifneq ($(libssl_path),)
SSL_LDIR := $(dir $(libssl_path))
$(info Found OpenSSL libs at $(SSL_LDIR))
else
$(error Warning: OpenSSL library not found. exiting, please install openssl.)
endif

ssl_header_path := $(shell find /usr /usr/local /opt -name "ssl.h" -path "*/openssl/*" 2>/dev/null | head -n 1)

ifneq ($(ssl_header_path),)
SSL_IDIR := $(shell dirname $(ssl_header_path))
$(info Found OpenSSL headers at $(SSL_IDIR))
else
$(error Warning: OpenSSL headers not found. exiting, please install openssl.)
endif

EV_DIR := $(DEPS_PATH)/libev/libev/
EV_IDIR := $(EV_DIR)
Expand Down
20 changes: 17 additions & 3 deletions test/tap/tests_with_deps/common_defs.Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,23 @@ LIBINJECTION_DIR=$(DEPS_PATH)/libinjection/libinjection
LIBINJECTION_IDIR=$(LIBINJECTION_DIR)/src
LIBINJECTION_LDIR=$(LIBINJECTION_DIR)/src

SSL_DIR=$(DEPS_PATH)/libssl/openssl/
SSL_IDIR=$(SSL_DIR)/include
SSL_LDIR=$(SSL_DIR)
libssl_path := $(shell find /usr /usr/local /opt -name "libssl.so" 2>/dev/null | head -n 1)

ifneq ($(libssl_path),)
SSL_LDIR := $(dir $(libssl_path))
$(info Found OpenSSL libs at $(SSL_LDIR))
else
$(error Warning: OpenSSL library not found. exiting, please install openssl.)
endif

ssl_header_path := $(shell find /usr /usr/local /opt -name "ssl.h" -path "*/openssl/*" 2>/dev/null | head -n 1)

ifneq ($(ssl_header_path),)
SSL_IDIR := $(shell dirname $(ssl_header_path))
$(info Found OpenSSL headers at $(SSL_IDIR))
else
$(error Warning: OpenSSL headers not found. exiting, please install openssl.)
endif

EV_DIR=$(DEPS_PATH)/libev/libev/
EV_IDIR=$(EV_DIR)
Expand Down
20 changes: 17 additions & 3 deletions test/tap/tests_with_deps/deprecate_eof_support/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,23 @@ MICROHTTPD_DIR := $(DEPS_PATH)/libmicrohttpd/libmicrohttpd/src
MICROHTTPD_IDIR := $(MICROHTTPD_DIR)/include
MICROHTTPD_LDIR := $(MICROHTTPD_DIR)/microhttpd/.libs

SSL_DIR := $(DEPS_PATH)/libssl/openssl/
SSL_IDIR := $(SSL_DIR)/include
SSL_LDIR := $(SSL_DIR)
libssl_path := $(shell find /usr /usr/local /opt -name "libssl.so" 2>/dev/null | head -n 1)

ifneq ($(libssl_path),)
SSL_LDIR := $(dir $(libssl_path))
$(info Found OpenSSL libs at $(SSL_LDIR))
else
$(error Warning: OpenSSL library not found. exiting, please install openssl.)
endif

ssl_header_path := $(shell find /usr /usr/local /opt -name "ssl.h" -path "*/openssl/*" 2>/dev/null | head -n 1)

ifneq ($(ssl_header_path),)
SSL_IDIR := $(shell dirname $(ssl_header_path))
$(info Found OpenSSL headers at $(SSL_IDIR))
else
$(error Warning: OpenSSL headers not found. exiting, please install openssl.)
endif

EV_DIR := $(DEPS_PATH)/libev/libev/
EV_IDIR := $(EV_DIR)
Expand Down

0 comments on commit c9b72da

Please sign in to comment.