]> git.saurik.com Git - wxWidgets.git/blob - distrib/msw/makerpm
glibc's vswprintf doesn't nul terminate on truncation.
[wxWidgets.git] / distrib / msw / makerpm
1 #!/bin/sh
2 # Makes the wxWidgets RPMs
3
4 RPMBUILDARGS=
5 PLATFORM=
6 NORPMS=
7
8 doupdatecvs()
9 {
10 cd $WXSRC
11 echo Updating from CVS...
12 cvswx update -d -P
13 }
14
15 dospinwxgtk()
16 {
17 echo Making wxGTK RPMs...
18 RPM_ROOT=$WXDEST/wxgtk/rpm-root
19
20 if [ ! -d $WXDEST ]; then
21 mkdir $WXDEST
22 fi
23
24 rm -f -r $WXDEST/wxgtk
25 mkdir $WXDEST/wxgtk
26 mkdir $WXDEST/wxgtk/release
27 mkdir $RPM_ROOT
28
29 cd $WXSRC
30 cd locale
31 make allmo
32 cd $WXDEST/wxgtk/release
33 echo Configuring...
34 $WXSRC/configure --with-gtk --no-recursion
35 echo Making...
36 make -j1 dist bzip-dist-only
37
38 mkdir $WXDEST/$PLATFORM
39
40 if [ "$NORPMS" != "1" ]
41 then
42
43 echo Setting up RPM build dir $RPM_ROOT...
44 rm -f -r $RPM_ROOT
45 mkdir $RPM_ROOT
46 mkdir $RPM_ROOT/BUILD
47 mkdir $RPM_ROOT/RPMS
48 mkdir $RPM_ROOT/RPMS/i386
49 mkdir $RPM_ROOT/RPMS/i686
50 mkdir $RPM_ROOT/RPMS/noarch
51 mkdir $RPM_ROOT/SOURCES
52 mkdir $RPM_ROOT/SPECS
53 mkdir $RPM_ROOT/SRPMS
54
55 echo %_topdir $RPM_ROOT > ~/.rpmmacros
56
57 echo Copying wxGTK-$WXVER.tar.bz2 to $RPM_ROOT/SOURCES...
58 cp wxGTK-$WXVER.tar.bz2 $RPM_ROOT/SOURCES
59 echo Copying wxGTK.spec to $RPM_ROOT/SPECS...
60 cp $WXSRC/wxGTK.spec $RPM_ROOT/SPECS
61
62 echo Starting wxGTK RPM build, rpmbuild args=$RPMBUILDARGS...
63 cd $RPM_ROOT
64 rpmbuild -ba $RPMBUILDARGS SPECS/wxGTK.spec 2>&1 | tee wxGTK.out
65
66 echo Finished wxGTK RPM build, in $RPM_ROOT.
67 echo "SRPMS:"
68 ls SRPMS
69 echo "RPMS/i386:"
70 ls RPMS/i386
71
72 cp $RPM_ROOT/SRPMS/*.rpm $WXDEST/$PLATFORM
73 cp $RPM_ROOT/RPMS/i386/*.rpm $WXDEST/$PLATFORM
74
75 fi
76
77 cp $WXDEST/wxgtk/release/*.tar.gz $WXDEST/$PLATFORM
78 cp $WXDEST/wxgtk/release/*.tar.bz2 $WXDEST/$PLATFORM
79
80 # rm -f -r $WXDEST/wxgtk
81
82 echo Now try the RPMs with rpm -i.
83 }
84
85 dospinwxmgl()
86 {
87 echo Making wxMGL RPMs...
88 RPM_ROOT=$WXDEST/wxmgl/rpm-root
89
90 if [ ! -d $WXDEST ]; then
91 mkdir $WXDEST
92 fi
93
94 rm -f -r $WXDEST/wxmgl
95 mkdir $WXDEST/wxmgl
96 mkdir $WXDEST/wxmgl/release
97 mkdir $RPM_ROOT
98
99 cd $WXSRC
100 cd locale
101 make allmo
102 cd $WXDEST/wxmgl/release
103 echo Configuring...
104 $WXSRC/configure --with-mgl --no-recursion
105 echo Making...
106 make -j1 dist bzip-dist-only
107
108 if [ "$NORPMS" != "1" ]
109 then
110
111 echo Setting up RPM build dir $RPM_ROOT...
112 rm -f -r $RPM_ROOT
113 mkdir $RPM_ROOT
114 mkdir $RPM_ROOT/BUILD
115 mkdir $RPM_ROOT/RPMS
116 mkdir $RPM_ROOT/RPMS/i386
117 mkdir $RPM_ROOT/RPMS/i686
118 mkdir $RPM_ROOT/RPMS/noarch
119 mkdir $RPM_ROOT/SOURCES
120 mkdir $RPM_ROOT/SPECS
121 mkdir $RPM_ROOT/SRPMS
122
123 echo %_topdir $RPM_ROOT > ~/.rpmmacros
124
125 echo Copying wxMGL-$WXVER.tar.bz2 to $RPM_ROOT/SOURCES...
126 cp wxMGL-$WXVER.tar.bz2 $RPM_ROOT/SOURCES
127 echo Copying wxMGL.spec to $RPM_ROOT/SPECS...
128 cp $WXSRC/wxMGL.spec $RPM_ROOT/SPECS
129
130 echo Starting wxMGL RPM build...
131 cd $RPM_ROOT
132 rpmbuild -ba SPECS/wxMGL.spec 2>&1 | tee wxMGL.out
133
134 echo Finished wxMGL RPM build, in $RPM_ROOT.
135 echo "SRPMS:"
136 ls SRPMS
137 echo "RPMS/i386:"
138 ls RPMS/i386
139
140 cp $RPM_ROOT/SRPMS/*.rpm $WXDEST
141 cp $RPM_ROOT/RPMS/i386/*.rpm $WXDEST
142
143 fi
144
145 cp $WXDEST/wxmgl/release/*.tar.gz $WXDEST
146 cp $WXDEST/wxmgl/release/*.tar.bz2 $WXDEST
147
148 # rm -f -r $WXDEST/wxmgl
149
150 echo Now try the RPMs with rpm -i.
151 }
152
153 dospinwxmotif()
154 {
155 echo Making wxMotif RPMs...
156 RPM_ROOT=$WXDEST/wxmotif/rpm-root
157
158 if [ ! -d $WXDEST ]; then
159 mkdir $WXDEST
160 fi
161
162 rm -f -r $WXDEST/wxmotif
163 mkdir $WXDEST/wxmotif
164 mkdir $WXDEST/wxmotif/release
165 mkdir $RPM_ROOT
166
167 cd $WXSRC
168 cd locale
169 make allmo
170 cd $WXDEST/wxmotif/release
171 echo Configuring...
172 $WXSRC/configure --with-motif --no-recursion
173 echo Making...
174 make -j1 dist bzip-dist-only
175
176 if [ "$NORPMS" != "1" ]
177 then
178
179 echo Setting up RPM build dir $RPM_ROOT...
180 rm -f -r $RPM_ROOT
181 mkdir $RPM_ROOT
182 mkdir $RPM_ROOT/BUILD
183 mkdir $RPM_ROOT/RPMS
184 mkdir $RPM_ROOT/RPMS/i386
185 mkdir $RPM_ROOT/RPMS/i686
186 mkdir $RPM_ROOT/RPMS/noarch
187 mkdir $RPM_ROOT/SOURCES
188 mkdir $RPM_ROOT/SPECS
189 mkdir $RPM_ROOT/SRPMS
190
191 echo %_topdir $RPM_ROOT > ~/.rpmmacros
192
193 echo Copying wxMOTIF-$WXVER.tar.bz2 to $RPM_ROOT/SOURCES...
194 cp wxMOTIF-$WXVER.tar.bz2 $RPM_ROOT/SOURCES
195 echo Copying wxMotif.spec to $RPM_ROOT/SPECS...
196 cp $WXSRC/wxMotif.spec $RPM_ROOT/SPECS
197
198 echo Starting wxMotif RPM build...
199 cd $RPM_ROOT
200 rpmbuild -ba SPECS/wxMotif.spec 2>&1 | tee wxGTK.out
201
202 echo Finished wxMotif RPM build, in $RPM_ROOT.
203 echo "SRPMS:"
204 ls SRPMS
205 echo "RPMS/i386:"
206 ls RPMS/i386
207
208 cp $RPM_ROOT/SRPMS/*.rpm $WXDEST
209 cp $RPM_ROOT/RPMS/i386/*.rpm $WXDEST
210
211 fi
212
213 cp $WXDEST/wxmotif/release/*.tar.gz $WXDEST
214 cp $WXDEST/wxmotif/release/*.tar.bz2 $WXDEST
215
216 echo Rearchiving wxMotif tarballs to change wxMOTIF to wxMotif...
217 cd $WXDEST
218 mkdir wxMotif.tmp
219 cd wxMotif.tmp
220 rm -f -r *
221 tar xfz ../wxMOTIF-$WXVER.tar.gz
222 mv wxMOTIF-$WXVER wxMotif-$WXVER
223 rm -f ../wxMOTIF-$WXVER.tar.gz
224 rm -f ../wxMOTIF-$WXVER.tar.bz2
225 tar cf ../wxMotif-$WXVER.tar *
226 gzip -c ../wxMotif-$WXVER.tar > ../wxMotif-$WXVER.tar.gz
227 bzip2 -f9 ../wxMotif-$WXVER.tar
228 cd ..
229 rm -f -r wxMotif.tmp
230 # rm -f -r $WXDEST/wxmotif
231
232 echo Now try the RPMs with rpm -i.
233 }
234
235 dospinwxmac()
236 {
237 echo Making wxMac tarballs...
238 echo Note that this must be done on a Mac.
239 if [ ! -d $WXDEST ]; then
240 mkdir $WXDEST
241 fi
242
243 rm -f -r $WXDEST/wxmac
244 mkdir $WXDEST/wxmac
245 mkdir $WXDEST/wxmac/release
246
247 cd $WXSRC
248 cd locale
249 make allmo
250 cd $WXDEST/wxmac/release
251 echo Configuring...
252 $WXSRC/configure --with-mac --no-recursion
253 echo Making...
254 make -j1 dist bzip-dist-only
255
256 cp $WXDEST/wxmac/release/*.tar.gz $WXDEST
257 cp $WXDEST/wxmac/release/*.tar.bz2 $WXDEST
258
259 echo Rearchiving wxMac tarballs to change wxMAC to wxMAC...
260 cd $WXDEST
261 mkdir wxMac.tmp
262 cd wxMac.tmp
263 rm -f -r *
264 tar xfz ../wxMac-$WXVER.tar.gz
265 mv wxMAC-$WXVER wxMac-$WXVER
266 rm -f ../wxMAC-$WXVER.tar.gz
267 rm -f ../wxMAC-$WXVER.tar.bz2
268 tar cf ../wxMac-$WXVER.tar *
269 gzip -c ../wxMac-$WXVER.tar > ../wxMac-$WXVER.tar.gz
270 bzip2 -f9 ../wxMac-$WXVER.tar
271 cd ..
272 rm -f -r wxMac.tmp
273
274 rm -f -r $WXDEST/wxmac
275 echo Now try the RPMs with rpm -i.
276 }
277
278 dospinwxbase()
279 {
280 echo Making wxBase RPMs...
281 RPM_ROOT=$WXDEST/wxbase/rpm-root
282
283 if [ ! -d $WXDEST ]; then
284 mkdir $WXDEST
285 fi
286
287 rm -f -r $WXDEST/wxbase
288 mkdir $WXDEST/wxbase
289 mkdir $WXDEST/wxbase/release
290 mkdir $RPM_ROOT
291
292 cd $WXSRC
293 cd locale
294 make allmo
295 cd $WXDEST/wxbase/release
296 echo Configuring...
297 $WXSRC/configure --disable-gui --no-recursion
298 echo Making...
299 make -j1 dist bzip-dist-only
300
301 mkdir $WXDEST/$PLATFORM
302
303 if [ "$NORPMS" != "1" ]
304 then
305
306 echo Setting up RPM build dir $RPM_ROOT...
307 rm -f -r $RPM_ROOT
308 mkdir $RPM_ROOT
309 mkdir $RPM_ROOT/BUILD
310 mkdir $RPM_ROOT/RPMS
311 mkdir $RPM_ROOT/RPMS/i386
312 mkdir $RPM_ROOT/RPMS/i686
313 mkdir $RPM_ROOT/RPMS/noarch
314 mkdir $RPM_ROOT/SOURCES
315 mkdir $RPM_ROOT/SPECS
316 mkdir $RPM_ROOT/SRPMS
317
318 echo %_topdir $RPM_ROOT > ~/.rpmmacros
319
320 echo Copying wxBase-$WXVER.tar.bz2 to $RPM_ROOT/SOURCES...
321 cp wxBase-$WXVER.tar.bz2 $RPM_ROOT/SOURCES
322 echo Copying wxBase.spec to $RPM_ROOT/SPECS...
323 cp $WXSRC/wxBase.spec $RPM_ROOT/SPECS
324
325 echo Starting wxBase RPM build, rpmbuild args=$RPMBUILDARGS...
326 cd $RPM_ROOT
327 rpmbuild -ba $RPMBUILDARGS SPECS/wxBase.spec 2>&1 | tee wxBase.out
328
329 echo Finished wxBase RPM build, in $RPM_ROOT.
330 echo "SRPMS:"
331 ls SRPMS
332 echo "RPMS/i386:"
333 ls RPMS/i386
334
335 cp $RPM_ROOT/SRPMS/*.rpm $WXDEST/$PLATFORM
336 cp $RPM_ROOT/RPMS/i386/*.rpm $WXDEST/$PLATFORM
337
338 fi
339
340 cp $WXDEST/wxbase/release/*.tar.gz $WXDEST/$PLATFORM
341 cp $WXDEST/wxbase/release/*.tar.bz2 $WXDEST/$PLATFORM
342
343 # rm -f -r $WXDEST/wxbase
344 echo Now try the RPMs with rpm -i.
345 }
346
347 dospinwxx11()
348 {
349 echo Making wxX11 RPMs...
350 RPM_ROOT=$WXDEST/wxx11/rpm-root
351
352 if [ ! -d $WXDEST ]; then
353 mkdir $WXDEST
354 fi
355
356 rm -f -r $WXDEST/wxx11
357 mkdir $WXDEST/wxx11
358 mkdir $WXDEST/wxx11/release
359 mkdir $RPM_ROOT
360
361 cd $WXSRC
362 cd locale
363 make allmo
364 cd $WXDEST/wxx11/release
365 echo Configuring...
366 $WXSRC/configure --with-x11 --no-recursion
367 echo Making...
368 make -j1 dist bzip-dist-only
369
370 if [ "$NORPMS" != "1" ]
371 then
372
373 echo Setting up RPM build dir $RPM_ROOT...
374 rm -f -r $RPM_ROOT
375 mkdir $RPM_ROOT
376 mkdir $RPM_ROOT/BUILD
377 mkdir $RPM_ROOT/RPMS
378 mkdir $RPM_ROOT/RPMS/i386
379 mkdir $RPM_ROOT/RPMS/i686
380 mkdir $RPM_ROOT/RPMS/noarch
381 mkdir $RPM_ROOT/SOURCES
382 mkdir $RPM_ROOT/SPECS
383 mkdir $RPM_ROOT/SRPMS
384
385 echo %_topdir $RPM_ROOT > ~/.rpmmacros
386
387 echo Copying wxX11-$WXVER.tar.bz2 to $RPM_ROOT/SOURCES...
388 cp wxX11-$WXVER.tar.bz2 $RPM_ROOT/SOURCES
389 echo Copying wxX11.spec to $RPM_ROOT/SPECS...
390 cp $WXSRC/wxX11.spec $RPM_ROOT/SPECS
391
392 echo Starting wxX11 RPM build...
393 cd $RPM_ROOT
394 rpmbuild -ba SPECS/wxX11.spec 2>&1 | tee wxX11.out
395
396 echo Finished wxX11 RPM build, in $RPM_ROOT.
397 echo "SRPMS:"
398 ls SRPMS
399 echo "RPMS/i386:"
400 ls RPMS/i386
401
402 cp $RPM_ROOT/SRPMS/*.rpm $WXDEST
403 cp $RPM_ROOT/RPMS/i386/*.rpm $WXDEST
404
405 fi
406
407 cp $WXDEST/wxx11/release/*.tar.gz $WXDEST
408 cp $WXDEST/wxx11/release/*.tar.bz2 $WXDEST
409
410 # rm -f -r $WXDEST/wxx11
411 echo Now try the RPMs with rpm -i.
412 }
413
414 PROGNAME=$0
415 WXSRC=$1
416 WXDEST=$2
417 WXVER=$3
418
419 SPINWXX11=0
420 SPINWXGTK1=0
421 SPINWXGTK2=0
422 SPINWXGTK2UNICODE=0
423 SPINWXMAC=0
424 SPINWXMOTIF=0
425 SPINWXBASE=0
426 SPINWXBASEUNICODE=0
427 SPINWXMGL=0
428 SPINEVERYTHING=0
429 UPDATECVS=0
430
431 usage()
432 {
433 echo Usage: $PROGNAME "src-dir dest-dir version-number [ options ]"
434 echo Options:
435 echo " --help Display this help message"
436 echo " --wxgtk1 Spin wxGTK1 RPMs"
437 echo " --wxgtk2 Spin wxGTK2 RPMs"
438 echo " --wxgtk2unicode Spin wxGTK2 Unicode RPMs"
439 echo " --wxbase Spin wxBase RPMs"
440 echo " --wxbaseunicode Spin wxBase Unicode RPMs"
441 echo " --wxx11 Spin wxX11 RPMs"
442 echo " --wxmotif Spin wxMotif RPMs"
443 echo " --wxmgl Spin wxMGL RPMs"
444 echo " --wxmac Make wxMac tarball"
445 echo " --all Spin EVERYTHING"
446 echo " --updatecvs Update from CVS"
447 echo " --norpms No RPMS, just tarballs"
448
449 exit 1
450 }
451
452 init=""
453 if [ "$1" = "" ]
454 then
455 usage
456 exit
457 fi
458
459 if [ "$2" = "" ]
460 then
461 usage
462 exit
463 fi
464
465 if [ "$3" = "" ]
466 then
467 usage
468 exit
469 fi
470
471 # Process command line options.
472 shift 3
473 for i in "$@"; do
474 case "$i" in
475 --wxx11) SPINWXX11=1 ;;
476 --wxgtk1) SPINWXGTK1=1 ;;
477 --wxgtk2) SPINWXGTK2=1 ;;
478 --wxgtk2unicode) SPINWXGTK2UNICODE=1 ;;
479 --wxmotif) SPINWXMOTIF=1 ;;
480 --wxmgl) SPINWXMGL=1 ;;
481 --wxmac) SPINWXMAC=1 ;;
482 --wxbase) SPINWXBASE=1 ;;
483 --wxbaseunicode) SPINWXBASEUNICODE=1 ;;
484 --all) SPINEVERYTHING=1 ;;
485 --updatecvs) UPDATECVS=1 ;;
486 --norpms) NORPMS=1 ;;
487 *)
488 usage
489 exit
490 ;;
491 esac
492 done
493
494 echo About to make wxWidgets RPMs:
495 echo From $WXSRC
496 echo To $WXDEST
497 echo Version $WXVER
498 echo CTRL-C if this is not correct.
499 read dummy
500
501 if [ "$UPDATECVS" = "1" ]; then
502 doupdatecvs
503 fi
504
505 if [ "$SPINWXX11" = "1" ] || [ "$SPINEVERYTHING" = "1" ]; then
506 dospinwxx11
507 fi
508
509 if [ "$SPINWXGTK1" = "1" ] || [ "$SPINEVERYTHING" = "1" ]; then
510 RPMBUILDARGS="--without gtk2"
511 PLATFORM=gtk1
512 dospinwxgtk
513 fi
514
515 if [ "$SPINWXGTK2" = "1" ] || [ "$SPINEVERYTHING" = "1" ]; then
516 RPMBUILDARGS="--with gtk2"
517 PLATFORM=gtk2
518 dospinwxgtk
519 fi
520
521 if [ "$SPINWXGTK2UNICODE" = "1" ] || [ "$SPINEVERYTHING" = "1" ]; then
522 RPMBUILDARGS="--with gtk2 --with unicode"
523 PLATFORM=gtk2unicode
524 dospinwxgtk
525 fi
526
527 if [ "$SPINWXBASE" = "1" ] || [ "$SPINEVERYTHING" = "1" ]; then
528 PLATFORM=base
529 dospinwxbase
530 fi
531
532 if [ "$SPINWXBASEUNICODE" = "1" ] || [ "$SPINEVERYTHING" = "1" ]; then
533 RPMBUILDARGS="--with unicode"
534 PLATFORM=baseunicode
535 dospinwxbase
536 fi
537
538 if [ "$SPINWXMOTIF" = "1" ] || [ "$SPINEVERYTHING" = "1" ]; then
539 dospinwxmotif
540 fi
541
542 if [ "$SPINWXMGL" = "1" ] || [ "$SPINEVERYTHING" = "1" ]; then
543 dospinwxmgl
544 fi
545
546 if [ "$SPINWXMAC" = "1" ]; then
547 dospinwxmac
548 fi
549