]> git.street.me.uk Git - andy/viking.git/blame - win32/prepare.bat
[WINDOWS] Add libmagic DLL 5.03 for Windows build.
[andy/viking.git] / win32 / prepare.bat
CommitLineData
b1a8def8 1@echo OFF\r
ba3695b5 2:: License: CC0\r
b1a8def8
RN
3::\r
4:: Setup wget first - this has to be done manually\r
5:: http://gnuwin32.sourceforge.net/packages/wget.htm\r
6:: http://downloads.sourceforge.net/gnuwin32/wget-1.11.4-1-setup.exe\r
7::\r
8:: Simple script to check required built environment in default locations\r
9:: Versions downloaded are specified absolutely as otherwise it's tricky to try and work out the latest/stable version\r
10:: In principal the idea is to try and automate the process as much as possible\r
11::\r
12set PATH=%PATH%;%ProgramFiles%\GnuWin32\bin\r
13\r
14set MINGW=%SystemDrive%\MinGW\r
15set MINGW_BIN=%MinGW%\bin\r
16\r
17set ERRORLEVEL=0\r
18\r
19if not exist cache mkdir cache\r
20pushd cache\r
21\r
22echo =+=+=\r
23echo Checking mingw...\r
24echo =+=+=\r
25set MINGW_EXE=MinGW-5.1.6.exe\r
26set BIN_UTILS=binutils-2.19.1-mingw32-bin.tar.gz\r
27set GCC_CORE=gcc-core-3.4.5-20060117-3.tar.gz\r
28set GCC_GPP=gcc-g++-3.4.5-20060117-3.tar.gz\r
29set MINGWRTDLL=mingwrt-3.15.2-mingw32-dll.tar.gz\r
7619e0e9 30set MINGWRTDEV=mingwrt-3.15.2-mingw32-dev.tar.gz\r
b1a8def8
RN
31set W32API=w32api-3.13-mingw32-dev.tar.gz\r
32\r
33if not exist "%MINGW_BIN%" (\r
34 :: Here we download all default components manually in an attempt to get autoinstall to work...\r
35 if not exist %MINGW_EXE% (\r
36 wget "http://sourceforge.net/projects/mingw/files/OldFiles/MinGW 5.1.6/%MINGW_EXE%"\r
37 )\r
38 if not exist %BIN_UTILS% (\r
39 wget "http://sourceforge.net/projects/mingw/files/MinGW/Base/binutils/binutils-2.19.1/%BIN_UTILS%/download"\r
40 )\r
41 if not exist %GCC_CORE% (\r
42 wget "http://sourceforge.net/projects/mingw/files/MinGW/Base/gcc/Version3/Current Release_ gcc-3.4.5-20060117-3/%GCC_CORE%/download"\r
43 )\r
44 if not exist %GCC_GPP% (\r
45 wget "http://sourceforge.net/projects/mingw/files/MinGW/Base/gcc/Version3/Current Release_ gcc-3.4.5-20060117-3/%GCC_GPP%/download"\r
46 )\r
47 if not exist %MINGWRTDEV% (\r
48 wget http://sourceforge.net/projects/mingw/files/MinGW/Base/mingw-rt/mingwrt-3.15.2/%MINGWRTDEV%/download\r
49 )\r
50 if not exist %MINGWRTDLL% (\r
51 wget http://sourceforge.net/projects/mingw/files/MinGW/Base/mingw-rt/mingwrt-3.15.2/%MINGWRTDLL%/download\r
52 )\r
53 if not exist %W32API% (\r
54 wget http://sourceforge.net/projects/mingw/files/MinGW/Base/w32api/w32api-3.13/%W32API%/download\r
55 )\r
56 :: 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
57 :: Have to click through manually\r
58 %MINGW_EXE%\r
59 if ERRORLEVEL 1 goto Error\r
60)\r
61\r
62echo =+=+=\r
63echo Checking MSYS...\r
64echo =+=+=\r
65set MSYS_EXE=MSYS-1.0.11.exe\r
66if not exist "%SystemDrive%\msys" (\r
67 if not exist %MSYS_EXE% (\r
68 wget http://downloads.sourceforge.net/mingw/%MSYS_EXE%\r
69 )\r
70 if not [%WINELOADER%]==[] (\r
71 echo Running under WINE - Requires MSYS install fixes: run msys-pi-wine.sh when msys install halts..."\r
72 echo Ctrl-C to stop and then rerun the installation if necessary\r
73 )\r
74 %MSYS_EXE% /sp- /silent\r
75 if ERRORLEVEL 1 goto Error\r
76)\r
77\r
78:: We need a program to be able to extract not only zips, but bz2 and *lzma*\r
79set PATH=%PATH%;%ProgramFiles%\7-Zip\r
80echo =+=+=\r
81echo Checking 7Zip is Available...\r
82echo =+=+=\r
83set ZIP_INST=7z920.exe\r
84if not exist "%ProgramFiles%\7-Zip\7z.exe" (\r
85 if not exist %ZIP_INST% (\r
86 wget http://downloads.sourceforge.net/sevenzip/%ZIP_INST%\r
87 )\r
88 %ZIP_INST% /S\r
89 if ERRORLEVEL 1 goto Error\r
90)\r
91\r
92::\r
93echo =+=+=\r
94echo Checking gtk+-bundle...\r
95echo =+=+=\r
96set GTK_ZIP=gtk+-bundle_2.24.10-20120208_win32.zip\r
97if not exist "%MINGW_BIN%\gtk-update-icon-cache.exe" (\r
98 if not exist %GTK_ZIP% (\r
99 wget http://ftp.gnome.org/pub/gnome/binaries/win32/gtk+/2.24/%GTK_ZIP%\r
100 )\r
101 7z x %GTK_ZIP% -o"%MinGW%"\r
102 if ERRORLEVEL 1 goto Error\r
103)\r
104\r
105set EXPAT_ZIP=expat-dev_2.0.1-1_win32.zip\r
106echo =+=+=\r
107echo Checking expat-dev...\r
108echo =+=+=\r
109if not exist "%MINGW%\include\expat.h" (\r
110 if not exist %EXPAT_ZIP% (\r
111 wget http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/%EXPAT_ZIP%\r
112 )\r
113 7z x %EXPAT_ZIP% -o"%MinGW%"\r
114 if ERRORLEVEL 1 goto Error\r
115)\r
116\r
117set GTT_ZIP=gettext-tools-dev_0.18.1.1-2_win32.zip\r
118echo =+=+=\r
119echo Checking gettext-tools-dev...\r
120echo =+=+=\r
121if not exist "%MINGW_BIN%\libgettextlib-0-18-1.dll" (\r
122 if not exist %GTT_ZIP% (\r
123 wget http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/%GTT_ZIP%\r
124 )\r
125 7z x -y %GTT_ZIP% -o"%MinGW%"\r
126 if ERRORLEVEL 1 goto Error\r
127)\r
128\r
129echo =+=+=\r
130echo Checking intltool...\r
131echo =+=+=\r
132set INTLTOOL_ZIP=intltool_0.40.4-1_win32.zip\r
133if not exist "%MINGW_BIN%\intltoolize" (\r
134 if not exist %INTLTOOL_ZIP% (\r
135 wget http://ftp.acc.umu.se/pub/GNOME/binaries/win32/intltool/0.40/%INTLTOOL_ZIP%\r
136 )\r
137 7z x %INTLTOOL_ZIP% -o"%MinGW%"\r
138 if ERRORLEVEL 1 goto Error\r
139)\r
140\r
141echo =+=+=\r
142echo Checking iconv...\r
143echo =+=+=\r
144set ICONV_ZIP=libiconv-1.9.2-1-bin.zip\r
145if not exist "%MINGW_BIN%\iconv.exe" (\r
146 if not exist %ICONV_ZIP% (\r
147 wget http://sourceforge.net/projects/gnuwin32/files/libiconv/1.9.2-1/%ICONV_ZIP%\r
148 )\r
149 7z x -y %ICONV_ZIP% -o"%MinGW%"\r
150 if ERRORLEVEL 1 goto Error\r
151)\r
152\r
153echo =+=+=\r
154echo Checking libintl...\r
155echo =+=+=\r
156:: Needed by iconv\r
157set LIBINTL_ZIP=libintl-0.14.4-bin.zip\r
158if not exist "%MINGW_BIN%\libintl3.dll" (\r
159 if not exist %LIBINTL_ZIP% (\r
160 wget http://sourceforge.net/projects/gnuwin32/files/libintl/0.14.4/%LIBINTL_ZIP%\r
161 )\r
162 7z x -y %LIBINTL_ZIP% -o"%MinGW%"\r
163 if ERRORLEVEL 1 goto Error\r
164)\r
165\r
166echo =+=+=\r
167echo Checking libcurl...\r
168echo =+=+=\r
169set CURL_TAR=libcurl-7.14.0_nossl-1sid.tar\r
170set CURL_BZ2=%CURL_TAR%.bz2\r
171if not exist "%MINGW_BIN%\libcurl.dll" (\r
172 if not exist %CURL_BZ2% (\r
173 wget http://downloads.sourceforge.net/devpaks/libcurl-7.14.0_nossl-1sid.DevPak?download\r
174 move libcurl-7.14.0_nossl-1sid.DevPak %CURL_BZ2%\r
175 )\r
176 echo Extracting libcurl...\r
177 7z e %CURL_BZ2%\r
178 7z x %CURL_TAR% -o"libcurl"\r
179 if ERRORLEVEL 1 goto Error\r
180 @echo ON\r
181 move libcurl\include "%MinGW%\include\curl\r
182 copy /Y libcurl\bin\*.* "%MinGW_BIN%"\r
183 copy /Y libcurl\lib\*.* "%MinGW%\lib"\r
184 copy /Y libcurl\docs\*.* "%MinGW%\doc"\r
59a4fc6d 185 copy /Y COPYING.txt "%MinGW%\COPYING_curl.txt"\r
b1a8def8
RN
186 rmdir /S /Q libcurl\r
187 del %CURL_TAR%\r
188 @echo OFF\r
189)\r
190\r
191echo =+=+=\r
192echo Checking libexif...\r
193echo =+=+=\r
194set EXIF=libexif-0.6.20_winxp_mingw\r
195set EXIF_7Z=%EXIF%.7z\r
196if not exist "%MINGW_BIN%\libexif-12.dll" (\r
197 if not exist %EXIF_7Z% (\r
198 wget "http://sourceforge.net/projects/maille/files/Extern libs/%EXIF_7Z%/download"\r
199 )\r
200 echo Extracting libexif...\r
201 7z x %EXIF_7Z%\r
202 if ERRORLEVEL 1 goto Error\r
203\r
204 echo Using *xcopy* (to get all subdirs) libexif into place...\r
205 @echo ON\r
206 xcopy /Y /S %EXIF%\*.* "%MinGW%"\r
207 rmdir /S /Q %EXIF%\r
208 @echo OFF\r
209)\r
210\r
211echo =+=+=\r
212echo Checking libstdc++...\r
213echo =+=+=\r
214set STDCPP_TAR=libstdc++-4.6.2-1-mingw32-dll-6.tar\r
215set STDCPP_LZ=%STDCPP_TAR%.lzma\r
216if not exist "%MINGW_BIN%\libstdc++-6.dll" (\r
217 if not exist %STDCPP_LZ% (\r
218 wget http://sourceforge.net/projects/mingw/files/MinGW/Base/gcc/Version4/gcc-4.6.2-1/%STDCPP_LZ%\r
219 )\r
220 echo Extracting lidstdc++...\r
221 7z e %STDCPP_LZ%\r
222 7z x %STDCPP_TAR% -o"%MinGW%"\r
223 if ERRORLEVEL 1 goto Error\r
224 del %STDCPP_TAR%\r
225)\r
226\r
003cc4e3
RN
227echo =+=+=\r
228echo Checking libbz2 header...\r
229echo =+=+=\r
230set BZ2_TAR=bzip2-1.0.6-4-mingw32-dev.tar\r
231set BZ2_LZ=%BZ2_TAR%.lzma\r
232if not exist "%MINGW%\include\bzlib.h" (\r
233 if not exist %BZ2_LZ% (\r
234 wget "http://sourceforge.net/projects/mingw/files/MinGW/Extension/bzip2/bzip2-1.0.6-4/%BZ2_LZ%"\r
235 )\r
236 echo Extracting libbz2 header...\r
237 7z e %BZ2_LZ%\r
238 7z x %BZ2_TAR% -o"%MinGW%"\r
239 if ERRORLEVEL 1 goto Error\r
240 del %BZ2_TAR%\r
241)\r
242\r
243echo =+=+=\r
244echo Checking libbz2...\r
245echo =+=+=\r
246set BZ2DLL_TAR=libbz2-1.0.6-4-mingw32-dll-2.tar\r
247set BZ2DLL_LZ=%BZ2DLL_TAR%.lzma\r
248if not exist "%MINGW_BIN%\libbz2-2.dll" (\r
249 if not exist %BZ2DLL_LZ% (\r
250 wget "http://sourceforge.net/projects/mingw/files/MinGW/Extension/bzip2/bzip2-1.0.6-4/%BZ2DLL_LZ%"\r
251 )\r
252 echo Extracting libbz2...\r
253 7z e %BZ2DLL_LZ%\r
254 7z x %BZ2DLL_TAR% -o"%MinGW%"\r
255 if ERRORLEVEL 1 goto Error\r
256 del %BZ2DLL_TAR%\r
257)\r
258\r
498efdef
RN
259echo =+=+=\r
260echo Checking magic dev...\r
261echo =+=+=\r
262set MAGIC_ZIP=file-5.03-lib.zip\r
263if not exist "%MINGW%\include\magic.h" (\r
264 if not exist %MAGIC_ZIP% (\r
265 wget http://downloads.sourceforge.net/gnuwin32/%MAGIC_ZIP%\r
266 )\r
267 7z x %MAGIC_ZIP% -o"%MinGW%"\r
268 if ERRORLEVEL 1 goto Error\r
269)\r
270\r
271echo =+=+=\r
272echo Checking magic DLL...\r
273echo =+=+=\r
274set MAGICDLL_ZIP=file-5.03-bin.zip\r
275if not exist "%MINGW_BIN%\magic1.dll" (\r
276 if not exist %MAGICDLL_ZIP% (\r
277 wget http://downloads.sourceforge.net/gnuwin32/%MAGICDLL_ZIP%\r
278 )\r
279 7z x %MAGICDLL_ZIP% -o"%MinGW%"\r
280 if ERRORLEVEL 1 goto Error\r
281)\r
282\r
283echo =+=+=\r
284echo Checking regex DLL (required by magic)...\r
285echo =+=+=\r
286set REGDLL_ZIP=regex-2.7-bin.zip\r
287if not exist "%MINGW_BIN%\regex2.dll" (\r
288 if not exist %REGDLL_ZIP% (\r
289 wget http://downloads.sourceforge.net/gnuwin32/%REGDLL_ZIP%\r
290 )\r
291 7z x %REGDLL_ZIP% -o"%MinGW%"\r
292 if ERRORLEVEL 1 goto Error\r
293)\r
294\r
59a4fc6d
RN
295::\r
296:: Ideally building the code on Windows shouldn't need Doc Utils or the Help processor stuff\r
297:: But ATM it's too hard to avoid.\r
298::\r
b1a8def8
RN
299echo =+=+=\r
300echo Checking Gnome Doc Utils...\r
301echo =+=+=\r
302set GNOME_DOC_ZIP=gnome-doc-utils-0.12.0.zip\r
303if not exist "%MINGW_BIN%\gnome-doc-prepare" (\r
304 if not exist %GNOME_DOC_ZIP% (\r
305 wget http://ftp.gnome.org/pub/gnome/binaries/win32/gnome-doc-utils/0.12/%GNOME_DOC_ZIP%\r
306 )\r
307 echo Extracting Gnome Doc Utils...\r
308 7z x %GNOME_DOC_ZIP% -o"%MinGW%"\r
309 if ERRORLEVEL 1 goto Error\r
310)\r
311\r
59a4fc6d
RN
312echo =+=+=\r
313echo Checking xsltproc...\r
314echo =+=+=\r
315set XLST=libxslt-1.1.26.win32\r
316set XLST_ZIP=%XLST%.zip\r
317if not exist "%MINGW_BIN%\xsltproc.exe" (\r
318 if not exist %XLST_ZIP% (\r
319 wget ftp://ftp.zlatkovic.com/libxml/%XLST_ZIP%\r
320 )\r
321 echo Extracting XLST...\r
322 7z x %XLST_ZIP%\r
323 xcopy /Y /S "%XLST%\bin\*" "%MinGW_BIN%"\r
324 if ERRORLEVEL 1 goto Error\r
325 rmdir /Q /S %XLST%\r
326)\r
327\r
328echo =+=+=\r
329echo Checking xmllint...\r
330echo =+=+=\r
331set XML2=libxml2-2.7.8.win32\r
332set XML2_ZIP=%XML2%.zip\r
333if not exist "%MINGW_BIN%\xmllint.exe" (\r
334 if not exist %XML2_ZIP% (\r
335 wget ftp://ftp.zlatkovic.com/libxml/%XML2_ZIP%\r
336 )\r
337 echo Extracting xmllint...\r
338 7z x %XML2_ZIP%\r
339 xcopy /Y /S "%XML2%\bin\*" "%MinGW_BIN%"\r
340 if ERRORLEVEL 1 goto Error\r
341 rmdir /Q /S %XML2%\r
342)\r
343\r
344echo =+=+=\r
345echo Checking iconv...\r
346echo =+=+=\r
347set ICONV=iconv-1.9.2.win32\r
348set ICONV_ZIP=%ICONV%.zip\r
349if not exist "%MINGW_BIN%\iconv.dll" (\r
350 if not exist %ICONV_ZIP% (\r
351 wget ftp://ftp.zlatkovic.com/libxml/%ICONV_ZIP%\r
352 )\r
353 echo Extracting iconv...\r
354 7z x %ICONV_ZIP%\r
355 xcopy /Y /S "%ICONV%\bin\*" "%MinGW_BIN%"\r
356 if ERRORLEVEL 1 goto Error\r
357 rmdir /Q /S %ICONV%\r
358)\r
359\r
b1a8def8
RN
360:: Note GPSBabel can not be directly downloaded via wget\r
361:: ATM get it manually from here:\r
362:: http://www.gpsbabel.org/download.html\r
363set GPSBABEL_INST=GPSBabel-1.4.4-Setup.exe\r
364if not exist "%ProgramFiles%\GPSBabel" (\r
365 echo Installing GPSBabel...\r
366 if exist %GPSBABEL_INST% (\r
367 %GPSBABEL_INST% /silent\r
368 if ERRORLEVEL 1 goto Error\r
369 )\r
370)\r
371\r
372echo =+=+=\r
373echo Checking Perl Installation...\r
374echo =+=+=\r
375set PERL_MSI=ActivePerl-5.14.3.1404-MSWin32-x86-296513.msi\r
376if not exist "%SystemDrive%\Perl" (\r
377 if not exist %PERL_MSI% (\r
378 wget http://downloads.activestate.com/ActivePerl/releases/5.14.3.1404/%PERL_MSI%\r
379 )\r
380 echo Installing Perl takes a little time...\r
381 msiexec /qb /i %PERL_MSI% PERL_PATH=Yes PERL_EXT=Yes\r
382 if ERRORLEVEL 1 goto Error\r
383)\r
384\r
385echo =+=+=\r
386echo Checking NSIS installed...\r
387echo =+=+=\r
388set NSIS_INST=nsis-2.46-setup.exe\r
389if not exist "%ProgramFiles%\NSIS" (\r
390 if not exist %NSIS_INST% (\r
391 wget http://prdownloads.sourceforge.net/nsis/nsis-2.46-setup.exe?download\r
392 )\r
393 echo Installing NSIS...\r
394 %NSIS_INST% /S\r
395 if ERRORLEVEL 1 goto Error\r
396)\r
397\r
398echo =+=+=\r
399echo Checking NSIS Plugins installed...\r
400echo =+=+=\r
401set FPDLLZIP=FindProc.zip\r
402if not exist "%ProgramFiles%\NSIS\Plugins\FindProcDLL.dll" (\r
403 if not exist %FPDLLZIP% (\r
404 wget http://nsis.sourceforge.net/mediawiki/images/3/3c/%FPDLLZIP%\r
405 )\r
406 echo Extracting NSIS Plugins...\r
407 7z e %FPDLLZIP% -o"%ProgramFiles%\NSIS\Plugins"\r
408 if ERRORLEVEL 1 goto Error\r
409)\r
410\r
411popd\r
412\r
413echo Fixing Perl reference\r
414REM Sadly '-i' for in place changes doesn't seem available with Windows sed 3.02\r
415set PATH=%PATH%;C:\msys\1.0\bin\r
416sed -e 's:#! /bin/perl:#! /opt/perl/bin/perl:' %MINGW_BIN%\glib-mkenums > tmp.enums\r
417if ERRORLEVEL 1 goto Error\r
418xcopy /Y tmp.enums %MINGW_BIN%\glib-mkenums\r
419if ERRORLEVEL 1 goto Error\r
420del tmp.enums\r
421\r
422:: Potentially Clean Up\r
423:: If any parameters given on the command line then remove all downloaded items\r
424:Clean\r
425if not [%1]==[] (\r
426 echo Removing downloaded files\r
427 if exist cache rmdir /S /Q cache\r
428)\r
429\r
430goto End\r
431\r
432:Error\r
433echo exitting due to error: %ERRORLEVEL%\r
434exit\r
435\r
436:End\r
437echo Finished\r