forked from fuse-open/fuse-studio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpack.sh
executable file
·197 lines (157 loc) · 4.32 KB
/
pack.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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
#!/bin/bash
set -e
cd "`dirname "$0"`"
if [ -n "$RELEASE_VERSION" ]; then
VERSION="$RELEASE_VERSION"
else
VERSION=$(cat VERSION.txt)"-local"
fi
DST="`pwd -P`/Release"
rm -rf "$DST"
DO_BUILD="1"
DO_ZIP="1"
for arg in "$@"; do
case $arg in
--no-build)
DO_BUILD="0"
;;
--no-zip)
DO_ZIP="0"
;;
*)
echo "ERROR: Invalid argument '$arg'" >&2
exit 1
;;
esac
done
if [ "$DO_BUILD" = "1" ]; then
if [ "$OSTYPE" = "msys" ]; then
cmd //c build.bat --release
else
./build.sh --release
fi
# Warm up package installs to include what's needed to preview an app on .NET out-of-the-box.
Stuff/uno create App -cApp -f
Stuff/uno build dotnet App
fi
echo "Copying files to '$DST'"
if [ "$OSTYPE" = "msys" ]; then
CP="cp -f"
else
CP="cp -f"
fi
UNO_VER=`cat .unoversion`
UNO="$DST/Uno"
PACKAGES="$DST/Packages"
MODULES="$DST/Modules"
mkdir -p "$UNO" "$PACKAGES"
# Uno
$CP -R packages/FuseOpen.Uno.Tool.$UNO_VER/tools/* "$UNO"
$CP -R packages/FuseOpen.Uno.Tool.$UNO_VER/tools/.unoconfig "$UNO"
# Templates
mkdir -p "$DST/Templates"
$CP -R Templates/* "$DST/Templates"
# Modules
mkdir -p "$DST/Modules"
$CP -R Modules/* "$DST/Modules"
# Packages
$CP Stuff/*.packages "$DST"
# Include installed packages in installer (does not include "premiumlibs" packages)
$CP -R Stuff/lib/* "$PACKAGES"
# Fuse.unoconfig
if [ "$OSTYPE" = msys ]; then
PACKAGE_INSTALL_DIR=%LOCALAPPDATA%/Fusetools/Packages
else
PACKAGE_INSTALL_DIR="%HOME%/Library/Application Support/Fusetools/Packages"
fi
cat <<EOF >> "$UNO/Fuse.unoconfig"
if WIN32 {
SimulatorDll: Fuse.Simulator.dll
} else {
SimulatorDll: MonoBundle/Fuse.Simulator.dll
}
TemplatesDirectory: Templates
ModulesDirectory: Modules
Mono: Mono/bin/mono
// Package manager config
Packages.InstallDirectory: "$PACKAGE_INSTALL_DIR"
Packages.SearchPaths += Packages
Packages.LockFiles += [
uno.packages
fuselibs.packages
premiumlibs.packages
]
// SDK config
if WIN32 {
SdkConfig: %LOCALAPPDATA%/Fusetools/Fuse/Android/.sdkconfig
include %LOCALAPPDATA%/Fusetools/Fuse/Android/.sdkconfig
} else {
SdkConfig: "%HOME%/Library/Application Support/Fusetools/Fuse/Android/.sdkconfig"
include "%HOME%/Library/Application Support/Fusetools/Fuse/Android/.sdkconfig"
}
//Extra unoconfig
if WIN32 {
include "%LOCALAPPDATA%/Fusetools/Fuse/extra.unoconfig"
} else {
include "%HOME%/.fuse/extra.unoconfig"
}
EOF
if [ "$OSTYPE" != msys ]; then
cat <<EOF >> "$UNO/Fuse.unoconfig"
// Simulator packages
Packages.SearchPaths += /usr/local/share/uno/Packages
EOF
fi
case $OSTYPE in
darwin*)
OS_NAME="OSX"
# Fix Info.plist
PLIST=bin/Release/Fuse.app/Contents/Info.plist
sed -i '' "s/VERSION_NUMBER/$VERSION/" $PLIST
sed -i '' 's/Copyright [^<]*/Copyright © 2017 Fusetools AS/' $PLIST
# Simulator client uno project
rsync -ru --copy-links Source/Simulator/build/* "$PACKAGES"
rsync -ru --copy-links Source/Preview/build/* "$PACKAGES"
# Fuse.app
rsync -r --copy-links bin/Release/Fuse.app "$DST"
# Bundle Uno, Templates, Modules and Tools inside Fuse.app
mv "$UNO/Fuse.unoconfig" "$DST/Templates" "$DST/Modules" "$DST/Fuse.app/Contents"
mkdir -p "$DST/Fuse.app/Contents/Uno"
mv "$UNO"/* "$UNO/.unoconfig" "$DST/Fuse.app/Contents/Uno"
rm -rf "$UNO" "$DST/Templates" "$DST/Modules"
cat <<EOF >> "$DST/Fuse.app/Contents/.unoconfig"
Packages.SearchPaths += ../../Packages
include Uno/.unoconfig
include Fuse.unoconfig
EOF
;;
linux*)
OS_NAME="Linux"
;;
msys*)
OS_NAME="Win32"
mv "$UNO"/* "$UNO/.unoconfig" "$DST"
rm -rf "$UNO"
# Fuse.exe
$CP bin/Release/*.dll "$DST"
$CP bin/Release/*.exe "$DST"
$CP bin/Release/fuse_simulator.ico "$DST"
# Simulator client uno project
$CP -r Source/Simulator/build/* "$PACKAGES"
$CP -r Source/Preview/build/* "$PACKAGES"
;;
esac
# Delete debug symbols to avoid bloating the installers
find "$DST" -name "*.pdb" -exec rm {} \; || :
find "$DST" -name "*.mdb" -exec rm {} \; || :
if [ "$DO_ZIP" = "1" ]; then
ZIP="`pwd -P`/Fuse-$VERSION-$OS_NAME.zip"
rm -f "$ZIP"
cd "$DST"
if [ "$OSTYPE" = "msys" ]; then
"C:\Program Files\7-Zip\7z.exe" a -y "$ZIP" * .unoconfig
else
zip -r --symlinks "$ZIP" * .unoconfig
fi
echo -e "\nRESULT: $ZIP"
fi