Skip to content
This repository was archived by the owner on Dec 9, 2018. It is now read-only.

Commit 409570f

Browse files
committed
consistently use -Oz -O3 optimization across all stages of compilation: configure, make and link. this reduces vim.js from 44MB to 37MB (with multibyte).
1 parent e0c84ae commit 409570f

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

build.sh

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,14 @@
22
set -e
33
[ -z "$EM_DIR" ] && EM_DIR=~/src/emscripten
44

5+
OPTZ="-Oz -O3"
6+
57
do_config() {
68
echo config
79
# something wrong with emcc + cproto, use gcc as CPP instead
8-
CPPFLAGS="-Os -DFEAT_GUI_WEB" \
9-
CPP="gcc -E" \
10+
CPPFLAGS="$OPTZ -DFEAT_GUI_WEB" \
11+
CFLAGS="$OPTZ" \
12+
CPP="emcc -E" \
1013
$EM_DIR/emconfigure ./configure \
1114
--enable-gui=web \
1215
--with-features=small \
@@ -46,7 +49,7 @@ $EM_DIR/emconfigure ./configure \
4649
}
4750

4851
do_make() {
49-
$EM_DIR/emmake make -j8
52+
$EM_DIR/emmake make CFLAGS="$OPTZ" -j8
5053
}
5154

5255
do_link() {
@@ -58,7 +61,7 @@ cat vim_lib.js | sed -e "1 s/\(foldmethod\|foldmarker\)[^ ]\+//g" > usr/local/sh
5861
# Use vim.js as filename to generate vim.js.mem
5962
$EM_DIR/emcc vim.bc \
6063
-o vim.js \
61-
-Oz \
64+
$OPTZ \
6265
--memory-init-file 1 \
6366
--js-library vim_lib.js \
6467
-s ASYNCIFY=1 \

0 commit comments

Comments
 (0)