]> git.street.me.uk Git - andy/viking.git/blame - win32/prepare.bat
Add YOURS online routing.
[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)
7bcf4720 33\r
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
7bcf4720
RN
466\r
467echo =+=+=\r
468echo Checking libzip...\r
469echo =+=+=\r
470REM Originally planned to extract from an existing MINGW32 RPM,\r
471REM which worked OK to compile+link but Viking did not run up after install\r
472REM I think the dll is linked to a different gcc runtime\r
473set LIBZIP=mingw32-libzip-1.0.1-3\r
474set LIBZIP_RPM=mingw32-libzip-1.0.1-3.fc24.noarch.rpm\r
475if not exist "%MINGW_BIN%\libzip.dll" (\r
476 echo MANUALLY NEED TO ACQUIRE AND INSTALL LIBZIP\r
477 EXIT\r
478REM Instead build libzip from source\r
479REM http://www.nih.at/libzip/ - download latest source (31d625ae55b5 on 16/11/15)\r
480REM Use CMake (v3.4.0) on Windows\r
481REM wine cmd\r
482REM set CC=gcc\r
483REM set PATH=%PATH%;%SystemDrive%\Mingw\bin\r
484REM cmake -DCMAKE_C_COMPILER:FILEPATH='gcc' -G "MSYS Makefiles" .\r
485REM set PATH=%PATH%;%SystemDrive%\msys\1.0\bin\r
486REM make\r
487REM (needed to fix zipint.h to include limits.h for a successful compile)\r
488REM Copy libzip.dll.a,libzip.dll,zip.h+zipconf.h to appropraite places.\r
489)\r
490\r
b1a8def8
RN
491:: Note GPSBabel can not be directly downloaded via wget\r
492:: ATM get it manually from here:\r
493:: http://www.gpsbabel.org/download.html\r
c1b746db 494set GPSBABEL_INST=GPSBabel-1.5.2-Setup.exe
f570ee2b
RN
495if not exist %GPSBABEL_INST% (
496 echo Required %GPSBABEL_INST% not found. Exitting
497 exit /b
b1a8def8
RN
498)\r
499\r
500echo =+=+=\r
501echo Checking Perl Installation...\r
502echo =+=+=\r
5f12fb6a 503set PERL_MSI=ActivePerl-5.18.2.1802-MSWin32-x86-64int-298023.msi
b1a8def8 504if not exist "%SystemDrive%\Perl" (\r
5f12fb6a 505 call :Download %PERL_MSI% http://downloads.activestate.com/ActivePerl/releases/5.18.2.1802/%PERL_MSI%
b1a8def8
RN
506 echo Installing Perl takes a little time...\r
507 msiexec /qb /i %PERL_MSI% PERL_PATH=Yes PERL_EXT=Yes\r
508 if ERRORLEVEL 1 goto Error\r
509)\r
510\r
511echo =+=+=\r
512echo Checking NSIS installed...\r
513echo =+=+=\r
514set NSIS_INST=nsis-2.46-setup.exe\r
515if not exist "%ProgramFiles%\NSIS" (\r
5f12fb6a 516 call :Download %NSIS_INST% http://prdownloads.sourceforge.net/nsis/nsis-2.46-setup.exe?download
b1a8def8
RN
517 echo Installing NSIS...\r
518 %NSIS_INST% /S\r
519 if ERRORLEVEL 1 goto Error\r
520)\r
521\r
522echo =+=+=\r
523echo Checking NSIS Plugins installed...\r
524echo =+=+=\r
525set FPDLLZIP=FindProc.zip\r
526if not exist "%ProgramFiles%\NSIS\Plugins\FindProcDLL.dll" (\r
5f12fb6a 527 call :Download %FPDLLZIP% http://nsis.sourceforge.net/mediawiki/images/3/3c/%FPDLLZIP%
b1a8def8
RN
528 echo Extracting NSIS Plugins...\r
529 7z e %FPDLLZIP% -o"%ProgramFiles%\NSIS\Plugins"\r
530 if ERRORLEVEL 1 goto Error\r
531)\r
532\r
533popd\r
534\r
535echo Fixing Perl reference\r
5f12fb6a 536
b1a8def8 537set PATH=%PATH%;C:\msys\1.0\bin\r
5f12fb6a
RN
538
539call :FixPerlRef %MINGW_BIN%\glib-mkenums s:/bin/perl:perl:
540call :FixPerlRef %MINGW_BIN%\intltool-extract s:/opt/perl/bin/perl:perl:
541call :FixPerlRef %MINGW_BIN%\intltool-merge s:/opt/perl/bin/perl:perl:
542call :FixPerlRef %MINGW_BIN%\intltool-prepare s:/opt/perl/bin/perl:perl:
543call :FixPerlRef %MINGW_BIN%\intltool-update s:/opt/perl/bin/perl:perl:
544
545goto End
546
547:FixPerlRef
548:: Param %1 = File
549:: Param %2 = sed command
550:: Sadly '-i' for in place changes doesn't seem available with Windows sed 3.02
551sed -e '%2' %1 > %1.tmp
b1a8def8 552if ERRORLEVEL 1 goto Error\r
5f12fb6a 553xcopy /Y %1.tmp %1
b1a8def8 554if ERRORLEVEL 1 goto Error\r
5f12fb6a
RN
555del %1.tmp
556:: End function
557exit /b
b1a8def8
RN
558\r
559:: Potentially Clean Up\r
560:: If any parameters given on the command line then remove all downloaded items\r
561:Clean\r
562if not [%1]==[] (\r
563 echo Removing downloaded files\r
564 if exist cache rmdir /S /Q cache\r
565)\r
566\r
567goto End\r
568\r
5f12fb6a
RN
569
570::Function to try to download something via wget
571:: (obviously needs 7zip to be installed first and available on the path!)
572:: Param %1 = File
573:: Param %2 = URL (which should retrieve %1) [ URL can't contain a space or %20:( ]
574:Download
575if not exist "%1" (
576 wget "%2"
577 if ERRORLEVEL 1 goto Error
578)
579:: End function
580exit /b
581
582::Function to install something via 7zip
583:: (obviously needs 7zip to be installed first and available on the path!)
584:: Param %1 = LZMA file
585:: Param %2 = Internal file (normally the .tar file)
586:InstallBy7Zip
587echo Extracting "%1" from "%2"
5887z e "%1"
589if ERRORLEVEL 1 goto Error
5907z x "%2" -o"%MinGW%"
591if ERRORLEVEL 1 goto Error
592del "%2"
593if ERRORLEVEL 1 goto Error
594:: End function
595exit /b
596
597::Function to install LZMA file containing a tar file (via 7zip)
598:: (obviously needs 7zip to be installed first and available on the path!)
599:: Param %1 = LZMA file
600:InstallLZMA
6017z e "%1"
602if ERRORLEVEL 1 goto Error
603set param=%1
604:: Remove the .lzma extension to get the tar file
605set file=%param:.lzma=%
6067z x "%file%" -o"%MinGW%" -y
607if ERRORLEVEL 1 goto Error
608del "%file%"
609if ERRORLEVEL 1 goto Error
610:: End function
611exit /b
612
b1a8def8
RN
613:Error\r
614echo exitting due to error: %ERRORLEVEL%\r
5f12fb6a 615exit /b
b1a8def8
RN
616\r
617:End\r
618echo Finished\r