From 456ce7b341ac5d06301d1874d39a3ea56d7d8b4b Mon Sep 17 00:00:00 2001 From: Miro Stauder Date: Sun, 8 Dec 2024 10:25:50 +0000 Subject: [PATCH] make OpenSSL special case only for almalinux8 --- deps/Makefile | 18 +++++++++--------- lib/Makefile | 14 ++++++++++---- src/Makefile | 21 +++++++++++---------- 3 files changed, 30 insertions(+), 23 deletions(-) diff --git a/deps/Makefile b/deps/Makefile index 2823e66db..f7be0f2b9 100644 --- a/deps/Makefile +++ b/deps/Makefile @@ -72,29 +72,29 @@ libinjection: libinjection/libinjection/src/libinjection.a DISTRO := $(shell lsb_release -si 2>/dev/null || grep '^ID=' /etc/os-release | cut -d= -f2 | tr -d '"') OPENSSL_VERSION_3 := 3.0.0 +ssl_header_path := $(shell find /usr /usr/local /opt -name "ssl.h" -path "*/openssl/*" 2>/dev/null | head -n 1) +LIB_SSL_PATH := $(shell find /usr /usr/local /opt -name "libssl.so" 2>/dev/null | head -n 1) +LIB_CRYPTO_PATH := $(shell find /usr /usr/local /opt -name "libcrypto.so" 2>/dev/null | head -n 1) ifeq ($(DISTRO), almalinux) +ifeq ($(CENTOSVER), 8) ssl_header_path := $(shell find /usr /usr/local /opt -name "ssl.h" -path "*/openssl3/*" 2>/dev/null | head -n 1) LIB_SSL_PATH := $(shell find /usr /usr/local /opt -name "libssl.so.3" 2>/dev/null | head -n 1) LIB_CRYPTO_PATH := $(shell find /usr /usr/local /opt -name "libcrypto.so.3" 2>/dev/null | head -n 1) - SSL_LDIR := $(dir $(LIB_SSL_PATH)) -else - ssl_header_path := $(shell find /usr /usr/local /opt -name "ssl.h" -path "*/openssl/*" 2>/dev/null | head -n 1) - LIB_SSL_PATH := $(shell find /usr /usr/local /opt -name "libssl.so" 2>/dev/null | head -n 1) - LIB_CRYPTO_PATH := $(shell find /usr /usr/local /opt -name "libcrypto.so" 2>/dev/null | head -n 1) - SSL_LDIR := $(dir $(LIB_SSL_PATH)) endif +endif +SSL_LDIR := $(dir $(LIB_SSL_PATH)) ifneq ($(ssl_header_path),) SSL_IDIR := $(shell dirname $(shell dirname $(ssl_header_path))) $(info Found OpenSSL headers at $(SSL_IDIR)) $(info OpenSSL lib full path is $(LIB_SSL_PATH)) - $(info OpenSSL libs directory is $(SSL_LDIR)) + $(info OpenSSL libs directory is $(SSL_LDIR)) else - $(error Warning: OpenSSL headers not found. exiting, please install openssl.) + $(error Warning: OpenSSL headers not found. exiting, please install openssl version 3.) endif check_openssl_version: - @if [ "$(DISTRO)" = "almalinux" ]; then \ + @if [ "$(DISTRO)" = "almalinux" && "$(CENTOSVER)" = "8" ]; then \ @current_version=$$(openssl3 version | awk '{print $$2}'); \ else \ @current_version=$$(openssl version | awk '{print $$2}'); \ diff --git a/lib/Makefile b/lib/Makefile index 0c2d605c3..492d3c4cd 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -6,6 +6,11 @@ ifndef GIT_VERSION $(error GIT_VERSION is not set) endif +CENTOSVER := Unknown +ifneq (,$(wildcard /etc/system-release)) + CENTOSVER := $(shell rpm --eval %rhel) +endif + DEPS_PATH := ../deps UNAME_S := $(shell uname -s) @@ -49,17 +54,18 @@ CURL_IDIR := $(CURL_DIR)/include DISTRO := $(shell lsb_release -si 2>/dev/null || grep '^ID=' /etc/os-release | cut -d= -f2 | tr -d '"') +ssl_header_path := $(shell find /usr /usr/local /opt -name "ssl.h" -path "*/openssl/*" 2>/dev/null | head -n 1) ifeq ($(DISTRO), almalinux) +ifeq ($(CENTOSVER), 8) ssl_header_path := $(shell find /usr /usr/local /opt -name "ssl.h" -path "*/openssl3/*" 2>/dev/null | head -n 1) -else - ssl_header_path := $(shell find /usr /usr/local /opt -name "ssl.h" -path "*/openssl/*" 2>/dev/null | head -n 1) +endif endif ifneq ($(ssl_header_path),) SSL_IDIR := $(shell dirname $(shell dirname $(ssl_header_path))) - $(info Found yash OpenSSL headers at $(SSL_IDIR)) + $(info Found OpenSSL headers at $(SSL_IDIR)) else - $(error Warning: OpenSSL headers not found. exiting, please install openssl.) + $(error Warning: OpenSSL headers not found. exiting, please install openssl version 3.) endif EV_DIR := $(DEPS_PATH)/libev/libev/ diff --git a/src/Makefile b/src/Makefile index 4da9e31e6..a8636e954 100644 --- a/src/Makefile +++ b/src/Makefile @@ -83,25 +83,25 @@ CURL_LDIR := $(CURL_PATH)/lib/.libs DISTRO := $(shell lsb_release -si 2>/dev/null || grep '^ID=' /etc/os-release | cut -d= -f2 | tr -d '"') +ssl_header_path := $(shell find /usr /usr/local /opt -name "ssl.h" -path "*/openssl/*" 2>/dev/null | head -n 1) +LIB_SSL_PATH := $(shell find /usr /usr/local /opt -name "libssl.so" 2>/dev/null | head -n 1) +LIB_CRYPTO_PATH := $(shell find /usr /usr/local /opt -name "libcrypto.so" 2>/dev/null | head -n 1) ifeq ($(DISTRO), almalinux) +ifeq ($(CENTOSVER), 8) ssl_header_path := $(shell find /usr /usr/local /opt -name "ssl.h" -path "*/openssl3/*" 2>/dev/null | head -n 1) LIB_SSL_PATH := $(shell find /usr /usr/local /opt -name "libssl.so.3" 2>/dev/null | head -n 1) LIB_CRYPTO_PATH := $(shell find /usr /usr/local /opt -name "libcrypto.so.3" 2>/dev/null | head -n 1) - SSL_LDIR := $(dir $(LIB_SSL_PATH)) -else - ssl_header_path := $(shell find /usr /usr/local /opt -name "ssl.h" -path "*/openssl/*" 2>/dev/null | head -n 1) - LIB_SSL_PATH := $(shell find /usr /usr/local /opt -name "libssl.so" 2>/dev/null | head -n 1) - LIB_CRYPTO_PATH := $(shell find /usr /usr/local /opt -name "libcrypto.so" 2>/dev/null | head -n 1) - SSL_LDIR := $(dir $(LIB_SSL_PATH)) endif +endif +SSL_LDIR := $(dir $(LIB_SSL_PATH)) ifneq ($(ssl_header_path),) SSL_IDIR := $(shell dirname $(shell dirname $(ssl_header_path))) $(info Found OpenSSL headers at $(SSL_IDIR)) $(info OpenSSL lib full path is $(LIB_SSL_PATH)) - $(info OpenSSL libs directory is $(SSL_LDIR)) + $(info OpenSSL libs directory is $(SSL_LDIR)) else - $(error Warning: OpenSSL headers not found. exiting, please install openssl.) + $(error Warning: OpenSSL headers not found. exiting, please install openssl version 3.) endif EV_PATH := $(DEPS_PATH)/libev/libev/ @@ -201,10 +201,11 @@ ifeq ($(UNAME_S),Linux) STATICMYLIBS += -lcoredumper endif +MYLIBS := -Wl,--export-dynamic $(STATICMYLIBS) -Wl,-Bdynamic -lgnutls -lpthread -lssl -lcrypto -lm -lz -lrt -lprometheus-cpp-pull -lprometheus-cpp-core -luuid $(EXTRALINK) ifeq ($(DISTRO), almalinux) +ifeq ($(CENTOSVER), 8) MYLIBS := -Wl,--export-dynamic $(STATICMYLIBS) -Wl,-Bdynamic -lgnutls -lpthread $(LIB_SSL_PATH) $(LIB_CRYPTO_PATH) -lm -lz -lrt -lprometheus-cpp-pull -lprometheus-cpp-core -luuid $(EXTRALINK) -else - MYLIBS := -Wl,--export-dynamic $(STATICMYLIBS) -Wl,-Bdynamic -lgnutls -lpthread -lssl -lcrypto -lm -lz -lrt -lprometheus-cpp-pull -lprometheus-cpp-core -luuid $(EXTRALINK) +endif endif ifeq ($(UNAME_S),Darwin)