From 9c8b9220690596f5f5f675e510b0b39a42011ed8 Mon Sep 17 00:00:00 2001 From: Cory McWilliams Date: Tue, 24 Dec 2024 14:47:33 -0500 Subject: [PATCH] build: Use all the tricks to make release smaller on all the platforms. --- GNUmakefile | 7 ++++--- tools/ssl-android | 4 +++- tools/ssl-ios | 4 ++-- tools/ssl-local | 4 +++- tools/ssl-mingw64 | 2 +- 5 files changed, 13 insertions(+), 8 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index 0b7a8ed6..5b3cb155 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -208,11 +208,12 @@ $(ANDROID_TARGETS): CFLAGS += \ -Wno-unknown-warning-option $(ANDROID_TARGETS): LDFLAGS += --sysroot $(ANDROID_NDK)/toolchains/llvm/prebuilt/linux-x86_64/sysroot -fPIC $(DEBUG_TARGETS): CFLAGS += -DDEBUG -Og +$(DEBUG_TARGETS): LDFLAGS += -Og $(RELEASE_TARGETS): CFLAGS += \ -DNDEBUG \ - -flto -$(NONANDROID_RELEASE_TARGETS): CFLAGS += -O3 -$(ANDROID_RELEASE_TARGETS): CFLAGS += -Oz + -flto \ + -Oz +$(RELEASE_TARGETS): LDFLAGS += -Oz $(WINDOWS_TARGETS): CC = x86_64-w64-mingw32-gcc-win32 $(WINDOWS_TARGETS): AS = $(CC) $(WINDOWS_TARGETS): CFLAGS += \ diff --git a/tools/ssl-android b/tools/ssl-android index 2a969251..8fd9cb90 100755 --- a/tools/ssl-android +++ b/tools/ssl-android @@ -73,8 +73,10 @@ build_the_thing() { no-whirlpool no-weak-ssl-ciphers no-zlib - -Os + -Oz -DOPENSSL_SMALL_FOOTPRINT + -ffunction-sections + -fdata-sections -flto" pwd echo "./Configure $SSL_TARGET $OPTIONS $GLOBAL_OPTIONS" && \ diff --git a/tools/ssl-ios b/tools/ssl-ios index 86a522ba..0000929d 100755 --- a/tools/ssl-ios +++ b/tools/ssl-ios @@ -29,14 +29,14 @@ do case $build_target in ios64-xcrun) TRIBLE="arm64-darwin-ios" - OPTIONS="--static -static -ffunction-sections -fdata-sections -fPIC -Wno-macro-redefined -miphoneos-version-min=9.0" + OPTIONS="--static -static -Oz -ffunction-sections -fdata-sections -fPIC -Wno-macro-redefined -miphoneos-version-min=9.0" DESTDIR="/tmp/$BUILD_DIR/arm64-ios" SSL_TARGET="ios64-xcrun" CC=clang ;; iossimulator-xcrun) TRIBLE="x86_64-darwin-ios" - OPTIONS="--static -static -ffunction-sections -fdata-sections -fPIC -Wno-macro-redefined" + OPTIONS="--static -static -Oz -ffunction-sections -fdata-sections -fPIC -Wno-macro-redefined" DESTDIR="/tmp/$BUILD_DIR/x86_64-iossim" SSL_TARGET="iossimulator-xcrun" CC=clang diff --git a/tools/ssl-local b/tools/ssl-local index 1365d741..3d2a10e9 100755 --- a/tools/ssl-local +++ b/tools/ssl-local @@ -69,8 +69,10 @@ no-uplink no-whirlpool no-weak-ssl-ciphers no-zlib --Os +-Oz -DOPENSSL_SMALL_FOOTPRINT +-ffunction-sections +-fdata-sections -flto" pwd echo "./Configure $SSL_TARGET $OPTIONS $GLOBAL_OPTIONS" && \ diff --git a/tools/ssl-mingw64 b/tools/ssl-mingw64 index d75c6545..8c739805 100755 --- a/tools/ssl-mingw64 +++ b/tools/ssl-mingw64 @@ -56,7 +56,7 @@ build_the_thing() { no-uplink no-weak-ssl-ciphers no-zlib - -Os + -Oz -ffunction-sections -fdata-sections -flto