mongodb: update to 2.6.1
This commit is contained in:
parent
dfae838d8a
commit
466a5a25f3
4 changed files with 15 additions and 250 deletions
|
@ -1,181 +0,0 @@
|
|||
From: Robie Basak <robie.basak@canonical.com>
|
||||
Date: Sat, 20 Apr 2013 22:05:50 -0300
|
||||
Subject: ARM support for ASM operations in MongoDB
|
||||
|
||||
This is a modified version of Jon Masters' ARM patch. I have replaced some of
|
||||
the calls whose return value semantics didn't quite match the existing x86
|
||||
assembler.
|
||||
|
||||
Original-Author: Jon Masters <jcm@redhat.com>
|
||||
Origin: http://lists.fedoraproject.org/pipermail/arm/2013-February/005388.html
|
||||
Last-Update: 2013-03-15
|
||||
---
|
||||
src/mongo/platform/atomic_intrinsics_gcc.h | 69 +++++++++++++++++++++++++++++-
|
||||
src/mongo/platform/bits.h | 2 +-
|
||||
2 files changed, 68 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git src/mongo/platform/atomic_intrinsics_gcc.h src/mongo/platform/atomic_intrinsics_gcc.h
|
||||
index f8f96f0..da36685 100644
|
||||
--- src/mongo/platform/atomic_intrinsics_gcc.h
|
||||
+++ src/mongo/platform/atomic_intrinsics_gcc.h
|
||||
@@ -14,14 +14,19 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
- * Implementation of the AtomicIntrinsics<T>::* operations for IA-32 and AMD64 systems using a
|
||||
- * GCC-compatible compiler toolchain.
|
||||
+ * Implementation of the AtomicIntrinsics<T>::* operations for IA-32, AMD64, and 32-bit ARM
|
||||
+ * systems using a GCC-compatible compiler toolchain.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <boost/utility.hpp>
|
||||
|
||||
+#if defined(__arm__)
|
||||
+typedef int (__kuser_cmpxchg_t)(int oldval, int newval, volatile int *ptr);
|
||||
+#define __kuser_cmpxchg (*(__kuser_cmpxchg_t *)0xffff0fc0)
|
||||
+#endif
|
||||
+
|
||||
namespace mongo {
|
||||
|
||||
/**
|
||||
@@ -37,31 +42,58 @@ namespace mongo {
|
||||
static T compareAndSwap(volatile T* dest, T expected, T newValue) {
|
||||
|
||||
T result;
|
||||
+
|
||||
+#if defined(__i386__) || defined(__x86_64__)
|
||||
asm volatile ("lock cmpxchg %[src], %[dest]"
|
||||
: [dest] "+m" (*dest),
|
||||
"=a" (result)
|
||||
: [src] "r" (newValue),
|
||||
"a" (expected)
|
||||
: "memory", "cc");
|
||||
+#endif
|
||||
+
|
||||
+#if defined(__arm__)
|
||||
+ result = __sync_val_compare_and_swap(dest, expected, newValue);
|
||||
+#endif
|
||||
+
|
||||
return result;
|
||||
}
|
||||
|
||||
static T swap(volatile T* dest, T newValue) {
|
||||
|
||||
T result = newValue;
|
||||
+
|
||||
+#if defined(__i386__) || defined(__x86_64__)
|
||||
// No need for "lock" prefix on "xchg".
|
||||
asm volatile ("xchg %[r], %[dest]"
|
||||
: [dest] "+m" (*dest),
|
||||
[r] "+r" (result)
|
||||
:
|
||||
: "memory");
|
||||
+#endif
|
||||
+
|
||||
+#if defined(__arm__)
|
||||
+ __sync_synchronize();
|
||||
+ result = __sync_lock_test_and_set(dest, newValue);
|
||||
+#endif
|
||||
+
|
||||
return result;
|
||||
}
|
||||
|
||||
static T load(volatile const T* value) {
|
||||
+
|
||||
+#if defined(__i386__) || defined(__x86_64__)
|
||||
asm volatile ("mfence" ::: "memory");
|
||||
T result = *value;
|
||||
asm volatile ("mfence" ::: "memory");
|
||||
+#endif
|
||||
+
|
||||
+#if defined(__arm__)
|
||||
+ asm volatile("mcr p15, 0, r0, c7, c10, 5");
|
||||
+ T result = *value;
|
||||
+ asm volatile("mcr p15, 0, r0, c7, c10, 5");
|
||||
+#endif
|
||||
+
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -70,19 +102,44 @@ namespace mongo {
|
||||
}
|
||||
|
||||
static void store(volatile T* dest, T newValue) {
|
||||
+
|
||||
+#if defined(__i386__) || defined(__x86_64__)
|
||||
asm volatile ("mfence" ::: "memory");
|
||||
*dest = newValue;
|
||||
asm volatile ("mfence" ::: "memory");
|
||||
+#endif
|
||||
+
|
||||
+#if defined(__arm__)
|
||||
+ asm volatile("mcr p15, 0, r0, c7, c10, 5");
|
||||
+ *dest = newValue;
|
||||
+ asm volatile("mcr p15, 0, r0, c7, c10, 5");
|
||||
+#endif
|
||||
+
|
||||
}
|
||||
|
||||
static T fetchAndAdd(volatile T* dest, T increment) {
|
||||
|
||||
T result = increment;
|
||||
+
|
||||
+#if defined(__i386__) || defined(__x86_64__)
|
||||
asm volatile ("lock xadd %[src], %[dest]"
|
||||
: [dest] "+m" (*dest),
|
||||
[src] "+r" (result)
|
||||
:
|
||||
: "memory", "cc");
|
||||
+#endif
|
||||
+
|
||||
+#if defined(__arm__)
|
||||
+ int old;
|
||||
+
|
||||
+ do {
|
||||
+ old = (int)(*dest);
|
||||
+ } while(__kuser_cmpxchg((int)old, (int)(old+increment),
|
||||
+ (volatile int *)dest));
|
||||
+
|
||||
+ result = old;
|
||||
+#endif
|
||||
+
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -105,6 +162,8 @@ namespace mongo {
|
||||
public:
|
||||
static T compareAndSwap(volatile T* dest, T expected, T newValue) {
|
||||
T result = expected;
|
||||
+
|
||||
+#if defined(__i386__) || defined(__x86_64__)
|
||||
asm volatile ("push %%eax\n"
|
||||
"push %%ebx\n"
|
||||
"push %%ecx\n"
|
||||
@@ -125,6 +184,12 @@ namespace mongo {
|
||||
"D" (&result),
|
||||
"d" (&newValue)
|
||||
: "memory", "cc");
|
||||
+#endif
|
||||
+
|
||||
+#if defined(__arm__)
|
||||
+ result = __sync_val_compare_and_swap(dest, expected, newValue);
|
||||
+#endif
|
||||
+
|
||||
return result;
|
||||
}
|
||||
|
||||
diff --git src/mongo/platform/bits.h src/mongo/platform/bits.h
|
||||
index 7afc428..75343dd 100644
|
||||
--- src/mongo/platform/bits.h
|
||||
+++ src/mongo/platform/bits.h
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
#if defined(__x86_64__) || defined(__amd64__) || defined(_WIN64)
|
||||
#define MONGO_PLATFORM_64
|
||||
-#elif defined(__i386__) || defined(_WIN32)
|
||||
+#elif defined(__i386__) || defined(_WIN32) || defined(__arm__)
|
||||
#define MONGO_PLATFORM_32
|
||||
#else
|
||||
#error "unknown platform"
|
|
@ -1,67 +0,0 @@
|
|||
From: Robie Basak <robie.basak@canonical.com>
|
||||
Date: Sat, 20 Apr 2013 22:05:50 -0300
|
||||
Subject: Fix ARM alignment problems
|
||||
|
||||
This is a temporary workaround. We avoid double alignment issues by using
|
||||
memcpy to make sure that all doubles are aligned before accessing them.
|
||||
|
||||
Last-Update: 2013-03-15
|
||||
---
|
||||
src/mongo/bson/bsonelement.h | 16 +++++++++++++++-
|
||||
src/mongo/db/key.cpp | 2 +-
|
||||
2 files changed, 16 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git src/mongo/bson/bsonelement.h src/mongo/bson/bsonelement.h
|
||||
index f094ab9..1ecb47f 100644
|
||||
--- src/mongo/bson/bsonelement.h
|
||||
+++ src/mongo/bson/bsonelement.h
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
-#include <string.h> // strlen
|
||||
+#include <string.h> // strlen, memcpy
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
@@ -529,13 +529,27 @@ namespace mongo {
|
||||
}
|
||||
|
||||
inline double BSONElement::numberDouble() const {
|
||||
+#if defined(__arm__)
|
||||
+ int int_result;
|
||||
+ long long long_long_result;
|
||||
+#endif
|
||||
switch( type() ) {
|
||||
case NumberDouble:
|
||||
return _numberDouble();
|
||||
case NumberInt:
|
||||
+#if defined(__arm__)
|
||||
+ memcpy(&int_result, value(), sizeof(int_result));
|
||||
+ return int_result;
|
||||
+#else
|
||||
return *reinterpret_cast< const int* >( value() );
|
||||
+#endif
|
||||
case NumberLong:
|
||||
+#if defined(__arm__)
|
||||
+ memcpy(&long_long_result, value(), sizeof(long_long_result));
|
||||
+ return (double)long_long_result;
|
||||
+#else
|
||||
return (double) *reinterpret_cast< const long long* >( value() );
|
||||
+#endif
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
diff --git src/mongo/db/key.cpp src/mongo/db/key.cpp
|
||||
index 3d9eaa7..95959d8 100644
|
||||
--- src/mongo/db/key.cpp
|
||||
+++ src/mongo/db/key.cpp
|
||||
@@ -406,7 +406,7 @@ namespace mongo {
|
||||
p += 8;
|
||||
break;
|
||||
case cdouble:
|
||||
- b.append("", (double&) *p);
|
||||
+ b.append("", (reinterpret_cast< const PackedDouble& >(*p)).d);
|
||||
p += sizeof(double);
|
||||
break;
|
||||
case cint:
|
11
srcpkgs/mongodb/patches/removeWerror.patch
Normal file
11
srcpkgs/mongodb/patches/removeWerror.patch
Normal file
|
@ -0,0 +1,11 @@
|
|||
--- SConstruct 2014-04-08 22:55:57.206075327 +0800
|
||||
+++ SConstruct 2014-04-08 22:57:58.692240224 +0800
|
||||
@@ -819,7 +819,7 @@
|
||||
"-Winvalid-pch"] )
|
||||
# env.Append( " -Wconversion" ) TODO: this doesn't really work yet
|
||||
if linux or darwin:
|
||||
- env.Append( CCFLAGS=["-Werror", "-pipe"] )
|
||||
+ env.Append( CCFLAGS=["-pipe"] )
|
||||
|
||||
env.Append( CPPDEFINES=["_FILE_OFFSET_BITS=64"] )
|
||||
env.Append( CXXFLAGS=["-Wnon-virtual-dtor", "-Woverloaded-virtual"] )
|
|
@ -1,6 +1,6 @@
|
|||
# Template file for 'mongodb'
|
||||
pkgname=mongodb
|
||||
version=2.4.10
|
||||
version=2.6.1
|
||||
revision=1
|
||||
hostmakedepends="scons"
|
||||
makedepends="boost-devel pcre-devel snappy-devel openssl-devel libpcap-devel gperftools-devel v8-3.16-devel"
|
||||
|
@ -13,7 +13,7 @@ maintainer="Enno Boland <eb@s01.de>"
|
|||
homepage="http://www.mongodb.org"
|
||||
license="AGPL-3"
|
||||
distfiles="http://downloads.mongodb.org/src/mongodb-src-r${version}.tar.gz"
|
||||
checksum=8ac8d0537e5316e842e3713870b76ea3cc18ec1234307e850046449f48a87402
|
||||
checksum="a3199666acff3d8e236a93118de497a20b47309cf91495099f9a22b9787d262b"
|
||||
make_dirs="
|
||||
/var/lib/mongodb 0700 mongodb mongodb
|
||||
/var/log/mongodb 0750 mongodb mongodb"
|
||||
|
@ -25,6 +25,8 @@ _scons_args=" --use-system-boost \
|
|||
--use-system-v8 \
|
||||
--ssl \
|
||||
--sharedclient"
|
||||
disable_parallel_build=yes
|
||||
|
||||
|
||||
do_configure() {
|
||||
find . -name SConstruct -print0 | xargs -0 sed -i "s/-Werror/-Wno-error/g"
|
||||
|
|
Loading…
Reference in a new issue