From 9e54fc4847d3d427b232e36758e7efc0c0019fe2 Mon Sep 17 00:00:00 2001 From: Thierry Laurion Date: Mon, 21 Feb 2022 18:55:44 -0500 Subject: [PATCH] WiP: Pass all modules from O2 to Os to optimize for space. Adresses @easrentai suggestion to pass modules optimization here: https://github.com/osresearch/heads/issues/590#issuecomment-821788703 flashrom and busybox don't seem to take Os into consideration --- modules/cairo | 2 +- modules/cryptsetup | 4 +++- modules/cryptsetup2 | 4 +++- modules/gpg | 1 + modules/gpg2 | 4 +++- modules/libgcrypt | 1 + modules/libgpg-error | 4 +++- modules/libksba | 4 +++- modules/libpng | 1 + modules/lvm2 | 1 + modules/pixman | 1 + modules/tpmtotp | 2 +- modules/util-linux | 1 + modules/zlib | 1 + 14 files changed, 24 insertions(+), 7 deletions(-) diff --git a/modules/cairo b/modules/cairo index 647ed2ca78..7fc92331fe 100644 --- a/modules/cairo +++ b/modules/cairo @@ -8,7 +8,7 @@ cairo_hash := 8c90f00c500b2299c0a323dd9beead2a00353752b2092ead558139bd67f7bf16 cairo_configure := \ $(CROSS_TOOLS) \ - CFLAGS="-DCAIRO_NO_MUTEX=1 -O3" \ + CFLAGS="-DCAIRO_NO_MUTEX=1 -Os" \ ./configure \ --host i386-elf-linux \ --prefix="/" \ diff --git a/modules/cryptsetup b/modules/cryptsetup index 4cea7f3591..cddffa1856 100644 --- a/modules/cryptsetup +++ b/modules/cryptsetup @@ -10,8 +10,10 @@ cryptsetup_hash := af2b04e8475cf40b8d9ffd97a1acfa73aa787c890430afd89804fb544d6ad # Use an empty prefix so that the executables will not include the # build path. -cryptsetup_configure := ./configure \ +cryptsetup_configure := \ $(CROSS_TOOLS) \ + CFLAGS="-Os" \ + ./configure \ --host i386-elf-linux \ --prefix "/" \ --disable-gcrypt-pbkdf2 \ diff --git a/modules/cryptsetup2 b/modules/cryptsetup2 index af7fe38196..b69aedb683 100644 --- a/modules/cryptsetup2 +++ b/modules/cryptsetup2 @@ -10,8 +10,10 @@ cryptsetup2_hash := 3bca4ffe39e2f94cef50f6ea65acb873a6dbce5db34fc6bcefe38b6d095e # Use an empty prefix so that the executables will not include the # build path. -cryptsetup2_configure := ./configure \ +cryptsetup2_configure := \ $(CROSS_TOOLS) \ + CFLAGS="-Os" \ + ./configure \ --host i386-elf-linux \ --prefix "/" \ --disable-rpath \ diff --git a/modules/gpg b/modules/gpg index 4d4440a11e..493bf6dc68 100644 --- a/modules/gpg +++ b/modules/gpg @@ -19,6 +19,7 @@ gpg_hash := 6b47a3100c857dcab3c60e6152e56a997f2c7862c1b8b2b25adf3884a1ae2276 # gpg_configure := ./configure \ $(CROSS_TOOLS) \ + CFLAGS="-Os" \ --build i386-elf-linux \ --host x86_64-linux-musl \ --with-libusb="$(INSTALL)" \ diff --git a/modules/gpg2 b/modules/gpg2 index 1f2c863589..6e40d88712 100644 --- a/modules/gpg2 +++ b/modules/gpg2 @@ -11,7 +11,9 @@ gpg2_hash := 61e83278fb5fa7336658a8b73ab26f379d41275bb1c7c6e694dd9f9a6e8e76ec # be generated with the correct paths, but then re-write them when # we use the install target so that they will be copied to the correct # location. -gpg2_configure := ./configure \ +gpg2_configure := \ + CFLAGS="-Os" \ + ./configure \ $(CROSS_TOOLS) \ CPPFLAGS="-I$(INSTALL)/include/libusb-1.0" \ --host x86_64-linux-musl \ diff --git a/modules/libgcrypt b/modules/libgcrypt index 3c2e5d9adb..5cf97d79c2 100644 --- a/modules/libgcrypt +++ b/modules/libgcrypt @@ -7,6 +7,7 @@ libgcrypt_hash := 0cba2700617b99fc33864a0c16b1fa7fdf9781d9ed3509f5d767178e5fd7b9 libgcrypt_configure := ./configure \ $(CROSS_TOOLS) \ + CFLAGS="-Os" \ --host=x86_64-linux-musl \ --prefix "/" \ --disable-static \ diff --git a/modules/libgpg-error b/modules/libgpg-error index 00bd06440e..482f80f374 100644 --- a/modules/libgpg-error +++ b/modules/libgpg-error @@ -5,8 +5,10 @@ libgpg-error_tar := libgpg-error-$(libgpg-error_version).tar.bz2 libgpg-error_url := https://gnupg.org/ftp/gcrypt/libgpg-error/$(libgpg-error_tar) libgpg-error_hash := b32d6ff72a73cf79797f7f2d039e95e9c6f92f0c1450215410840ab62aea9763 -libgpg-error_configure := ./configure \ +libgpg-error_configure := \ $(CROSS_TOOLS) \ + CFLAGS="-Os" \ + ./configure \ --prefix "/" \ --host=x86_64-linux-musl \ --disable-static \ diff --git a/modules/libksba b/modules/libksba index bf88d2da05..c529b2399f 100644 --- a/modules/libksba +++ b/modules/libksba @@ -5,7 +5,9 @@ libksba_tar := libksba-$(libksba_version).tar.bz2 libksba_url := https://gnupg.org/ftp/gcrypt/libksba/$(libksba_tar) libksba_hash := bfe6a8e91ff0f54d8a329514db406667000cb207238eded49b599761bfca41b6 -libksba_configure := ./configure \ +libksba_configure := \ + CFLAGS="-Os" \ + ./configure \ $(CROSS_TOOLS) \ --host x86_64-linux-musl \ --prefix "/" \ diff --git a/modules/libpng b/modules/libpng index e5c3d7184f..8debbda409 100644 --- a/modules/libpng +++ b/modules/libpng @@ -8,6 +8,7 @@ libpng_hash := 574623a4901a9969080ab4a2df9437026c8a87150dfd5c235e28c94b212964a7 libpng_configure := \ $(CROSS_TOOLS) \ + CFLAGS="-Os" \ ./configure \ --host i386-elf-linux \ --prefix="/" \ diff --git a/modules/lvm2 b/modules/lvm2 index e3005f1bd3..f6edd6673d 100644 --- a/modules/lvm2 +++ b/modules/lvm2 @@ -10,6 +10,7 @@ lvm2_hash := 23a3d1cddd41b3ef51812ebf83e9fa491f502fe74130d4263be327a91914660d # so we force it via the configure cache. lvm2_configure := \ $(CROSS_TOOLS) \ + CFLAGS="-Os" \ PKG_CONFIG=/bin/false \ MODPROBE_CMD=/bin/false \ ac_cv_func_malloc_0_nonnull=yes \ diff --git a/modules/pixman b/modules/pixman index 65a2e2008e..e7ec1bd82b 100644 --- a/modules/pixman +++ b/modules/pixman @@ -8,6 +8,7 @@ pixman_hash := 21b6b249b51c6800dc9553b65106e1e37d0e25df942c90531d4c3997aa20a88e pixman_configure := \ $(CROSS_TOOLS) \ + CFLAGS="-Os" \ ./configure \ --host i386-elf-linux \ --prefix="/" \ diff --git a/modules/tpmtotp b/modules/tpmtotp index 433df8ceb4..1ce561d058 100644 --- a/modules/tpmtotp +++ b/modules/tpmtotp @@ -13,7 +13,7 @@ tpmtotp_hash := 1082f2b0e4af833e04220dddedcc21a39eb39ee4dc5668bb010e7bcc795c606c tpmtotp_target := \ $(CROSS_TOOLS) \ - CFLAGS="-I$(INSTALL)/include" \ + CFLAGS="-I$(INSTALL)/include -Os" \ LDFLAGS="-L$(INSTALL)/lib" \ tpmtotp_output := \ diff --git a/modules/util-linux b/modules/util-linux index 908ff3e799..6ea85f8a01 100644 --- a/modules/util-linux +++ b/modules/util-linux @@ -8,6 +8,7 @@ util-linux_hash := accea4d678209f97f634f40a93b7e9fcad5915d1f4749f6c47bee6bf110fe util-linux_configure := ./configure \ $(CROSS_TOOLS) \ + CFLAGS="-Os" \ --host i386-elf-linux \ --prefix "/" \ --oldincludedir "$(INSTALL)/include" \ diff --git a/modules/zlib b/modules/zlib index 89602a0b43..09025cefa4 100644 --- a/modules/zlib +++ b/modules/zlib @@ -9,6 +9,7 @@ zlib_hash := c3e5e9fdd5004dcb542feda5ee4f0ff0744628baf8ed2dd5d66f8ca1197cb1a1 zlib_configure := \ $(CROSS_TOOLS) \ + CFLAGS="-Os" \ ./configure \ --prefix="/" \