forked from skycoin/skycoin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-electron-release.sh
executable file
·131 lines (108 loc) · 3.23 KB
/
build-electron-release.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
#!/usr/bin/env bash
set -e -o pipefail
# Builds an entire electron-based GUI for release
# Implemented architectures:
# darwin/amd64
# windows/amd64
# windows/386
# linux/amd64
#
# By default builds all architectures.
# A single arch can be built by specifying it using gox's arch names
if [ -n "$1" ]; then
GOX_OSARCH="$1"
fi
. build-conf.sh "$GOX_OSARCH"
SKIP_COMPILATION=${SKIP_COMPILATION:-0}
WITH_BUILDER=$2
WITH_BUILDER=${WITH_BUILDER:-1}
SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
pushd "$SCRIPTDIR" >/dev/null
if [ $SKIP_COMPILATION -ne 1 ]; then
./gox.sh "$GOX_OSARCH" "$GOX_OUTPUT" "$WITH_BUILDER"
fi
if [ -e "$ELN_OUTPUT" ]; then
rm -r "$ELN_OUTPUT"
fi
if [ "$WITH_BUILDER" = "1" ]; then
if [ ! -z "$WIN64_ELN" ] && [ ! -z "$WIN32_ELN" ]; then
npm run dist-win
elif [ ! -z "$WIN64_ELN" ]; then
npm run dist-win64
elif [ ! -z "$WIN32_ELN" ]; then
npm run dist-win32
fi
if [ ! -z "$LNX64_ELN" ]; then
npm run dist-linux
fi
if [ ! -z "$OSX64_ELN" ]; then
if [[ "$OSTYPE" == "darwin"* ]]; then
npm run dist-mac
elif [[ "$OSTYPE" == "linux"* ]]; then
npm run pack-mac
else
echo "Can not run build script in $OSTYPE"
fi
fi
pushd "$FINAL_OUTPUT" >/dev/null
if [ -e "mac" ]; then
pushd "mac" >/dev/null
if [ -e "${PDT_NAME}-${APP_VERSION}.dmg" ]; then
mv "${PDT_NAME}-${APP_VERSION}.dmg" "../${PKG_NAME}-${APP_VERSION}-gui-osx-x64.dmg"
elif [ -e "${PDT_NAME}.app" ]; then
if [[ "$OSTYPE" == "darwin"* ]]; then
tar czf "../${PKG_NAME}-${APP_VERSION}-gui-osx-x64.zip" "${PDT_NAME}.app"
elif [[ "$OSTYPE" == "linux"* ]]; then
tar czf "../${PKG_NAME}-${APP_VERSION}-gui-osx-x64.zip" --owner=0 --group=0 "${PDT_NAME}.app"
fi
fi
popd >/dev/null
rm -rf "mac"
fi
IMG="${PKG_NAME}-${APP_VERSION}-x86_64.AppImage"
DEST_IMG="${PKG_NAME}-${APP_VERSION}-gui-linux-x64.AppImage"
if [ -e $IMG ]; then
mv "$IMG" "$DEST_IMG"
chmod +x "$DEST_IMG"
fi
EXE="${PDT_NAME} Setup ${APP_VERSION}.exe"
if [ -e "$EXE" ]; then
mv "$EXE" "${PKG_NAME}-${APP_VERSION}-gui-win-setup.exe"
fi
# clean unpacked folders
rm -rf *-unpacked
popd >/dev/null
else
GULP_PLATFORM=""
if [ -n "$1" ]; then
case "$1" in
"linux/amd64")
GULP_PLATFORM="linux-x64"
;;
"linux/arm")
GULP_PLATFORM="linux-arm"
;;
"windows/amd64")
GULP_PLATFORM="win32-x64"
;;
"windows/386")
GULP_PLATFORM="win32-ia32"
;;
"darwin/amd64")
GULP_PLATFORM="darwin-x64"
;;
esac
fi
if [ -n "$GULP_PLATFORM" ]; then
gulp electron --platform "$GULP_PLATFORM"
else
gulp electron
fi
echo "--------------------------"
echo "Packaging electron release"
./package-electron-release.sh $GOX_OSARCH
echo "----------------------------"
echo "Compressing electron release"
./compress-electron-release.sh $GOX_OSARCH
fi
popd >/dev/null