generated from vivid-lapin/ts
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathsetup_wcjs.sh
executable file
·42 lines (40 loc) · 1.7 KB
/
setup_wcjs.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
set -eu
export ELECTRON_VER="$(yarn run --silent electron --version | sed -e "s/v//")"
export BUILD_DIR="./build/Release"
export npm_config_wcjs_runtime=electron
export npm_config_wcjs_runtime_version=$ELECTRON_VER
npm_config_wcjs_arch=${npm_config_wcjs_arch:-}
if [[ -z "${npm_config_wcjs_arch}" ]]; then
export npm_config_wcjs_arch="$(arch | sed -e "s/i386/x64/")"
fi
export ELECTRON_MIRROR="https://artifacts.electronjs.org/headers/dist"
export OS_NAME="$(uname)"
cd node_modules/webchimera.js
function finally {
echo "Cleanup"
rm -rf node_modules build deps/VLC.app yarn.lock .yarn
}
trap finally EXIT
finally
if [ "$OS_NAME" = "Darwin" ]; then
if [ -d "../../VLC.app" ]; then
echo "Using ./VLC.app"
cp -Ra ../../VLC.app ./deps;
else
echo "Using /Application/VLC.app"
cp -Ra /Applications/VLC.app ./deps;
fi
fi
export WCJS_ARCHIVE=WebChimera.js_${npm_config_wcjs_runtime}_${npm_config_wcjs_runtime_version}_${npm_config_wcjs_arch}_${OS_NAME}.zip
export WCJS_ARCHIVE_PATH=$BUILD_DIR/$WCJS_ARCHIVE
export WCJS_FULL_ARCHIVE=WebChimera.js_${npm_config_wcjs_runtime}_v${npm_config_wcjs_runtime_version}_VLC_${npm_config_wcjs_arch}_${OS_NAME}.tar.gz
if [ "$OS_NAME" = "Darwin" ]; then export WCJS_FULL_ARCHIVE_PATH=$BUILD_DIR/$WCJS_FULL_ARCHIVE; else export WCJS_FULL_ARCHIVE_PATH=$WCJS_ARCHIVE_PATH; fi
echo 'nodeLinker: node-modules' > .yarnrc.yml
echo '' > yarn.lock
rm -rf deps/libvlc_wrapper
git clone --depth 1 --recursive https://github.com/RSATom/ya-libvlc-wrapper.git deps/libvlc_wrapper
YARN_ENABLE_IMMUTABLE_INSTALLS=false yarn install
node rebuild.js
file ./build/Release/WebChimera.js.node
mv ./build/Release/WebChimera.js.node .
echo "module.exports = require('./WebChimera.js.node')" > index.js