diff -Nru mongodb-2.0.4/debian/changelog mongodb-2.0.4/debian/changelog --- mongodb-2.0.4/debian/changelog 2012-04-03 18:40:01.000000000 +0000 +++ mongodb-2.0.4/debian/changelog 2012-04-04 11:49:53.000000000 +0000 @@ -1,3 +1,11 @@ +mongodb (1:2.0.4-1ubuntu2) precise; urgency=low + + * debian/control: enable armhf and armel builds. + * debian/patches/0009-arm-support.patch: Signedness and alignment + fixes to make the smoketest pass on ARM. + + -- Jani Monoses Wed, 04 Apr 2012 12:49:34 +0300 + mongodb (1:2.0.4-1ubuntu1) precise; urgency=low * Merge bugfix release from Debian unstable, remaining change: diff -Nru mongodb-2.0.4/debian/control mongodb-2.0.4/debian/control --- mongodb-2.0.4/debian/control 2012-03-30 19:44:27.000000000 +0000 +++ mongodb-2.0.4/debian/control 2012-04-04 11:49:49.000000000 +0000 @@ -10,7 +10,7 @@ Homepage: http://www.mongodb.org Package: mongodb -Architecture: i386 amd64 +Architecture: i386 amd64 armel armhf Depends: mongodb-server, mongodb-dev, ${shlibs:Depends}, ${misc:Depends} Description: object/document-oriented database (metapackage) MongoDB is a high-performance, open source, schema-free @@ -33,7 +33,7 @@ This is a metapackage that depends on all the mongodb parts. Package: mongodb-server -Architecture: i386 amd64 +Architecture: i386 amd64 armel armhf Depends: mongodb-clients, ${shlibs:Depends}, ${misc:Depends}, adduser Replaces: mongodb (<= 1:1.4.2-2) Description: object/document-oriented database (server package) @@ -57,7 +57,7 @@ This package contains the server itself. Package: mongodb-clients -Architecture: i386 amd64 +Architecture: i386 amd64 armel armhf Depends: ${shlibs:Depends}, ${misc:Depends} Replaces: mongodb (<= 1:1.4.2-2) Description: object/document-oriented database (client apps) @@ -82,7 +82,7 @@ Package: mongodb-dev Section: libdevel -Architecture: i386 amd64 +Architecture: i386 amd64 armel armhf Depends: mongodb-server, libboost-dev, ${shlibs:Depends}, ${misc:Depends} Replaces: mongodb (<= 1:1.4.2-2) Description: object/document-oriented database (development) diff -Nru mongodb-2.0.4/debian/patches/0009-arm-support.patch mongodb-2.0.4/debian/patches/0009-arm-support.patch --- mongodb-2.0.4/debian/patches/0009-arm-support.patch 1970-01-01 00:00:00.000000000 +0000 +++ mongodb-2.0.4/debian/patches/0009-arm-support.patch 2012-04-04 11:49:41.000000000 +0000 @@ -0,0 +1,273 @@ +## Description: add some description +## Origin/Author: add some origin or author +## Bug: bug URL +Index: mongodb-2.0.4/bson/bsonelement.h +=================================================================== +--- mongodb-2.0.4.orig/bson/bsonelement.h 2012-04-04 14:30:37.709491618 +0300 ++++ mongodb-2.0.4/bson/bsonelement.h 2012-04-04 14:34:51.218748691 +0300 +@@ -104,7 +104,7 @@ + operator string() const { return toString(); } + + /** Returns the type of the element */ +- BSONType type() const { return (BSONType) *data; } ++ BSONType type() const { return (BSONType) *reinterpret_cast< const signed char * >(data); } + + /** retrieve a field within this element + throws exception if *this is not an embedded object +@@ -183,7 +183,11 @@ + bool isNumber() const; + + /** Return double value for this field. MUST be NumberDouble type. */ ++#ifdef __arm__ ++ double _numberDouble() const {return (reinterpret_cast< const struct packed_double* >( value() ))->d; } ++#else + double _numberDouble() const {return *reinterpret_cast< const double* >( value() ); } ++#endif + /** Return double value for this field. MUST be NumberInt type. */ + int _numberInt() const {return *reinterpret_cast< const int* >( value() ); } + /** Return double value for this field. MUST be NumberLong type. */ +@@ -489,7 +493,11 @@ + case NumberLong: + return *reinterpret_cast< const long long* >( value() ) != 0; + case NumberDouble: ++#ifdef __arm__ ++ return (reinterpret_cast < const struct packed_double * >(value ()))->d != 0; ++#else + return *reinterpret_cast< const double* >( value() ) != 0; ++#endif + case NumberInt: + return *reinterpret_cast< const int* >( value() ) != 0; + case mongo::Bool: +Index: mongodb-2.0.4/bson/util/builder.h +=================================================================== +--- mongodb-2.0.4.orig/bson/util/builder.h 2012-04-04 14:30:37.749491819 +0300 ++++ mongodb-2.0.4/bson/util/builder.h 2012-04-04 14:34:42.034703166 +0300 +@@ -24,7 +24,14 @@ + #include "../stringdata.h" + + namespace mongo { +- ++ /* Accessing unaligned doubles on ARM/Linux results in SIGBUS. ++ Wrapping in a packed struct forces gcc to generate code that works with unaligned value as well. ++ */ ++#ifdef __arm__ ++ struct packed_double { ++ double d; ++ } __attribute__((packed)); ++#endif + /* Note the limit here is rather arbitrary and is simply a standard. generally the code works + with any object that fits in ram. + +@@ -155,7 +162,11 @@ + *((bool*)grow(sizeof(bool))) = j; + } + void appendNum(double j) { ++#ifdef __arm__ ++ ((struct packed_double*)grow(sizeof(double)))->d = j; ++#else + *((double*)grow(sizeof(double))) = j; ++#endif + } + void appendNum(long long j) { + *((long long*)grow(sizeof(long long))) = j; +Index: mongodb-2.0.4/db/key.cpp +=================================================================== +--- mongodb-2.0.4.orig/db/key.cpp 2012-04-04 14:30:37.765491905 +0300 ++++ mongodb-2.0.4/db/key.cpp 2012-04-04 14:30:38.481495455 +0300 +@@ -19,6 +19,7 @@ + #include "pch.h" + #include "key.h" + #include "../util/unittest.h" ++#include "../bson/util/builder.h" + + namespace mongo { + +@@ -398,11 +399,20 @@ + p += sizeof(double); + break; + case cint: ++#ifdef __arm__ ++ b.append("", (int) (long long)((struct packed_double&) *p).d); ++#else + b.append("", (int) ((double&) *p)); ++#endif ++ + p += sizeof(double); + break; + case clong: ++#ifdef __arm__ ++ b.append("", (long long) ((struct packed_double&) *p).d); ++#else + b.append("", (long long) ((double&) *p)); ++#endif + p += sizeof(double); + break; + default: +@@ -428,8 +438,13 @@ + switch( lt ) { + case cdouble: + { ++#ifdef __arm__ ++ double L = ((struct packed_double *) l)->d; ++ double R = ((struct packed_double *) r)->d; ++#else + double L = *((double *) l); + double R = *((double *) r); ++#endif + if( L < R ) + return -1; + if( L != R ) +@@ -617,7 +632,11 @@ + l += 8; r += 8; + break; + case cdouble: ++#ifdef __arm__ ++ if( ((struct packed_double *) l)->d != ((struct packed_double *) r)->d ) ++#else + if( *((double *) l) != *((double *) r) ) ++#endif + return false; + l += 8; r += 8; + break; +Index: mongodb-2.0.4/db/stats/counters.cpp +=================================================================== +--- mongodb-2.0.4.orig/db/stats/counters.cpp 2012-04-04 14:30:37.789492024 +0300 ++++ mongodb-2.0.4/db/stats/counters.cpp 2012-04-04 14:30:38.481495455 +0300 +@@ -21,26 +21,7 @@ + #include "counters.h" + + namespace mongo { +- +- OpCounters::OpCounters() { +- int zero = 0; +- +- BSONObjBuilder b; +- b.append( "insert" , zero ); +- b.append( "query" , zero ); +- b.append( "update" , zero ); +- b.append( "delete" , zero ); +- b.append( "getmore" , zero ); +- b.append( "command" , zero ); +- _obj = b.obj(); +- +- _insert = (AtomicUInt*)_obj["insert"].value(); +- _query = (AtomicUInt*)_obj["query"].value(); +- _update = (AtomicUInt*)_obj["update"].value(); +- _delete = (AtomicUInt*)_obj["delete"].value(); +- _getmore = (AtomicUInt*)_obj["getmore"].value(); +- _command = (AtomicUInt*)_obj["command"].value(); +- } ++ OpCounters::OpCounters() {} + + void OpCounters::gotOp( int op , bool isCommand ) { + switch ( op ) { +@@ -63,28 +44,37 @@ + } + } + +- BSONObj& OpCounters::getObj() { ++ BSONObj OpCounters::getObj() { + const unsigned MAX = 1 << 30; + RARELY { + bool wrap = +- _insert->get() > MAX || +- _query->get() > MAX || +- _update->get() > MAX || +- _delete->get() > MAX || +- _getmore->get() > MAX || +- _command->get() > MAX; ++ _insert.get() > MAX || ++ _query.get() > MAX || ++ _update.get() > MAX || ++ _delete.get() > MAX || ++ _getmore.get() > MAX || ++ _command.get() > MAX; + + if ( wrap ) { +- _insert->zero(); +- _query->zero(); +- _update->zero(); +- _delete->zero(); +- _getmore->zero(); +- _command->zero(); ++ _insert.zero(); ++ _query.zero(); ++ _update.zero(); ++ _delete.zero(); ++ _getmore.zero(); ++ _command.zero(); + } + + } +- return _obj; ++ BSONObjBuilder b; ++ { ++ b.append( "insert" , _insert.get() ); ++ b.append( "query" , _query.get() ); ++ b.append( "update" , _update.get() ); ++ b.append( "delete" , _delete.get() ); ++ b.append( "getmore" , _getmore.get() ); ++ b.append( "command" , _command.get() ); ++ } ++ return b.obj(); + } + + IndexCounters::IndexCounters() { +Index: mongodb-2.0.4/db/stats/counters.h +=================================================================== +--- mongodb-2.0.4.orig/db/stats/counters.h 2012-04-04 14:30:37.817492158 +0300 ++++ mongodb-2.0.4/db/stats/counters.h 2012-04-04 14:30:38.481495455 +0300 +@@ -33,37 +33,36 @@ + public: + + OpCounters(); +- ++/* + AtomicUInt * getInsert() { return _insert; } + AtomicUInt * getQuery() { return _query; } + AtomicUInt * getUpdate() { return _update; } + AtomicUInt * getDelete() { return _delete; } + AtomicUInt * getGetMore() { return _getmore; } + AtomicUInt * getCommand() { return _command; } +- +- void incInsertInWriteLock(int n) { _insert->x += n; } +- void gotInsert() { _insert[0]++; } +- void gotQuery() { _query[0]++; } +- void gotUpdate() { _update[0]++; } +- void gotDelete() { _delete[0]++; } +- void gotGetMore() { _getmore[0]++; } +- void gotCommand() { _command[0]++; } ++*/ ++ void incInsertInWriteLock(int n) { _insert.x += n; } ++ void gotInsert() { _insert++; } ++ void gotQuery() { _query++; } ++ void gotUpdate() { _update++; } ++ void gotDelete() { _delete++; } ++ void gotGetMore() { _getmore++; } ++ void gotCommand() { _command++; } + + void gotOp( int op , bool isCommand ); + +- BSONObj& getObj(); ++ BSONObj getObj(); + + private: +- BSONObj _obj; + + // todo: there will be a lot of cache line contention on these. need to do something + // else eventually. +- AtomicUInt * _insert; +- AtomicUInt * _query; +- AtomicUInt * _update; +- AtomicUInt * _delete; +- AtomicUInt * _getmore; +- AtomicUInt * _command; ++ AtomicUInt _insert; ++ AtomicUInt _query; ++ AtomicUInt _update; ++ AtomicUInt _delete; ++ AtomicUInt _getmore; ++ AtomicUInt _command; + }; + + extern OpCounters globalOpCounters; diff -Nru mongodb-2.0.4/debian/patches/series mongodb-2.0.4/debian/patches/series --- mongodb-2.0.4/debian/patches/series 2012-03-30 19:44:27.000000000 +0000 +++ mongodb-2.0.4/debian/patches/series 2012-04-04 11:50:11.000000000 +0000 @@ -2,3 +2,4 @@ 0002-return-empty-TERM-if-not-set-Closes-620910.patch 0003-Ignore-unused-but-set-variables-and-params-Closes-62.patch 0004-use-system-wide-pcre.patch +0009-arm-support.patch