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