From: Rob Norris Date: Sun, 3 Feb 2013 22:13:30 +0000 (+0000) Subject: Windows: Script full generation of Windows build from scratch for version 1.4. X-Git-Url: https://git.street.me.uk/andy/viking.git/commitdiff_plain/b1a8def84f1b68b40500f8dfaef23f5537d1a8cd Windows: Script full generation of Windows build from scratch for version 1.4. Aim to be able to automate the generation of Windows Viking Installer executable from scratch. [Preferably from a Linux System using Wine] Script to setup full Windows build environment (including various work-a-rounds), using old but known to work MinGW5.1.6 + gcc3.4.5 compiler and various dependencies. Miscellaneous scripts to make this work via Wine. TODO: In the future look to using the current MinGW (Dev System) with gcc4.6+ This should hopefully simplify the auto build environment. --- diff --git a/src/Makefile_windows b/src/Makefile_windows deleted file mode 100644 index 63ff1dd0..00000000 --- a/src/Makefile_windows +++ /dev/null @@ -1,47 +0,0 @@ -# This is the Makefile for the viking gps viewer program. -# This file is licensed through the GPL version 2 or newer. - -ifeq ($shell uname -o),Cygwin) -CYGWIN = 1 -EXE = .exe -endif - -TARGET=viking$(EXE) -OBJECTS=viktrack.o vikwaypoint.o clipboard.o coords.o gpsmapper.o gpspoint.o file.o main.o dialog.o http.o viktreeview.o viktrwlayer.o viklayer.o viklayerspanel.o vikcoordlayer.o vikstatus.o vikwindow.o vikviewport.o vikaggregatelayer.o vikgeoreflayer.o vikfileentry.o viktrwlayer_tpwin.o viktrwlayer_propwin.o thumbnails.o background.o vikradiogroup.o vikcoord.o expedia.o mapcache.o vikmapslayer.o terraserver.o gtkcellrendererprogress.o - -CCFLAGS = -DWINDOWS -mms-bitfields -Wall -g -LINKFLAGS = -lwsock32 - -ifdef DEBUG -DFLAGS += -g -endif - -all:: viking - -.PHONY: all clean realclean depend - --include .depend - -.compile_config: - pkg-config --cflags gtk+-2.0 | sed -e 's/ -I/ -isystem/g' -e 's/^-I/-isystem/g' >$@.tmp - mv $@.tmp $@ -.link_config: - pkg-config --libs gtk+-2.0 gthread-2.0 >$@.tmp - mv $@.tmp $@ - -clean:: - rm -f *.o core $(TARGET).core *.tmp -realclean:: clean - rm -f $(TARGET) .depend .compile_config .link_config - -$(TARGET): $(OBJECTS) .link_config - $(CC) $(LINKFLAGS) -o $@ $(OBJECTS) `cat .link_config` -%.o: %.c .compile_config - $(CC) $(CCFLAGS) -o $@ -c $< `cat .compile_config` - -.depend: .compile_config .link_config - $(CC) $(CFLAGS) -MM -MG $(OBJECTS:.o=.c) `cat .compile_config` >$@.tmp - mv $@.tmp $@ - @echo dependencys got built. -depend:: - @# diff --git a/win32/README.txt b/win32/README.txt index 542aa591..158cc5c7 100644 --- a/win32/README.txt +++ b/win32/README.txt @@ -11,3 +11,24 @@ To generate the installer (once the code has been compiled as above) run the ins For further details (especially about how to set up the development dependencies) see: http://sourceforge.net/apps/mediawiki/viking/index.php?title=WindowsBuildInstructions + +These instructions have now been turned turned into a series of scripts to produce the Viking installer: + +1. prepare.bat +2a. configure_and_make.bat +2b. make.bat +3. installer.bat + +The scripts are aimed at a pristine Windows XP installation. +Using *prepare.bat* will attempt to *download* and *install* various Open Source software to aid this process. +An administrator level account is needed to run this which will *modify* your system. + +The other scripts simply make use of these (assumed) available system programs. + +This setup is for dedicated usage to build Viking, primarily under Wine with: + + ./generate_install.sh + +Such that any Windows system (or of course a Virtual Machine) can be simply deleted (e.g. rm -rf /.wine) and recreated fully via the scripts. + +From Viking 1.4 onwards this is how the Windows viking-W.X.Y.Z.exe installer file is produced. diff --git a/win32/configure_and_make-wine.sh b/win32/configure_and_make-wine.sh new file mode 100755 index 00000000..cc5529ce --- /dev/null +++ b/win32/configure_and_make-wine.sh @@ -0,0 +1,7 @@ +#!/bin/sh +# Note the configure stage under wine** is really slow can easily be over 15 minutes +# make of the icons is also very slow** - can easily over 5 minutes +# compartively the make of the actual src code is not too bad +wine ~/.wine/drive_c/windows/system32/cmd.exe /c configure_and_make.bat + +# ** slowness is probably due to lots of forking going on starting many new small processes diff --git a/win32/configure_and_make.bat b/win32/configure_and_make.bat new file mode 100644 index 00000000..49937609 --- /dev/null +++ b/win32/configure_and_make.bat @@ -0,0 +1,5 @@ +:: Full build +set PATH=%PATH%;C:\Mingw\bin;C:\msys\1.0\bin +cd ..\ +sh configure CFLAGS=-DWINDOWS LIBCURL=-lcurldll LIBS=-lzdll --disable-realtime-gps-tracking --disable-scrollkeeper +make diff --git a/win32/generate_install.sh b/win32/generate_install.sh new file mode 100755 index 00000000..2abec4fa --- /dev/null +++ b/win32/generate_install.sh @@ -0,0 +1,23 @@ +#!/bin/bash +# NB Annoyingly pushd/popd are bashisms! +# +# You don't want to do this on a previously configured/built Linux source tree +# as the build system will get confused so make clean and start again... +# + +# Ensure a basic Windows compatible system is set up +# Use wget to get wget! +if [ ! -e ~/.wine/drive_c/Program\ Files/GnuWin32/bin/wget.exe ]; then + if [ ! -e cache ]; then + mkdir cache + fi + pushd cache + WGET_EXE=wget-1.11.4-1-setup.exe + if [ ! -e $WGET_EXE ]; then + wget http://downloads.sourceforge.net/gnuwin32/$WGET_EXE + fi + wine $WGET_EXE \/silent + popd +fi + +wine ~/.wine/drive_c/windows/system32/cmd.exe /c prepare.bat diff --git a/win32/make-wine.sh b/win32/make-wine.sh new file mode 100755 index 00000000..92cba7f9 --- /dev/null +++ b/win32/make-wine.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +wine ~/.wine/drive_c/windows/system32/cmd.exe /c make.bat diff --git a/win32/make.bat b/win32/make.bat new file mode 100644 index 00000000..e6f43d5d --- /dev/null +++ b/win32/make.bat @@ -0,0 +1,4 @@ +:: Standard build +set PATH=%PATH%;C:\MinGW\bin;C:\msys\1.0\bin +cd ..\src +make diff --git a/win32/msys-pi-wine.sh b/win32/msys-pi-wine.sh new file mode 100755 index 00000000..42350bb2 --- /dev/null +++ b/win32/msys-pi-wine.sh @@ -0,0 +1,4 @@ +#!/bin/sh +# Run this when msys install halts + +wine ~/.wine/drive_c/windows/system32/cmd.exe /c msys-pi.bat diff --git a/win32/msys-pi.bat b/win32/msys-pi.bat new file mode 100644 index 00000000..e6a26449 --- /dev/null +++ b/win32/msys-pi.bat @@ -0,0 +1,3 @@ + +set PATH=%PATH%;C:\msys\1.0\bin +sh msys-pi.sh diff --git a/win32/msys-pi.sh b/win32/msys-pi.sh new file mode 100644 index 00000000..c055b70d --- /dev/null +++ b/win32/msys-pi.sh @@ -0,0 +1,40 @@ +# Fix up MSYS install +# Don't ask for questions +# fix fstab to the values I need + +. /etc/profile + +echo +echo "Creating /etc/fstab with mingw mount bindings." +cat </etc/fstab +C:\MinGW /mingw +C:\Perl /opt/perl +EOF + +# Stuff from original post MSYS install script +echo +echo " Normalizing your MSYS environment." +echo + +for I in awk cmd echo egrep ex fgrep printf pwd rvi rview rvim vi view +do + if [ -f /bin/$I. ] + then + echo You have script /bin/$I + if [ -f /bin/$I.exe ] + then + echo Removing /bin/$I.exe + rm -f /bin/$I.exe + fi + fi +done + +for I in ftp ln make +do + if [ -f /bin/$I.exe ] && [ -f /bin/$I. ] + then + echo You have both /bin/$I.exe and /bin/$I. + echo Removing /bin/$I. + rm -f /bin/$I. + fi +done diff --git a/win32/prepare.bat b/win32/prepare.bat new file mode 100644 index 00000000..250c0570 --- /dev/null +++ b/win32/prepare.bat @@ -0,0 +1,315 @@ +@echo OFF +:: +:: Setup wget first - this has to be done manually +:: http://gnuwin32.sourceforge.net/packages/wget.htm +:: http://downloads.sourceforge.net/gnuwin32/wget-1.11.4-1-setup.exe +:: +:: Simple script to check required built environment in default locations +:: Versions downloaded are specified absolutely as otherwise it's tricky to try and work out the latest/stable version +:: In principal the idea is to try and automate the process as much as possible +:: +set PATH=%PATH%;%ProgramFiles%\GnuWin32\bin + +set MINGW=%SystemDrive%\MinGW +set MINGW_BIN=%MinGW%\bin + +set ERRORLEVEL=0 + +if not exist cache mkdir cache +pushd cache + +echo =+=+= +echo Checking mingw... +echo =+=+= +set MINGW_EXE=MinGW-5.1.6.exe +set BIN_UTILS=binutils-2.19.1-mingw32-bin.tar.gz +set GCC_CORE=gcc-core-3.4.5-20060117-3.tar.gz +set GCC_GPP=gcc-g++-3.4.5-20060117-3.tar.gz +set MINGWRTDLL=mingwrt-3.15.2-mingw32-dll.tar.gz +set MINGWRTDEV=mingwrt-3.15.2-mingw32-dll.tar.gz +set W32API=w32api-3.13-mingw32-dev.tar.gz + +if not exist "%MINGW_BIN%" ( + :: Here we download all default components manually in an attempt to get autoinstall to work... + if not exist %MINGW_EXE% ( + wget "http://sourceforge.net/projects/mingw/files/OldFiles/MinGW 5.1.6/%MINGW_EXE%" + ) + if not exist %BIN_UTILS% ( + wget "http://sourceforge.net/projects/mingw/files/MinGW/Base/binutils/binutils-2.19.1/%BIN_UTILS%/download" + ) + if not exist %GCC_CORE% ( + wget "http://sourceforge.net/projects/mingw/files/MinGW/Base/gcc/Version3/Current Release_ gcc-3.4.5-20060117-3/%GCC_CORE%/download" + ) + if not exist %GCC_GPP% ( + wget "http://sourceforge.net/projects/mingw/files/MinGW/Base/gcc/Version3/Current Release_ gcc-3.4.5-20060117-3/%GCC_GPP%/download" + ) + if not exist %MINGWRTDEV% ( + wget http://sourceforge.net/projects/mingw/files/MinGW/Base/mingw-rt/mingwrt-3.15.2/%MINGWRTDEV%/download + ) + if not exist %MINGWRTDLL% ( + wget http://sourceforge.net/projects/mingw/files/MinGW/Base/mingw-rt/mingwrt-3.15.2/%MINGWRTDLL%/download + ) + if not exist %W32API% ( + wget http://sourceforge.net/projects/mingw/files/MinGW/Base/w32api/w32api-3.13/%W32API%/download + ) + :: Can't get it to silent install. As a NSIS installer it supports /S, but it doesn't seem to work - it just hangs + :: Have to click through manually + %MINGW_EXE% + if ERRORLEVEL 1 goto Error +) + +echo =+=+= +echo Checking MSYS... +echo =+=+= +set MSYS_EXE=MSYS-1.0.11.exe +if not exist "%SystemDrive%\msys" ( + if not exist %MSYS_EXE% ( + wget http://downloads.sourceforge.net/mingw/%MSYS_EXE% + ) + if not [%WINELOADER%]==[] ( + echo Running under WINE - Requires MSYS install fixes: run msys-pi-wine.sh when msys install halts..." + echo Ctrl-C to stop and then rerun the installation if necessary + ) + %MSYS_EXE% /sp- /silent + if ERRORLEVEL 1 goto Error +) + +:: We need a program to be able to extract not only zips, but bz2 and *lzma* +set PATH=%PATH%;%ProgramFiles%\7-Zip +echo =+=+= +echo Checking 7Zip is Available... +echo =+=+= +set ZIP_INST=7z920.exe +if not exist "%ProgramFiles%\7-Zip\7z.exe" ( + if not exist %ZIP_INST% ( + wget http://downloads.sourceforge.net/sevenzip/%ZIP_INST% + ) + %ZIP_INST% /S + if ERRORLEVEL 1 goto Error +) + +:: +echo =+=+= +echo Checking gtk+-bundle... +echo =+=+= +set GTK_ZIP=gtk+-bundle_2.24.10-20120208_win32.zip +if not exist "%MINGW_BIN%\gtk-update-icon-cache.exe" ( + if not exist %GTK_ZIP% ( + wget http://ftp.gnome.org/pub/gnome/binaries/win32/gtk+/2.24/%GTK_ZIP% + ) + 7z x %GTK_ZIP% -o"%MinGW%" + if ERRORLEVEL 1 goto Error +) + +set EXPAT_ZIP=expat-dev_2.0.1-1_win32.zip +echo =+=+= +echo Checking expat-dev... +echo =+=+= +if not exist "%MINGW%\include\expat.h" ( + if not exist %EXPAT_ZIP% ( + wget http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/%EXPAT_ZIP% + ) + 7z x %EXPAT_ZIP% -o"%MinGW%" + if ERRORLEVEL 1 goto Error +) + +set GTT_ZIP=gettext-tools-dev_0.18.1.1-2_win32.zip +echo =+=+= +echo Checking gettext-tools-dev... +echo =+=+= +if not exist "%MINGW_BIN%\libgettextlib-0-18-1.dll" ( + if not exist %GTT_ZIP% ( + wget http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/%GTT_ZIP% + ) + 7z x -y %GTT_ZIP% -o"%MinGW%" + if ERRORLEVEL 1 goto Error +) + +echo =+=+= +echo Checking intltool... +echo =+=+= +set INTLTOOL_ZIP=intltool_0.40.4-1_win32.zip +if not exist "%MINGW_BIN%\intltoolize" ( + if not exist %INTLTOOL_ZIP% ( + wget http://ftp.acc.umu.se/pub/GNOME/binaries/win32/intltool/0.40/%INTLTOOL_ZIP% + ) + 7z x %INTLTOOL_ZIP% -o"%MinGW%" + if ERRORLEVEL 1 goto Error +) + +echo =+=+= +echo Checking iconv... +echo =+=+= +set ICONV_ZIP=libiconv-1.9.2-1-bin.zip +if not exist "%MINGW_BIN%\iconv.exe" ( + if not exist %ICONV_ZIP% ( + wget http://sourceforge.net/projects/gnuwin32/files/libiconv/1.9.2-1/%ICONV_ZIP% + ) + 7z x -y %ICONV_ZIP% -o"%MinGW%" + if ERRORLEVEL 1 goto Error +) + +echo =+=+= +echo Checking libintl... +echo =+=+= +:: Needed by iconv +set LIBINTL_ZIP=libintl-0.14.4-bin.zip +if not exist "%MINGW_BIN%\libintl3.dll" ( + if not exist %LIBINTL_ZIP% ( + wget http://sourceforge.net/projects/gnuwin32/files/libintl/0.14.4/%LIBINTL_ZIP% + ) + 7z x -y %LIBINTL_ZIP% -o"%MinGW%" + if ERRORLEVEL 1 goto Error +) + +echo =+=+= +echo Checking libcurl... +echo =+=+= +set CURL_TAR=libcurl-7.14.0_nossl-1sid.tar +set CURL_BZ2=%CURL_TAR%.bz2 +if not exist "%MINGW_BIN%\libcurl.dll" ( + if not exist %CURL_BZ2% ( + wget http://downloads.sourceforge.net/devpaks/libcurl-7.14.0_nossl-1sid.DevPak?download + move libcurl-7.14.0_nossl-1sid.DevPak %CURL_BZ2% + ) + echo Extracting libcurl... + 7z e %CURL_BZ2% + 7z x %CURL_TAR% -o"libcurl" + if ERRORLEVEL 1 goto Error + @echo ON + move libcurl\include "%MinGW%\include\curl + copy /Y libcurl\bin\*.* "%MinGW_BIN%" + copy /Y libcurl\lib\*.* "%MinGW%\lib" + copy /Y libcurl\docs\*.* "%MinGW%\doc" + rmdir /S /Q libcurl + del %CURL_TAR% + @echo OFF +) + +echo =+=+= +echo Checking libexif... +echo =+=+= +set EXIF=libexif-0.6.20_winxp_mingw +set EXIF_7Z=%EXIF%.7z +if not exist "%MINGW_BIN%\libexif-12.dll" ( + if not exist %EXIF_7Z% ( + wget "http://sourceforge.net/projects/maille/files/Extern libs/%EXIF_7Z%/download" + ) + echo Extracting libexif... + 7z x %EXIF_7Z% + if ERRORLEVEL 1 goto Error + + echo Using *xcopy* (to get all subdirs) libexif into place... + @echo ON + xcopy /Y /S %EXIF%\*.* "%MinGW%" + rmdir /S /Q %EXIF% + @echo OFF +) + +echo =+=+= +echo Checking libstdc++... +echo =+=+= +set STDCPP_TAR=libstdc++-4.6.2-1-mingw32-dll-6.tar +set STDCPP_LZ=%STDCPP_TAR%.lzma +if not exist "%MINGW_BIN%\libstdc++-6.dll" ( + if not exist %STDCPP_LZ% ( + wget http://sourceforge.net/projects/mingw/files/MinGW/Base/gcc/Version4/gcc-4.6.2-1/%STDCPP_LZ% + ) + echo Extracting lidstdc++... + 7z e %STDCPP_LZ% + 7z x %STDCPP_TAR% -o"%MinGW%" + if ERRORLEVEL 1 goto Error + del %STDCPP_TAR% +) + +echo =+=+= +echo Checking Gnome Doc Utils... +echo =+=+= +set GNOME_DOC_ZIP=gnome-doc-utils-0.12.0.zip +if not exist "%MINGW_BIN%\gnome-doc-prepare" ( + if not exist %GNOME_DOC_ZIP% ( + wget http://ftp.gnome.org/pub/gnome/binaries/win32/gnome-doc-utils/0.12/%GNOME_DOC_ZIP% + ) + echo Extracting Gnome Doc Utils... + 7z x %GNOME_DOC_ZIP% -o"%MinGW%" + if ERRORLEVEL 1 goto Error +) + +:: Note GPSBabel can not be directly downloaded via wget +:: ATM get it manually from here: +:: http://www.gpsbabel.org/download.html +set GPSBABEL_INST=GPSBabel-1.4.4-Setup.exe +if not exist "%ProgramFiles%\GPSBabel" ( + echo Installing GPSBabel... + if exist %GPSBABEL_INST% ( + %GPSBABEL_INST% /silent + if ERRORLEVEL 1 goto Error + ) +) + +echo =+=+= +echo Checking Perl Installation... +echo =+=+= +set PERL_MSI=ActivePerl-5.14.3.1404-MSWin32-x86-296513.msi +if not exist "%SystemDrive%\Perl" ( + if not exist %PERL_MSI% ( + wget http://downloads.activestate.com/ActivePerl/releases/5.14.3.1404/%PERL_MSI% + ) + echo Installing Perl takes a little time... + msiexec /qb /i %PERL_MSI% PERL_PATH=Yes PERL_EXT=Yes + if ERRORLEVEL 1 goto Error +) + +echo =+=+= +echo Checking NSIS installed... +echo =+=+= +set NSIS_INST=nsis-2.46-setup.exe +if not exist "%ProgramFiles%\NSIS" ( + if not exist %NSIS_INST% ( + wget http://prdownloads.sourceforge.net/nsis/nsis-2.46-setup.exe?download + ) + echo Installing NSIS... + %NSIS_INST% /S + if ERRORLEVEL 1 goto Error +) + +echo =+=+= +echo Checking NSIS Plugins installed... +echo =+=+= +set FPDLLZIP=FindProc.zip +if not exist "%ProgramFiles%\NSIS\Plugins\FindProcDLL.dll" ( + if not exist %FPDLLZIP% ( + wget http://nsis.sourceforge.net/mediawiki/images/3/3c/%FPDLLZIP% + ) + echo Extracting NSIS Plugins... + 7z e %FPDLLZIP% -o"%ProgramFiles%\NSIS\Plugins" + if ERRORLEVEL 1 goto Error +) + +popd + +echo Fixing Perl reference +REM Sadly '-i' for in place changes doesn't seem available with Windows sed 3.02 +set PATH=%PATH%;C:\msys\1.0\bin +sed -e 's:#! /bin/perl:#! /opt/perl/bin/perl:' %MINGW_BIN%\glib-mkenums > tmp.enums +if ERRORLEVEL 1 goto Error +xcopy /Y tmp.enums %MINGW_BIN%\glib-mkenums +if ERRORLEVEL 1 goto Error +del tmp.enums + +:: Potentially Clean Up +:: If any parameters given on the command line then remove all downloaded items +:Clean +if not [%1]==[] ( + echo Removing downloaded files + if exist cache rmdir /S /Q cache +) + +goto End + +:Error +echo exitting due to error: %ERRORLEVEL% +exit + +:End +echo Finished