-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakegitso.sh
364 lines (292 loc) · 10.6 KB
/
makegitso.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
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
#! /bin/bash
##########
# Gisto - Gitso is to support others
#
# Copyright 2008 - 2010: Aaron Gerber, Derek Buranen
#
# Gitso is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Gitso is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Gitso. If not, see <http://www.gnu.org/licenses/>.
##########
##
# Helper methods
############################
#
# Creates the source package, works on all UNIX/LINUX based platforms
#
function mksrc {
P=`pwd`
TMP_PKG="../pkg"
# Clean up first.
find . -name "*~" -exec rm {} ';'
rm -rf $OSX_BUILD_DIR
rm -rf $RPM_BUILD_DIR
rm -rf $DEB_TARGZ_PATH
rm -rf $P/*.bz2
rm -rf $P/*.tar
rm -rf $P/*.gz
rm -rf $P/*.app
rm -rf $P/*.dmg
rm -rf $P/*.deb
rm -rf $P/*.rpm
rm -rf $P/*.exe
rm -rf $TMP_PKG
# Create the SRC file
mkdir -p $TMP_PKG/trunk/
cp -r ./ $TMP_PKG/trunk/
find $TMP_PKG/trunk -name ".svn" -exec rm -rf {} 2>&1 > /dev/null ';' 2>&1 > /dev/null
mv $TMP_PKG/trunk $TMP_PKG/gitso-0.6.2
tar -cj -C $TMP_PKG/ gitso-0.6.2 > $P/$SRC
rm -rf $TMP_PKG
}
#
# Create the .app folder for snow leopard, it uses a different version of pythong
# And because py2app needs to know there, we just use different config files.
#
function snowLeopardDMG {
# Grab the default option and then reset it at the end.
#defaults write com.apple.versioner.python Prefer-32-Bit -bool yes
echo -e "Creating Gitso.app "
rm -f setup.py
rm -rf $OSX_BUILD_DIR
echo -e ".."
python arch/osx/setup.py py2app
echo -e ".."
cp arch/osx/Info_OSX-10.6.plist $OSX_BUILD_DIR/Gitso.app/Contents/Info.plist
cp COPYING $OSX_BUILD_DIR/Gitso.app/Contents/Resources/
cp PythonApplet.icns $OSX_BUILD_DIR/Gitso.app/Contents/Resources/
tar xvfz arch/osx/OSXvnc.tar.gz
mv OSXvnc $OSX_BUILD_DIR/Gitso.app/Contents/Resources/
tar xvfz arch/osx/cotvnc.app.tar.gz
mv cotvnc.app $OSX_BUILD_DIR/Gitso.app/Contents/Resources/
cp icon.ico $OSX_BUILD_DIR/Gitso.app/Contents/Resources/
cp icon.png $OSX_BUILD_DIR/Gitso.app/Contents/Resources/
cp __init__.py $OSX_BUILD_DIR/Gitso.app/Contents/Resources/
cp ArgsParser.py $OSX_BUILD_DIR/Gitso.app/Contents/Resources/
cp Processes.py $OSX_BUILD_DIR/Gitso.app/Contents/Resources/
cp ConnectionWindow.py $OSX_BUILD_DIR/Gitso.app/Contents/Resources/
cp AboutWindow.py $OSX_BUILD_DIR/Gitso.app/Contents/Resources/
cp GitsoThread.py $OSX_BUILD_DIR/Gitso.app/Contents/Resources/
cp NATPMP.py $OSX_BUILD_DIR/Gitso.app/Contents/Resources/
cp arch/osx/libjpeg-copyright.txt $OSX_BUILD_DIR/Gitso.app/Contents/Frameworks/
cp arch/osx/osxnvc_echoware-copyright.txt $OSX_BUILD_DIR/Gitso.app/Contents/Resources/OSXvnc/
cp arch/osx/cotvnc-copyright.txt $OSX_BUILD_DIR/Gitso.app/Contents/Resources/cotvnc.app/contents/Resources
cp arch/osx/osxvnc-copyright.txt $OSX_BUILD_DIR/Gitso.app/Contents/Resources/OSXvnc/
echo -e " [done]\n"
echo -e "Creating $DMG_OSX_106"
rm -f $DMG_OSX_106
mkdir $OSX_BUILD_DIR/Gitso
cp arch/osx/dmg_DS_Store $OSX_BUILD_DIR/Gitso/.DS_Store
ln -s /Applications/ $OSX_BUILD_DIR/Gitso/Applications
mv "$OSX_BUILD_DIR/Gitso.app" "$OSX_BUILD_DIR/Gitso/"
cp -r arch/osx/Readme.rtfd $OSX_BUILD_DIR/Gitso/Readme.rtfd
echo -e "..."
hdiutil create -srcfolder $OSX_BUILD_DIR/Gitso/ $DMG_OSX_106
echo -e "... [done]\n"
}
#
# Create the .app folder for Leopard, it uses a different version of pythong
# And because py2app needs to know there, we just use different config files.
#
function LeopardDMG {
echo -e "Creating Gitso.app "
rm -f setup.py
rm -rf $OSX_BUILD_DIR
echo -e ".."
python arch/osx/setup.py py2app
echo -e ".."
cp arch/osx/Info_OSX-10.5.plist $OSX_BUILD_DIR/Gitso.app/Contents/Info.plist
cp COPYING $OSX_BUILD_DIR/Gitso.app/Contents/Resources/
cp PythonApplet.icns $OSX_BUILD_DIR/Gitso.app/Contents/Resources/
tar xvfz arch/osx/OSXvnc.tar.gz
mv OSXvnc $OSX_BUILD_DIR/Gitso.app/Contents/Resources/
tar xvfz arch/osx/cotvnc.app.tar.gz
mv cotvnc.app $OSX_BUILD_DIR/Gitso.app/Contents/Resources/
cp icon.ico $OSX_BUILD_DIR/Gitso.app/Contents/Resources/
cp icon.png $OSX_BUILD_DIR/Gitso.app/Contents/Resources/
cp __init__.py $OSX_BUILD_DIR/Gitso.app/Contents/Resources/
cp ArgsParser.py $OSX_BUILD_DIR/Gitso.app/Contents/Resources/
cp Processes.py $OSX_BUILD_DIR/Gitso.app/Contents/Resources/
cp ConnectionWindow.py $OSX_BUILD_DIR/Gitso.app/Contents/Resources/
cp AboutWindow.py $OSX_BUILD_DIR/Gitso.app/Contents/Resources/
cp GitsoThread.py $OSX_BUILD_DIR/Gitso.app/Contents/Resources/
cp NATPMP.py $OSX_BUILD_DIR/Gitso.app/Contents/Resources/
cp arch/osx/libjpeg-copyright.txt $OSX_BUILD_DIR/Gitso.app/Contents/Frameworks/
cp arch/osx/osxnvc_echoware-copyright.txt $OSX_BUILD_DIR/Gitso.app/Contents/Resources/OSXvnc/
cp arch/osx/cotvnc-copyright.txt $OSX_BUILD_DIR/Gitso.app/Contents/Resources/cotvnc.app/contents/Resources
cp arch/osx/osxvnc-copyright.txt $OSX_BUILD_DIR/Gitso.app/Contents/Resources/OSXvnc/
echo -e " [done]\n"
echo -e "Creating $DMG_OSX_105"
rm -f $DMG_OSX_105
mkdir $OSX_BUILD_DIR/Gitso
cp arch/osx/dmg_DS_Store $OSX_BUILD_DIR/Gitso/.DS_Store
ln -s /Applications/ $OSX_BUILD_DIR/Gitso/Applications
mv "$OSX_BUILD_DIR/Gitso.app" "$OSX_BUILD_DIR/Gitso/"
cp -r arch/osx/Readme.rtfd $OSX_BUILD_DIR/Gitso/Readme.rtfd
echo -e "..."
hdiutil create -srcfolder $OSX_BUILD_DIR/Gitso/ $DMG_OSX_105
echo -e "... [done]\n"
}
#
# Displays the help menu
#
function helpMenu {
echo -e "Usage makegitso.sh: [ BUILD OPTIONS ] [ OPTIONS ]"
echo -e "\tBUILD OPTIONS"
echo -e "\t--fedora\tMake package for Fedora. (only avaible on Fedora)"
echo -e "\t--opensuse\tMake package for OpenSUSE. (only avaible on OpenSUSE)"
# Cent OS doesn't have wxWidget in it's repo....
#echo -e "\t--centos\tMake package for CentOS. (only avaible on CentOS)"
echo -e "\t--source\tMake the source package. (All UNIX/Linux systems)\n"
echo -e "\tOPTIONS:"
echo -e "\t--no-clean\tDo not remove the build directory."
echo -e "\t--help \tThese options."
exit 0
}
##
# Initialize values
############################
DMG_OSX_106="Gitso_0.6.2_mac_SnowLeopard.dmg"
DMG_OSX_105="Gitso_0.6.2_mac_Leopard.dmg"
DEB="../gitso_0.6.2_all.deb"
TARGZ="../gitso_0.6.2_all.tar.gz"
SRC="gitso_0.6.2_src.tar.bz2"
RPM="gitso-0.6.2-1.i586.rpm"
RPMOUT=""
OSX_BUILD_DIR=`pwd`"/dist"
RPM_BUILD_DIR=`pwd`"/build"
DEB_BUILD_DIR="debian/gitso"
DEB_TARGZ_PATH="gitso"
CLEAN="yes"
RPMNAME=""
USESRC="no"
##
# Get Comman line arguments
############################
for param in "$@"
do
if test "${param}" = "--no-clean"; then
CLEAN="no"
elif test "${param}" = "--fedora"; then
RPMNAME="fedora"
RPMOUT="gitso_0.6.2-1_fedora.i386.rpm"
elif test "${param}" = "--centos"; then
RPMNAME="centos"
RPMOUT="gitso_0.6.2-1_centos.i386.rpm"
elif test "${param}" = "--opensuse"; then
RPMNAME="opensuse"
RPMOUT="gitso_0.6.2-1_opensuse.i586.rpm"
elif test "${param}" = "--source"; then
USESRC="yes"
else
helpMenu
fi
done
##
# Create packages!
########################
if [ "$USESRC" = "yes" ]; then
# Creating the source
echo -n "Creating gitso $SRC...."
mksrc
echo -e " [done]\n"
elif [ "`uname -a | grep Darwin`" != "" ]; then
#We're on OS X
if test `which py2applet`; then
# To Make cotvnc
# cvs -z3 -d:pserver:[email protected]:/cvsroot/cotvnc co -P cotvnc
#
# cd cotvnc
# patch -p0 < [Gitso-path]/arch/osx/cotvnc-gitso.diff
#
# Then in xCode build cotvnc
# find build/Development/
# rename Chicken Of The VNC.app to cotvnc.app
# remove cotvnc.app/Contents/Resources/*non English.lproj
# rename cotvnc.app/Contents/MacOS/Chicken Of The VNC to cotvnc.app/Contents/MacOS/cotvnc
#
# Patch was made with: diff -aurr . ../cotvnc-gitso/ > cotvnc-gitso.diff
#
LeopardDMG
snowLeopardDMG
else
echo -e "Error, you need py2applet to be installed."
fi
elif test "`uname -a 2>&1 | grep Linux | grep -v which`"; then
#We're on Linux
if test "`which dpkg 2>&1 | grep -v which`"; then
# Deb version of Gitso.
echo -n "Creating $DEB"
dpkg-buildpackage -us -uc -d -b
echo -e " [done]"
# Standalone version of Gitso.
echo -n "Creating $TARGZ"
rm -rf $DEB_TARGZ_PATH
cp -r $DEB_BUILD_DIR $DEB_TARGZ_PATH
rm -rf $DEB_TARGZ_PATH/DEBIAN
echo -n ".."
cp arch/linux/README-stand-alone.txt $DEB_TARGZ_PATH/README
cp arch/linux/run-gitso.sh $DEB_TARGZ_PATH/
mv $DEB_TARGZ_PATH/usr/bin $DEB_TARGZ_PATH/bin
mv $DEB_TARGZ_PATH/usr/share $DEB_TARGZ_PATH/share
rm -rf $DEB_TARGZ_PATH/usr/
echo -n "."
tar -cvzf $TARGZ $DEB_TARGZ_PATH 2>&1 > /dev/null
echo -e " [done]\n"
elif test "`which rpm 2>&1 | grep -v which`"; then
# RPM version of Gitso
if [ "$RPMNAME" = "fedora" ]; then
SPEC="gitso_rpm_fedora.spec"
# yum --nogpgcheck install gitso_0.6.2-1_fedora.i386.rpm
elif [ "$RPMNAME" = "opensuse" ]; then
SPEC="gitso_rpm.spec"
elif [ "$RPMNAME" = "centos" ]; then
SPEC="gitso_rpm_centos.spec"
else
echo -e "Error: Invalid RPM Type: '$RPMNAME'\n\tPlease specify one of the following:\n\t--opensuse\n\t--fedora\n"
exit 1
fi
echo "Creating $RPM"
export RPM_BUILD_DIR=$RPM_BUILD_DIR
TMP="$RPM_BUILD_DIR/rpm/tmp"
BUILD_ROOT="$RPM_BUILD_DIR/rpm/tmp/gitso-root"
# We need this because the rpmbuild below needs to the source ball.
# Also realize that mksrc is going to clean-up, so if you creat diste files before this line
# They will be deleted.
mksrc
mkdir -p $RPM_BUILD_DIR/rpm/{BUILD,RPMS/$ARCH,RPMS/noarch,SOURCES,SRPMS,SPECS,tmp}
mkdir -p $BUILD_ROOT
cp $SRC $RPM_BUILD_DIR/rpm/SOURCES/$SRC
cp arch/linux/$SPEC $TMP
perl -e 's/%\(echo \$HOME\)/$ENV{'RPM_BUILD_DIR'}/g;' -pi $TMP/$SPEC
if [ "$RPMNAME" = "fedora" ]; then
rpmbuild -ba $TMP/$SPEC
elif [ "$RPMNAME" = "opensuse" ]; then
export RPM_BUILD_ROOT="$HOME/rpmbuild/BUILDROOT/gitso-0.6.2-1.i386"
rpmbuild -ba --buildroot=$RPM_BUILD_ROOT $TMP/$SPEC
elif [ "$RPMNAME" = "centos" ]; then
export RPM_BUILD_ROOT="$HOME/rpmbuild/BUILDROOT/gitso-0.6.2-1.i386"
rpmbuild -ba --buildroot=$RPM_BUILD_ROOT $TMP/$SPEC
fi
find $RPM_BUILD_DIR/rpm/RPMS -name "*.rpm" -exec cp {} $RPMOUT ';'
echo -e " [done]\n"
fi
fi
# Clean up
if [ "$CLEAN" = "yes" ]; then
echo -e "Cleaning up...."
rm -rf $RPM_BUILD_DIR
dpkg-buildpackage -tc -us -uc -d -b
rm -rf $DEB_TARGZ_PATH
find . -name "*.pyc" -exec rm {} ';'
echo -e " [done]\n"
fi