]> git.street.me.uk Git - andy/viking.git/blame - win32/prepare.bat
Don't need specify full path for cmd.exe in using wine
[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
7619e0e9 29set MINGWRTDEV=mingwrt-3.15.2-mingw32-dev.tar.gz\r
b1a8def8
RN
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
59a4fc6d 184 copy /Y COPYING.txt "%MinGW%\COPYING_curl.txt"\r
b1a8def8
RN
185 rmdir /S /Q libcurl\r
186 del %CURL_TAR%\r
187 @echo OFF\r
188)\r
189\r
190echo =+=+=\r
191echo Checking libexif...\r
192echo =+=+=\r
193set EXIF=libexif-0.6.20_winxp_mingw\r
194set EXIF_7Z=%EXIF%.7z\r
195if not exist "%MINGW_BIN%\libexif-12.dll" (\r
196 if not exist %EXIF_7Z% (\r
197 wget "http://sourceforge.net/projects/maille/files/Extern libs/%EXIF_7Z%/download"\r
198 )\r
199 echo Extracting libexif...\r
200 7z x %EXIF_7Z%\r
201 if ERRORLEVEL 1 goto Error\r
202\r
203 echo Using *xcopy* (to get all subdirs) libexif into place...\r
204 @echo ON\r
205 xcopy /Y /S %EXIF%\*.* "%MinGW%"\r
206 rmdir /S /Q %EXIF%\r
207 @echo OFF\r
208)\r
209\r
210echo =+=+=\r
211echo Checking libstdc++...\r
212echo =+=+=\r
213set STDCPP_TAR=libstdc++-4.6.2-1-mingw32-dll-6.tar\r
214set STDCPP_LZ=%STDCPP_TAR%.lzma\r
215if not exist "%MINGW_BIN%\libstdc++-6.dll" (\r
216 if not exist %STDCPP_LZ% (\r
217 wget http://sourceforge.net/projects/mingw/files/MinGW/Base/gcc/Version4/gcc-4.6.2-1/%STDCPP_LZ%\r
218 )\r
219 echo Extracting lidstdc++...\r
220 7z e %STDCPP_LZ%\r
221 7z x %STDCPP_TAR% -o"%MinGW%"\r
222 if ERRORLEVEL 1 goto Error\r
223 del %STDCPP_TAR%\r
224)\r
225\r
59a4fc6d
RN
226::\r
227:: Ideally building the code on Windows shouldn't need Doc Utils or the Help processor stuff\r
228:: But ATM it's too hard to avoid.\r
229::\r
b1a8def8
RN
230echo =+=+=\r
231echo Checking Gnome Doc Utils...\r
232echo =+=+=\r
233set GNOME_DOC_ZIP=gnome-doc-utils-0.12.0.zip\r
234if not exist "%MINGW_BIN%\gnome-doc-prepare" (\r
235 if not exist %GNOME_DOC_ZIP% (\r
236 wget http://ftp.gnome.org/pub/gnome/binaries/win32/gnome-doc-utils/0.12/%GNOME_DOC_ZIP%\r
237 )\r
238 echo Extracting Gnome Doc Utils...\r
239 7z x %GNOME_DOC_ZIP% -o"%MinGW%"\r
240 if ERRORLEVEL 1 goto Error\r
241)\r
242\r
59a4fc6d
RN
243echo =+=+=\r
244echo Checking xsltproc...\r
245echo =+=+=\r
246set XLST=libxslt-1.1.26.win32\r
247set XLST_ZIP=%XLST%.zip\r
248if not exist "%MINGW_BIN%\xsltproc.exe" (\r
249 if not exist %XLST_ZIP% (\r
250 wget ftp://ftp.zlatkovic.com/libxml/%XLST_ZIP%\r
251 )\r
252 echo Extracting XLST...\r
253 7z x %XLST_ZIP%\r
254 xcopy /Y /S "%XLST%\bin\*" "%MinGW_BIN%"\r
255 if ERRORLEVEL 1 goto Error\r
256 rmdir /Q /S %XLST%\r
257)\r
258\r
259echo =+=+=\r
260echo Checking xmllint...\r
261echo =+=+=\r
262set XML2=libxml2-2.7.8.win32\r
263set XML2_ZIP=%XML2%.zip\r
264if not exist "%MINGW_BIN%\xmllint.exe" (\r
265 if not exist %XML2_ZIP% (\r
266 wget ftp://ftp.zlatkovic.com/libxml/%XML2_ZIP%\r
267 )\r
268 echo Extracting xmllint...\r
269 7z x %XML2_ZIP%\r
270 xcopy /Y /S "%XML2%\bin\*" "%MinGW_BIN%"\r
271 if ERRORLEVEL 1 goto Error\r
272 rmdir /Q /S %XML2%\r
273)\r
274\r
275echo =+=+=\r
276echo Checking iconv...\r
277echo =+=+=\r
278set ICONV=iconv-1.9.2.win32\r
279set ICONV_ZIP=%ICONV%.zip\r
280if not exist "%MINGW_BIN%\iconv.dll" (\r
281 if not exist %ICONV_ZIP% (\r
282 wget ftp://ftp.zlatkovic.com/libxml/%ICONV_ZIP%\r
283 )\r
284 echo Extracting iconv...\r
285 7z x %ICONV_ZIP%\r
286 xcopy /Y /S "%ICONV%\bin\*" "%MinGW_BIN%"\r
287 if ERRORLEVEL 1 goto Error\r
288 rmdir /Q /S %ICONV%\r
289)\r
290\r
b1a8def8
RN
291:: Note GPSBabel can not be directly downloaded via wget\r
292:: ATM get it manually from here:\r
293:: http://www.gpsbabel.org/download.html\r
294set GPSBABEL_INST=GPSBabel-1.4.4-Setup.exe\r
295if not exist "%ProgramFiles%\GPSBabel" (\r
296 echo Installing GPSBabel...\r
297 if exist %GPSBABEL_INST% (\r
298 %GPSBABEL_INST% /silent\r
299 if ERRORLEVEL 1 goto Error\r
300 )\r
301)\r
302\r
303echo =+=+=\r
304echo Checking Perl Installation...\r
305echo =+=+=\r
306set PERL_MSI=ActivePerl-5.14.3.1404-MSWin32-x86-296513.msi\r
307if not exist "%SystemDrive%\Perl" (\r
308 if not exist %PERL_MSI% (\r
309 wget http://downloads.activestate.com/ActivePerl/releases/5.14.3.1404/%PERL_MSI%\r
310 )\r
311 echo Installing Perl takes a little time...\r
312 msiexec /qb /i %PERL_MSI% PERL_PATH=Yes PERL_EXT=Yes\r
313 if ERRORLEVEL 1 goto Error\r
314)\r
315\r
316echo =+=+=\r
317echo Checking NSIS installed...\r
318echo =+=+=\r
319set NSIS_INST=nsis-2.46-setup.exe\r
320if not exist "%ProgramFiles%\NSIS" (\r
321 if not exist %NSIS_INST% (\r
322 wget http://prdownloads.sourceforge.net/nsis/nsis-2.46-setup.exe?download\r
323 )\r
324 echo Installing NSIS...\r
325 %NSIS_INST% /S\r
326 if ERRORLEVEL 1 goto Error\r
327)\r
328\r
329echo =+=+=\r
330echo Checking NSIS Plugins installed...\r
331echo =+=+=\r
332set FPDLLZIP=FindProc.zip\r
333if not exist "%ProgramFiles%\NSIS\Plugins\FindProcDLL.dll" (\r
334 if not exist %FPDLLZIP% (\r
335 wget http://nsis.sourceforge.net/mediawiki/images/3/3c/%FPDLLZIP%\r
336 )\r
337 echo Extracting NSIS Plugins...\r
338 7z e %FPDLLZIP% -o"%ProgramFiles%\NSIS\Plugins"\r
339 if ERRORLEVEL 1 goto Error\r
340)\r
341\r
342popd\r
343\r
344echo Fixing Perl reference\r
345REM Sadly '-i' for in place changes doesn't seem available with Windows sed 3.02\r
346set PATH=%PATH%;C:\msys\1.0\bin\r
347sed -e 's:#! /bin/perl:#! /opt/perl/bin/perl:' %MINGW_BIN%\glib-mkenums > tmp.enums\r
348if ERRORLEVEL 1 goto Error\r
349xcopy /Y tmp.enums %MINGW_BIN%\glib-mkenums\r
350if ERRORLEVEL 1 goto Error\r
351del tmp.enums\r
352\r
353:: Potentially Clean Up\r
354:: If any parameters given on the command line then remove all downloaded items\r
355:Clean\r
356if not [%1]==[] (\r
357 echo Removing downloaded files\r
358 if exist cache rmdir /S /Q cache\r
359)\r
360\r
361goto End\r
362\r
363:Error\r
364echo exitting due to error: %ERRORLEVEL%\r
365exit\r
366\r
367:End\r
368echo Finished\r