]> git.saurik.com Git - wxWidgets.git/blob - distrib/tar-o-matic.sh
glibc's vswprintf doesn't nul terminate on truncation.
[wxWidgets.git] / distrib / tar-o-matic.sh
1 #!/bin/sh
2
3 # create wx tarballs automatically given a tag, or from CVS HEAD
4 PROGNAME=$0
5 VERSION=""
6 TAG=""
7 STARTDIR=$PWD
8
9 SPINWXX11=0
10 SPINWXGTK=0
11 SPINWXMOTIF=0
12 SPINWXMAC=0
13 SPINWXBASE=0
14 SPINWXMGL=0
15 SPINWXALL=0
16 SPINWXMSW=0
17 SPINDOCS=0
18 SPINEVERYTHING=0
19 REBAKE=0
20
21 SILENTFLAG=""
22
23 about()
24 {
25 # sorry folks, I couldn't resist. :-)
26
27 echo "It's the tar-o-matic 2000! It slices! It dices! It..."
28 echo "Grabs CVS revisions and generates complete tarballs from them!!"
29 echo ""
30 echo "WARNING:"
31 echo "- Do not use tar-o-matic while intoxicated."
32 echo "- Do not use tar-o-matic while driving."
33 echo "- Do not use tar-o-matic while driving intoxicated."
34 echo "- Keep tar-o-matic away from small children. Large ones too."
35 echo "- Tar-o-matic is not for use as a life-saving device."
36 echo "- Do not call tar-o-matic nasty names. It really hates that."
37 echo "- Avoid developing strong emotional attachment to tar-o-matic."
38 echo "- Keep tar-o-matic away from unmonitored internet connections."
39 echo "- Don't say we didn't warn you."
40 echo ""
41 echo "In case of malfunction, let tar-o-matic know that it is special."
42 }
43
44 usage()
45 {
46 echo Usage: $PROGNAME " version-number cvs-revision [ options ]"
47 echo Options:
48 echo " --help Display this help message"
49 echo " --wxgtk Spin wxGTK"
50 echo " --wxbase Spin wxBase"
51 echo " --wxx11 Spin wxX11"
52 echo " --wxmotif Spin wxMotif"
53 echo " --wxmac Spin wxMac"
54 echo " --wxmgl Spin wxMGL"
55 echo " --wxall Spin wxALL"
56 echo " --wxmsw Spin wxMSW"
57 echo " --docs Spin docs"
58 echo " --all Spin EVERYTHING"
59 echo " --updatecvs Update from CVS"
60 echo " --silent Don't prompt whenever possible"
61 echo " only for use with revisions > 2.6.1"
62 echo " --about about $PROGNAME"
63 echo ""
64 echo "NOTES:"
65 echo "- Set EXTRASDIR environment variable to have any zip files"
66 echo " in that directory copied into deliver/extra for inclusion."
67 echo "- Set WXDISTDIR environment variable to have completed "
68 echo " tarballs put in that directory. This allows for things like"
69 echo " setting a network path for all machines to send files to."
70 echo "- EXTRASDIR defaults to ./extra and WXDISTDIR defaults to ./deliver"
71
72 exit 1
73 }
74
75 if [ "$1" = "" ] || [ "$1" = "--help" ]; then
76 usage
77 exit
78 fi
79
80 if [ "$1" = "--about" ]; then
81 about
82 exit
83 fi
84
85 VERSION=$1
86 shift 1
87
88 FINDTAG=`echo "$1" | sed /\-\-/p`
89 if [ FINDTAG != "" ]; then
90 TAG=$1
91 shift 1
92 fi
93
94 for i in "$@"; do
95 case "$i" in
96 --wxx11) SPINWXX11=1 ;;
97 --wxgtk) SPINWXGTK=1 ;;
98 --wxmac) SPINWXMAC=1 ;;
99 --wxbase) SPINWXBASE=1 ;;
100 --wxmgl) SPINWXMGL=1 ;;
101 --wxmsw) SPINWXMSW=1 ;;
102 --wxmotif) SPINWXMOTIF=1 ;;
103 --docs) SPINDOCS=1 ;;
104 --all) SPINEVERYTHING=1 ;;
105 --rebake) REBAKE=1 ;;
106 --silent) SILENTFLAG="--silent" ;;
107 --clean-build) CLEANBUILD=1 ;;
108 *)
109 usage
110 exit
111 ;;
112 esac
113 done
114
115 # checkout wx sources to this tree
116 if [ -d ./temp-wx ]; then
117 rm -rf ./temp-wx
118 fi
119
120 mkdir $STARTDIR/temp-wx
121 WXDIR="$STARTDIR/temp-wx/wxWidgets"
122
123 TAGNAME=""
124 if [ "$TAG" != "" ]; then
125 echo "Checking out wxWidgets revision: $TAG"
126 TAGNAME="-r $TAG"
127 else
128 echo "Checking out wxWidgets HEAD sources..."
129 fi
130 echo "" # add a blank line for readability
131
132 cd $STARTDIR/temp-wx
133 cvs -d:pserver:anoncvs:anoncvs@cvs.wxwidgets.org:/pack/cvsroots/wxwidgets login
134
135 echo "cvs -d :pserver:anoncvs@cvs.wxwidgets.org:/pack/cvsroots/wxwidgets checkout $TAGNAME wxWidgets"
136 cvs -d :pserver:anoncvs@cvs.wxwidgets.org:/pack/cvsroots/wxwidgets checkout $TAGNAME wxWidgets
137
138 if [ "$REBAKE" = "1" ]; then
139 echo "TODO! Implement re-baking..."
140 fi
141
142 # Copy extra .zips over to deliver/extra so they'll get picked up...
143 if [ ! -d $WXDIR/deliver ]; then
144 mkdir $WXDIR/deliver
145 fi
146
147 if [ ! -d $WXDIR/deliver/extra ]; then
148 mkdir $WXDIR/deliver/extra
149 fi
150
151 # allow the user to specify extras dir in an environment variable
152 EXTRA_DIR=$STARTDIR/extra
153 if [ "$EXTRASDIR" != "" ]; then
154 EXTRA_DIR="$EXTRASDIR"
155 fi
156
157 for filename in $EXTRA_DIR/*.zip
158 do
159 cp $filename $WXDIR/deliver/extra
160 done
161
162 if [ "$SPINWXMAC" = "1" ] || [ "$SPINEVERYTHING" = "1" ]; then
163 cd $WXDIR
164 sh $WXDIR/distrib/msw/tardist $WXDIR $WXDIR/deliver $VERSION --wxmac
165 fi
166
167 if [ "$SPINEVERYTHING" = "1" ]; then
168 cd $WXDIR
169 sh $WXDIR/distrib/msw/tardist $WXDIR $WXDIR/deliver $VERSION --wxall
170 fi
171
172 if [ "$SPINWXMSW" = "1" ] || [ "$SPINEVERYTHING" = "1" ]; then
173 cd $WXDIR
174 sh $WXDIR/distrib/msw/makesetup.sh --wxmsw
175 fi
176
177 if [ "$SPINWXBASE" = "1" ] || [ "$SPINEVERYTHING" = "1" ]; then
178 cd $WXDIR
179 sh $WXDIR/distrib/msw/maketarballs $WXDIR $WXDIR/deliver $VERSION --wxbase $SILENTFLAG
180 fi
181
182 if [ "$SPINWXOS2" = "1" ] || [ "$SPINEVERYTHING" = "1" ]; then
183 cd $WXDIR
184 sh $WXDIR/distrib/msw/makesetup.sh --wxos2
185 fi
186
187 if [ "$SPINWXGTK" = "1" ] || [ "$SPINEVERYTHING" = "1" ]; then
188 cd $WXDIR
189 sh $WXDIR/distrib/msw/maketarballs $WXDIR $WXDIR/deliver $VERSION --wxgtk $SILENTFLAG
190 fi
191
192 if [ "$SPINWXMOTIF" = "1" ] || [ "$SPINEVERYTHING" = "1" ]; then
193 cd $WXDIR
194 sh $WXDIR/distrib/msw/maketarballs $WXDIR $WXDIR/deliver $VERSION --wxmotif $SILENTFLAG
195 fi
196
197 if [ "$SPINWXMGL" = "1" ] || [ "$SPINEVERYTHING" = "1" ]; then
198 cd $WXDIR
199 sh $WXDIR/distrib/msw/maketarballs $WXDIR $WXDIR/deliver $VERSION --wxmgl $SILENTFLAG
200 fi
201
202 if [ "$SPINWXX11" = "1" ] || [ "$SPINEVERYTHING" = "1" ]; then
203 cd $WXDIR
204 sh $WXDIR/distrib/msw/maketarballs $WXDIR $WXDIR/deliver $VERSION --wxx11 $SILENTFLAG
205 fi
206
207 DISTDIR="$STARTDIR/deliver"
208 if [ "$WXDISTDIR" != "" ] && [ -d $WXDISTDIR ]; then
209 DISTDIR="$WXDISTDIR"
210 fi
211
212 # delete any old tarballs
213 if [ -d $DISTDIR ]; then
214 rm -rf $DISTDIR
215 fi
216
217 mkdir $DISTDIR
218
219 # copy over the created tarballs
220 cp $WXDIR/deliver/*.gz $DISTDIR
221 cp $WXDIR/deliver/*.bz2 $DISTDIR
222 cp $WXDIR/deliver/*.zip $DISTDIR