]> git.street.me.uk Git - andy/viking.git/blame - win32/prepare.bat
Fix potential unnecessary exit in trying to handle spawning of external command.
[andy/viking.git] / win32 / prepare.bat
CommitLineData
b1a8def8
RN
1@echo OFF\r
2::\r
3:: Setup wget first - this has to be done manually\r
4:: http://gnuwin32.sourceforge.net/packages/wget.htm\r
5:: http://downloads.sourceforge.net/gnuwin32/wget-1.11.4-1-setup.exe\r
6::\r
7:: Simple script to check required built environment in default locations\r
8:: Versions downloaded are specified absolutely as otherwise it's tricky to try and work out the latest/stable version\r
9:: In principal the idea is to try and automate the process as much as possible\r
10::\r
11set PATH=%PATH%;%ProgramFiles%\GnuWin32\bin\r
12\r
13set MINGW=%SystemDrive%\MinGW\r
14set MINGW_BIN=%MinGW%\bin\r
15\r
16set ERRORLEVEL=0\r
17\r
18if not exist cache mkdir cache\r
19pushd cache\r
20\r
21echo =+=+=\r
22echo Checking mingw...\r
23echo =+=+=\r
24set MINGW_EXE=MinGW-5.1.6.exe\r
25set BIN_UTILS=binutils-2.19.1-mingw32-bin.tar.gz\r
26set GCC_CORE=gcc-core-3.4.5-20060117-3.tar.gz\r
27set GCC_GPP=gcc-g++-3.4.5-20060117-3.tar.gz\r
28set MINGWRTDLL=mingwrt-3.15.2-mingw32-dll.tar.gz\r
29set MINGWRTDEV=mingwrt-3.15.2-mingw32-dll.tar.gz\r
30set W32API=w32api-3.13-mingw32-dev.tar.gz\r
31\r
32if not exist "%MINGW_BIN%" (\r
33 :: Here we download all default components manually in an attempt to get autoinstall to work...\r
34 if not exist %MINGW_EXE% (\r
35 wget "http://sourceforge.net/projects/mingw/files/OldFiles/MinGW 5.1.6/%MINGW_EXE%"\r
36 )\r
37 if not exist %BIN_UTILS% (\r
38 wget "http://sourceforge.net/projects/mingw/files/MinGW/Base/binutils/binutils-2.19.1/%BIN_UTILS%/download"\r
39 )\r
40 if not exist %GCC_CORE% (\r
41 wget "http://sourceforge.net/projects/mingw/files/MinGW/Base/gcc/Version3/Current Release_ gcc-3.4.5-20060117-3/%GCC_CORE%/download"\r
42 )\r
43 if not exist %GCC_GPP% (\r
44 wget "http://sourceforge.net/projects/mingw/files/MinGW/Base/gcc/Version3/Current Release_ gcc-3.4.5-20060117-3/%GCC_GPP%/download"\r
45 )\r
46 if not exist %MINGWRTDEV% (\r
47 wget http://sourceforge.net/projects/mingw/files/MinGW/Base/mingw-rt/mingwrt-3.15.2/%MINGWRTDEV%/download\r
48 )\r
49 if not exist %MINGWRTDLL% (\r
50 wget http://sourceforge.net/projects/mingw/files/MinGW/Base/mingw-rt/mingwrt-3.15.2/%MINGWRTDLL%/download\r
51 )\r
52 if not exist %W32API% (\r
53 wget http://sourceforge.net/projects/mingw/files/MinGW/Base/w32api/w32api-3.13/%W32API%/download\r
54 )\r
55 :: Can't get it to silent install. As a NSIS installer it supports /S, but it doesn't seem to work - it just hangs\r
56 :: Have to click through manually\r
57 %MINGW_EXE%\r
58 if ERRORLEVEL 1 goto Error\r
59)\r
60\r
61echo =+=+=\r
62echo Checking MSYS...\r
63echo =+=+=\r
64set MSYS_EXE=MSYS-1.0.11.exe\r
65if not exist "%SystemDrive%\msys" (\r
66 if not exist %MSYS_EXE% (\r
67 wget http://downloads.sourceforge.net/mingw/%MSYS_EXE%\r
68 )\r
69 if not [%WINELOADER%]==[] (\r
70 echo Running under WINE - Requires MSYS install fixes: run msys-pi-wine.sh when msys install halts..."\r
71 echo Ctrl-C to stop and then rerun the installation if necessary\r
72 )\r
73 %MSYS_EXE% /sp- /silent\r
74 if ERRORLEVEL 1 goto Error\r
75)\r
76\r
77:: We need a program to be able to extract not only zips, but bz2 and *lzma*\r
78set PATH=%PATH%;%ProgramFiles%\7-Zip\r
79echo =+=+=\r
80echo Checking 7Zip is Available...\r
81echo =+=+=\r
82set ZIP_INST=7z920.exe\r
83if not exist "%ProgramFiles%\7-Zip\7z.exe" (\r
84 if not exist %ZIP_INST% (\r
85 wget http://downloads.sourceforge.net/sevenzip/%ZIP_INST%\r
86 )\r
87 %ZIP_INST% /S\r
88 if ERRORLEVEL 1 goto Error\r
89)\r
90\r
91::\r
92echo =+=+=\r
93echo Checking gtk+-bundle...\r
94echo =+=+=\r
95set GTK_ZIP=gtk+-bundle_2.24.10-20120208_win32.zip\r
96if not exist "%MINGW_BIN%\gtk-update-icon-cache.exe" (\r
97 if not exist %GTK_ZIP% (\r
98 wget http://ftp.gnome.org/pub/gnome/binaries/win32/gtk+/2.24/%GTK_ZIP%\r
99 )\r
100 7z x %GTK_ZIP% -o"%MinGW%"\r
101 if ERRORLEVEL 1 goto Error\r
102)\r
103\r
104set EXPAT_ZIP=expat-dev_2.0.1-1_win32.zip\r
105echo =+=+=\r
106echo Checking expat-dev...\r
107echo =+=+=\r
108if not exist "%MINGW%\include\expat.h" (\r
109 if not exist %EXPAT_ZIP% (\r
110 wget http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/%EXPAT_ZIP%\r
111 )\r
112 7z x %EXPAT_ZIP% -o"%MinGW%"\r
113 if ERRORLEVEL 1 goto Error\r
114)\r
115\r
116set GTT_ZIP=gettext-tools-dev_0.18.1.1-2_win32.zip\r
117echo =+=+=\r
118echo Checking gettext-tools-dev...\r
119echo =+=+=\r
120if not exist "%MINGW_BIN%\libgettextlib-0-18-1.dll" (\r
121 if not exist %GTT_ZIP% (\r
122 wget http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/%GTT_ZIP%\r
123 )\r
124 7z x -y %GTT_ZIP% -o"%MinGW%"\r
125 if ERRORLEVEL 1 goto Error\r
126)\r
127\r
128echo =+=+=\r
129echo Checking intltool...\r
130echo =+=+=\r
131set INTLTOOL_ZIP=intltool_0.40.4-1_win32.zip\r
132if not exist "%MINGW_BIN%\intltoolize" (\r
133 if not exist %INTLTOOL_ZIP% (\r
134 wget http://ftp.acc.umu.se/pub/GNOME/binaries/win32/intltool/0.40/%INTLTOOL_ZIP%\r
135 )\r
136 7z x %INTLTOOL_ZIP% -o"%MinGW%"\r
137 if ERRORLEVEL 1 goto Error\r
138)\r
139\r
140echo =+=+=\r
141echo Checking iconv...\r
142echo =+=+=\r
143set ICONV_ZIP=libiconv-1.9.2-1-bin.zip\r
144if not exist "%MINGW_BIN%\iconv.exe" (\r
145 if not exist %ICONV_ZIP% (\r
146 wget http://sourceforge.net/projects/gnuwin32/files/libiconv/1.9.2-1/%ICONV_ZIP%\r
147 )\r
148 7z x -y %ICONV_ZIP% -o"%MinGW%"\r
149 if ERRORLEVEL 1 goto Error\r
150)\r
151\r
152echo =+=+=\r
153echo Checking libintl...\r
154echo =+=+=\r
155:: Needed by iconv\r
156set LIBINTL_ZIP=libintl-0.14.4-bin.zip\r
157if not exist "%MINGW_BIN%\libintl3.dll" (\r
158 if not exist %LIBINTL_ZIP% (\r
159 wget http://sourceforge.net/projects/gnuwin32/files/libintl/0.14.4/%LIBINTL_ZIP%\r
160 )\r
161 7z x -y %LIBINTL_ZIP% -o"%MinGW%"\r
162 if ERRORLEVEL 1 goto Error\r
163)\r
164\r
165echo =+=+=\r
166echo Checking libcurl...\r
167echo =+=+=\r
168set CURL_TAR=libcurl-7.14.0_nossl-1sid.tar\r
169set CURL_BZ2=%CURL_TAR%.bz2\r
170if not exist "%MINGW_BIN%\libcurl.dll" (\r
171 if not exist %CURL_BZ2% (\r
172 wget http://downloads.sourceforge.net/devpaks/libcurl-7.14.0_nossl-1sid.DevPak?download\r
173 move libcurl-7.14.0_nossl-1sid.DevPak %CURL_BZ2%\r
174 )\r
175 echo Extracting libcurl...\r
176 7z e %CURL_BZ2%\r
177 7z x %CURL_TAR% -o"libcurl"\r
178 if ERRORLEVEL 1 goto Error\r
179 @echo ON\r
180 move libcurl\include "%MinGW%\include\curl\r
181 copy /Y libcurl\bin\*.* "%MinGW_BIN%"\r
182 copy /Y libcurl\lib\*.* "%MinGW%\lib"\r
183 copy /Y libcurl\docs\*.* "%MinGW%\doc"\r
184 rmdir /S /Q libcurl\r
185 del %CURL_TAR%\r
186 @echo OFF\r
187)\r
188\r
189echo =+=+=\r
190echo Checking libexif...\r
191echo =+=+=\r
192set EXIF=libexif-0.6.20_winxp_mingw\r
193set EXIF_7Z=%EXIF%.7z\r
194if not exist "%MINGW_BIN%\libexif-12.dll" (\r
195 if not exist %EXIF_7Z% (\r
196 wget "http://sourceforge.net/projects/maille/files/Extern libs/%EXIF_7Z%/download"\r
197 )\r
198 echo Extracting libexif...\r
199 7z x %EXIF_7Z%\r
200 if ERRORLEVEL 1 goto Error\r
201\r
202 echo Using *xcopy* (to get all subdirs) libexif into place...\r
203 @echo ON\r
204 xcopy /Y /S %EXIF%\*.* "%MinGW%"\r
205 rmdir /S /Q %EXIF%\r
206 @echo OFF\r
207)\r
208\r
209echo =+=+=\r
210echo Checking libstdc++...\r
211echo =+=+=\r
212set STDCPP_TAR=libstdc++-4.6.2-1-mingw32-dll-6.tar\r
213set STDCPP_LZ=%STDCPP_TAR%.lzma\r
214if not exist "%MINGW_BIN%\libstdc++-6.dll" (\r
215 if not exist %STDCPP_LZ% (\r
216 wget http://sourceforge.net/projects/mingw/files/MinGW/Base/gcc/Version4/gcc-4.6.2-1/%STDCPP_LZ%\r
217 )\r
218 echo Extracting lidstdc++...\r
219 7z e %STDCPP_LZ%\r
220 7z x %STDCPP_TAR% -o"%MinGW%"\r
221 if ERRORLEVEL 1 goto Error\r
222 del %STDCPP_TAR%\r
223)\r
224\r
225echo =+=+=\r
226echo Checking Gnome Doc Utils...\r
227echo =+=+=\r
228set GNOME_DOC_ZIP=gnome-doc-utils-0.12.0.zip\r
229if not exist "%MINGW_BIN%\gnome-doc-prepare" (\r
230 if not exist %GNOME_DOC_ZIP% (\r
231 wget http://ftp.gnome.org/pub/gnome/binaries/win32/gnome-doc-utils/0.12/%GNOME_DOC_ZIP%\r
232 )\r
233 echo Extracting Gnome Doc Utils...\r
234 7z x %GNOME_DOC_ZIP% -o"%MinGW%"\r
235 if ERRORLEVEL 1 goto Error\r
236)\r
237\r
238:: Note GPSBabel can not be directly downloaded via wget\r
239:: ATM get it manually from here:\r
240:: http://www.gpsbabel.org/download.html\r
241set GPSBABEL_INST=GPSBabel-1.4.4-Setup.exe\r
242if not exist "%ProgramFiles%\GPSBabel" (\r
243 echo Installing GPSBabel...\r
244 if exist %GPSBABEL_INST% (\r
245 %GPSBABEL_INST% /silent\r
246 if ERRORLEVEL 1 goto Error\r
247 )\r
248)\r
249\r
250echo =+=+=\r
251echo Checking Perl Installation...\r
252echo =+=+=\r
253set PERL_MSI=ActivePerl-5.14.3.1404-MSWin32-x86-296513.msi\r
254if not exist "%SystemDrive%\Perl" (\r
255 if not exist %PERL_MSI% (\r
256 wget http://downloads.activestate.com/ActivePerl/releases/5.14.3.1404/%PERL_MSI%\r
257 )\r
258 echo Installing Perl takes a little time...\r
259 msiexec /qb /i %PERL_MSI% PERL_PATH=Yes PERL_EXT=Yes\r
260 if ERRORLEVEL 1 goto Error\r
261)\r
262\r
263echo =+=+=\r
264echo Checking NSIS installed...\r
265echo =+=+=\r
266set NSIS_INST=nsis-2.46-setup.exe\r
267if not exist "%ProgramFiles%\NSIS" (\r
268 if not exist %NSIS_INST% (\r
269 wget http://prdownloads.sourceforge.net/nsis/nsis-2.46-setup.exe?download\r
270 )\r
271 echo Installing NSIS...\r
272 %NSIS_INST% /S\r
273 if ERRORLEVEL 1 goto Error\r
274)\r
275\r
276echo =+=+=\r
277echo Checking NSIS Plugins installed...\r
278echo =+=+=\r
279set FPDLLZIP=FindProc.zip\r
280if not exist "%ProgramFiles%\NSIS\Plugins\FindProcDLL.dll" (\r
281 if not exist %FPDLLZIP% (\r
282 wget http://nsis.sourceforge.net/mediawiki/images/3/3c/%FPDLLZIP%\r
283 )\r
284 echo Extracting NSIS Plugins...\r
285 7z e %FPDLLZIP% -o"%ProgramFiles%\NSIS\Plugins"\r
286 if ERRORLEVEL 1 goto Error\r
287)\r
288\r
289popd\r
290\r
291echo Fixing Perl reference\r
292REM Sadly '-i' for in place changes doesn't seem available with Windows sed 3.02\r
293set PATH=%PATH%;C:\msys\1.0\bin\r
294sed -e 's:#! /bin/perl:#! /opt/perl/bin/perl:' %MINGW_BIN%\glib-mkenums > tmp.enums\r
295if ERRORLEVEL 1 goto Error\r
296xcopy /Y tmp.enums %MINGW_BIN%\glib-mkenums\r
297if ERRORLEVEL 1 goto Error\r
298del tmp.enums\r
299\r
300:: Potentially Clean Up\r
301:: If any parameters given on the command line then remove all downloaded items\r
302:Clean\r
303if not [%1]==[] (\r
304 echo Removing downloaded files\r
305 if exist cache rmdir /S /Q cache\r
306)\r
307\r
308goto End\r
309\r
310:Error\r
311echo exitting due to error: %ERRORLEVEL%\r
312exit\r
313\r
314:End\r
315echo Finished\r