File: installer.bat

package info (click to toggle)
viking 1.11-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 18,468 kB
  • sloc: ansic: 81,706; xml: 2,893; sh: 2,501; makefile: 874; python: 589; perl: 384; cpp: 259
file content (156 lines) | stat: -rw-r--r-- 4,578 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
@echo OFF
:: License: CC0
::
:: TODO return an error code when not completed as expected
::
echo STARTING INSTALLER PROCESS...

:: For strip
set PATH=%PATH%;%SystemDrive%\MinGW\bin

echo Remove debugging symbols
pushd ..\src
strip.exe -g viking.exe
popd

set MYCOPY=copy /y
set DESTINATION=installer\bin
echo Copying locale files into layout required by NSIS
dir ..\po\*.gmo /B > gmolist.txt
:: Create directories like de\LC_MESSAGES
for /f %%i in (gmolist.txt) do mkdir %DESTINATION%\locale\%%~ni\LC_MESSAGES
for /f %%i in (gmolist.txt) do %MYCOPY% ..\po\%%i %DESTINATION%\locale\%%~ni\LC_MESSAGES\viking.mo
del gmolist.txt

echo Copying Viking
%MYCOPY% ..\src\viking.exe %DESTINATION%
%MYCOPY% installer\pixmaps\viking_icon.ico %DESTINATION%
%MYCOPY% ..\COPYING %DESTINATION%\COPYING_GPL.txt
%MYCOPY% ..\AUTHORS %DESTINATION%\AUTHORS.txt
%MYCOPY% ..\NEWS %DESTINATION%\NEWS.txt
%MYCOPY% ..\README %DESTINATION%\README.txt
:: ATM this relies on being generated by an external system
%MYCOPY% cache\ChangeLog.txt %DESTINATION%
:: ATM this relies on being generated by an external system
%MYCOPY% ..\help\C\viking.pdf %DESTINATION%
:: Python cache converter tool
%MYCOPY% ..\tools\viking-cache.py %DESTINATION%

echo Copying Extension Configuration Data
mkdir %DESTINATION%\data
%MYCOPY% ..\data\*.xml %DESTINATION%\data
%MYCOPY% ..\data\latlontz.txt %DESTINATION%\data

echo Copying Libraries
set MINGW=%SystemDrive%\MinGW
if not exist "%MINGW%" (
	echo Required %MINGW% does not exist
	goto Tidy
)

set MINGW_BIN=%MINGW%\Bin

REM Curl 7.17+ has quite a few dependencies for SSL support
set LIBCURL=%MINGW_BIN%\libcurl.dll
if exist "%LIBCURL%" (
	%MYCOPY% "%LIBCURL%" %DESTINATION%
	%MYCOPY% "%MINGW_BIN%\libeay32.dll" %DESTINATION%
	%MYCOPY% "%MINGW_BIN%\librtmp.dll" %DESTINATION%
	%MYCOPY% "%MINGW_BIN%\libssh2.dll" %DESTINATION%
	%MYCOPY% "%MINGW_BIN%\libidn-11.dll" %DESTINATION%
	%MYCOPY% "%MINGW_BIN%\ssleay32.dll" %DESTINATION%
::	%MYCOPY% "%MINGW_BIN%\zlib1.dll" %DESTINATION%
	%MYCOPY% "%MINGW%\COPYING_curl.txt" %DESTINATION%
) else (
	echo %LIBCURL% does not exist
	goto Tidy
)
set LIBEXIF=%MINGW_BIN%\libexif-12.dll
if exist "%LIBEXIF%" (
	%MYCOPY% "%LIBEXIF%" %DESTINATION%
) else (
	echo Required %LIBEXIF% does not exist
	goto Tidy
)
set LIBBZ2=%MINGW_BIN%\libbz2-2.dll
if exist "%LIBBZ2%" (
	%MYCOPY% "%LIBBZ2%" %DESTINATION%
	%MYCOPY% "%MINGW_BIN%\libgcc_s_dw2-1.dll" %DESTINATION%
) else (
	echo Required %LIBBZ2% does not exist
	goto Tidy
)
set LIBMAGIC=%MINGW_BIN%\magic1.dll
if exist "%LIBMAGIC%" (
	%MYCOPY% "%LIBMAGIC%" %DESTINATION%
	%MYCOPY% "%MINGW_BIN%\regex2.dll" %DESTINATION%
	%MYCOPY% "%MINGW%\share\misc\magic.mgc" %DESTINATION%
) else (
	echo Required %LIBMAGIC% does not exist
	goto Tidy
)
set LIBSQL3=%MINGW_BIN%\sqlite3.dll
if exist "%LIBSQL3%" (
	%MYCOPY% "%LIBSQL3%" %DESTINATION%
) else (
	echo Required %LIBSQL3% does not exist
	goto Tidy
)
set LIBZIP=%MINGW_BIN%\libzip.dll
if exist "%LIBZIP%" (
	%MYCOPY% "%LIBZIP%" %DESTINATION%
) else (
	echo Required %LIBZIP% does not exist
	goto Tidy
)

:: TODO Maybe embed http://gtk-win.sourceforge.net/home/index.php/Main/EmbeddingGTK directly in NSIS?
:: Best to use the same GTK version as we built against in prepare.bat!!
echo =+=+=
echo Checking gtk runtime
echo =+=+=
set GTK_RUNTIME=gtk2-runtime-2.24.10-2012-10-10-ash.exe
pushd cache
if not exist %GTK_RUNTIME% (
	set PATH=%PATH%;%ProgramFiles%\GnuWin32\bin
	wget http://downloads.sourceforge.net/gtk-win/%GTK_RUNTIME%
)
if not exist %GTK_RUNTIME% (
	echo Required GTK Runtime does not exist
	goto Tidy
)
:: Install GTK into temporary location so we can repackage it
:: Destination path appears to have to be an absolute kind
popd
cd > tmp.tmp
set /p PWD=<tmp.tmp
del tmp.tmp
cache\%GTK_RUNTIME% /sideeffects=no /setpath=no /dllpath=root /translations=no /compatdlls=yes /S /D=%PWD%\%DESTINATION%

echo Copying GPSBabel Installer
mkdir %DESTINATION%\Optional
%MYCOPY% cache\GPSBabel-1.5.4-Setup.exe %DESTINATION%\Optional
if ERRORLEVEL 1 goto Error

::
echo Copying Translations
%MYCOPY% installer\translations\*nsh %DESTINATION%
if ERRORLEVEL 1 goto Error

echo Running NSIS (command line version)
pushd installer
if exist "%ProgramFiles%\NSIS" (
	"%ProgramFiles%\NSIS\makensis.exe" /X"SetCompressor /SOLID lzma" viking-installer.nsi
) else (
	echo NSIS Not installed in known location
)
popd

goto Tidy

:Error
echo Exitting due to error: %ERRORLEVEL%

:Tidy
echo Tidy Up
rmdir /S /Q %DESTINATION%