-
Notifications
You must be signed in to change notification settings - Fork 37
Expand file tree
/
Copy pathdist.sh
More file actions
executable file
·51 lines (46 loc) · 1.88 KB
/
Copy pathdist.sh
File metadata and controls
executable file
·51 lines (46 loc) · 1.88 KB
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
#!/bin/bash
set -e
. build.sh
app_name=$(node -e "console.log($(cat package.json).name)")
nw_version=0.12.3 # https://github.com/nwjs/nw.js/wiki/Downloads-of-old-versions
ulimit -n $(ulimit -Hn) # bump open file limit to its hard limit, OSX build requires a lot of them
desktop_app() {
echo "building desktop app for $@"
node <<.
new (require('nw-builder'))({files:'build/nw/**',version:'$nw_version',platforms:'$@'.split(' ')})
.build().catch(function(e){console.error(e);process.exit(1)})
.
}
desktop_app ${@:-win osx linux}
# workaround for https://github.com/mllrsohn/grunt-node-webkit-builder/issues/125
# Replace icons on OS X & Windows
for bits in 32 64; do
d=build/$app_name/osx$bits/${app_name}.app/Contents/Resources
if [ -d $d ]; then cp -v style/DyalogUnicode.icns $d/nw.icns; fi
if which wine >/dev/null; then
w=build/$app_name/win$bits/${app_name}.exe
if [ -s $w ]; then
echo "replacing ${bits}-bit Windows icon"; wine node_modules/rcedit/bin/rcedit.exe $w --set-icon ./favicon.ico
fi
else
echo 'please install wine to set windows icons'
fi
done
for bits in 32 64; do
d=cache/$nw_version/linux$bits
if [ -d $d -a ! -e $d/ok ]; then # if d is a directory that doesn't have an "ok" file in it
echo "fixing nw-builder's cache"; chmod a-x $d/icudtl.dat $d/nw.pak; touch $d/ok
echo 'must rebuild the app...'; desktop_app linux$bits
fi
done
echo 'removing libffmpegsumo from build'; find build/$app_name -name '*ffmpegsumo*' -delete
echo 'fixing file permissions'; chmod -R g+w build/$app_name
find build/$app_name -perm /111 -print0 | xargs -0 chmod 755
for bits in 32 64; do
if [ -d build/$app_name/win$bits ]; then
if [ ! -e build/$app_name/win$bits/set-ime.exe ]; then
echo "copying set-ime.exe to win$bits build"; cp windows-ime/set-ime.exe build/$app_name/win$bits/
fi
cp build/nw/version build/$app_name/win$bits
fi
done