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