fix: set maxdepth for OpenSSL libraries search

Previously OpenSSL library search didn't specify the depth of the
search. This results in long waits during building searching in
unnecessary system directories.

The previous is unnecessary. When pkg-config is requested with 'libdir',
the expectation is that the directory in which the binaries are located
is returned. Due to this, the search can be contained only in that
target directory.
v3.0-future_build_fixes
Javier Jaramago Fernández 1 month ago
parent 1c311fd5f1
commit f88dddaefb

@ -22,28 +22,28 @@ ifeq ($(CUSTOM_OPENSSL_PATH),)
ifeq ($(OPENSSL_PACKAGE),openssl3)
SSL_IDIR := $(shell pkg-config --cflags $(OPENSSL_PACKAGE) | sed -E 's/-I/ /g' | awk '{for(i=1;i<=NF;i++) if($$i ~ /^\//) print $$i}' | head -n 1)
SSL_LDIR := $(shell pkg-config --variable=libdir $(OPENSSL_PACKAGE))
LIB_SSL_PATH := $(shell find $(SSL_LDIR) -name "libssl.so.3" 2>/dev/null | head -n 1)
LIB_CRYPTO_PATH := $(shell find $(SSL_LDIR) -name "libcrypto.so.3" 2>/dev/null | head -n 1)
LIB_SSL_PATH := $(shell find $(SSL_LDIR) -maxdepth 1 -name "libssl.so.3" 2>/dev/null | head -n 1)
LIB_CRYPTO_PATH := $(shell find $(SSL_LDIR) -maxdepth 1 -name "libcrypto.so.3" 2>/dev/null | head -n 1)
else
SSL_IDIR := $(shell export PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1; export PKG_CONFIG_ALLOW_SYSTEM_LIBS=1; pkg-config --cflags $(OPENSSL_PACKAGE) | sed -E 's/-I/ /g' | awk '{for(i=1;i<=NF;i++) if($$i ~ /^\//) print $$i}' | head -n 1)
SSL_LDIR := $(shell pkg-config --variable=libdir $(OPENSSL_PACKAGE))
ifeq ($(UNAME_S),Darwin)
LIB_SSL_PATH := $(shell find $(SSL_LDIR) -name "libssl.dylib" 2>/dev/null | head -n 1)
LIB_SSL_PATH := $(shell find $(SSL_LDIR) -maxdepth 1 -name "libssl.dylib" 2>/dev/null | head -n 1)
ifeq ($(LIB_SSL_PATH),)
LIB_SSL_PATH := $(shell find $(SSL_LDIR) -name "libssl.a" 2>/dev/null | head -n 1)
LIB_SSL_PATH := $(shell find $(SSL_LDIR) -maxdepth 1 -name "libssl.a" 2>/dev/null | head -n 1)
endif
LIB_CRYPTO_PATH := $(shell find $(SSL_LDIR) -name "libcrypto.dylib" 2>/dev/null | head -n 1)
LIB_CRYPTO_PATH := $(shell find $(SSL_LDIR) -maxdepth 1 -name "libcrypto.dylib" 2>/dev/null | head -n 1)
ifeq ($(LIB_CRYPTO_PATH),)
LIB_CRYPTO_PATH := $(shell find $(SSL_LDIR) -name "libcrypto.a" 2>/dev/null | head -n 1)
LIB_CRYPTO_PATH := $(shell find $(SSL_LDIR) -maxdepth 1 -name "libcrypto.a" 2>/dev/null | head -n 1)
endif
else
LIB_SSL_PATH := $(shell find $(SSL_LDIR) -name "libssl.so*" 2>/dev/null | head -n 1)
LIB_SSL_PATH := $(shell find $(SSL_LDIR) -maxdepth 1 -name "libssl.so*" 2>/dev/null | head -n 1)
ifeq ($(LIB_SSL_PATH),)
LIB_SSL_PATH := $(shell find $(SSL_LDIR) -name "libssl.a" 2>/dev/null | head -n 1)
LIB_SSL_PATH := $(shell find $(SSL_LDIR) -maxdepth 1 -name "libssl.a" 2>/dev/null | head -n 1)
endif
LIB_CRYPTO_PATH := $(shell find $(SSL_LDIR) -name "libcrypto.so*" 2>/dev/null | head -n 1)
LIB_CRYPTO_PATH := $(shell find $(SSL_LDIR) -maxdepth 1 -name "libcrypto.so*" 2>/dev/null | head -n 1)
ifeq ($(LIB_CRYPTO_PATH),)
LIB_CRYPTO_PATH := $(shell find $(SSL_LDIR) -name "libcrypto.a" 2>/dev/null | head -n 1)
LIB_CRYPTO_PATH := $(shell find $(SSL_LDIR) -maxdepth 1 -name "libcrypto.a" 2>/dev/null | head -n 1)
endif
endif
endif
@ -55,22 +55,22 @@ else
SSL_LDIR := $(CUSTOM_OPENSSL_PATH)/lib64
endif
ifeq ($(UNAME_S),Darwin)
LIB_SSL_PATH := $(shell find $(SSL_LDIR) -name "libssl.dylib" 2>/dev/null | head -n 1)
LIB_SSL_PATH := $(shell find $(SSL_LDIR) -maxdepth 1 -name "libssl.dylib" 2>/dev/null | head -n 1)
ifeq ($(LIB_SSL_PATH),)
LIB_SSL_PATH := $(shell find $(SSL_LDIR) -name "libssl.a" 2>/dev/null | head -n 1)
LIB_SSL_PATH := $(shell find $(SSL_LDIR) -maxdepth 1 -name "libssl.a" 2>/dev/null | head -n 1)
endif
LIB_CRYPTO_PATH := $(shell find $(SSL_LDIR) -name "libcrypto.dylib" 2>/dev/null | head -n 1)
LIB_CRYPTO_PATH := $(shell find $(SSL_LDIR) -maxdepth 1 -name "libcrypto.dylib" 2>/dev/null | head -n 1)
ifeq ($(LIB_CRYPTO_PATH),)
LIB_CRYPTO_PATH := $(shell find $(SSL_LDIR) -name "libcrypto.a" 2>/dev/null | head -n 1)
LIB_CRYPTO_PATH := $(shell find $(SSL_LDIR) -maxdepth 1 -name "libcrypto.a" 2>/dev/null | head -n 1)
endif
else
LIB_SSL_PATH := $(shell find $(SSL_LDIR) -name "libssl.so" 2>/dev/null | head -n 1)
LIB_SSL_PATH := $(shell find $(SSL_LDIR) -maxdepth 1 -name "libssl.so" 2>/dev/null | head -n 1)
ifeq ($(LIB_SSL_PATH),)
LIB_SSL_PATH := $(shell find $(SSL_LDIR) -name "libssl.a" 2>/dev/null | head -n 1)
LIB_SSL_PATH := $(shell find $(SSL_LDIR) -maxdepth 1 -name "libssl.a" 2>/dev/null | head -n 1)
endif
LIB_CRYPTO_PATH := $(shell find $(SSL_LDIR) -name "libcrypto.so" 2>/dev/null | head -n 1)
LIB_CRYPTO_PATH := $(shell find $(SSL_LDIR) -maxdepth 1 -name "libcrypto.so" 2>/dev/null | head -n 1)
ifeq ($(LIB_CRYPTO_PATH),)
LIB_CRYPTO_PATH := $(shell find $(SSL_LDIR) -name "libcrypto.a" 2>/dev/null | head -n 1)
LIB_CRYPTO_PATH := $(shell find $(SSL_LDIR) -maxdepth 1 -name "libcrypto.a" 2>/dev/null | head -n 1)
endif
endif
$(info Using custom OpenSSL path: $(CUSTOM_OPENSSL_PATH))
@ -88,4 +88,4 @@ else
endif
else
$(error Warning: OpenSSL headers (SSL_IDIR) not found. Exiting. Please install OpenSSL version 3.)
endif
endif

Loading…
Cancel
Save