]> git.street.me.uk Git - andy/viking.git/blame - win32/prepare.bat
Enable using an optional file cache for Mapnik Renderings.
[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
5f12fb6a
RN
22:: We need a program to be able to extract not only zips, but bz2 and *lzma*
23set PATH=%PATH%;%ProgramFiles%\7-Zip
24echo =+=+=
25echo Checking 7Zip is Available...
26echo =+=+=
27set ZIP_INST=7z920.exe
28if not exist "%ProgramFiles%\7-Zip\7z.exe" (
29 call :Download %ZIP_INST% http://downloads.sourceforge.net/sevenzip/%ZIP_INST%
30 %ZIP_INST% /S
31 if ERRORLEVEL 1 goto Error
32)
33
b1a8def8
RN
34echo =+=+=\r
35echo Checking mingw...\r
36echo =+=+=\r
5f12fb6a
RN
37set MINGW_BASE_URL=http://sourceforge.net/projects/mingw/files/MinGW/Base
38set BIN_UTILS_LZ=binutils-2.23.2-1-mingw32-bin.tar.lzma
39set BIN_UTILS_URL=%MINGW_BASE_URL%/binutils/binutils-2.23.2-1/%BIN_UTILS_LZ%/download
40::GCC dependencies::
41set MPC_DEV_LZ=mpc-1.0.1-2-mingw32-dev.tar.lzma
42set MPC_DEV_URL=%MINGW_BASE_URL%/mpc/mpc-1.0.1-2/%MPC_DEV_LZ%/download
43set MPC_DLL_LZ=mpc-1.0.1-2-mingw32-dll.tar.lzma
44set MPC_DLL_URL=%MINGW_BASE_URL%/mpc/mpc-1.0.1-2/%MPC_DLL_LZ%/download
45set MPFR_DEV_LZ=mpfr-3.1.2-2-mingw32-dev.tar.lzma
46set MPFR_DEV_URL=%MINGW_BASE_URL%/mpfr/mpfr-3.1.2-2/%MPFR_DEV_LZ%/download
47set MPFR_DLL_LZ=mpfr-3.1.2-2-mingw32-dll.tar.lzma
48set MPFR_DLL_URL=%MINGW_BASE_URL%/mpfr/mpfr-3.1.2-2/%MPFR_DLL_LZ%/download
49set GMP_DEV_LZ=gmp-5.1.2-1-mingw32-dev.tar.lzma
50set GMP_DEV_URL=%MINGW_BASE_URL%/gmp/gmp-5.1.2/%GMP_DEV_LZ%/download
51set GMP_DLL_LZ=gmp-5.1.2-1-mingw32-dll.tar.lzma
52set GMP_DLL_URL=%MINGW_BASE_URL%/gmp/gmp-5.1.2/%GMP_DLL_LZ%/download
53set PTHREADS_DEV_LZ=pthreads-w32-2.9.1-1-mingw32-dev.tar.lzma
54set PTHREADS_DEV_URL=%MINGW_BASE_URL%/pthreads-w32/pthreads-w32-2.9.1/%PTHREADS_DEV_LZ%/download
55set PTHREADS_DLL_LZ=pthreads-w32-2.9.1-1-mingw32-dll.tar.lzma
56set PTHREADS_DLL_URL=%MINGW_BASE_URL%/pthreads-w32/pthreads-w32-2.9.1/%PTHREADS_DLL_LZ%/download
57set ICONV_DEV_LZ=libiconv-1.14-3-mingw32-dev.tar.lzma
58set ICONV_DEV_URL=%MINGW_BASE_URL%/libiconv/libiconv-1.14-3/%ICONV_DEV_LZ%/download
59set ICONV_DLL_LZ=libiconv-1.14-3-mingw32-dll.tar.lzma
60set ICONV_DLL_URL=%MINGW_BASE_URL%/libiconv/libiconv-1.14-3/%ICONV_DLL_LZ%/download
61set GCC_CORE_BIN_LZ=gcc-core-4.8.1-4-mingw32-bin.tar.lzma
62set GCC_CORE_BIN_URL=%MINGW_BASE_URL%/gcc/Version4/gcc-4.8.1-4/%GCC_CORE_BIN_LZ%/download
63set GCC_CORE_DEV_LZ=gcc-core-4.8.1-4-mingw32-dev.tar.lzma
64set GCC_CORE_DEV_URL=%MINGW_BASE_URL%/gcc/Version4/gcc-4.8.1-4/%GCC_CORE_DEV_LZ%/download
65set GCC_CORE_DLL_LZ=gcc-core-4.8.1-4-mingw32-dll.tar.lzma
66set GCC_CORE_DLL_URL=%MINGW_BASE_URL%/gcc/Version4/gcc-4.8.1-4/%GCC_CORE_DLL_LZ%/download
67set MINGWRTDLL_LZ=mingwrt-4.0.3-1-mingw32-dll.tar.lzma
68set MINGWRTDLL_URL=%MINGW_BASE_URL%/mingw-rt/mingwrt-4.0.3/%MINGWRTDLL_LZ%/download
69set MINGWRTDEV_LZ=mingwrt-4.0.3-1-mingw32-dev.tar.lzma
70set MINGWRTDEV_URL=%MINGW_BASE_URL%/mingw-rt/mingwrt-4.0.3/%MINGWRTDEV_LZ%/download
71set W32API_LZ=w32api-4.0.3-1-mingw32-dev.tar.lzma
72set W32API_URL=%MINGW_BASE_URL%/w32api/w32api-4.0.3/%W32API_LZ%/download
73set ZLIB_LZ=zlib-1.2.8-1-mingw32-dll.tar.lzma
74set ZLIB_URL=%MINGW_BASE_URL%/zlib/zlib-1.2.8/%ZLIB_LZ%/download
75set GETTEXT_LZ=gettext-0.18.3.1-1-mingw32-dll.tar.lzma
76set GETTEXT_URL=%MINGW_BASE_URL%/gettext/gettext-0.18.3.1-1/%GETTEXT_LZ%/download
b1a8def8
RN
77\r
78if not exist "%MINGW_BIN%" (\r
79 :: Here we download all default components manually in an attempt to get autoinstall to work...\r
5f12fb6a
RN
80 call :Download "%BIN_UTILS_LZ%" "%BIN_UTILS_URL%"
81 call :InstallLZMA "%BIN_UTILS_LZ%"
82
83 call :Download "%MPC_DLL_LZ%" "%MPC_DLL_URL%"
84 call :InstallLZMA "%MPC_DLL_LZ%"
85
86 call :Download "%MPC_DEV_LZ%" "%MPC_DEV_URL%"
87 call :InstallLZMA "%MPC_DEV_LZ%"
88
89 call :Download "%MPFR_DLL_LZ%" "%MPFR_DLL_URL%"
90 call :InstallLZMA "%MPFR_DLL_LZ%"
91
92 call :Download "%MPFR_DEV_LZ%" "%MPFR_DEV_URL%"
93 call :InstallLZMA "%MPFR_DEV_LZ%"
94
95 call :Download "%GMP_DEV_LZ%" "%GMP_DEV_URL%"
96 call :InstallLZMA "%GMP_DEV_LZ%"
97
98 call :Download "%GMP_DLL_LZ%" "%GMP_DLL_URL%"
99 call :InstallLZMA "%GMP_DLL_LZ%"
100
101 call :Download "%PTHREADS_DLL_LZ%" "%PTHREADS_DLL_URL%"
102 call :InstallLZMA "%PTHREADS_DLL_LZ%"
103
104 call :Download "%PTHREADS_DEV_LZ%" "%PTHREADS_DEV_URL%"
105 call :InstallLZMA "%PTHREADS_DEV_LZ%"
106
107 call :Download "%ICONV_DEV_LZ%" "%ICONV_DEV_URL%"
108 call :InstallLZMA "%ICONV_DEV_LZ%"
109
110 call :Download "%ICONV_DLL_LZ%" "%ICONV_DLL_URL%"
111 call :InstallLZMA "%ICONV_DLL_LZ%"
112
113 call :Download "%GCC_CORE_DEV_LZ%" "%GCC_CORE_DEV_URL%"
114 call :InstallLZMA "%GCC_CORE_DEV_LZ%"
115
116 call :Download "%GCC_CORE_DLL_LZ%" "%GCC_CORE_DLL_URL%"
117 call :InstallLZMA "%GCC_CORE_DLL_LZ%"
118
119 call :Download "%GCC_CORE_BIN_LZ%" "%GCC_CORE_BIN_URL%"
120 call :InstallLZMA "%GCC_CORE_BIN_LZ%"
121
122 call :Download "%MINGWRTDEV_LZ%" "%MINGWRTDEV_URL%"
123 call :InstallLZMA "%MINGWRTDEV_LZ%"
124
125 call :Download "%MINGWRTDLL_LZ%" "%MINGWRTDLL_URL%"
126 call :InstallLZMA "%MINGWRTDLL_LZ%"
127
128 call :Download "%W32API_LZ%" "%W32API_URL%"
129 call :InstallLZMA "%W32API_LZ%"
130
131 call :Download "%ZLIB_LZ%" "%ZLIB_URL%"
132 call :InstallLZMA "%ZLIB_LZ%"
133
134 call :Download "%GETTEXT_LZ%" "%GETTEXT_URL%"
135 call :InstallLZMA "%GETTEXT_LZ%"
b1a8def8
RN
136)\r
137\r
138echo =+=+=\r
139echo Checking MSYS...\r
140echo =+=+=\r
141set MSYS_EXE=MSYS-1.0.11.exe\r
142if not exist "%SystemDrive%\msys" (\r
143 if not exist %MSYS_EXE% (\r
144 wget http://downloads.sourceforge.net/mingw/%MSYS_EXE%\r
145 )\r
5f12fb6a 146 if not [%WINELOADERNOEXEC%]==[] (
b1a8def8
RN
147 echo Running under WINE - Requires MSYS install fixes: run msys-pi-wine.sh when msys install halts..."\r
148 echo Ctrl-C to stop and then rerun the installation if necessary\r
149 )\r
150 %MSYS_EXE% /sp- /silent\r
151 if ERRORLEVEL 1 goto Error\r
152)\r
153\r
b1a8def8
RN
154::\r
155echo =+=+=\r
156echo Checking gtk+-bundle...\r
157echo =+=+=\r
158set GTK_ZIP=gtk+-bundle_2.24.10-20120208_win32.zip\r
159if not exist "%MINGW_BIN%\gtk-update-icon-cache.exe" (\r
5f12fb6a
RN
160 call :Download %GTK_ZIP% http://ftp.gnome.org/pub/gnome/binaries/win32/gtk+/2.24/%GTK_ZIP%
161 7z x %GTK_ZIP% -o"%MinGW%" -y
b1a8def8
RN
162 if ERRORLEVEL 1 goto Error\r
163)\r
164\r
165set EXPAT_ZIP=expat-dev_2.0.1-1_win32.zip\r
166echo =+=+=\r
167echo Checking expat-dev...\r
168echo =+=+=\r
169if not exist "%MINGW%\include\expat.h" (\r
5f12fb6a 170 call :Download %EXPAT_ZIP% http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/%EXPAT_ZIP%
b1a8def8
RN
171 7z x %EXPAT_ZIP% -o"%MinGW%"\r
172 if ERRORLEVEL 1 goto Error\r
173)\r
174\r
5f12fb6a
RN
175::set GTT_ZIP=gettext-tools-dev_0.18.1.1-2_win32.zip
176::echo =+=+=
177::echo Checking gettext-tools-dev...
178::echo =+=+=
179::if not exist "%MINGW_BIN%\libgettextlib-0-18-1.dll" (
180:: if not exist %GTT_ZIP% (
181:: wget http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/%GTT_ZIP%
182:: )
183:: 7z x -y %GTT_ZIP% -o"%MinGW%"
184:: if ERRORLEVEL 1 goto Error
185::)
b1a8def8
RN
186\r
187echo =+=+=\r
188echo Checking intltool...\r
189echo =+=+=\r
190set INTLTOOL_ZIP=intltool_0.40.4-1_win32.zip\r
191if not exist "%MINGW_BIN%\intltoolize" (\r
5f12fb6a 192 call :Download %INTLTOOL_ZIP% http://ftp.acc.umu.se/pub/GNOME/binaries/win32/intltool/0.40/%INTLTOOL_ZIP%
b1a8def8
RN
193 7z x %INTLTOOL_ZIP% -o"%MinGW%"\r
194 if ERRORLEVEL 1 goto Error\r
195)\r
196\r
197echo =+=+=\r
198echo Checking iconv...\r
199echo =+=+=\r
200set ICONV_ZIP=libiconv-1.9.2-1-bin.zip\r
201if not exist "%MINGW_BIN%\iconv.exe" (\r
5f12fb6a 202 call :Download %ICONV_ZIP% http://sourceforge.net/projects/gnuwin32/files/libiconv/1.9.2-1/%ICONV_ZIP%
b1a8def8
RN
203 7z x -y %ICONV_ZIP% -o"%MinGW%"\r
204 if ERRORLEVEL 1 goto Error\r
205)\r
206\r
207echo =+=+=\r
208echo Checking libintl...\r
209echo =+=+=\r
210:: Needed by iconv\r
211set LIBINTL_ZIP=libintl-0.14.4-bin.zip\r
212if not exist "%MINGW_BIN%\libintl3.dll" (\r
5f12fb6a 213 call :Download %LIBINTL_ZIP% http://sourceforge.net/projects/gnuwin32/files/libintl/0.14.4/%LIBINTL_ZIP%
b1a8def8
RN
214 7z x -y %LIBINTL_ZIP% -o"%MinGW%"\r
215 if ERRORLEVEL 1 goto Error\r
216)\r
217\r
218echo =+=+=\r
5f12fb6a
RN
219echo Checking gettext tools...
220echo =+=+=
221:: Needed by intltool
222set GETTEXT_BIN_LZ=gettext-0.18.3.1-1-mingw32-bin.tar.lzma
223set GETTEXT_BIN_URL=%MINGW_BASE_URL%/gettext/gettext-0.18.3.1-1/%GETTEXT_BIN_LZ%/download
224if not exist "%MINGW_BIN%\xgettext.exe" (
225 call :Download %GETTEXT_BIN_LZ% %GETTEXT_BIN_URL%
226 call :InstallLZMA "%GETTEXT_BIN_LZ%"
227)
228
229echo =+=+=
b1a8def8
RN
230echo Checking libcurl...\r
231echo =+=+=\r
7097c6b4
RN
232REM Win32 - Generic - http://curl.haxx.se/download.html
233set CURL=curl-7.34.0-devel-mingw32
234set CURL_ZIP=%CURL%.zip
b1a8def8 235if not exist "%MINGW_BIN%\libcurl.dll" (\r
7097c6b4 236 call :Download %CURL_ZIP% http://curl.haxx.se/gknw.net/7.34.0/dist-w32/%CURL_ZIP%
b1a8def8 237 echo Extracting libcurl...\r
7097c6b4 238 7z x -y %CURL_ZIP% -o"libcurl"
b1a8def8
RN
239 if ERRORLEVEL 1 goto Error\r
240 @echo ON\r
7097c6b4
RN
241 xcopy /S /Y libcurl\%CURL%\include\*.* "%MinGW%\include"
242 xcopy /S /Y libcurl\%CURL%\bin\*.* "%MinGW_BIN%"
243 xcopy /S /Y libcurl\%CURL%\lib\*.a "%MinGW%\lib"
244 copy /Y libcurl\%CURL%\COPYING "%MinGW%\COPYING_curl.txt"
b1a8def8 245 rmdir /S /Q libcurl\r
b1a8def8
RN
246 @echo OFF\r
247)\r
248\r
249echo =+=+=\r
250echo Checking libexif...\r
251echo =+=+=\r
5f12fb6a 252set EXIF=libexif-0.6.21.1_winxp_mingw
b1a8def8
RN
253set EXIF_7Z=%EXIF%.7z\r
254if not exist "%MINGW_BIN%\libexif-12.dll" (\r
5f12fb6a
RN
255 :: Space in URL so function call doesn't work ATM
256 ::call :Download %EXIF_7Z% "http://sourceforge.net/projects/maille/files/Extern libs/%EXIF_7Z%/download"
257 if not exist "%EXIF_7Z%" (
b1a8def8 258 wget "http://sourceforge.net/projects/maille/files/Extern libs/%EXIF_7Z%/download"\r
5f12fb6a 259 if ERRORLEVEL 1 goto Error
b1a8def8 260 )\r
5f12fb6a 261
b1a8def8
RN
262 echo Extracting libexif...\r
263 7z x %EXIF_7Z%\r
264 if ERRORLEVEL 1 goto Error\r
265\r
5f12fb6a 266 echo Using xcopy to get all subdirs of libexif into place...
b1a8def8
RN
267 @echo ON\r
268 xcopy /Y /S %EXIF%\*.* "%MinGW%"\r
269 rmdir /S /Q %EXIF%\r
270 @echo OFF\r
271)\r
272\r
273echo =+=+=\r
274echo Checking libstdc++...\r
275echo =+=+=\r
5f12fb6a 276set STDCPP_TAR=gcc-c++-4.8.1-4-mingw32-dll.tar
b1a8def8
RN
277set STDCPP_LZ=%STDCPP_TAR%.lzma\r
278if not exist "%MINGW_BIN%\libstdc++-6.dll" (\r
5f12fb6a
RN
279 call :Download "%STDCPP_LZ%" "http://sourceforge.net/projects/mingw/files/MinGW/Base/gcc/Version4/gcc-4.8.1-4/%STDCPP_LZ%/download"
280 call :InstallLZMA "%STDCPP_LZ%"
b1a8def8
RN
281)\r
282\r
003cc4e3
RN
283echo =+=+=\r
284echo Checking libbz2 header...\r
285echo =+=+=\r
286set BZ2_TAR=bzip2-1.0.6-4-mingw32-dev.tar\r
287set BZ2_LZ=%BZ2_TAR%.lzma\r
288if not exist "%MINGW%\include\bzlib.h" (\r
5f12fb6a
RN
289 call :Download %BZ2_LZ% "http://sourceforge.net/projects/mingw/files/MinGW/Extension/bzip2/bzip2-1.0.6-4/%BZ2_LZ%"
290 call :InstallLZMA "%BZ2_LZ%"
003cc4e3
RN
291)\r
292\r
293echo =+=+=\r
294echo Checking libbz2...\r
295echo =+=+=\r
296set BZ2DLL_TAR=libbz2-1.0.6-4-mingw32-dll-2.tar\r
297set BZ2DLL_LZ=%BZ2DLL_TAR%.lzma\r
298if not exist "%MINGW_BIN%\libbz2-2.dll" (\r
5f12fb6a
RN
299 call :Download %BZ2DLL_LZ% "http://sourceforge.net/projects/mingw/files/MinGW/Extension/bzip2/bzip2-1.0.6-4/%BZ2DLL_LZ%"
300 call :InstallLZMA "%BZ2DLL_LZ%"
003cc4e3
RN
301)\r
302\r
498efdef
RN
303echo =+=+=\r
304echo Checking magic dev...\r
305echo =+=+=\r
306set MAGIC_ZIP=file-5.03-lib.zip\r
307if not exist "%MINGW%\include\magic.h" (\r
5f12fb6a 308 call :Download %MAGIC_ZIP% http://downloads.sourceforge.net/gnuwin32/%MAGIC_ZIP%
498efdef
RN
309 7z x %MAGIC_ZIP% -o"%MinGW%"\r
310 if ERRORLEVEL 1 goto Error\r
311)\r
312\r
313echo =+=+=\r
314echo Checking magic DLL...\r
315echo =+=+=\r
316set MAGICDLL_ZIP=file-5.03-bin.zip\r
317if not exist "%MINGW_BIN%\magic1.dll" (\r
5f12fb6a 318 call :Download %MAGICDLL_ZIP% http://downloads.sourceforge.net/gnuwin32/%MAGICDLL_ZIP%
498efdef
RN
319 7z x %MAGICDLL_ZIP% -o"%MinGW%"\r
320 if ERRORLEVEL 1 goto Error\r
321)\r
322\r
323echo =+=+=\r
324echo Checking regex DLL (required by magic)...\r
325echo =+=+=\r
326set REGDLL_ZIP=regex-2.7-bin.zip\r
327if not exist "%MINGW_BIN%\regex2.dll" (\r
5f12fb6a 328 call :Download %REGDLL_ZIP% http://downloads.sourceforge.net/gnuwin32/%REGDLL_ZIP%
498efdef
RN
329 7z x %REGDLL_ZIP% -o"%MinGW%"\r
330 if ERRORLEVEL 1 goto Error\r
331)\r
332\r
9412daf4
RN
333echo =+=+=\r
334echo Checking SQLite dev...\r
335echo =+=+=\r
336set SQL_ZIP=sqlite-amalgamation-3080002.zip\r
337if not exist "%MINGW%\include\sqlite3.h" (\r
5f12fb6a 338 call :Download %SQL_ZIP% http://www.sqlite.org/2013/%SQL_ZIP%
9412daf4
RN
339 7z x %SQL_ZIP%\r
340 if ERRORLEVEL 1 goto Error\r
341 copy /Y sqlite-amalgamation-3080002\s* "%MinGW%\include"\r
342 rmdir /S /Q sqlite-amalgamation-3080002\r
343)\r
344\r
345echo =+=+=\r
346echo Checking SQL DLL...\r
347echo =+=+=\r
348set SQLDLL_ZIP=sqlite-dll-win32-x86-3080002.zip\r
349if not exist "%MINGW_BIN%\sqlite3.dll" (\r
5f12fb6a 350 call :Download %SQLDLL_ZIP% http://www.sqlite.org/2013/%SQLDLL_ZIP%
9412daf4
RN
351 7z x %SQLDLL_ZIP% -o"%MinGW_BIN%"\r
352 if ERRORLEVEL 1 goto Error\r
353 REM Annoyingly SQL doesn't come with a .lib file so have to generate it ourselves:\r
354 REM Possibly need to insert the line 'LIBRARY sqlite3.dll' at the beginning of the def file?\r
355 REM but this may not be needed as the --dllname option may suffice\r
5f12fb6a
RN
356 set PATH=%PATH%;%MinGW_BIN%
357 dlltool.exe -d %MinGW_BIN%\sqlite3.def --dllname %MinGW_BIN%\sqlite3.dll -l %MinGW%\lib\sqlite3.lib
358 if ERRORLEVEL 1 goto Error
9412daf4
RN
359)\r
360\r
59a4fc6d
RN
361::\r
362:: Ideally building the code on Windows shouldn't need Doc Utils or the Help processor stuff\r
363:: But ATM it's too hard to avoid.\r
364::\r
b1a8def8
RN
365echo =+=+=\r
366echo Checking Gnome Doc Utils...\r
367echo =+=+=\r
368set GNOME_DOC_ZIP=gnome-doc-utils-0.12.0.zip\r
369if not exist "%MINGW_BIN%\gnome-doc-prepare" (\r
5f12fb6a 370 call :Download %GNOME_DOC_ZIP% http://ftp.gnome.org/pub/gnome/binaries/win32/gnome-doc-utils/0.12/%GNOME_DOC_ZIP%
b1a8def8
RN
371 echo Extracting Gnome Doc Utils...\r
372 7z x %GNOME_DOC_ZIP% -o"%MinGW%"\r
373 if ERRORLEVEL 1 goto Error\r
374)\r
375\r
59a4fc6d
RN
376echo =+=+=\r
377echo Checking xsltproc...\r
378echo =+=+=\r
379set XLST=libxslt-1.1.26.win32\r
380set XLST_ZIP=%XLST%.zip\r
381if not exist "%MINGW_BIN%\xsltproc.exe" (\r
5f12fb6a 382 call :Download %XLST_ZIP% ftp://ftp.zlatkovic.com/libxml/%XLST_ZIP%
59a4fc6d
RN
383 echo Extracting XLST...\r
384 7z x %XLST_ZIP%\r
385 xcopy /Y /S "%XLST%\bin\*" "%MinGW_BIN%"\r
386 if ERRORLEVEL 1 goto Error\r
387 rmdir /Q /S %XLST%\r
388)\r
389\r
390echo =+=+=\r
391echo Checking xmllint...\r
392echo =+=+=\r
393set XML2=libxml2-2.7.8.win32\r
394set XML2_ZIP=%XML2%.zip\r
395if not exist "%MINGW_BIN%\xmllint.exe" (\r
5f12fb6a 396 call :Download %XML2_ZIP% ftp://ftp.zlatkovic.com/libxml/%XML2_ZIP%
59a4fc6d
RN
397 echo Extracting xmllint...\r
398 7z x %XML2_ZIP%\r
399 xcopy /Y /S "%XML2%\bin\*" "%MinGW_BIN%"\r
400 if ERRORLEVEL 1 goto Error\r
401 rmdir /Q /S %XML2%\r
402)\r
403\r
404echo =+=+=\r
405echo Checking iconv...\r
406echo =+=+=\r
407set ICONV=iconv-1.9.2.win32\r
408set ICONV_ZIP=%ICONV%.zip\r
409if not exist "%MINGW_BIN%\iconv.dll" (\r
5f12fb6a 410 call :Download %ICONV_ZIP% ftp://ftp.zlatkovic.com/libxml/%ICONV_ZIP%
59a4fc6d
RN
411 echo Extracting iconv...\r
412 7z x %ICONV_ZIP%\r
413 xcopy /Y /S "%ICONV%\bin\*" "%MinGW_BIN%"\r
414 if ERRORLEVEL 1 goto Error\r
415 rmdir /Q /S %ICONV%\r
416)\r
417\r
b1a8def8
RN
418:: Note GPSBabel can not be directly downloaded via wget\r
419:: ATM get it manually from here:\r
420:: http://www.gpsbabel.org/download.html\r
f570ee2b
RN
421set GPSBABEL_INST=GPSBabel-1.5.1-Setup.exe
422if not exist %GPSBABEL_INST% (
423 echo Required %GPSBABEL_INST% not found. Exitting
424 exit /b
b1a8def8
RN
425)\r
426\r
427echo =+=+=\r
428echo Checking Perl Installation...\r
429echo =+=+=\r
5f12fb6a 430set PERL_MSI=ActivePerl-5.18.2.1802-MSWin32-x86-64int-298023.msi
b1a8def8 431if not exist "%SystemDrive%\Perl" (\r
5f12fb6a 432 call :Download %PERL_MSI% http://downloads.activestate.com/ActivePerl/releases/5.18.2.1802/%PERL_MSI%
b1a8def8
RN
433 echo Installing Perl takes a little time...\r
434 msiexec /qb /i %PERL_MSI% PERL_PATH=Yes PERL_EXT=Yes\r
435 if ERRORLEVEL 1 goto Error\r
436)\r
437\r
438echo =+=+=\r
439echo Checking NSIS installed...\r
440echo =+=+=\r
441set NSIS_INST=nsis-2.46-setup.exe\r
442if not exist "%ProgramFiles%\NSIS" (\r
5f12fb6a 443 call :Download %NSIS_INST% http://prdownloads.sourceforge.net/nsis/nsis-2.46-setup.exe?download
b1a8def8
RN
444 echo Installing NSIS...\r
445 %NSIS_INST% /S\r
446 if ERRORLEVEL 1 goto Error\r
447)\r
448\r
449echo =+=+=\r
450echo Checking NSIS Plugins installed...\r
451echo =+=+=\r
452set FPDLLZIP=FindProc.zip\r
453if not exist "%ProgramFiles%\NSIS\Plugins\FindProcDLL.dll" (\r
5f12fb6a 454 call :Download %FPDLLZIP% http://nsis.sourceforge.net/mediawiki/images/3/3c/%FPDLLZIP%
b1a8def8
RN
455 echo Extracting NSIS Plugins...\r
456 7z e %FPDLLZIP% -o"%ProgramFiles%\NSIS\Plugins"\r
457 if ERRORLEVEL 1 goto Error\r
458)\r
459\r
460popd\r
461\r
462echo Fixing Perl reference\r
5f12fb6a 463
b1a8def8 464set PATH=%PATH%;C:\msys\1.0\bin\r
5f12fb6a
RN
465
466call :FixPerlRef %MINGW_BIN%\glib-mkenums s:/bin/perl:perl:
467call :FixPerlRef %MINGW_BIN%\intltool-extract s:/opt/perl/bin/perl:perl:
468call :FixPerlRef %MINGW_BIN%\intltool-merge s:/opt/perl/bin/perl:perl:
469call :FixPerlRef %MINGW_BIN%\intltool-prepare s:/opt/perl/bin/perl:perl:
470call :FixPerlRef %MINGW_BIN%\intltool-update s:/opt/perl/bin/perl:perl:
471
472goto End
473
474:FixPerlRef
475:: Param %1 = File
476:: Param %2 = sed command
477:: Sadly '-i' for in place changes doesn't seem available with Windows sed 3.02
478sed -e '%2' %1 > %1.tmp
b1a8def8 479if ERRORLEVEL 1 goto Error\r
5f12fb6a 480xcopy /Y %1.tmp %1
b1a8def8 481if ERRORLEVEL 1 goto Error\r
5f12fb6a
RN
482del %1.tmp
483:: End function
484exit /b
b1a8def8
RN
485\r
486:: Potentially Clean Up\r
487:: If any parameters given on the command line then remove all downloaded items\r
488:Clean\r
489if not [%1]==[] (\r
490 echo Removing downloaded files\r
491 if exist cache rmdir /S /Q cache\r
492)\r
493\r
494goto End\r
495\r
5f12fb6a
RN
496
497::Function to try to download something via wget
498:: (obviously needs 7zip to be installed first and available on the path!)
499:: Param %1 = File
500:: Param %2 = URL (which should retrieve %1) [ URL can't contain a space or %20:( ]
501:Download
502if not exist "%1" (
503 wget "%2"
504 if ERRORLEVEL 1 goto Error
505)
506:: End function
507exit /b
508
509::Function to install something via 7zip
510:: (obviously needs 7zip to be installed first and available on the path!)
511:: Param %1 = LZMA file
512:: Param %2 = Internal file (normally the .tar file)
513:InstallBy7Zip
514echo Extracting "%1" from "%2"
5157z e "%1"
516if ERRORLEVEL 1 goto Error
5177z x "%2" -o"%MinGW%"
518if ERRORLEVEL 1 goto Error
519del "%2"
520if ERRORLEVEL 1 goto Error
521:: End function
522exit /b
523
524::Function to install LZMA file containing a tar file (via 7zip)
525:: (obviously needs 7zip to be installed first and available on the path!)
526:: Param %1 = LZMA file
527:InstallLZMA
5287z e "%1"
529if ERRORLEVEL 1 goto Error
530set param=%1
531:: Remove the .lzma extension to get the tar file
532set file=%param:.lzma=%
5337z x "%file%" -o"%MinGW%" -y
534if ERRORLEVEL 1 goto Error
535del "%file%"
536if ERRORLEVEL 1 goto Error
537:: End function
538exit /b
539
b1a8def8
RN
540:Error\r
541echo exitting due to error: %ERRORLEVEL%\r
5f12fb6a 542exit /b
b1a8def8
RN
543\r
544:End\r
545echo Finished\r