forked from coolwanglu/vim.js
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.sh
executable file
·153 lines (126 loc) · 2.88 KB
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
#!/bin/bash
export CPPFLAGS="-DFEAT_GUI_WEB"
export CPP="gcc -E "
export CFLAGS="-g -Wall -Wmissing-prototypes -Oz \
-s LINKABLE=1 s EXPORT_ALL=1 \
-s EXPORTED_FUNCTIONS=['_main_','_input_available','_gui_web_handle_key','_gui_send_mouse_event','_gui_mouse_move'] \
"
VIMDIR="/vim"
do_proto(){
emmake make proto
}
do_config() {
echo config
emconfigure ./configure \
--enable-gui=web \
--prefix=$VIMDIR \
--with-features=normal \
--disable-selinux \
--disable-xsmp \
--disable-xsmp-interact \
--disable-luainterp \
--disable-mzschemeinterp \
--disable-perlinterp \
--disable-pythoninterp \
--disable-python3interp \
--disable-tclinterp \
--disable-rubyinterp \
--disable-cscope \
--disable-workshop \
--disable-netbeans \
--disable-multibyte \
--disable-hangulinput \
--disable-xim \
--disable-fontset \
--disable-gtk2-check \
--disable-gnome-check \
--disable-motif-check \
--disable-athena-check \
--disable-nextaw-check \
--disable-carbon-check \
--disable-gtktest \
--disable-largefile \
--disable-acl \
--disable-gpm \
--disable-sysmouse \
--disable-nls \
--with-local-dir="/" \
--disable-smack \
--disable-channel \
--with-compiledby="Tinmarino"
}
do_make() {
emmake make VIMRUNTIMEDIR=$VIMDIR
}
do_link() {
pushd web
cp ../src/vim vim.bc
emcc \
--js-library vim_lib.js \
-Oz \
--closure 0 \
-s EMTERPRETIFY=1 \
-s EMTERPRETIFY_ASYNC=1 \
-s 'EMTERPRETIFY_FILE="vimjs.dat"' \
--memory-init-file 1 \
-v \
vim.bc \
-o vim.js
popd
}
#-s 'EMTERPRETIFY_FILE="vim.js.mem"' \
#-s 'EMTERPRETIFY_FILE="vimjs.dat"' \
#-s EXPORTED_FUNCTIONS="['_main','_input_available','_gui_web_handle_key','_gui_send_mouse_event','_gui_mouse_move']" \
#-s EMTERPRETIFY_FILE=\"vim_bytecode.bin\" \
#--prefix="."
#emcc vim.bc \
# -o vim.js \
# -Oz \
# --js-library vim_lib.js \
# --embed-file usr \
export JOB_COUNT=10
do_transform1() {
pushd web
mv vim.js vim-1.js
# vim-2._js is counted as a job
echo "Transfoming..."
node transform.js vim-1.js vim-2 $JOB_COUNT
popd
}
do_transform2() {
pushd web
echo "Compiling with streamline.js... $JOB_COUNT"
_node -c vim-2._js
for ((i=0; i < JOB_COUNT; i++))
do
echo "Compiling number: $i"
_node -c vim-2.$i._js &
done
wait
popd
}
do_transform3() {
pushd web
for ((i=0; i < JOB_COUNT; i++))
do
cat vim-2.$i.js >> vim-2.js
done
popd
}
do_compress() {
pushd web
echo "Optimizing with closure compiler"
export EM_DIR="/home2/tourneboeuf/Software/Js/EmSdk/emscripten/1.37.22"
#--compilation_level ADVANCED_OPTIMIZATIONS \
java -Xmx2048m \
-jar $EM_DIR/third_party/closure-compiler/compiler.jar \
--language_in ECMASCRIPT5 \
--js vim-2.js\
--js_output_file vim.js \
popd
}
do_copy() {
cp web/vim.js NW.js/
cp web/vim.js.mem NW.js/
}
# vim: expandtab: