aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKonstantin Demin <rockdrilla@gmail.com>2019-03-25 21:41:27 +0300
committerHans Dedecker <dedeckeh@gmail.com>2019-03-25 22:25:33 +0100
commitddf1a063261202e92caf58f18a1afa0085de9b8d (patch)
tree4f71c1fe0cccf540a42550e677305bd68711dabc
parent9c3bfd0906398e9f508c4207bfb16b697e2f47be (diff)
downloadupstream-ddf1a063261202e92caf58f18a1afa0085de9b8d.tar.gz
upstream-ddf1a063261202e92caf58f18a1afa0085de9b8d.tar.bz2
upstream-ddf1a063261202e92caf58f18a1afa0085de9b8d.zip
dropbear: honour CFLAGS while building bundled libtomcrypt/libtommath
Felix Fietkau pointed out that bundled libtomcrypt/libtommath do funny stuff with CFLAGS. fix this with checking environment variable OPENWRT_BUILD in both libs. change in dropbear binary size is drastical: 221621 -> 164277. Signed-off-by: Konstantin Demin <rockdrilla@gmail.com>
-rw-r--r--package/network/services/dropbear/patches/901-bundled-libs-cflags.patch48
1 files changed, 48 insertions, 0 deletions
diff --git a/package/network/services/dropbear/patches/901-bundled-libs-cflags.patch b/package/network/services/dropbear/patches/901-bundled-libs-cflags.patch
new file mode 100644
index 0000000000..033aee3a06
--- /dev/null
+++ b/package/network/services/dropbear/patches/901-bundled-libs-cflags.patch
@@ -0,0 +1,48 @@
+--- a/libtomcrypt/makefile_include.mk
++++ b/libtomcrypt/makefile_include.mk
+@@ -75,6 +75,13 @@ endif
+
+ LTC_CFLAGS += -Wno-type-limits
+
++ifdef OPENWRT_BUILD
++ ifeq (-Os,$(filter -Os,$(CFLAGS)))
++ LTC_CFLAGS += -DLTC_SMALL_CODE
++ endif
++else
++ ### ! OPENWRT_BUILD
++
+ ifdef LTC_DEBUG
+ $(info Debug build)
+ # compile for DEBUGGING (required for ccmalloc checking!!!)
+@@ -102,6 +109,9 @@ endif
+ endif # COMPILE_SMALL
+ endif # COMPILE_DEBUG
+
++ ### ! OPENWRT_BUILD
++endif
++
+
+ ifneq ($(findstring clang,$(CC)),)
+ LTC_CFLAGS += -Wno-typedef-redefinition -Wno-tautological-compare -Wno-builtin-requires-header -Wno-missing-field-initializers
+--- a/libtommath/makefile_include.mk
++++ b/libtommath/makefile_include.mk
+@@ -37,6 +37,9 @@ CFLAGS += -Wsystem-headers -Wdeclaration
+ CFLAGS += -Wstrict-prototypes -Wpointer-arith
+ endif
+
++ifndef OPENWRT_BUILD
++ ### ! OPENWRT_BUILD
++
+ ifdef COMPILE_DEBUG
+ #debug
+ CFLAGS += -g3
+@@ -58,6 +61,9 @@ endif
+ endif # COMPILE_SIZE
+ endif # COMPILE_DEBUG
+
++ ### ! OPENWRT_BUILD
++endif
++
+ ifneq ($(findstring clang,$(CC)),)
+ CFLAGS += -Wno-typedef-redefinition -Wno-tautological-compare -Wno-builtin-requires-header
+ endif