Updated the build scripts for the new rust audio library
parent
1c50051a4a
commit
c405eeee41
|
@ -4,12 +4,7 @@ language: node_js
|
||||||
node_js:
|
node_js:
|
||||||
- "12"
|
- "12"
|
||||||
|
|
||||||
services:
|
|
||||||
- docker
|
|
||||||
|
|
||||||
before_install:
|
before_install:
|
||||||
# If ever run on windows make sure you don't run this in the git bash!
|
|
||||||
- docker run -dit --name emscripten -v "$(pwd)":"/src/" trzeci/emscripten:sdk-incoming-64bit bash
|
|
||||||
- chmod +x ./scripts/travis/build.sh
|
- chmod +x ./scripts/travis/build.sh
|
||||||
- chmod +x ./scripts/travis/deploy_server.sh
|
- chmod +x ./scripts/travis/deploy_server.sh
|
||||||
- chmod +x ./scripts/travis/deploy_github.sh
|
- chmod +x ./scripts/travis/deploy_github.sh
|
||||||
|
|
|
@ -0,0 +1,84 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
install_sys_deps() {
|
||||||
|
# shellcheck disable=SC2207
|
||||||
|
curl_version=($(curl --version 2>/dev/null))
|
||||||
|
|
||||||
|
# shellcheck disable=SC2181
|
||||||
|
if [[ $? -ne 0 ]]; then
|
||||||
|
echo "> Missing curl. Please install it."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "> Found curl ${curl_version[1]}"
|
||||||
|
}
|
||||||
|
|
||||||
|
install_node() {
|
||||||
|
node_version=$(node --version 2>/dev/null)
|
||||||
|
# shellcheck disable=SC2181
|
||||||
|
if [[ $? -ne 0 ]]; then
|
||||||
|
echo "> Missing node. We can't currently install it automatically."
|
||||||
|
echo "> Please download the latest version here: https://nodejs.org/en/download/"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
echo "> Found node $node_version"
|
||||||
|
fi
|
||||||
|
|
||||||
|
npm_version=$(npm --version 2>/dev/null)
|
||||||
|
# shellcheck disable=SC2181
|
||||||
|
if [[ $? -ne 0 ]]; then
|
||||||
|
echo "> Missing npm. Please ensure you've correctly installed node."
|
||||||
|
echo "> You may need to add npm manually to your PATH variable."
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
echo "> Found npm $npm_version"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
install_rust() {
|
||||||
|
rustup_version=$(rustup --version 2>/dev/null)
|
||||||
|
if [[ $? -ne 0 ]]; then
|
||||||
|
echo "> Missing rustup, installing..."
|
||||||
|
curl https://build.travis-ci.org/files/rustup-init.sh -sSf | sh -s -- -y --default-toolchain nightly --default-host wasm32-unknown-unknown
|
||||||
|
# shellcheck disable=SC2181
|
||||||
|
[[ $? -ne 0 ]] && {
|
||||||
|
echo "> Failed to install rustup"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
rustup_version=$(rustup --version 2>/dev/null)
|
||||||
|
echo "> Installed $rustup_version"
|
||||||
|
else
|
||||||
|
echo "> Found $rustup_version"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "> Installing/updating the wasm32-unknown-unknown host"
|
||||||
|
rustup target add wasm32-unknown-unknown
|
||||||
|
if [[ $? -ne 0 ]]; then
|
||||||
|
echo "> Failed to install/updating the wasm target"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
install_wasmpack() {
|
||||||
|
wasmpack_version=$(wasm-pack --version 2>/dev/null)
|
||||||
|
if [[ $? -ne 0 ]]; then
|
||||||
|
echo "> Missing wasm-pack, installing..."
|
||||||
|
curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
|
||||||
|
|
||||||
|
# shellcheck disable=SC2181
|
||||||
|
[[ $? -ne 0 ]] && {
|
||||||
|
echo "> Failed to install wasm-pack"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
wasmpack_version=$(wasm-pack --version 2>/dev/null)
|
||||||
|
echo "> Installed $wasmpack_version"
|
||||||
|
else
|
||||||
|
echo "> Found $wasmpack_version"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
install_sys_deps
|
||||||
|
install_node
|
||||||
|
install_rust
|
||||||
|
install_wasmpack
|
|
@ -148,22 +148,13 @@ if [[ -e "$LOG_FILE" ]]; then
|
||||||
rm "$LOG_FILE"
|
rm "$LOG_FILE"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
chmod +x ./web/native-codec/build.sh
|
echo "---------- Setup ----------"
|
||||||
if hash emcmake 2>/dev/null; then
|
chmod +x ./scripts/install_dependencies.sh
|
||||||
hash cmake 2>/dev/null || { echo "Missing cmake. Please install cmake before retrying. (apt-get install cmake)"; exit 1; }
|
execute \
|
||||||
hash make 2>/dev/null || { echo "Missing make. Please install build-essential before retrying. (apt-get install build-essential)"; exit 1; }
|
"Installing dependencies" \
|
||||||
|
"Failed to install required dependencies" \
|
||||||
|
"./scripts/install_dependencies.sh"
|
||||||
|
|
||||||
echo "Found installation of emcmake locally. Don't use docker in order to build the native parts."
|
|
||||||
execute \
|
|
||||||
"Building native codes" \
|
|
||||||
"Failed to build native opus codec" \
|
|
||||||
"./web/native-codec/build.sh"
|
|
||||||
else
|
|
||||||
execute \
|
|
||||||
"Building native codes" \
|
|
||||||
"Failed to build native opus codec" \
|
|
||||||
"docker exec -it emscripten bash -c 'web/native-codec/build.sh'"
|
|
||||||
fi
|
|
||||||
echo "---------- Web client ----------"
|
echo "---------- Web client ----------"
|
||||||
|
|
||||||
function move_target_file() {
|
function move_target_file() {
|
||||||
|
|
Loading…
Reference in New Issue