1
- all : demo_file_api.js big_file_demo.js
1
+ all : libzim-wasm.dev.js libzim-asm.dev.js libzim-wasm.js libzim-asm.js large_file_access.js
2
+
2
3
build/lib/liblzma.so :
3
- wget -N https://tukaani.org/xz/xz-5.2.4.tar.gz
4
+ # Origin: https://tukaani.org/xz/xz-5.2.4.tar.gz
5
+ [ ! -f xz-* .tar.gz ] && wget -N https://dev.kiwix.org/kiwix-build/xz-5.2.4.tar.gz || true
4
6
tar xf xz-5.2.4.tar.gz
5
7
cd xz-5.2.4 ; ./autogen.sh
6
8
cd xz-5.2.4 ; emconfigure ./configure --prefix=` pwd` /../build
7
9
cd xz-5.2.4 ; emmake make
8
10
cd xz-5.2.4 ; emmake make install
9
11
10
- build/lib/libz.a :
12
+ build/lib/libz.a :
13
+ # Version not yet available in dev.kiwix.org
11
14
wget -N https://zlib.net/zlib-1.2.13.tar.gz
12
15
tar xf zlib-1.2.13.tar.gz
13
16
cd zlib-1.2.13 ; emconfigure ./configure --prefix=`pwd`/../build
14
17
cd zlib-1.2.13 ; emmake make
15
18
cd zlib-1.2.13 ; emmake make install
16
19
17
- build/lib/libzstd.a :
18
- wget -N https://github.com/facebook/zstd/releases/download/v1.4.4/zstd-1.4.4.tar.gz
19
- tar xf zstd-1.4.4.tar.gz
20
- cd zstd-1.4.4/build/meson ; meson setup --cross-file=../../../emscripten-crosscompile.ini -Dbin_programs=false -Dbin_contrib=false -Dzlib=disabled -Dlzma=disabled -Dlz4=disabled --prefix=` pwd` /../../../build --libdir=lib builddir
21
- cd zstd-1.4.4/build/meson/builddir ; ninja
22
- cd zstd-1.4.4/build/meson/builddir ; ninja install
20
+ build/lib/libzstd.a :
21
+ # Origin: https://github.com/facebook/zstd/releases/download/v1.4.4/zstd-1.4.4.tar.gz
22
+ [ ! -f zstd-* .tar.gz ] && wget -N https://dev.kiwix.org/kiwix-build/zstd-1.5.2.tar.gz || true
23
+ tar xf zstd-1.5.2.tar.gz
24
+ cd zstd-1.5.2/build/meson ; meson setup --cross-file=../../../emscripten-crosscompile.ini -Dbin_programs=false -Dbin_contrib=false -Dzlib=disabled -Dlzma=disabled -Dlz4=disabled --prefix=` pwd` /../../../build --libdir=lib builddir
25
+ cd zstd-1.5.2/build/meson/builddir ; ninja
26
+ cd zstd-1.5.2/build/meson/builddir ; ninja install
23
27
24
28
build/lib/libicudata.so :
25
- wget -N https://github.com/unicode-org/icu/releases/download/release-69-1/icu4c-69_1-src.tgz
26
- tar xf icu4c-69_1-src.tgz
29
+ # Version not yet available in dev.kiwix.org
30
+ wget -N https://github.com/unicode-org/icu/releases/download/release-71-1/icu4c-71_1-src.tgz
31
+ tar xf icu4c-71_1-src.tgz
27
32
# It's no use trying to compile examples
28
33
sed -i -e ' s/^SUBDIRS =\(.*\)$$(DATASUBDIR) $$(EXTRA) $$(SAMPLE) $$(TEST)\(.*\)/SUBDIRS =\1\2/' icu/source/Makefile.in
29
34
cd icu/source ; emconfigure ./configure --prefix=` pwd` /../../build
30
35
cd icu/source ; emmake make
31
36
cd icu/source ; emmake make install
32
37
33
38
build/lib/libxapian.a : build/lib/libz.a
34
- wget -N https://oligarchy.co.uk/xapian/1.4.18/xapian-core-1.4.18.tar.xz
39
+ # Origin: https://oligarchy.co.uk/xapian/1.4.18/xapian-core-1.4.18.tar.xz
40
+ [ ! -f xapian-* .tar.gz ] && wget -N https://dev.kiwix.org/kiwix-build/xapian-core-1.4.18.tar.xz || true
35
41
tar xf xapian-core-1.4.18.tar.xz
36
42
# Some options coming from https://github.com/xapian/xapian/tree/master/xapian-core/emscripten
37
- # cd xapian-core-1.4.18; emconfigure ./configure --prefix=`pwd`/../build "CFLAGS=-I`pwd`/../build/include -L`pwd`/../build/lib" "CXXFLAGS=-I`pwd`/../build/include -L`pwd`/../build/lib" CPPFLAGS='-DFLINTLOCK_USE_FLOCK' CXXFLAGS='-Oz -s USE_ZLIB=1 -fno-rtti' --disable-backend-honey --disable-backend-inmemory --disable-shared --disable-backend-remote
43
+ # cd xapian-core-1.4.18; emconfigure ./configure --prefix=`pwd`/../build "CFLAGS=-I`pwd`/../build/include -L`pwd`/../build/lib" "CXXFLAGS=-I`pwd`/../build/include -L`pwd`/../build/lib" CPPFLAGS='-DFLINTLOCK_USE_FLOCK' CXXFLAGS='-Oz -s USE_ZLIB=1 -fno-rtti' --disable-backend-honey --disable-backend-inmemory --disable-shared --disable-backend-remote
38
44
cd xapian-core-1.4.18; emconfigure ./configure --prefix=`pwd`/../build "CFLAGS=-I`pwd`/../build/include -L`pwd`/../build/lib" "CXXFLAGS=-I`pwd`/../build/include -L`pwd`/../build/lib" --disable-shared --disable-backend-remote
39
45
cd xapian-core-1.4.18; emmake make "CFLAGS=-I`pwd`/../build/include -L`pwd`/../build/lib -std=c++11" "CXXFLAGS=-I`pwd`/../build/include -L`pwd`/../build/lib -std=c++11"
40
46
cd xapian-core-1.4.18; emmake make install
41
47
42
48
build/lib/libzim.a : build/lib/liblzma.so build/lib/libz.a build/lib/libzstd.a build/lib/libicudata.so build/lib/libxapian.a
43
- wget -N --content-disposition https://github.com/openzim/libzim/archive/7.2.2.tar.gz
44
- tar xf libzim-7.2.2.tar.gz
49
+ # Origin: wget -N --content-disposition https://github.com/openzim/libzim/archive/7.2.2.tar.gz
50
+ [ ! -f libzim-* .tar.xz ] && wget -N https://download.openzim.org/release/libzim/libzim-8.1.0.tar.xz || true
51
+ tar xf libzim-8.1.0.tar.xz
45
52
# It's no use trying to compile examples
46
- sed -i -e " s/^subdir('examples')//" libzim-7.2.2/meson.build
47
- cd libzim-7.2.2; PKG_CONFIG_PATH=/src/build/lib/pkgconfig meson --prefix=` pwd` /../build --cross-file=../emscripten-crosscompile.ini . build -DUSE_MMAP=false
48
- cd libzim-7.2.2; ninja -C build
49
- cd libzim-7.2.2; ninja -C build install
53
+ sed -i -e " s/^subdir('examples')//" libzim-8.1.0/meson.build
54
+ cd libzim-8.1.0; PKG_CONFIG_PATH=/src/build/lib/pkgconfig meson --prefix=` pwd` /../build --cross-file=../emscripten-crosscompile.ini . build -DUSE_MMAP=false
55
+ cd libzim-8.1.0; ninja -C build
56
+ cd libzim-8.1.0; ninja -C build install
57
+
58
+ # Development WASM version for testing, completely unoptimized
59
+ libzim-wasm.dev.js : build/lib/libzim.a libzim_bindings.cpp prejs_file_api.js postjs_file_api.js
60
+ em++ -o libzim-wasm.dev.js --bind libzim_bindings.cpp -I/src/build/include -L/src/build/lib -lzim -llzma -lzstd -lxapian -lz -licui18n -licuuc -licudata -lpthread -lm -fdiagnostics-color=always -pipe -Wall -Winvalid-pch -Wnon-virtual-dtor -Werror -std=c++11 -O0 -g --pre-js prejs_file_api.js --post-js postjs_file_api.js -s WASM=1 -s DISABLE_EXCEPTION_CATCHING=0 -s " EXPORTED_RUNTIME_METHODS=['ALLOC_NORMAL','printErr','ALLOC_STACK','print']" -s DEMANGLE_SUPPORT=1 -s INITIAL_MEMORY=83886080 -s ALLOW_MEMORY_GROWTH=1 -lworkerfs.js
61
+ cp libzim-wasm.dev.* tests/prototype/
62
+
63
+ # Development ASM version for testing, completely unoptimized
64
+ libzim-asm.dev.js : build/lib/libzim.a libzim_bindings.cpp prejs_file_api.js postjs_file_api.js
65
+ em++ -o libzim-asm.dev.js --bind libzim_bindings.cpp -I/src/build/include -L/src/build/lib -lzim -llzma -lzstd -lxapian -lz -licui18n -licuuc -licudata -lpthread -lm -fdiagnostics-color=always -pipe -Wall -Winvalid-pch -Wnon-virtual-dtor -Werror -std=c++11 -O0 -g --pre-js prejs_file_api.js --post-js postjs_file_api.js -s WASM=0 --memory-init-file 0 -s DISABLE_EXCEPTION_CATCHING=0 -s " EXPORTED_RUNTIME_METHODS=['ALLOC_NORMAL','printErr','ALLOC_STACK','print']" -s DEMANGLE_SUPPORT=1 -s INITIAL_MEMORY=83886080 -s ALLOW_MEMORY_GROWTH=1 -lworkerfs.js
66
+
67
+ # Production WASM version, optimized and packed
68
+ libzim-wasm.js : build/lib/libzim.a libzim_bindings.cpp prejs_file_api.js postjs_file_api.js
69
+ em++ -o libzim-wasm.js --bind libzim_bindings.cpp -I/src/build/include -L/src/build/lib -lzim -llzma -lzstd -lxapian -lz -licui18n -licuuc -licudata -O3 --pre-js prejs_file_api.js --post-js postjs_file_api.js -s WASM=1 -s " EXPORTED_RUNTIME_METHODS=['ALLOC_NORMAL','printErr','ALLOC_STACK','print']" -s INITIAL_MEMORY=83886080 -s ALLOW_MEMORY_GROWTH=1 -lworkerfs.js
50
70
51
- demo_file_api.js : build/lib/libzim.a demo_file_api.cpp prejs_file_api.js postjs_file_api.js
52
- em++ --bind demo_file_api.cpp -I/src/build/include -L/src/build/lib -lzim -llzma -lzstd -lxapian -lz -licui18n -licuuc -licudata -lpthread -lm -fdiagnostics-color=always -pipe -Wall -Winvalid-pch -Wnon-virtual-dtor -Werror -std=c++11 -O0 -g --pre-js prejs_file_api.js --post-js postjs_file_api.js -s DISABLE_EXCEPTION_CATCHING=0 -s " EXPORTED_RUNTIME_METHODS=['ALLOC_NORMAL','printErr','ALLOC_STACK','print']" -s DEMANGLE_SUPPORT=1 -s TOTAL_MEMORY=83886080 -s ALLOW_MEMORY_GROWTH=1 -lworkerfs.js
71
+ # Production ASM version, optimized and packed
72
+ libzim-asm.js : build/lib/libzim.a libzim_bindings.cpp prejs_file_api.js postjs_file_api.js
73
+ em++ -o libzim-asm.js --bind libzim_bindings.cpp -I/src/build/include -L/src/build/lib -lzim -llzma -lzstd -lxapian -lz -licui18n -licuuc -licudata -O3 --pre-js prejs_file_api.js --post-js postjs_file_api.js -s WASM=0 --memory-init-file 0 -s MIN_EDGE_VERSION=40 -s " EXPORTED_RUNTIME_METHODS=['ALLOC_NORMAL','printErr','ALLOC_STACK','print']" -s INITIAL_MEMORY=83886080 -s ALLOW_MEMORY_GROWTH=1 -lworkerfs.js
53
74
54
- big_file_demo.js :
55
- em++ --bind -std=c++11 -O0 --pre-js prejs_file_api_testbigfile.js --post-js postjs_file_api_testbigfile.js big_file_test.cpp -lworkerfs.js -o bigfile.js
75
+ # Test case: for testing large files
76
+ large_file_access.js : test_file_bindings.cpp prejs_test_file_access.js postjs_test_file_access.js
77
+ em++ -o large_file_access.js --bind test_file_bindings.cpp -std=c++11 -O0 --pre-js prejs_test_file_access.js --post-js postjs_test_file_access.js -lworkerfs.js
78
+ cp large_file_access.* tests/test_large_file_access/
56
79
57
80
clean :
58
81
rm -rf xz-*
@@ -62,6 +85,5 @@ clean :
62
85
rm -rf icu*
63
86
rm -rf libzim-*
64
87
rm -rf build
65
- rm a.out.*
66
88
67
89
.PHONY : all clean
0 commit comments