]> git.street.me.uk Git - andy/viking.git/blobdiff - win32/installer.bat
Update viking.doap file
[andy/viking.git] / win32 / installer.bat
index d522e16e385a8d68779f2d1e6bf0dcd02e14854b..873084d052cb15af980e9a57edbc9effafa6eaa2 100644 (file)
@@ -1,10 +1,12 @@
 @echo OFF\r
+:: License: CC0\r
+::\r
+:: TODO return an error code when not completed as expected\r
+::\r
 echo STARTING INSTALLER PROCESS...\r
 \r
-echo Create Icon\r
-pushd installer\pixmaps\r
-windres.exe viking_icon.rc -o viking_icon.o\r
-popd\r
+:: For strip\r
+set PATH=%PATH%;%SystemDrive%\MinGW\bin\r
 \r
 echo Remove debugging symbols\r
 pushd ..\src\r
@@ -16,41 +18,117 @@ set DESTINATION=installer\bin
 echo Copying locale files into layout required by NSIS\r
 dir ..\po\*.gmo /B > gmolist.txt\r
 :: Create directories like de\LC_MESSAGES\r
-for /f %%i in (gmolist.txt) do mkdir %DESTINATION%\%%~ni\LC_MESSAGES\r
-for /f %%i in (gmolist.txt) do %MYCOPY% ..\po\%%i %DESTINATION%\%%~ni\LC_MESSAGES\viking.mo\r
+for /f %%i in (gmolist.txt) do mkdir %DESTINATION%\locale\%%~ni\LC_MESSAGES\r
+for /f %%i in (gmolist.txt) do %MYCOPY% ..\po\%%i %DESTINATION%\locale\%%~ni\LC_MESSAGES\viking.mo\r
 del gmolist.txt\r
 \r
 echo Copying Viking\r
 %MYCOPY% ..\src\viking.exe %DESTINATION%\r
 %MYCOPY% installer\pixmaps\viking_icon.ico %DESTINATION%\r
 %MYCOPY% ..\COPYING %DESTINATION%\COPYING_GPL.txt\r
-::\r
-echo Copying GPSBabel\r
-:: It is assumed you've tested the code after building it :)\r
-::  Thus GPSBabel should be here\r
-%MYCOPY% ..\src\gpsbabel.exe %DESTINATION%\r
-:: Otherwise install it from http://www.gpsbabel.org/download.html\r
-::  (or get it from an old Viking Windows release)\r
-::  and copy the command line program into ..\src\r
-::\r
+%MYCOPY% ..\AUTHORS %DESTINATION%\AUTHORS.txt\r
+%MYCOPY% ..\NEWS %DESTINATION%\NEWS.txt\r
+%MYCOPY% ..\README %DESTINATION%\README.txt\r
+:: ATM this relies on being generated by an external system\r
+%MYCOPY% cache\ChangeLog.txt %DESTINATION%\r
+:: ATM this relies on being generated by an external system\r
+%MYCOPY% ..\help\C\viking.pdf %DESTINATION%\r
+:: Python cache converter tool\r
+%MYCOPY% ..\tools\viking-cache.py %DESTINATION%\r
+\r
+echo Copying Extension Configuration Data\r
+mkdir %DESTINATION%\data\r
+%MYCOPY% ..\data\*.xml %DESTINATION%\data\r
+%MYCOPY% ..\data\latlontz.txt %DESTINATION%\data\r
+\r
 echo Copying Libraries\r
-set LIBCURL=C:\MinGW\bin\libcurl.dll\r
-if exist %LIBCURL% (\r
-       %MYCOPY% %LIBCURL% %DESTINATION%\r
+set MINGW=%SystemDrive%\MinGW
+if not exist "%MINGW%" (\r
+       echo Required %MINGW% does not exist\r
+       goto Tidy\r
+)\r
+\r
+set MINGW_BIN=%MINGW%\Bin\r
+\r
+REM Curl 7.17+ has quite a few dependencies for SSL support
+set LIBCURL=%MINGW_BIN%\libcurl.dll\r
+if exist "%LIBCURL%" (\r
+       %MYCOPY% "%LIBCURL%" %DESTINATION%\r
+       %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%\r
 ) else (\r
        echo %LIBCURL% does not exist\r
        goto Tidy\r
 )\r
-set LIBEXIF=C:\MinGW\bin\libexif-12.dll\r
-if exist %LIBEXIF% (\r
-       %MYCOPY% %LIBEXIF% %DESTINATION%\r
+set LIBEXIF=%MINGW_BIN%\libexif-12.dll\r
+if exist "%LIBEXIF%" (\r
+       %MYCOPY% "%LIBEXIF%" %DESTINATION%\r
+) else (\r
+       echo Required %LIBEXIF% does not exist\r
+       goto Tidy\r
+)\r
+set LIBBZ2=%MINGW_BIN%\libbz2-2.dll\r
+if exist "%LIBBZ2%" (\r
+       %MYCOPY% "%LIBBZ2%" %DESTINATION%\r
+       %MYCOPY% "%MINGW_BIN%\libgcc_s_dw2-1.dll" %DESTINATION%\r
+) else (\r
+       echo Required %LIBBZ2% does not exist\r
+       goto Tidy\r
+)\r
+set LIBMAGIC=%MINGW_BIN%\magic1.dll\r
+if exist "%LIBMAGIC%" (\r
+       %MYCOPY% "%LIBMAGIC%" %DESTINATION%\r
+       %MYCOPY% "%MINGW_BIN%\regex2.dll" %DESTINATION%\r
+       %MYCOPY% "%MINGW%\share\misc\magic.mgc" %DESTINATION%\r
+) else (\r
+       echo Required %LIBMAGIC% does not exist\r
+       goto Tidy\r
+)\r
+set LIBSQL3=%MINGW_BIN%\sqlite3.dll\r
+if exist "%LIBSQL3%" (\r
+       %MYCOPY% "%LIBSQL3%" %DESTINATION%\r
 ) else (\r
-       echo %LIBEXIF% does not exist\r
+       echo Required %LIBSQL3% does not exist\r
        goto Tidy\r
 )\r
+\r
+:: TODO Maybe embed http://gtk-win.sourceforge.net/home/index.php/Main/EmbeddingGTK directly in NSIS?\r
+:: Best to use the same GTK version as we built against in prepare.bat!!\r
+echo =+=+=\r
+echo Checking gtk runtime\r
+echo =+=+=\r
+set GTK_RUNTIME=gtk2-runtime-2.24.10-2012-10-10-ash.exe\r
+pushd cache\r
+if not exist %GTK_RUNTIME% (\r
+       set PATH=%PATH%;%ProgramFiles%\GnuWin32\bin\r
+       wget http://downloads.sourceforge.net/gtk-win/%GTK_RUNTIME%\r
+)\r
+if not exist %GTK_RUNTIME% (\r
+       echo Required GTK Runtime does not exist\r
+       goto Tidy\r
+)\r
+:: Install GTK into temporary location so we can repackage it\r
+:: Destination path appears to have to be an absolute kind\r
+popd\r
+cd > tmp.tmp\r
+set /p PWD=<tmp.tmp\r
+del tmp.tmp\r
+cache\%GTK_RUNTIME% /sideeffects=no /setpath=no /dllpath=root /translations=no /compatdlls=yes /S /D=%PWD%\%DESTINATION%\r
+\r
+echo Copying GPSBabel Installer
+mkdir %DESTINATION%\Optional
+%MYCOPY% cache\GPSBabel-1.5.2-Setup.exe %DESTINATION%\Optional
+if ERRORLEVEL 1 goto Error
+
 ::\r
 echo Copying Translations\r
 %MYCOPY% installer\translations\*nsh %DESTINATION%\r
+if ERRORLEVEL 1 goto Error
 \r
 echo Running NSIS (command line version)\r
 pushd installer\r
@@ -61,6 +139,11 @@ if exist "%ProgramFiles%\NSIS" (
 )\r
 popd\r
 \r
-echo Tidy Up\r
+goto Tidy
+
+:Error
+echo Exitting due to error: %ERRORLEVEL%
+
 :Tidy\r
+echo Tidy Up
 rmdir /S /Q %DESTINATION%\r