Retry only for https protocol
[elinks.git] / doc / small.txt
blob9d526e6fed29602878c2ad34ac1248e89672306b
1 Tips to obtain a very small static elinks binary
2 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4 Tips to obtain a very small static elinks binary suitable for mini
5 distributions
7 Remove config.cache (previous CC may be cached):
9         $ rm config.cache
11 Use dietlibc (http://www.fefe.de/dietlibc/) or similar stuff (uClibc, ...):
13         $ export CC='diet -Os gcc'
15 Use compilers flags to optimize for size:
17         $ export CFLAGS='-s -fno-inline -nostdinc -fomit-frame-pointer'
19 Note that if you don't use dietlibc, you definitively want to add `-Os` or
20 `-O2` to `CFLAGS`; GCC 2.95 does not know `-Os`, and some say `-O2` gives
21 smaller executables even for GCC 3.x.
23 [TIP]
24 ===============================================================================
25 If you use these `CFLAGS` on Cygwin and you get unresolved symbols (`htons` and
26 suite in particular), try removing `-fno-inline` parameter.
27 ===============================================================================
29 Disable some compile-time options:
31 ------------------------------------------------------------------------------
32 $ ./configure --disable-ipv6 --disable-backtrace --disable-nls \
33   --enable-fastmem --without-zlib --without-bzlib --disable-xbel \
34   --without-lua --without-gnutls --without-openssl --without-x \
35   --enable-small --without-spidermonkey --without-gpm
36 ------------------------------------------------------------------------------
38 You can disable bookmarks, globhist and more, too, if you want to.
40 [TIP]
41 .Other configure options that can reduce the size
42 ===============================================================================
43  - \--disable-backtrace disables internal backtrace code.
44  - \--disable-nls disables i18n support.
45  - \--enable-fastmem disables internal `malloc()` debugging and use `alloca()`
46    wherever possible.
47  - \--enable-small forces to remove some text descriptions in options and
48    keybind stuff (regain 30Kb).
49 ===============================================================================
51 Dependencies over external libs must be removed using the related configure
52 options:
53 `-----------------------`------------------------------------------------------
54 Option                  Description
55 -------------------------------------------------------------------------------
56 \--without-zlib         removes libz dependency (compression)
57 \--without-bzlib        removes libbz2 dependency (compression)
58 \--disable-xbel         removes expat dependency (XBEL bookmarks support)
59 \--without-lua          removes liblua dependency (Lua scripting)
60 \--without-gnutls       removes libtls dependency (SSL support)
61 \--without-openssl      removes libssl dependency (SSL support)
62 \--without-x            removes libx11 dependency (restoring terminal title)
63 \--without-spidermonkey removes libjs dependency (JavaScript)
64 \--without-gpm          removes libgpm dependency (mouse/console)
65 -------------------------------------------------------------------------------
67 It seems GCC 2.95.x do not generate as small binaries as GCC 3.2.x with same
68 flags.
70 You can use an executable compressor like UPX
71 link:http://upx.sourceforge.net/[].
73 Here are some results using gcc 2.95.3, dietlibc-0.23, and previous flags:
75         me$ ls -l src/elinks
76         -rwxr-xr-x   1 zas      users      495100 Oct 20 15:53 src/elinks
77         me$ upx --best src/elinks
78         me$ ls -l src/elinks
79         -rwxr-xr-x   1 zas      users      217946 Oct 20 15:53 src/elinks
81 Whow ! Around 200kb :)
83 [NOTE]
84 .Details about the `\--enable-small` configure option effects:
85 ==============================================================================
86 - it disables long descriptions of options;
87 - it disables textual descriptions of keybinding options;
88 - it reduces size of some HTTP errors messages;
89 - it disables fastfind feature, reducing performance, but also reducing a lot
90   memory usage, and a bit the executable size.
91 ==============================================================================