Fix ARM build

This commit is contained in:
Volker Fröhlich 2014-03-28 19:48:28 +01:00
parent ec2e05494a
commit a5f997a9c9
2 changed files with 235 additions and 4 deletions

227
qgis-2.2.0-arm-build.patch Normal file
View File

@ -0,0 +1,227 @@
From 03b028dbf7c66949a1365cb6a927874c1318840e Mon Sep 17 00:00:00 2001
From: Bas Couwenberg <sebastic@xs4all.nl>
Date: Fri, 28 Mar 2014 10:37:13 +0100
Subject: [PATCH 1/3] On armel/armhf qreal is typedef'ed to float not double.
This patch adds qreal versions of some functions on arm. It was originally
writen by Konstantinos Margaritis and later fixed by Peter Michael Green.
Bug-Debian: http://bugs.debian.org/691333
---
src/core/qgscoordinatetransform.cpp | 11 +++++++++++
src/core/qgscoordinatetransform.h | 3 +++
src/core/qgsmaptopixel.cpp | 9 +++++++++
src/core/qgsmaptopixel.h | 3 +++
4 files changed, 26 insertions(+)
diff --git a/src/core/qgscoordinatetransform.cpp b/src/core/qgscoordinatetransform.cpp
index 42427f9..58fb557 100644
--- a/src/core/qgscoordinatetransform.cpp
+++ b/src/core/qgscoordinatetransform.cpp
@@ -434,6 +434,17 @@ void QgsCoordinateTransform::transformInPlace(
}
}
+#ifdef QT_ARCH_ARM
+void QgsCoordinateTransform::transformInPlace( qreal& x, qreal& y, double& z,
+ TransformDirection direction ) const
+{
+ double xd = (double) x, yd = (double) y;
+ transformInPlace(xd, yd, z, direction);
+ x=xd;
+ y=yd;
+}
+#endif
+
#ifdef ANDROID
void QgsCoordinateTransform::transformInPlace( float& x, float& y, float& z,
TransformDirection direction ) const
diff --git a/src/core/qgscoordinatetransform.h b/src/core/qgscoordinatetransform.h
index df9c314..20bb04a 100644
--- a/src/core/qgscoordinatetransform.h
+++ b/src/core/qgscoordinatetransform.h
@@ -156,6 +156,9 @@ class CORE_EXPORT QgsCoordinateTransform : public QObject
// and y variables in place. The second one works with good old-fashioned
// C style arrays.
void transformInPlace( double& x, double& y, double &z, TransformDirection direction = ForwardTransform ) const;
+#ifdef QT_ARCH_ARM
+ void transformInPlace( qreal& x, qreal& y, double &z, TransformDirection direction = ForwardTransform ) const;
+#endif
//! @note not available in python bindings
void transformInPlace( QVector<double>& x, QVector<double>& y, QVector<double>& z,
diff --git a/src/core/qgsmaptopixel.cpp b/src/core/qgsmaptopixel.cpp
index 6dff6f1..fab4848 100644
--- a/src/core/qgsmaptopixel.cpp
+++ b/src/core/qgsmaptopixel.cpp
@@ -138,6 +138,14 @@ void QgsMapToPixel::transformInPlace( double& x, double& y ) const
y = yMax - ( y - yMin ) / mMapUnitsPerPixel;
}
+#ifdef QT_ARCH_ARM
+void QgsMapToPixel::transformInPlace( qreal& x, qreal& y ) const
+{
+ x = ( x - xMin ) / mMapUnitsPerPixel;
+ y = yMax - ( y - yMin ) / mMapUnitsPerPixel;
+}
+#endif
+
void QgsMapToPixel::transformInPlace( QVector<double>& x,
QVector<double>& y ) const
{
@@ -161,3 +169,4 @@ void QgsMapToPixel::transformInPlace( QVector<float>& x,
transformInPlace( x[i], y[i] );
}
#endif
+
diff --git a/src/core/qgsmaptopixel.h b/src/core/qgsmaptopixel.h
index fb3c317..8377282 100644
--- a/src/core/qgsmaptopixel.h
+++ b/src/core/qgsmaptopixel.h
@@ -66,6 +66,9 @@ class CORE_EXPORT QgsMapToPixel
given coordinates in place. Intended as a fast way to do the
transform. */
void transformInPlace( double& x, double& y ) const;
+#ifdef QT_ARCH_ARM
+ void transformInPlace( qreal& x, qreal& y ) const;
+#endif
/* Transform device coordinates to map coordinates. Modifies the
given coordinates in place. Intended as a fast way to do the
--
1.8.5.5
From 7db6ae54124a2f2213c0609490904653c6c798af Mon Sep 17 00:00:00 2001
From: Bas Couwenberg <sebastic@xs4all.nl>
Date: Fri, 28 Mar 2014 10:39:35 +0100
Subject: [PATCH 2/3] Fix qreal vs double.
In qt4 on arm architectures qreal is defined as float while on other
architectures it is defined as double. This can cause problems if qreal
and double are carelessly mixed.
In this particular case the problem is that qMin/qMax are templates defined
to take two parameters of the same type. If two different types are passed
in then C++ can't resolve what type the template parameter should be and
bails out. The fix is simple, typecast one of the parameters so they
match.
Author: Peter Michael Green <plugwash@debian.org>
Bug-Debian: http://bugs.debian.org/737814
---
src/app/gps/qwtpolar-1.0/qwt_polar_curve.cpp | 2 +-
src/app/gps/qwtpolar-1.0/qwt_polar_layout.cpp | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/app/gps/qwtpolar-1.0/qwt_polar_curve.cpp b/src/app/gps/qwtpolar-1.0/qwt_polar_curve.cpp
index d63206a..7c18777 100644
--- a/src/app/gps/qwtpolar-1.0/qwt_polar_curve.cpp
+++ b/src/app/gps/qwtpolar-1.0/qwt_polar_curve.cpp
@@ -433,7 +433,7 @@ void QwtPolarCurve::drawLines( QPainter *painter,
if ( !clipRect.isEmpty() )
{
- double off = qCeil( qMax( 1.0, painter->pen().widthF() ) );
+ double off = qCeil( qMax((qreal)1.0,painter->pen().widthF() ) );
clipRect = clipRect.toRect().adjusted( -off, -off, off, off );
polyline = QwtClipper::clipPolygonF( clipRect, polyline );
}
diff --git a/src/app/gps/qwtpolar-1.0/qwt_polar_layout.cpp b/src/app/gps/qwtpolar-1.0/qwt_polar_layout.cpp
index 1db2379..b4a43b0 100644
--- a/src/app/gps/qwtpolar-1.0/qwt_polar_layout.cpp
+++ b/src/app/gps/qwtpolar-1.0/qwt_polar_layout.cpp
@@ -278,7 +278,7 @@ QRectF QwtPolarLayout::layoutLegend( Options options, QRectF &rect ) const
// We don't allow vertical legends to take more than
// half of the available space.
- dim = qMin( hint.width(), rect.width() * d_data->legendRatio );
+ dim = qMin( hint.width(), (qreal)(rect.width() * d_data->legendRatio) );
if ( !( options & IgnoreScrollbars ) )
{
@@ -293,7 +293,7 @@ QRectF QwtPolarLayout::layoutLegend( Options options, QRectF &rect ) const
}
else
{
- dim = qMin( hint.height(), rect.height() * d_data->legendRatio );
+ dim = qMin( hint.height(), (qreal)(rect.height() * d_data->legendRatio) );
dim = qMax( dim, d_data->layoutData.legend.hScrollBarHeight );
}
--
1.8.5.5
From 3d44c5934aba0c4a1e0919549f50f1650140de57 Mon Sep 17 00:00:00 2001
From: Bas Couwenberg <sebastic@xs4all.nl>
Date: Fri, 28 Mar 2014 10:41:22 +0100
Subject: [PATCH 3/3] Disable features on ARM.
Building QGIS on ARM produces the error:
sip: qgis/python/core/qgsclipper.sip:44: \
QgsClipper::trimFeature() unsupported function argument type - provide %MethodCode and a C++ signature
For the Android builds this was fixed in commit 2cc684793ceb29d8600d71564fb38f92c998f588.
This patch adapts the Android fix, by disabling the SIP features on all ARM systems.
Bug-Debian: http://bugs.debian.org/737814
---
python/CMakeLists.txt | 5 +++++
python/core/composer/qgscomposerscalebar.sip | 2 +-
python/core/qgsclipper.sip | 4 +++-
3 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt
index 044f65e..158e4fa 100644
--- a/python/CMakeLists.txt
+++ b/python/CMakeLists.txt
@@ -55,6 +55,11 @@ IF(NOT ANDROID)
SET(SIP_DISABLE_FEATURES ${SIP_DISABLE_FEATURES} ANDROID)
ENDIF(NOT ANDROID)
+IF(CMAKE_SYSTEM_PROCESSOR MATCHES "^arm")
+ELSE(CMAKE_SYSTEM_PROCESSOR MATCHES "^arm")
+ SET(SIP_DISABLE_FEATURES ${SIP_DISABLE_FEATURES} ARM)
+ENDIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^arm")
+
IF(NOT WITH_TOUCH)
SET(SIP_DISABLE_FEATURES ${SIP_DISABLE_FEATURES} HAVE_TOUCH)
ENDIF(NOT WITH_TOUCH)
diff --git a/python/core/composer/qgscomposerscalebar.sip b/python/core/composer/qgscomposerscalebar.sip
index 727c10f..9a0e034 100644
--- a/python/core/composer/qgscomposerscalebar.sip
+++ b/python/core/composer/qgscomposerscalebar.sip
@@ -109,7 +109,7 @@ class QgsComposerScaleBar: QgsComposerItem
of the segment
@note python bindings not available on android
*/
-%If (!ANDROID)
+%If (!ARM)
void segmentPositions( QList<QPair<double, double> >& posWidthList ) const;
%End
diff --git a/python/core/qgsclipper.sip b/python/core/qgsclipper.sip
index 847123c..90c920b 100644
--- a/python/core/qgsclipper.sip
+++ b/python/core/qgsclipper.sip
@@ -1,3 +1,5 @@
+%Feature ARM
+
class QgsClipper
{
%TypeHeaderCode
@@ -34,7 +36,7 @@ class QgsClipper
// A handy way to refer to the four boundaries
enum Boundary {XMax, XMin, YMax, YMin};
-%If (!ANDROID)
+%If (!ARM)
// Trims the given feature to a rectangular box. Returns the trimmed
// feature in x and y. The shapeOpen parameter determines whether
// the function treats the points as a closed shape (polygon), or as
--
1.8.5.5

View File

@ -19,7 +19,7 @@
Name: qgis Name: qgis
Version: 2.2.0 Version: 2.2.0
Release: 2%{?dist} Release: 3%{?dist}
Summary: A user friendly Open Source Geographic Information System Summary: A user friendly Open Source Geographic Information System
Group: Applications/Engineering Group: Applications/Engineering
@ -27,9 +27,6 @@ Group: Applications/Engineering
License: GPLv3+ with exceptions License: GPLv3+ with exceptions
URL: http://www.qgis.org URL: http://www.qgis.org
#TODO: There are build issues at the moment
ExcludeArch: armv7hl
Source0: http://qgis.org/downloads/%{name}-%{version}.tar.bz2 Source0: http://qgis.org/downloads/%{name}-%{version}.tar.bz2
# The used sources were released as a tarball, the below is only for work in progress # The used sources were released as a tarball, the below is only for work in progress
#git archive --format=tar --prefix=qgis-1.8.0/ master | bzip2 >../qgis-1.8.0.tar.gz #git archive --format=tar --prefix=qgis-1.8.0/ master | bzip2 >../qgis-1.8.0.tar.gz
@ -56,6 +53,9 @@ Patch3: %{name}-2.2.0-sip.patch
# https://github.com/qgis/QGIS/commit/afd667420a42cb257c6c4524290091663e21f3d6 # https://github.com/qgis/QGIS/commit/afd667420a42cb257c6c4524290091663e21f3d6
Patch4: %{name}-2.2.0-show-license.patch Patch4: %{name}-2.2.0-show-license.patch
# https://github.com/qgis/QGIS/pull/1275.patch
Patch5: %{name}-2.2.0-arm-build.patch
# Some plug-ins need Pyspatialite (bundled) # Some plug-ins need Pyspatialite (bundled)
# The license is not totally clear, see: # The license is not totally clear, see:
# http://code.google.com/p/pyspatialite/issues/detail?id=3 # http://code.google.com/p/pyspatialite/issues/detail?id=3
@ -188,6 +188,7 @@ Please refer to %{name}-mapserver-README.fedora for details!
%patch2 -p1 -b .httplib2~ %patch2 -p1 -b .httplib2~
%patch3 -p1 -b .sip~ %patch3 -p1 -b .sip~
%patch4 -p1 -b .license~ %patch4 -p1 -b .license~
%patch5 -p1 -b .arm-build~
# Readme file for QGIS mapserver configuration and Lighttpd example # Readme file for QGIS mapserver configuration and Lighttpd example
install -pm0644 %{SOURCE4} . install -pm0644 %{SOURCE4} .
@ -396,6 +397,9 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
%changelog %changelog
* Fri Mar 28 2014 Volker Fröhlich <volker27@gmx.at> - 2.2.0-3
- ARM build fix
* Sun Mar 16 2014 Rex Dieter <rdieter@fedoraproject.org> 2.2.0-2 * Sun Mar 16 2014 Rex Dieter <rdieter@fedoraproject.org> 2.2.0-2
- rebuild (sip) - rebuild (sip)