-
Notifications
You must be signed in to change notification settings - Fork 36
/
pkg.sh
executable file
·47 lines (38 loc) · 1.18 KB
/
pkg.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
43
44
45
46
47
#!/bin/bash
OS="$(uname -s)"
rm -rf ./pkg
if [ ! -f "build/main.js" ] ; then
echo "No build to package. Run 'npm run build' first."
exit 1
fi
if [ "$OS" == "Linux" ]; then
echo "Building for Linux..."
# linux x64
OUTPUT_DIR=chattervox-linux-x64
pkg --out-path "pkg/${OUTPUT_DIR}" \
--targets node8-linux-x64 . && \
cp node_modules/serialport/build/Release/serialport.node "pkg/${OUTPUT_DIR}"
pushd pkg
tar -zcvf "${OUTPUT_DIR}.tar.gz" "${OUTPUT_DIR}"
popd
# linux x86
OUTPUT_DIR=chattervox-linux-x86
pkg --out-path "pkg/${OUTPUT_DIR}" \
--targets node8-linux-x86 . && \
cp node_modules/serialport/build/Release/serialport.node "pkg/${OUTPUT_DIR}"
pushd pkg
tar -zcvf "${OUTPUT_DIR}.tar.gz" "${OUTPUT_DIR}"
popd
elif [ "$OS" == "Darwin" ]; then
echo "Building for MacOS..."
# MacOS
OUTPUT_DIR=chattervox-macos
pkg --out-path "pkg/${OUTPUT_DIR}" \
--targets node8-macos-x64 . && \
cp node_modules/serialport/build/Release/serialport.node "pkg/${OUTPUT_DIR}"
pushd pkg
tar -zcvf "${OUTPUT_DIR}.tar.gz" "${OUTPUT_DIR}"
popd
else
echo "unsupported OS $OS, exiting."
fi