From 224442772e61f0e625fa72fb6196d6fac6473480 Mon Sep 17 00:00:00 2001 From: Cory McWilliams Date: Mon, 23 Dec 2024 14:22:27 -0500 Subject: [PATCH] build: Let's try a thing. Use our own static openssl libraries built in-tree. --- GNUmakefile | 9 ++++++ tools/ssl-local | 86 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 95 insertions(+) create mode 100755 tools/ssl-local diff --git a/GNUmakefile b/GNUmakefile index dc915ca0..0ea4456f 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -242,6 +242,8 @@ $(IOS_TARGETS): CFLAGS += -miphoneos-version-min=9.0 -Ideps/openssl/ios/ios64-xc $(IOS_TARGETS): LDFLAGS += -miphoneos-version-min=9.0 -Ldeps/openssl/ios/ios64-xcrun/usr/local/lib $(IOSSIM_TARGETS): CFLAGS += -Ideps/openssl/ios/iossimulator-xcrun/usr/local/include $(IOSSIM_TARGETS): LDFLAGS += -Ldeps/openssl/ios/iossimulator-xcrun/usr/local/lib +$(LINUX_TARGETS): CFLAGS += -Ideps/openssl/$(UNAME_S)/$(UNAME_M)/usr/local/include +$(LINUX_TARGETS): LDFLAGS += -Ldeps/openssl/$(UNAME_S)/$(UNAME_M)/usr/local/lib ifeq ($(UNAME_M),x86_64) ifeq ($(UNAME_S),Linux) @@ -1106,6 +1108,13 @@ $(ANDROID_DEPS): +@ANDROID_NDK_ROOT=$(ANDROID_NDK) tools/ssl-android $(filter $(BUILD_DIR)/android%,$(APP_OBJS)): | $(ANDROID_DEPS) +ifeq ($(UNAME_S),Linux) +LOCAL_DEPS := deps/openssl/$(UNAME_S)/$(UNAME_M)/usr/local/lib/libssl.a +$(LOCAL_DEPS): + +@tools/ssl-local +$(filter $(BUILD_DIR)/debug/%,$(APP_OBJS)) $(filter $(BUILD_DIR)/release/%,$(APP_OBJS)): | $(LOCAL_DEPS) +endif + ifeq ($(HAVE_WIN),1) WINDOWS_DEPS := deps/openssl/mingw64/usr/local/lib/libssl.a $(WINDOWS_DEPS): diff --git a/tools/ssl-local b/tools/ssl-local new file mode 100755 index 00000000..71d5effb --- /dev/null +++ b/tools/ssl-local @@ -0,0 +1,86 @@ +#!/bin/bash + +BUILD_DIR=out/openssl_local_build + +BUILD_PLATFORM=$(uname -s) +BUILD_TARGET=$(uname -m) + +WORK_DIR=out/openssl-local +rm -rf $WORK_DIR +cp -arf deps/openssl_src/ $WORK_DIR + +echo "Building" +pwd +pushd $WORK_DIR || exit 128 +rm -rf $DESTDIR +echo $PATH +export GLOBAL_OPTIONS=" +no-apps +no-asm +no-async +no-autoerrinit +no-autoload-config +no-cmp +no-cms +no-comp +no-deprecated +no-dgram +no-docs +no-dsa +no-dso +no-dtls +no-dtls1 +no-dtls1-method +no-dynamic-engine +no-ec2m +no-egd +no-engine +no-err +no-filenames +no-gost +no-http +no-idea +no-legacy +no-md2 +no-md4 +no-module +no-multiblock +no-nextprotoneg +no-ocsp +no-psk +no-shared +no-sock +no-srp +no-ssl +no-ssl3 +no-ssl-trace +no-stdio +no-tests +no-thread-pool +no-threads +no-tls1 +no-tls1-method +no-trace +no-ui-console +no-uplink +no-whirlpool +no-weak-ssl-ciphers +no-zlib +-Os +-DOPENSSL_SMALL_FOOTPRINT +-flto" +pwd +echo "./Configure $SSL_TARGET $OPTIONS $GLOBAL_OPTIONS" && \ +./Configure $SSL_TARGET $OPTIONS $GLOBAL_OPTIONS && \ +make -s clean && \ +make -s build_generated && \ +make -s libcrypto.a libssl.a || exit 128 +popd +echo WORK_DIR=$WORK_DIR +rm -rf deps/openssl/$BUILD_PLATFORM/$BUILD_TARGET/ +mkdir -p deps/openssl/$BUILD_PLATFORM/$BUILD_TARGET/usr/local/include/ +mkdir -p deps/openssl/$BUILD_PLATFORM/$BUILD_TARGET/usr/local/lib/ +cp -R $WORK_DIR/include/* deps/openssl/$BUILD_PLATFORM/$BUILD_TARGET/usr/local/include/ +cp $WORK_DIR/*.a deps/openssl/$BUILD_PLATFORM/$BUILD_TARGET/usr/local/lib/ + +echo Success