From b0678771151113f2d5fb721799dd9fd938cace87 Mon Sep 17 00:00:00 2001 From: Rob Norris Date: Wed, 13 Jan 2016 00:47:15 +0000 Subject: [PATCH] [WINDOWS] Enable Windows 64bit cross build --- .gitignore | 1 + Makefile.am | 1 + configure.ac | 1 + mingw-viking.spec.in | 11 +-- mingw64-viking.spec.in | 107 +++++++++++++++++++++++++++ win32/README.txt | 7 +- win32/installer-mingw.sh | 28 ++++++- win32/installer/viking-installer.nsi | 15 +++- 8 files changed, 152 insertions(+), 19 deletions(-) create mode 100644 mingw64-viking.spec.in diff --git a/.gitignore b/.gitignore index d7623e12..b4ab06de 100644 --- a/.gitignore +++ b/.gitignore @@ -32,6 +32,7 @@ gnome-doc-utils.m4 /omf.make /viking.spec /mingw-viking.spec +/mingw64-viking.spec /xmldocs.make /test-driver /compile diff --git a/Makefile.am b/Makefile.am index 4d374e25..9e276077 100644 --- a/Makefile.am +++ b/Makefile.am @@ -15,6 +15,7 @@ EXTRA_DIST = \ ChangeLog.0 \ viking.spec \ mingw-viking.spec \ + mingw64-viking.spec \ $(INTLTOOL) .PHONY: generate-changelog diff --git a/configure.ac b/configure.ac index 4ddc6a5c..bd80c677 100644 --- a/configure.ac +++ b/configure.ac @@ -465,6 +465,7 @@ AC_DEFINE_UNQUOTED(THEYEAR, "`date +%Y`", [The Year]) AC_CONFIG_FILES([ viking.spec mingw-viking.spec + mingw64-viking.spec Makefile src/Makefile src/icons/Makefile diff --git a/mingw-viking.spec.in b/mingw-viking.spec.in index f6ac8abe..11aee9bf 100644 --- a/mingw-viking.spec.in +++ b/mingw-viking.spec.in @@ -12,7 +12,7 @@ Source0: %{_pkg_name}-%{version}.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildArch: noarch -# Only 32bit ATM +# 32bit version only in this file. See mingw64-viking.spec for the 64bit version # Programs to enable the cross build BuildRequires: mingw32-filesystem @@ -55,21 +55,12 @@ Requires: mingw32-libzip4 # Currently running makensis in seperate script - so you will need it then #Requires: mingw32-cross-nsis - %description Viking is a free/open source program to manage GPS data. You can import, plot and create tracks, routes and waypoints, show OSM and other maps, see real-time GPS position, control items, etc. Other advanced capabilities include Geotagging Images, generate Maps (using Mapnik), Upload and Download tracks from OSM, Routing from OSRM or Google, Name Searches from OSM Nominatim or Google and more. It is written in mainly in C with some C++ and uses the GTK+2 toolkit. -# -# TODO 64bit version - possibly like this... -# -#%package -n mingw64-%{_pkg_name} -#Summary: %{summary} -# -#%description -n mingw64-%{_pkg_name} -#%{description} %prep %setup -q -n %{_pkg_name}-%{version} diff --git a/mingw64-viking.spec.in b/mingw64-viking.spec.in new file mode 100644 index 00000000..1a56bc45 --- /dev/null +++ b/mingw64-viking.spec.in @@ -0,0 +1,107 @@ +# Public Domain CC0 +%{?mingw_package_header} +%define _pkg_name viking +Name: mingw64-%{_pkg_name} +Version: @VERSION@ +Release: 1 +Summary: GPS data editor and analyzer +Group: Applications/Productivity +License: GPLv2 +URL: http://sourceforge.net/projects/viking/ +Source0: %{_pkg_name}-%{version}.tar.gz +BuildRoot: %{_tmppath}/%{name}-%{version}-build +BuildArch: noarch + +# 64bit version only in this file. See mingw-viking.spec for the 32bit version + +# Programs to enable the cross build +BuildRequires: mingw64-filesystem +BuildRequires: mingw64-binutils +BuildRequires: mingw64-runtime +BuildRequires: mingw64-cross-binutils +BuildRequires: mingw64-cross-gcc +BuildRequires: mingw64-cross-pkg-config +BuildRequires: mingw64-gettext-tools +BuildRequires: mingw64-gnome-doc-utils-devel +BuildRequires: intltool +BuildRequires: gdk-pixbuf-devel +# ^For gdk-pixbuf-csource + +# Code +# Not worried about versions ATM +BuildRequires: mingw64-gtk2-devel +# ATM gtk2-devel auto includes at least devel versions of glib2, gobject, zlib and more + +# Mandatory libraries +BuildRequires: mingw64-libexpat-devel +BuildRequires: mingw64-libcurl-devel +# Optional libraries +BuildRequires: mingw64-libgexiv2-devel +BuildRequires: mingw64-libbz2-devel +BuildRequires: mingw64-file-devel +BuildRequires: mingw64-libmagic1 +BuildRequires: mingw64-libbz2-1 +BuildRequires: mingw64-sqlite-devel +BuildRequires: mingw64-libzip-devel + +# Libs for runtime (and thus also available for the NSIS installer to include the dependencies) +Requires: mingw64-gtk2 +Requires: mingw64-libexpat1 +Requires: mingw64-libcurl4 +Requires: mingw64-libgexiv2 +Requires: mingw64-libstdc++6 +Requires: mingw64-libsqlite3-0 +Requires: mingw64-libzip4 +# Currently running makensis in seperate script - so you will need it then +# NB No 64bit version available +#Requires: mingw32-cross-nsis + +%description +Viking is a free/open source program to manage GPS data. +You can import, plot and create tracks, routes and waypoints, show OSM and other maps, see real-time GPS position, control items, etc. +Other advanced capabilities include Geotagging Images, generate Maps (using Mapnik), Upload and Download tracks from OSM, Routing from OSRM or Google, Name Searches from OSM Nominatim or Google and more. +It is written in mainly in C with some C++ and uses the GTK+2 toolkit. + +%prep +%setup -q -n %{_pkg_name}-%{version} + +%build +# Create Icon +pushd win32/installer/pixmaps +%{_mingw64_windres} viking_icon.rc -o viking_icon.o +popd + +# +# Specifics for Windows build - i.e. no Mapnik & no GPSD +%{_mingw64_configure}\ + --disable-realtime-gps-tracking \ + --disable-mapnik \ + --disable-scrollkeeper \ + --enable-windows \ + CFLAGS="-DWINDOWS -DWIN32 -mwindows" +# NB not sure if '-DWIN32' is necessary/applicable for a 64bit build... + +%{_mingw64_make} %{?_smp_mflags} + +%install +pushd src +%{_mingw64_strip} -g %{_pkg_name}.exe +popd + +%make_install + +%find_lang %{_pkg_name} + +%clean +rm -rf %{buildroot} + +%files -f %{_pkg_name}.lang +%defattr(-,root,root) +%doc AUTHORS ChangeLog COPYING NEWS README doc/ +%{_mingw64_bindir}/*%{_pkg_name}.exe +%{_mingw64_datadir}/applications/%{_pkg_name}.desktop +%{_mingw64_datadir}/%{_pkg_name} +%{_mingw64_datadir}/icons/hicolor/*/apps/%{_pkg_name}.* +%exclude %{_mingw64_datadir}/icons/hicolor/icon-theme.cache + +%changelog diff --git a/win32/README.txt b/win32/README.txt index 4c2ffb6e..f3c0ade2 100644 --- a/win32/README.txt +++ b/win32/README.txt @@ -16,11 +16,12 @@ This could be done in the VM but installing dblatex requires ~650Mb install (so ### Guest Preparation (root) ### -In the guest ensure availability of build dependent mingw32 packages (not in standard Tumbleweed repo ATM) +In the guest ensure availability of build dependent mingw32 / mingw64 packages (not in standard Tumbleweed repo ATM) # As root zypper ar -f http://download.opensuse.org/repositories/windows:/mingw:/win32/openSUSE_Tumbleweed windows + zypper ar -f http://download.opensuse.org/repositories/windows:/mingw:/win64/openSUSE_Tumbleweed windows64 zypper ar -f http://download.opensuse.org/repositories/home:/ecsos/openSUSE_Tumbleweed windows-extra-ecsos - zypper ar -f http://download.opensuse.org/repositories/home:/ecsos:/pipelight/openSUSE_Tumbleweed windows-extra-ecsos + zypper ar -f http://download.opensuse.org/repositories/home:/ecsos:/pipelight/openSUSE_Tumbleweed windows-extra-ecsos2 # Ensure a standard user account is available for the build e.g: #useradd -m build #passwd build @@ -58,7 +59,7 @@ Now perform the build rpmbuild -ba mingw-viking.spec Install locally - rpm -i /home/build/rpmbuild/RPMS/noarch/viking-*.noarch.rpm + sudo rpm -i /home/build/rpmbuild/RPMS/noarch/ming*-viking-*.noarch.rpm Generate .msi cd win32 diff --git a/win32/installer-mingw.sh b/win32/installer-mingw.sh index 84e1702d..60c9a893 100755 --- a/win32/installer-mingw.sh +++ b/win32/installer-mingw.sh @@ -15,10 +15,18 @@ if [ -z "$DESTINATION" ]; then DESTINATION=installer/bin fi +# General clean out tmp copy location so 32v64 versions can't conflict +if [ -z "$NOCLEAN" ]; then + rm -rf installer/bin +fi mkdir -p $DESTINATION if [ -z "$MINGW" ]; then - MINGW=/usr/i686-w64-mingw32/sys-root/mingw + if [ "$HOSTTYPE" == "x86_64" ]; then + MINGW=/usr/x86_64-w64-mingw32/sys-root/mingw + else + MINGW=/usr/i686-w64-mingw32/sys-root/mingw + fi fi MINGW_BIN=$MINGW/bin echo MINGW=$MINGW @@ -56,7 +64,11 @@ cp ../data/latlontz.txt $DESTINATION/data echo Copying Helper Apps # Needed when spawning other programs (e.g. when invoking GPSBabel) -cp $MINGW_BIN/gspawn-win32-helper.exe $DESTINATION +if [ "$HOSTTYPE" == "x86_64" ]; then + cp $MINGW_BIN/gspawn-win64-helper.exe $DESTINATION +else + cp $MINGW_BIN/gspawn-win32-helper.exe $DESTINATION +fi echo Copying Libraries # Core libs @@ -100,7 +112,11 @@ cp $MINGW_BIN/libplc*.dll $DESTINATION cp $MINGW_BIN/libplds*.dll $DESTINATION cp $MINGW_BIN/nss*.dll $DESTINATION cp $MINGW_BIN/ssl*.dll $DESTINATION -cp /usr/share/doc/packages/mingw32-libcurl-devel/COPYING $DESTINATION/COPYING_curl.txt +if [ "$HOSTTYPE" == "x86_64" ]; then + cp /usr/share/doc/packages/mingw64-libcurl-devel/COPYING $DESTINATION/COPYING_curl.txt +else + cp /usr/share/doc/packages/mingw32-libcurl-devel/COPYING $DESTINATION/COPYING_curl.txt +fi cp $MINGW_BIN/libexiv2.dll $DESTINATION cp $MINGW_BIN/libgexiv2*.dll $DESTINATION @@ -122,4 +138,10 @@ else # Speedier install generation when testing makensis -X"SetCompress off" viking-installer.nsi fi + +if [ "$HOSTTYPE" == "x86_64" ]; then + rename viking viking-win64 viking-[0-9].[0-9].[0-9].[0-9].exe +else + rename viking viking-win32 viking-[0-9].[0-9].[0-9].[0-9].exe +fi popd diff --git a/win32/installer/viking-installer.nsi b/win32/installer/viking-installer.nsi index 98ebf789..94d01eba 100644 --- a/win32/installer/viking-installer.nsi +++ b/win32/installer/viking-installer.nsi @@ -35,6 +35,7 @@ SetDateSave on !include "Sections.nsh" !include "WinVer.nsh" !include "LogicLib.nsh" +!include "x64.nsh" ;; http://nsis.sourceforge.net/File_Association !include "FileAssociation.nsh" @@ -244,7 +245,11 @@ Section $(VIKING_SECTION_TITLE) SecViking ; Common settings WriteRegStr SHCTX ${VIKING_REG_KEY} "" "$INSTDIR" WriteRegStr SHCTX ${VIKING_REG_KEY} "Version" "${VIKING_VERSION}" - WriteRegStr SHCTX "${VIKING_UNINSTALL_KEY}" "DisplayName" "Viking" + ${If} ${RunningX64} + WriteRegStr SHCTX "${VIKING_UNINSTALL_KEY}" "DisplayName" "Viking (x86)" + ${Else} + WriteRegStr SHCTX "${VIKING_UNINSTALL_KEY}" "DisplayName" "Viking (x64)" + ${EndIf} WriteRegStr SHCTX "${VIKING_UNINSTALL_KEY}" "DisplayVersion" "${VIKING_VERSION}" WriteRegStr SHCTX "${VIKING_UNINSTALL_KEY}" "DisplayIcon" "$INSTDIR\viking_icon.ico" WriteRegStr SHCTX "${VIKING_UNINSTALL_KEY}" "HelpLink" "http://sourceforge.net/p/viking/wikiallura" @@ -546,8 +551,12 @@ Function .onInit Pop $R0 StrCmp $R0 "HKLM" 0 user_dir - StrCpy $INSTDIR "$PROGRAMFILES\Viking" - Goto instdir_done + ${If} ${RunningX64} + StrCpy $INSTDIR "$PROGRAMFILES64\Viking" + ${Else} + StrCpy $INSTDIR "$PROGRAMFILES\Viking" ; $PROGRAMFILES32 also works + ${EndIf} + Goto instdir_done user_dir: Push $SMPROGRAMS ${GetParent} $SMPROGRAMS $R2 -- 2.39.5