-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
46a6e2b
commit 63e29d3
Showing
6 changed files
with
101 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,3 +30,6 @@ | |
*.exe | ||
*.out | ||
*.app | ||
|
||
# VisualCode config | ||
.vscode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
FROM trzeci/emscripten:sdk-tag-1.38.30-64bit | ||
|
||
RUN apt-get update && \ | ||
apt-get install -y libtool && \ | ||
apt-get install -y autotools-dev && \ | ||
apt-get install -y autoconf && \ | ||
apt-get install -y automake |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
export OPTIMIZE="-Os" | ||
export LDFLAGS=${OPTIMIZE} | ||
export CFLAGS=${OPTIMIZE} | ||
export CXXFLAGS=${OPTIMIZE} | ||
|
||
ENTRY_POINT="rnnoise.js" | ||
|
||
echo "=============================================" | ||
echo "Compiling wasm bindings" | ||
echo "=============================================" | ||
( | ||
cd rnnoise | ||
|
||
# Clean possible autotools clutter that might affect the configurations step | ||
git clean -f -d | ||
./autogen.sh | ||
|
||
# For some reason setting the CFLAGS export doesn't apply optimization to all compilation steps | ||
# so we need to explicitly pass it to configure. | ||
emconfigure ./configure CFLAGS=${OPTIMIZE} | ||
emmake make clean | ||
emmake make V=1 | ||
|
||
# Compile librnnoise generated LLVM bytecode to wasm | ||
emcc \ | ||
${OPTIMIZE} \ | ||
-s STRICT=1 \ | ||
-s ALLOW_MEMORY_GROWTH=1 \ | ||
-s MALLOC=emmalloc \ | ||
-s MODULARIZE=1 \ | ||
-s EXPORT_ES6=1 \ | ||
-s EXPORTED_FUNCTIONS="['_rnnoise_process_frame', '_rnnoise_init', '_rnnoise_destroy', '_rnnoise_create', '_malloc', '_free']" \ | ||
.libs/librnnoise.so \ | ||
-o ./$ENTRY_POINT | ||
|
||
# Create output folder | ||
rm -rf ../dist | ||
mkdir -p ../dist | ||
|
||
# Move artifacts | ||
mv $ENTRY_POINT ../dist/index.js | ||
mv rnnoise.wasm ../dist/ | ||
|
||
# Clean cluttter | ||
git clean -f -d | ||
) | ||
echo "=============================================" | ||
echo "Compiling wasm bindings done" | ||
echo "=============================================" |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"name": "rnnoise-wasm", | ||
"description": "Rnnoise sub-module compiled with emscripten as web assembly module", | ||
"version": "0.0.1", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/andrei-gavrilescu/rnnoise-wasm.git" | ||
}, | ||
"main": "./dist/", | ||
"scripts": { | ||
"build:dockerimage": "docker image inspect -f '.' emscripten-autotools || docker build -t emscripten-autotools .", | ||
"build:emscripten": "docker run --rm -v $(pwd):/src emscripten-autotools bash -x ./build.sh", | ||
"build": "npm run build:dockerimage && npm run build:emscripten" | ||
}, | ||
"dependencies": {}, | ||
"devDependencies": {}, | ||
"licenses": [ | ||
{ | ||
"type": "Apache-2.0", | ||
"url": "http://www.apache.org/licenses/LICENSE-2.0" | ||
} | ||
] | ||
} |