Chrome port, with docker build instructions
diff --git a/README.chrome b/README.chrome
new file mode 100644
index 0000000..8263bde
--- /dev/null
+++ b/README.chrome
@@ -0,0 +1,38 @@
+Instructions for building the Chrome Extension port of Espeak NG,
+used on Chrome OS.
+
+You can either install emscripten locally, or use docker. I found
+it easier to use this docker image:
+ https://github.com/apiaryio/emscripten-docker
+
+These instructions are only slightly different than emscripten/README.md.
+The main difference is running autoreconf -fvi before autogen.sh,
+because otherwise autogen.sh will make symlinks to some GNU autotools
+files that won't be available to the docker image.
+
+# Build espeak normally first
+autoreconf -fvi
+./autogen.sh
+./configure --prefix=/usr --without-async --without-mbrola --without-sonic
+make
+
+# Build emscripten version of ucd-tools
+cd src/ucd-tools
+autoreconf -fvi
+./autogen.sh
+cd ../..
+bash
+docker run --rm -v $(pwd):/src -ti apiaryio/emcc /bin/bash
+ cd src/ucd-tools
+ emconfigure ./configure
+ emmake make
+
+# Build emscripten version of espeak-ng
+autoreconf -fvi
+./autogen.sh
+
+docker run --rm -v $(pwd):/src -ti apiaryio/emcc /bin/bash
+ emconfigure ./configure --prefix=/usr --without-async --without-mbrola --without-sonic
+ emmake make src/libespeak-ng.la
+ cd emscripten
+ emmake make
diff --git a/emscripten/Makefile b/emscripten/Makefile
index 3db5f6a..0e458b9 100644
--- a/emscripten/Makefile
+++ b/emscripten/Makefile
@@ -47,14 +47,8 @@
EM_WEBIDL_BINDER=python $(EMSCRIPTEN)/tools/webidl_binder.py
EM_FILE_PACKAGER=python $(EMSCRIPTEN)/tools/file_packager.py
-# NOTE: libespeak-ng.so (Linux) or libespeak-ng.dylib (macOS) compiled to LLVM IR code
-EM_LIBESPEAKNG_SO=$(wildcard ../src/.libs/libespeak-ng.so)
-EM_LIBESPEAKNG_DYLIB=$(wildcard ../src/.libs/libespeak-ng.dylib)
-ifneq ($(EM_LIBESPEAKNG_DYLIB),)
- EM_LIBESPEAKNG=$(EM_LIBESPEAKNG_DYLIB)
-else ifneq ($(EM_LIBESPEAKNG_SO),)
- EM_LIBESPEAKNG=$(EM_LIBESPEAKNG_SO)
-endif
+# NOTE: libespeak-ng.a (static library) compiled to LLVM IR code
+EM_LIBESPEAKNG=../src/.libs/libespeak-ng.a
# NOTE: glue code files
EM_GLUE_PREFIX=glue
@@ -100,7 +94,7 @@
#CXXFLAGS+=-s USE_PTHREADS=1
# NOTE: extra flags for emscripten
-EM_CXXFLAGS=-s RESERVED_FUNCTION_POINTERS=2 --memory-init-file 0
+EM_CXXFLAGS=-s RESERVED_FUNCTION_POINTERS=2 --memory-init-file 0 -s FORCE_FILESYSTEM=1 -s WASM=1
diff --git a/emscripten/post.js b/emscripten/post.js
index f5e13bc..045f38c 100644
--- a/emscripten/post.js
+++ b/emscripten/post.js
@@ -88,9 +88,9 @@
return aCallback(data, events) ? 1 : 0;
}
- var fp = Runtime.addFunction(cb);
+ var fp = addFunction(cb);
this.synth_(aText, fp);
- Runtime.removeFunction(fp);
+ removeFunction(fp);
};
eSpeakNGWorker.prototype.synthesize_ipa = function (aText, aCallback) {