Merge build script updates from 2.8 branch.
[wxWidgets.git] / distrib / msw / makedist.sh
1 #! /bin/bash
2 # makedist.sh
3 #
4 # Build wxWidgets 2 for Windows distribution.
5 # This builds all required binaries and documents before calling
6 # zipdist.sh to make the archives.
7 #
8 # To use this script, you need:
9 #
10 # - CygWin installation, for bash etc.
11 # - VC++ 6 or higher, to compile the binaries
12 # - WinHelp compiler, HTML Help compiler, Tex2RTF on your path
13 # - WISE Install 5
14 # - Word 97 (not tested with higher versions)
15 # - Adobe Acrobat & Distiller
16 #
17 # Before running this script, you will need to:
18 #
19 # - update the readmes, change log, manual version etc.
20 # - update version.h
21 # - update distrib/msw/wisetop.txt, wisebott.txt with the correct version
22 # number, plus any hard-wired wxWidgets paths
23 # - test on a variety of compilers
24 #
25 # TODO:
26 #
27 # - generation of PDF (only PDF RTF generated so far)
28 # - perhaps prompt the user to read the important release docs,
29 # version.h, setup.h
30 #
31 # Julian Smart, October 2000
32
33 SRC=`cygpath -u $WXWIN`
34 DEST=$SRC/deliver
35 TMPDIR=`cygpath -u $TEMP`
36 OK=1
37 DOWISE=0
38 DOPDF=0
39 DOALL=1
40 DOCSONLY=0
41 WXWINONLY=0
42 WISEONLY=0
43 BINONLY=0
44 PDFONLY=0
45
46 # For some reason, if we pipe output to egrep, we see output, but not otherwise.
47 WARNINGS=": decorated name|: see reference|: see declaration|C4786|VC98\\\\INCLUDE|template<>"
48
49 setup_vars() {
50 VCPATH="/c/Program Files/Microsoft Visual Studio/common/msdev98/bin:/c/Program Files/Microsoft Visual Studio/VC98/bin:DevStudio/VC/bin:/c/Program Files/Microsoft Visual Studio/common/tools:/c/Program Files/HTML Help Workshop"
51 INCLUDE="C:\Program Files\Microsoft Visual Studio\VC98\ATL\INCLUDE;C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE;C:\Program Files\Microsoft Visual Studio\VC98\MFC\INCLUDE;C:\Program Files\Tcl\include;C:\Program Files\HTML Help Workshop\include"
52 LIB="C:\Program Files\Microsoft Visual Studio\VC98\lib;C:\Program Files\Microsoft Visual Studio\VC98\MFC\lib;C:\Program Files\Tcl\lib;C:\Program Files\HTML Help Workshop\lib"
53 TCLHOME=C:/PROGRA~1/Tcl export TCLHOME
54 PATH="$PATH:$VCPATH" export PATH
55 export INCLUDE LIB
56
57 WORDEXE="/c/Program Files/Microsoft Office/Office/WINWORD.EXE"
58 }
59
60 check_compile() {
61 egrep ": error C|fatal error" $TMPDIR/buildlog.txt > $TMPDIR/errorlog.txt
62 if [ -s $TMPDIR/errorlog.txt ]; then
63 echo Did not build $0 successfully.
64 OK=0
65 fi
66 }
67
68 check_files() {
69 if [ ! -d "$SRC" ]; then
70 echo "$SRC" does not exist.
71 OK=0
72 fi
73
74 if [ ! -d "$SRC/deliver" ]; then
75 mkdir "$SRC/deliver"
76 fi
77
78 if [ ! -e $SRC/include/wx/msw/setup.h ]; then
79 cp "$SRC/include/wx/msw/setup0.h" "$SRC/include/wx/msw/setup.h"
80 echo setup0.h has been copied to setup.h.
81 echo You must now edit this file to restore release settings,
82 echo then run this script again.
83 OK=0
84 notepad.exe "$SRC/include/wx/msw/setup.h"
85 fi
86 if [ ! -d "$SRC/bin" ]; then
87 mkdir "$SRC/bin"
88 fi
89 if [ ! -e "$SRC/bin/DBGVIEW.EXE" ]; then
90 echo Please put DBGVIEW.EXE, DBGVIEW.CNT, DBGVIEW.HLP into $SRC/bin
91 echo and run the script again.
92 OK=0
93 fi
94 }
95
96 build_docs() {
97 cd "$SRC/src/msw"
98 echo "---------------------------------"
99 echo "Building wxWidgets documents"
100 nmake -f makefile.vc cleandocs docs
101
102 cd "$SRC/utils/tex2rtf/src"
103 nmake -f makefile.vc html htmlhelp htb hlp pdfrtf
104
105 cd "$SRC/contrib/src/ogl"
106 nmake -f makefile.vc html htmlhelp htb hlp pdfrtf
107
108 cd "$SRC/contrib/src/mmedia"
109 nmake -f makefile.vc html htmlhelp htb hlp pdfrtf
110 }
111
112 # TODO: Make PDF via Word, if Word and Adobe Acrobat are present.
113 # This has to be interactive at present.
114 build_pdf() {
115 echo "---------------------------------"
116 echo "Building wxWidgets PDF documents"
117 if [ -e "$WORDEXE" ]; then
118 "$WORDEXE" "$WXWIN\\docs\\pdf\\wx.rtf"
119 "$WORDEXE" "$WXWIN\\docs\\pdf\\tex2rtf.rtf"
120 "$WORDEXE" "$WXWIN\\contrib\\docs\\pdf\\ogl.rtf"
121 "$WORDEXE" "$WXWIN\\contrib\\docs\\mmedia\\ogl.rtf"
122 else
123 echo MS Word not present. Not doing PDF build.
124 fi
125 }
126
127 # Build wxWidgets
128 build_wxwin_vc() {
129 echo "---------------------------------"
130 echo "Building wxWidgets using VC++"
131 cd "$SRC/src"
132 echo Building wxWidgets Release library in `pwd`
133 echo Command: msdev wxvc.dsw /useenv /make "wxvc - Win32 Release" /rebuild
134 msdev wxvc.dsw /useenv /make "wxvc - Win32 Release" /rebuild | egrep -v "$WARNINGS"
135 }
136
137 build_tex2rtf() {
138 echo "---------------------------------"
139 echo "Building Tex2RTF using VC++"
140 cd "$SRC/utils/tex2rtf/src"
141 msdev Tex2RTFVC.dsw /useenv /make "Tex2RTFVC - Win32 Release" /rebuild | egrep -v "$WARNINGS" | tee $TMPDIR/buildlog.txt
142
143 check_compile "Tex2RTF"
144 }
145
146 build_life() {
147 echo "---------------------------------"
148 echo "Building Life! using VC++"
149 cd "$SRC/demos/life"
150 msdev LifeVC.dsw /useenv /make "LifeVC - Win32 Release" /rebuild | egrep -v "$WARNINGS" | tee $TMPDIR/buildlog.txt
151
152 check_compile "Life! Demo"
153 }
154
155 build_executables() {
156 build_tex2rtf
157 build_life
158 }
159
160 copy_files() {
161 cp "$SRC/utils/tex2rtf/src/Release/tex2rtf.exe" "$SRC/bin"
162 cp "$SRC/docs/winhelp/tex2rtf.hlp" "$SRC/docs/winhelp/tex2rtf.cnt" "$SRC/bin"
163
164 cp "$SRC/demos/life/Release/life.exe" "$SRC/demos/life/breeder.lif" "$SRC/bin"
165 }
166
167 # Process command line options.
168 for i in "$@"; do
169 case "$i" in
170 --wise) DOWISE=1 ;;
171 --pdf) DOPDF=1 ;;
172 --wise-only)
173 WISEONLY=1
174 DOWISE=1
175 DOALL=0
176 ;;
177 --docs-only)
178 DOCSONLY=1
179 DOALL=0
180 ;;
181 --bin-only)
182 BINONLY=1
183 DOALL=0
184 ;;
185 --wxwin-only)
186 WXWINONLY=1
187 DOALL=0
188 ;;
189 --pdf-only)
190 PDFONLY=1
191 DOPDF=1
192 DOALL=0
193 ;;
194 *)
195 echo Usage: $0 "[ options ]"
196 echo Generates documentation and binaries for creating a distribution,
197 echo and optionally generates the zip/setup.exe distribution by
198 echo calling zipdist.sh.
199 echo
200 echo Options:
201 echo " --help Display this help message"
202 echo " --wise Additonally, build zips and setup.exe"
203 echo " --pdf Additionally, try to generate PDF"
204 echo " --wise-only Only do zip/setup phase"
205 echo " --wxwin-only Only do wxWin lib building phase"
206 echo " --docs-only Only do docs building phase"
207 echo " --pdf-only Only do PDF building phase"
208 echo " --bin-only Only do .exe building phase"
209 exit 1
210 ;;
211 esac
212 done
213
214 mkdir -p $SRC/docs/pdf
215 mkdir -p $SRC/docs/html
216 mkdir -p $SRC/docs/htmlhelp
217 mkdir -p $SRC/docs/htb
218 mkdir -p $SRC/docs/winhelp
219 mkdir -p $SRC/contrib/docs/pdf
220 mkdir -p $SRC/contrib/docs/html
221 mkdir -p $SRC/contrib/docs/htmlhelp
222 mkdir -p $SRC/contrib/docs/htb
223 mkdir -p $SRC/contrib/docs/winhelp
224
225 setup_vars
226 check_files
227
228 if [ "$OK" = "1" ]; then
229 if [ "$DOCSONLY" = "1" ] || [ "$DOALL" = "1" ]; then
230 build_docs
231 fi
232 fi
233
234 if [ "$OK" = "1" ] && [ "$DOPDF" = "1" ]; then
235 if [ "$PDFONLY" = "1" ] || [ "$DOALL" = "1" ]; then
236 build_pdf
237 fi
238 fi
239
240 if [ "$OK" = "1" ]; then
241 if [ "$WXWINONLY" = "1" ] || [ "$DOALL" = "1" ]; then
242 build_wxwin_vc
243 fi
244 fi
245
246 if [ "$OK" = "1" ]; then
247 if [ "$BINONLY" = "1" ] || [ "$DOALL" = "1" ]; then
248 build_executables
249 fi
250 fi
251
252 if [ "$OK" = "1" ]; then
253 copy_files
254 fi
255
256 if [ "$OK" = "1" ] && [ "$DOWISE" = "1" ]; then
257 if [ "$WISEONLY" = "1" ] || [ "$DOALL" = "1" ]; then
258 $SRC/distrib/msw/zipdist.sh --wise
259 fi
260 fi
261
262 if [ "$OK" = "1" ]; then
263 echo Finished successfully.
264 else
265 echo Finished unsuccessfully. There were errors.
266 fi
267
268 echo Press return to continue.
269 read dummy
270