Merge pull request #318 from stevensmi/qt3-gcc-4-7

Qt3 gcc 4 7
This commit is contained in:
Kevin Mihelich 2012-11-27 21:02:18 -08:00
commit 0cf3723bc5
3 changed files with 76 additions and 28 deletions

View file

@ -4,6 +4,10 @@
# ALARM: Kevin Mihelich <kevin@archlinuxarm.org>
# - added arm.patch to fix compiling on ARM with GCC >= 4
# Source: http://lists.trolltech.com/qt-embedded-interest/2007-03/msg00003.html
# ALARM: Michael Stevens
# - replaces arm.patch with arm_no_packed.patch
# As of GCC-4.7 there is no way to get a reference to a packed ushort.
# Therefore we need to replace the 'ushort &unicode()' with 'ushort *unicodep()' breaking the exsting API
pkgname=qt3
pkgver=3.3.8b
@ -21,7 +25,7 @@ options=('!libtool')
install=qt.install
source=(ftp://ftp.trolltech.com/qt/source/qt-x11-free-${pkgver}.tar.gz
qt.profile qt3-png15.patch qt-copy-kde-patches.tar.bz2 qt-patches.tar.bz2
eastern_asian_languagues.diff qt-odbc.patch gcc-4.6.patch arm.patch)
eastern_asian_languagues.diff qt-odbc.patch gcc-4.6.patch arm_no_packed.patch)
sha1sums=('745def6250dc7f337dbb265e20bf38dcb41fd854'
'd2e257a9011208b2cb81b9cf47915b9a2f9dab83'
'3d19510c46016a1a211d97bf8f82b01498b1b33c'
@ -30,7 +34,7 @@ sha1sums=('745def6250dc7f337dbb265e20bf38dcb41fd854'
'40c7b8f06a21f809ddeb8b5560e9da63ccac6a17'
'1346320614f6f86fbeb10b9fbad721dea29f5b61'
'd9b83b8f6f9c8bd98d290dc1d0e9913a00b62c3f'
'896ffd1d5d31101a4c60155648dfed419abee3c1')
'43565c3b33c5d6f7adb217e4afea49adb48f6c97')
# qt-copy-kde-patches come from http://websvn.kde.org/trunk/qt-copy/patches/
# other qt-patches come from fedora and gentoo
@ -59,7 +63,7 @@ build() {
patch -p0 -i "${srcdir}"/qt3-png15.patch
# Arch Linux ARM patch
patch -p1 -i ${srcdir}/arm.patch
patch -p1 -i ${srcdir}/arm_no_packed.patch
# start compiling qt
sed -i 's|-cp -P -f|-cp -L -f|' qmake/Makefile.unix

View file

@ -1,25 +0,0 @@
diff -urN qt-x11-free-3.3.8.orig/src/tools/qglobal.h qt-x11-free-3.3.8/src/tools/qglobal.h
--- qt-x11-free-3.3.8.orig/src/tools/qglobal.h 2011-01-20 21:18:42.000000000 -0700
+++ qt-x11-free-3.3.8/src/tools/qglobal.h 2011-01-20 21:20:34.000000000 -0700
@@ -320,6 +320,9 @@
# if __GNUC__ == 3 && __GNUC_MINOR__ >= 4
# define Q_NO_PACKED_REFERENCE
# endif
+# if __GNUC__ == 4 && __GNUC_MINOR__ >= 0
+# define Q_NO_PACKED_POINTERS
+# endif
# endif
# if !defined(__EXCEPTIONS)
# define Q_NO_EXCEPTIONS
diff -urN qt-x11-free-3.3.8.orig/src/tools/qstring.h qt-x11-free-3.3.8/src/tools/qstring.h
--- qt-x11-free-3.3.8.orig/src/tools/qstring.h 2011-01-20 21:18:43.000000000 -0700
+++ qt-x11-free-3.3.8/src/tools/qstring.h 2011-01-20 21:21:48.000000000 -0700
@@ -195,6 +195,8 @@
ushort unicode() const { return ucs; }
#ifdef Q_NO_PACKED_REFERENCE
ushort &unicode() { return *(&ucs); }
+#elif defined Q_NO_PACKED_POINTERS
+ ushort &unicode() { ushort& tmp = ucs; return tmp; }
#else
ushort &unicode() { return ucs; }
#endif

View file

@ -0,0 +1,69 @@
--- qt-x11-free-3.3.8b/src/tools/qglobal.h
+++ qt-x11-free-3.3.8b/src/tools/qglobal.h
@@ -323,6 +323,13 @@
# if __GNUC__ == 3 && __GNUC_MINOR__ >= 4
# define Q_NO_PACKED_REFERENCE
# endif
+# if __GNUC__ == 4 && __GNUC_MINOR__ >= 0
+# if __GNUC__ == 4 && __GNUC_MINOR__ >= 7
+# define Q_NO_PACKED_ACCESS
+# else
+# define Q_NO_PACKED_POINTERS
+# endif
+# endif
# endif
# if !defined(__EXCEPTIONS)
# define Q_NO_EXCEPTIONS
--- qt-x11-free-3.3.8b/src/tools/qlocale.cpp
+++ qt-x11-free-3.3.8b/src/tools/qlocale.cpp
@@ -3293,7 +3293,11 @@ QString QLocalePrivate::doubleToString(double d,
if (zero().unicode() != '0') {
for (uint i = 0; i < digits.length(); ++i)
+#ifdef Q_NO_PACKED_ACCESS
+ *digits.ref(i).unicodep() += zero().unicode() - '0';
+#else
digits.ref(i).unicode() += zero().unicode() - '0';
+#endif
}
bool always_show_decpt = flags & Alternate;
--- qt-x11-free-3.3.8b/src/tools/qstring.cpp
+++ qt-x11-free-3.3.8b/src/tools/qstring.cpp
@@ -1933,7 +1933,11 @@ static QString replaceArgEscapes(const QString &s, const ArgEscapeData &d, int f
if (field_width > 0) { // left padded
for (uint i = 0; i < pad_chars; ++i)
+#ifdef Q_NO_PACKED_ACCESS
+ *(rc++)->unicodep() = ' ';
+#else
(rc++)->unicode() = ' ';
+#endif
}
if (locale_arg) {
@@ -1947,7 +1951,11 @@ static QString replaceArgEscapes(const QString &s, const ArgEscapeData &d, int f
if (field_width < 0) { // right padded
for (uint i = 0; i < pad_chars; ++i)
+#ifdef Q_NO_PACKED_ACCESS
+ *(rc++)->unicodep() = ' ';
+#else
(rc++)->unicode() = ' ';
+#endif
}
if (++repl_cnt == d.occurrences) {
--- qt-x11-free-3.3.8b/src/tools/qstring.h
+++ qt-x11-free-3.3.8b/src/tools/qstring.h
@@ -199,6 +199,10 @@ public:
ushort unicode() const { return ucs; }
#ifdef Q_NO_PACKED_REFERENCE
ushort &unicode() { return *(&ucs); }
+#elif defined Q_NO_PACKED_POINTERS
+ ushort &unicode() { ushort& tmp = ucs; return tmp; }
+#elif defined Q_NO_PACKED_ACCESS
+ ushort *unicodep() { return &ucs; }
#else
ushort &unicode() { return ucs; }
#endif