Stop building on a platform as soon as a tarball build error is encountered.
[wxWidgets.git] / distrib / scripts / mac / tardist
1 #!/bin/sh
2 # tardist: make up a tar.gz distribution of wxWidgets 2
3 # Supply a source (e.g. ~/wx2) and destination (e.g. ~/wx2/deliver)
4
5 # We can't use e.g. this:
6 # ls `cat $SRC/distrib/msw/makefile.rsp` zip -@ -u $DEST/wxWidgets-$VERSION-gen.zip
7 # because there's not enough space on the command line, plus we need to ignore the
8 # blank lines.
9
10 set -o errexit
11
12 PROGNAME=$0
13 WXSRC=$1
14 WXDEST=$2
15 WXVER=$3
16
17 # for docopyreadmefiles and docopysetup_h
18 SCRIPTDIR=$WXSRC/distrib/scripts
19 . $SCRIPTDIR/utils.inc
20
21 TAR=tar
22 ARCH=`arch`
23 if [ "$ARCH" = "ppc" ]; then
24   TAR=gnutar
25 fi
26
27 expandlines()
28 {
29     toexpand=$1
30     outputfile=$2
31
32     rm -f $outputfile
33     touch $outputfile
34     for line in `cat $toexpand` ; do
35       if [ "$line" != "" ]; then
36         ls $line >> $outputfile
37       fi
38     uniq < $outputfile > /tmp/uniqtemp.txt
39     mv /tmp/uniqtemp.txt $outputfile
40     done
41 }
42
43 doinit()
44 {
45   cd $WXSRC
46   echo Removing backup files...
47   rm *~ */*~ */*/*~ */*/*/*~ */*/*/*/*~
48
49   rm -f $WXDEST/wx*-${WXVER}*.tar.gz
50   # Copy setup files
51   cp $WXSRC/include/wx/msw/setup0.h $WXSRC/include/wx/msw/setup.h
52   cp $WXSRC/include/wx/univ/setup0.h $WXSRC/include/wx/univ/setup.h
53
54   # Copy readme and other files
55   docopydocs $WXSRC $WXDEST
56
57   # Make .mo files
58   cd $WXSRC/locale
59   make allmo
60 }
61
62 dospinwxmac()
63 {
64 echo Tarring wxMac...
65 ### wxMac
66 cp $WXSRC/include/wx/mac/setup0.h $WXSRC/include/wx/setup.h
67 cp $WXSRC/include/wx/mac/setup0.h $WXSRC/include/wx/mac/setup.h
68 cd $WXSRC
69 cat $SCRIPTDIR/manifests/mac.rsp $SCRIPTDIR/manifests/cocoa.rsp $SCRIPTDIR/manifests/generic.rsp $SCRIPTDIR/manifests/cw_mac.rsp $SCRIPTDIR/manifests/tex2rtf.rsp $SCRIPTDIR/manifests/utils.rsp $SCRIPTDIR/manifests/ogl.rsp $SCRIPTDIR/manifests/stc.rsp $SCRIPTDIR/manifests/xml.rsp $SCRIPTDIR/manifests/contrib.rsp $SCRIPTDIR/manifests/deprecated.rsp $SCRIPTDIR/manifests/makefile.rsp $SCRIPTDIR/manifests/tiff.rsp $SCRIPTDIR/manifests/jpeg.rsp > /tmp/wxmac_in.txt
70 expandlines /tmp/wxmac_in.txt /tmp/wxmac.txt
71 $TAR cf $WXDEST/wxMac-${WXVER}.tar -T /tmp/wxmac.txt
72
73 rm -f $WXSRC/include/wx/setup.h
74
75 echo Re-tarring wxMac in a subdirectory...
76 cd $WXDEST
77 mkdir wxMac-${WXVER}
78 cd wxMac-${WXVER}
79
80 $TAR xf ../wxMac-${WXVER}.tar
81 rm -f -r contrib/src/mmedia contrib/samples/mmedia
82 echo Copying readme files...
83 cp $WXSRC/docs/mac/readme.txt README-MAC.txt
84 cp $WXSRC/docs/mac/install.txt INSTALL-MAC.txt
85
86 cd ..
87 rm -f wxMac-${WXVER}.tar
88 $TAR cf $WXDEST/wxMac-${WXVER}.tar wxMac-${WXVER}/*
89 rm -f -r wxMac-${WXVER}
90 gzip $WXDEST/wxMac-${WXVER}.tar
91 }
92
93 ### wxUniv: universal-specific files
94 #cd $WXSRC
95 #cat $SCRIPTDIR/manifests/univ.rsp > /tmp/wxuniv_in.txt
96 #expandlines /tmp/wxuniv_in.txt /tmp/wxuniv.txt
97 #$TAR cf $WXDEST/wxWidgets-${WXVER}-Univ.tar -T /tmp/wxuniv.txt
98 #
99 #echo Re-tarring wxUniversal in a subdirectory...
100 #cd $WXDEST
101 #mkdir wxWidgets-${WXVER}
102 #cd wxWidgets-${WXVER}
103 #$TAR xf ../wxWidgets-${WXVER}-Univ.tar
104 #cd ..
105 #rm -f wxWidgets-${WXVER}-Univ.tar
106 #$TAR cf $WXDEST/wxWidgets-${WXVER}-Univ.tar wxWidgets-${WXVER}/*
107 #rm -f -r wxWidgets-${WXVER}
108 #gzip $WXDEST/wxWidgets-${WXVER}-Univ.tar
109
110 dospinwxall()
111 {
112 echo Tarring wxAll...
113
114 ### wxAll: all distributions in one giant archive
115 cd $WXSRC
116 cat $SCRIPTDIR/manifests/generic.rsp $SCRIPTDIR/manifests/msw.rsp $SCRIPTDIR/manifests/wince.rsp $SCRIPTDIR/manifests/vc.rsp $SCRIPTDIR/manifests/cw.rsp $SCRIPTDIR/manifests/cw_mac.rsp $SCRIPTDIR/manifests/gtk.rsp $SCRIPTDIR/manifests/x11.rsp $SCRIPTDIR/manifests/motif.rsp $SCRIPTDIR/manifests/mac.rsp $SCRIPTDIR/manifests/cocoa.rsp $SCRIPTDIR/manifests/os2.rsp $SCRIPTDIR/manifests/palmos.rsp $SCRIPTDIR/manifests/x11.rsp $SCRIPTDIR/manifests/univ.rsp $SCRIPTDIR/manifests/mgl.rsp $SCRIPTDIR/manifests/contrib.rsp $SCRIPTDIR/manifests/deprecated.rsp $SCRIPTDIR/manifests/utilmake.rsp $SCRIPTDIR/manifests/utils.rsp $SCRIPTDIR/manifests/mmedia.rsp $SCRIPTDIR/manifests/tex2rtf.rsp $SCRIPTDIR/manifests/stc.rsp $SCRIPTDIR/manifests/xml.rsp $SCRIPTDIR/manifests/ogl.rsp $SCRIPTDIR/manifests/makefile.rsp $SCRIPTDIR/manifests/tiff.rsp $SCRIPTDIR/manifests/jpeg.rsp $SCRIPTDIR/manifests/docsrc.rsp | uniq > /tmp/wxall_in.txt
117 expandlines /tmp/wxall_in.txt /tmp/wxall.txt
118 $TAR cf $WXDEST/wxWidgets-${WXVER}.tar -T /tmp/wxall.txt
119
120 echo Re-tarring wxAll in a subdirectory...
121 cd $WXDEST
122 mkdir wxWidgets-${WXVER}
123
124 cd wxWidgets-${WXVER}
125
126 # If we have the full set of VC++ project files,
127 # get them
128 if [ -f $WXDEST/extra/wxWidgets-${WXVER}-VC.zip ]; then
129   unzip -o $WXDEST/extra/wxWidgets-${WXVER}-VC.zip
130 else
131   echo "Warning - did not find $WXDEST/deliver/extra/wxWidgets-${WXVER}-VC.zip"
132 fi
133
134 # If we have the full set of eVC++ project files,
135 # get them
136 if [ -f $WXDEST/extra/wxWidgets-${WXVER}-eVC.zip ]; then
137   unzip -o $WXDEST/extra/wxWidgets-${WXVER}-eVC.zip
138 else
139   echo "Warning - did not find $WXDEST/deliver/extra/wxWidgets-${WXVER}-eVC.zip"
140 fi
141
142 # If we have the full set of DMC project files,
143 # get them
144 if [ -f $WXDEST/extra/wxWidgets-${WXVER}-DMC.zip ]; then
145   unzip -o $WXDEST/extra/wxWidgets-${WXVER}-DMC.zip
146 else
147   echo "Warning - did not find $WXDEST/deliver/extra/wxWidgets-${WXVER}-DMC.zip"
148 fi
149
150 $TAR xf ../wxWidgets-${WXVER}.tar
151
152 # Translate all .dsp and .dsw files to DOS format
153 unix2dos --unix2dos `cat $SCRIPTDIR/manifests/vc.rsp`
154
155 cd ..
156 rm -f wxWidgets-${WXVER}.tar
157 $TAR cf $WXDEST/wxWidgets-${WXVER}.tar wxWidgets-${WXVER}/*
158 rm -f -r wxWidgets-${WXVER}
159 gzip -c $WXDEST/wxWidgets-${WXVER}.tar > $WXDEST/wxWidgets-${WXVER}.tar.gz
160 bzip2 $WXDEST/wxWidgets-${WXVER}.tar
161 }
162
163 domakedocs()
164 {
165   mkdir -p $WXSRC/docs/html/wx
166   mkdir -p $WXSRC/docs/html/tex2rtf
167   mkdir -p $WXSRC/docs/html/fl
168   mkdir -p $WXSRC/docs/html/ogl
169   mkdir -p $WXSRC/docs/htb
170
171   rm -f -r $WXSRC/docs/html/wx/*.htm*
172   rm -f -r $WXSRC/docs/htb/wx.htb
173
174   echo Making HTML wxWidgets manual...
175   cd $WXSRC/docs/latex/wx
176   cp *.gif $WXSRC/docs/html/wx
177   tex2rtf manual.tex $WXSRC/docs/html/wx/wx.htm -twice -html
178
179   echo Making HTB wxWidgets manual...
180   cd $WXSRC/docs/html/wx
181   zip -q $WXSRC/docs/htb/wx.htb *.html *.gif *.hhp *.hhc *.hhk
182
183   echo Done making manuals.
184 }
185
186 init=""
187 if [ "$1" = "" ]
188 then
189   echo Usage: tardist wx-dir output-dir version
190   exit
191 fi
192
193 if [ "$2" = "" ]
194 then
195   echo Usage: tardist wx-dir output-dir version
196   exit
197 fi
198
199 if [ "$3" = "" ]
200 then
201   echo Usage: tardist wx-dir output-dir version
202   exit
203 fi
204
205 SPINWXALL=0
206 SPINWXMAC=0
207 SPINEVERYTHING=0
208 SILENT=0
209
210 usage()
211 {
212     echo Usage: $PROGNAME "src-dir dest-dir version-number [ options ]"
213     echo Options:
214     echo "    --help         Display this help message"
215     echo "    --wxall        Spin wxAll"
216     echo "    --wxmac        Spin wxMac"
217     echo "    --all          Spin EVERYTHING"
218     echo "    --silent       Don't ask for confirmation before running"
219
220     exit 1
221 }
222
223 # Process command line options.
224 shift 3
225 for i in "$@"; do
226     case "$i" in
227         --wxall) SPINWXALL=1 ;;
228         --wxmac) SPINWXMAC=1 ;;
229         --all) SPINEVERYTHING=1 ;;
230         --silent) SILENT=1 ;;
231         *)
232             usage
233             exit
234             ;;
235     esac
236 done
237
238 if [ "$SILENT" = "0" ]; then
239   echo About to archive wxWidgets:
240   echo   From    $WXSRC
241   echo   To      $WXDEST
242   echo   Version $WXVER
243   echo CTRL-C if this is not correct.
244   read dummy
245 fi
246
247 doinit
248
249 if [ "$SPINWXMAC" = "1" ] || [ "$SPINEVERYTHING" = "1" ]; then
250   dospinwxmac
251 fi
252
253 if [ "$SPINWXALL" = "1" ] || [ "$SPINEVERYTHING" = "1" ]; then
254   dospinwxall
255 fi
256