Automatically disable FEATURE_COMPRESS_USAGE for small builds.
authorDenys Vlasenko <vda.linux@googlemail.com>
Fri, 6 Jan 2017 18:16:36 +0000 (19:16 +0100)
committerDenys Vlasenko <vda.linux@googlemail.com>
Fri, 6 Jan 2017 18:16:36 +0000 (19:16 +0100)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
applets/usage_compressed
libbb/appletlib.c

index 186fcde774f36b6efbf7f8f065100a136b655e93..36fc2a007218e7684657e7d68042bef41bc9c686 100755 (executable)
@@ -36,6 +36,9 @@ echo ''
 #0000040 114 105 135 040 133 055 141 040 101 103 124 111 117 116 106 111
 #         042514 020135 026533 020141 041501 044524 047117 044506
 
+echo "#define UNPACKED_USAGE_LENGTH `$loc/usage | wc -c`"
+echo
+
 echo '#define PACKED_USAGE \'
 ## Breaks on big-endian systems!
 ## # Extra effort to avoid using "od -t x1": -t is not available
index 805cd3ae69d0a9a15dcef5477a4009b2b868879a..bf6d4762cb1dbacc4e70504056a887ba222e265b 100644 (file)
 
 #include "usage_compressed.h"
 
+
+/* "Do not compress usage text if uncompressed text is small
+ *  and we don't include bunzip2 code for other reasons"
+ *
+ * Useful for mass one-applet rebuild (bunzip2 code is ~2.7k).
+ *
+ * Unlike BUNZIP2, if FEATURE_SEAMLESS_BZ2 is on, bunzip2 code is built but
+ * still may be unused if none of the selected applets calls open_zipped()
+ * or its friends; we test for (FEATURE_SEAMLESS_BZ2 && <APPLET>) instead.
+ * For example, only if TAR and FEATURE_SEAMLESS_BZ2 are both selected,
+ * then bunzip2 code will be linked in anyway, and disabling help compression
+ * would be not optimal:
+ */
+#if UNPACKED_USAGE_LENGTH < 4*1024 \
+ && !(ENABLE_FEATURE_SEAMLESS_BZ2 && ENABLE_TAR) \
+ && !(ENABLE_FEATURE_SEAMLESS_BZ2 && ENABLE_MODPROBE) \
+ && !(ENABLE_FEATURE_SEAMLESS_BZ2 && ENABLE_INSMOD) \
+ && !(ENABLE_FEATURE_SEAMLESS_BZ2 && ENABLE_DEPMOD) \
+ && !(ENABLE_FEATURE_SEAMLESS_BZ2 && ENABLE_MAN) \
+ && !ENABLE_BUNZIP2 \
+ && !ENABLE_BZCAT
+# undef  ENABLE_FEATURE_COMPRESS_USAGE
+# define ENABLE_FEATURE_COMPRESS_USAGE 0
+#endif
+
+
 #if ENABLE_SHOW_USAGE && !ENABLE_FEATURE_COMPRESS_USAGE
 static const char usage_messages[] ALIGN1 = UNPACKED_USAGE;
 #else