post 2.7.1 fixes
[wxWidgets.git] / distrib / scripts / create_archives.sh
1 #!/bin/sh
2
3 # Make a distribution of an application on MSW.
4 # Example:
5 # ../distrib/msw/makesetup.sh --wxmsw --verbose &> log
6
7 # If your zip accepts Cygwin-style paths, then
8 # use cygpath, else substitute echo
9 CYGPATHPROG=cygpath
10 #CYGPATHPROG=echo
11
12 SPINMSW=0
13 SPINOS2=0
14 SPINDOCS=0
15 SPINALL=0
16 SPINWXALL=0
17 SPINBASE=0
18 GETMAKEFILES=0
19 VERBOSE=0
20 ZIPFLAGS=
21
22 PROGNAME=$0
23 ##SCRIPTDIR=$WXWIN/distrib/scripts
24 . $SCRIPTDIR/utils.inc
25
26 MANIFESTDIR=$WXWIN/distrib/scripts/manifests
27 WEBFILES=$WXWIN/../wxWebSite
28 if [ ! "$CYGPATH" = "" ]; then
29 WEBFILES=`$CYGPATH "$WEBFILES"`
30 fi
31
32 # Set this to the required version
33 if [ "$VERSION" = "" ]; then
34 VERSION=2.7.0
35 fi
36
37 getfilelist(){
38 port=$1
39 outfile=$2
40
41 filelist="base.rsp"
42 contribfiles="stc.rsp contrib.rsp ogl.rsp"
43 utilsfiles="tex2rtf.rsp utils.rsp utilmake.rsp"
44 commonfiles="generic.rsp jpeg.rsp tiff.rsp xml.rsp deprecated.rsp makefile.rsp $utilsfiles $contribfiles"
45
46 if [ ! $port = "base" ]; then
47 filelist="$filelist $commonfiles"
48 fi
49
50 if [ $port = "msw" ] || [ $port = "all" ]; then
51 filelist="$filelist msw.rsp univ.rsp vc.rsp mmedia.rsp wince.rsp dmc.rsp"
52 fi
53
54 if [ $port = "os2" ] || [ $port = "all" ]; then
55 filelist="$filelist os2.rsp"
56 fi
57
58 if [ $port = "x11" ] || [ $port = "all" ]; then
59 filelist="$filelist x11.rsp"
60 fi
61
62 if [ $port = "mgl" ] || [ $port = "all" ]; then
63 filelist="$filelist mgl.rsp"
64 fi
65
66 if [ $port = "gtk" ] || [ $port = "all" ]; then
67 filelist="$filelist gtk.rsp"
68 fi
69
70 if [ $port = "motif" ] || [ $port = "all" ]; then
71 filelist="$filelist motif.rsp"
72 fi
73
74 if [ $port = "mac" ] || [ $port = "all" ]; then
75 filelist="$filelist mac.rsp cocoa.rsp"
76 fi
77
78 if [ $port = "all" ]; then
79 filelist="$filelist gtk1.rsp palmos.rsp docsrc.rsp"
80 fi
81
82 tempfile="/tmp/wx$port.files.in"
83 rm -f $outfile
84
85 olddir=$PWD
86 cd $MANIFESTDIR
87
88 cat $filelist > $outfile
89
90 cd $olddir
91 }
92
93 copyfilelist(){
94 FILELIST=$1
95 APPDIR=$2
96 DESTDIR=$3
97
98 for line in `cat $FILELIST` ; do
99 if [ "$line" != "" ]; then
100 subdir=`dirname $line`
101 mkdir -p $DESTDIR/$subdir
102 cp -rf $APPDIR/$line $DESTDIR/$subdir
103 fi
104 done
105 }
106
107 doinit()
108 {
109 if [ "$VERBOSE" != "1" ]; then
110 ZIPFLAGS=-q
111 fi
112 }
113
114 dospinport(){
115 port=$1
116
117 case "$port" in
118 all)
119 portname=Widgets;;
120 base)
121 portname=Base;;
122 motif)
123 portname=Motif;;
124 mac)
125 portname=Mac;;
126 *)
127 portname=echo $port | tr [a-z] [A-Z];;
128 esac
129
130 echo "Creating wx$portname distribution..."
131
132 cd $APPDIR
133 portfiles="/tmp/wx$port.files"
134 getfilelist "$port" "$portfiles"
135
136 TMPFILESDIR=/tmp/wx$port/wx$portname-$VERSION
137 rm -rf $TMPFILESDIR
138 mkdir -p $TMPFILESDIR
139
140 copyfilelist $portfiles $APPDIR $TMPFILESDIR
141
142 if [ $port = "msw" ]; then
143 FILES=`find . -type f \( -path '*/CVS/*' -prune -o -exec ${SCRIPTDIR}/is_text.sh {} \; -print \)`
144 echo "$FILES" > /tmp/textfiles
145 fi
146
147 pushd /tmp/wx$port
148 # use DOS line endings for text files for MSW archives.
149 if [ $port = "msw" ]; then
150 pushd /tmp/wx$port/wx$portname-$VERSION
151 for file in `cat /tmp/textfiles`; do
152 unix2dos $file
153 done
154 popd
155 fi
156 echo "Creating wx$portname-$VERSION.zip..."
157 zip $ZIPFLAGS -r -9 $APPDIR/deliver/wx$portname-$VERSION.zip .
158 echo "Creating wx$portname-$VERSION.tar.gz..."
159 tar czf $APPDIR/deliver/wx$portname-$VERSION.tar.gz wx$portname-$VERSION
160 echo "Creating wx$portname-$VERSION.tar.bz2..."
161 tar ch wx$portname-$VERSION | bzip2 -f9 > $APPDIR/deliver/wx$portname-$VERSION.tar.bz2
162 popd
163 rm -rf /tmp/wx$port
164 rm ${portfiles}
165 # rm /tmp/textfiles
166 }
167
168 prepareforrelease()
169 {
170 pushd $APPDIR
171 echo Copying FAQ and other files from $WEBFILES
172 cp $WEBFILES/site/faq*.htm $APPDIR/docs/html
173 cp $WEBFILES/site/platform.htm $APPDIR/docs/html
174 cp $WEBFILES/site/i18n.htm $APPDIR/docs/html
175
176 echo Copying readme files...
177 cp $APPDIR/docs/msw/readme.txt README-MSW.txt
178 cp $APPDIR/docs/msw/install.txt INSTALL-MSW.txt
179 cp $APPDIR/docs/os2/install.txt INSTALL-OS2.txt
180 cp $APPDIR/docs/licence.txt LICENCE.txt
181 cp $APPDIR/docs/lgpl.txt COPYING.LIB
182 cp $APPDIR/docs/changes.txt CHANGES.txt
183 cp $APPDIR/docs/readme.txt README.txt
184
185 cp $APPDIR/docs/mgl/readme.txt $APPDIR/readme-mgl.txt
186 cp $APPDIR/docs/mgl/install.txt $APPDIR/install-mgl.txt
187
188 cp $APPDIR/docs/x11/readme.txt $APPDIR/readme-x11.txt
189 cp $APPDIR/docs/x11/install.txt $APPDIR/install-x11.txt
190
191 cp $APPDIR/docs/motif/readme.txt $APPDIR/readme-motif.txt
192 cp $APPDIR/docs/motif/install.txt $APPDIR/install-motif.txt
193
194 cp $APPDIR/docs/gtk/readme.txt $APPDIR/readme-gtk.txt
195 cp $APPDIR/docs/gtk/install.txt $APPDIR/install-gtk.txt
196
197 cp $APPDIR/docs/mac/readme.txt $APPDIR/readme-mac.txt
198 cp $APPDIR/docs/mac/install.txt $APPDIR/install-mac.txt
199
200 cp $APPDIR/docs/cocoa/readme.txt $APPDIR/readme-cocoa.txt
201 cp $APPDIR/docs/cocoa/install.txt $APPDIR/install-cocoa.txt
202
203 # Now delete a few files that are unnecessary
204 rm -f BuildCVS.txt descrip.mms
205 rm -f setup.h_vms
206 rm -f docs/html/wxbook.htm docs/html/roadmap.htm
207 rm -f -r contrib/docs/latex/ogl
208 rm -f src/mingegcs.bat
209 # rm -f *.spec
210 rm -f src/gtk/descrip.mms src/motif/descrip.mms
211
212 # Copy setup0.h files to setup.h
213 # OS/2 always built with configure now
214 # cp $APPDIR/include/wx/os2/setup0.h $APPDIR/include/wx/os2/setup.h
215 cp $APPDIR/include/wx/msw/setup0.h $APPDIR/include/wx/msw/setup.h
216 cp $APPDIR/include/wx/univ/setup0.h $APPDIR/include/wx/univ/setup.h
217
218 # Make MSW project files always have DOS line endings.
219 unix2dos `cat $MANIFESTDIR/vc.rsp`
220
221 popd
222 }
223
224 usage()
225 {
226 echo "Usage: $PROGNAME [ options ]" 1>&2
227 echo Options:
228 echo " --help Display this help message"
229 echo " --wxmac Build wxMac distribution"
230 echo " --wxmsw Build wxMSW distribution"
231 echo " --wxos2 Build wxOS2 distribution"
232 echo " --wxall Build wxAll zip distribution"
233 echo " --wxbase Build wxBase zip distribution"
234 echo " --all Build all distributions (the default)"
235 echo " --verbose Verbose zip operation"
236 exit 1
237 }
238
239 # Process command line options.
240
241 for i in "$@"; do
242
243 case "$i" in
244 --wxmac) SPINMAC=1; SPINALL=0 ;;
245 --wxmsw) SPINMSW=1; SPINALL=0 ;;
246 --wxos2) SPINOS2=1; SPINALL=0 ;;
247 --wxall) SPINWXALL=1; SPINALL=0 ;;
248 --wxbase) SPINBASE=1; SPINALL=0 ;;
249 --getmakefiles) GETMAKEFILES=1; SPINALL=0 ;;
250 --docs) SPINDOCS=1; SPINALL=0 ;;
251 --all) SPINALL=1 ;;
252 --verbose) VERBOSE=1 ;;
253 *)
254 usage
255 exit
256 ;;
257 esac
258 done
259
260
261 doinit
262 prepareforrelease
263
264 # Do OS/2 spin
265 if [ "$SPINOS2" = "1" ] || [ "$SPINALL" = "1" ]; then
266 dospinport "os2"
267 fi
268
269 # Do MSW spin
270 if [ "$SPINMSW" = "1" ] || [ "$SPINALL" = "1" ]; then
271 dospinport "msw"
272 fi
273
274 # Do wxBase spin
275 if [ "$SPINBASE" = "1" ] || [ "$SPINALL" = "1" ]; then
276 dospinport "base"
277 fi
278
279 # Do wxAll spin
280 if [ "$SPINWXALL" = "1" ] || [ "$SPINALL" = "1" ]; then
281 dospinport "all"
282 fi
283
284 if [ "$SPINALL" = "1" ]; then
285 dospinport "mgl"
286 dospinport "gtk"
287 dospinport "x11"
288 dospinport "motif"
289 dospinport "mac"
290 fi
291