mirror of
https://github.com/archlinuxarm/PKGBUILDs.git
synced 2024-11-28 22:57:37 +00:00
added community/mongodb
This commit is contained in:
parent
6df02912bf
commit
08607eebfc
8 changed files with 426 additions and 0 deletions
|
@ -0,0 +1,181 @@
|
|||
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 a/src/mongo/platform/atomic_intrinsics_gcc.h b/src/mongo/platform/atomic_intrinsics_gcc.h
|
||||
index f8f96f0..da36685 100644
|
||||
--- a/src/mongo/platform/atomic_intrinsics_gcc.h
|
||||
+++ b/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 a/src/mongo/platform/bits.h b/src/mongo/platform/bits.h
|
||||
index 7afc428..75343dd 100644
|
||||
--- a/src/mongo/platform/bits.h
|
||||
+++ b/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"
|
67
community/mongodb/0006-Fix-ARM-alignment-problems.patch
Normal file
67
community/mongodb/0006-Fix-ARM-alignment-problems.patch
Normal file
|
@ -0,0 +1,67 @@
|
|||
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 a/src/mongo/bson/bsonelement.h b/src/mongo/bson/bsonelement.h
|
||||
index f094ab9..1ecb47f 100644
|
||||
--- a/src/mongo/bson/bsonelement.h
|
||||
+++ b/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 a/src/mongo/db/key.cpp b/src/mongo/db/key.cpp
|
||||
index 3d9eaa7..95959d8 100644
|
||||
--- a/src/mongo/db/key.cpp
|
||||
+++ b/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:
|
94
community/mongodb/PKGBUILD
Normal file
94
community/mongodb/PKGBUILD
Normal file
|
@ -0,0 +1,94 @@
|
|||
# $Id$
|
||||
# Maintainer: Felix Yan <felixonmars@gmail.com>
|
||||
# Contributor: Sven-Hendrik Haase <sh@lutzhaase.com>
|
||||
# Contributor: Thomas Dziedzic < gostrc at gmail >
|
||||
# Contributor: Mathias Stearn <mathias@10gen.com>
|
||||
# Contributor: Alec Thomas
|
||||
|
||||
# ALARM: Kevin Mihelich <kevin@archlinuxarm.org>
|
||||
# - build -j3 (RAM constraints)
|
||||
# - use system v8
|
||||
# - ARM patches
|
||||
|
||||
pkgname=mongodb
|
||||
pkgver=2.4.9
|
||||
pkgrel=1
|
||||
pkgdesc='A high-performance, open source, schema-free document-oriented database'
|
||||
arch=('i686' 'x86_64')
|
||||
url='http://www.mongodb.org'
|
||||
license=('AGPL3')
|
||||
depends=('boost-libs' 'pcre' 'snappy' 'openssl' 'gperftools' 'v8')
|
||||
makedepends=('scons' 'boost' 'readline' 'ncurses' 'libpcap') # 'cyrus-sasl')
|
||||
checkdepends=('python2-pymongo')
|
||||
optdepends=('libpcap: needed for mongosniff')
|
||||
backup=('etc/mongodb.conf')
|
||||
install=mongodb.install
|
||||
source=("http://downloads.mongodb.org/src/mongodb-src-r${pkgver}.tar.gz"
|
||||
'mongodb.conf' 'mongodb.service' 'removeWerror.patch'
|
||||
'0005-ARM-support-for-ASM-operations-in-MongoDB.patch'
|
||||
'0006-Fix-ARM-alignment-problems.patch')
|
||||
|
||||
MAKEFLAGS="-j3"
|
||||
|
||||
build() {
|
||||
# fucking mongo aint no fun to package
|
||||
export SCONSFLAGS="$MAKEFLAGS"
|
||||
|
||||
cd mongodb-src-r${pkgver}
|
||||
|
||||
# failed to build with -Werror since 2.4.0
|
||||
patch -Np1 -i "$srcdir/removeWerror.patch"
|
||||
|
||||
patch -Np1 -i ../0005-ARM-support-for-ASM-operations-in-MongoDB.patch
|
||||
patch -Np1 -i ../0006-Fix-ARM-alignment-problems.patch
|
||||
|
||||
scons all \
|
||||
--use-system-boost \
|
||||
--use-system-pcre \
|
||||
--use-system-snappy \
|
||||
--use-system-tcmalloc \
|
||||
--ssl \
|
||||
--sharedclient \
|
||||
--use-system-v8
|
||||
# --use-sasl-client
|
||||
}
|
||||
|
||||
<<COMMENT
|
||||
check() {
|
||||
export SCONSFLAGS="$MAKEFLAGS"
|
||||
|
||||
cd mongodb-src-r${pkgver}
|
||||
|
||||
scons smokeAll --smokedbprefix=$srcdir
|
||||
}
|
||||
COMMENT
|
||||
|
||||
package() {
|
||||
export SCONSFLAGS="$MAKEFLAGS"
|
||||
|
||||
cd mongodb-src-r${pkgver}
|
||||
|
||||
scons install \
|
||||
--use-system-boost \
|
||||
--use-system-pcre \
|
||||
--use-system-snappy \
|
||||
--use-system-tcmalloc \
|
||||
--ssl \
|
||||
--sharedclient \
|
||||
--full \
|
||||
--prefix="$pkgdir/usr" \
|
||||
--use-system-v8
|
||||
# --use-sasl-client
|
||||
|
||||
install -Dm644 "$srcdir/mongodb.conf" "$pkgdir/etc/mongodb.conf"
|
||||
install -Dm644 "$srcdir/mongodb.service" "$pkgdir/usr/lib/systemd/system/mongodb.service"
|
||||
install -dm700 "$pkgdir/var/lib/mongodb"
|
||||
install -dm755 "$pkgdir/var/log/mongodb"
|
||||
}
|
||||
|
||||
sha512sums=('f9991b30eebdc13e04b553ea9c133f73cb7c0d034ae94e6293a28f3c40e8c93d3e63257e20ff801dfd586a22c95ca52551da8517d0e25534dda62f3ed650aa23'
|
||||
'05dead727d3ea5fe8af1a3c3888693f6b3e2b8cb7f197a5d793352e10d2c524e96c9a5c55ad2e88c1114643a9612ec0b26a2574b48a5260a9b51ec8941461f1c'
|
||||
'177251404b2e818ae2b546fe8b13cb76e348c99e85c7bef22a04b0f07b600fd515a309ede50214f4198594388a6d2b31f46e945b9dae84aabb4dfa13b1123bb9'
|
||||
'e709f76fa71a10d6b72d2eeae65d715e0a0a7e6cb93704114f22db8662d7102de77bd1e6706049351beb159aaa04548cfe4b14fe6ee498a166c5ad54c8275f84'
|
||||
'5e9d181f440aef2527e715116827972a8372b79aa8b22f87e31853adeb19e74f775afe85b7c5015fc4385b5fbdb1b5cf7db9904a2e891806c5541780f6bdbde6'
|
||||
'107f99d1f702ef717dcf85f524dd5937a03a59d3a40967e378fff90e048c3df0fc0c39956dd8a741c65b8758ef512c9046cb864f277b1063a8754588c75a6a11')
|
13
community/mongodb/SConscript.client.patch
Normal file
13
community/mongodb/SConscript.client.patch
Normal file
|
@ -0,0 +1,13 @@
|
|||
diff --git a/src/SConscript.client b/src/SConscript.client
|
||||
index 7a6bdc9..3fb55e5 100644
|
||||
--- a/src/SConscript.client
|
||||
+++ b/src/SConscript.client
|
||||
@@ -134,7 +134,7 @@ env.Install(
|
||||
# install
|
||||
prefix = GetOption("prefix")
|
||||
|
||||
-env.Install(prefix + "/lib", '${LIBPREFIX}mongoclient${LIBSUFFIX}')
|
||||
+env.InstallAs(prefix + "/lib", '${LIBPREFIX}mongoclient${LIBSUFFIX}')
|
||||
|
||||
for x in clientHeaderDirectories:
|
||||
env.Install(prefix + "/include/mongo/" + x,
|
8
community/mongodb/mongodb.conf
Normal file
8
community/mongodb/mongodb.conf
Normal file
|
@ -0,0 +1,8 @@
|
|||
# See http://www.mongodb.org/display/DOCS/File+Based+Configuration for format details
|
||||
# Run mongod --help to see a list of options
|
||||
|
||||
bind_ip = 127.0.0.1
|
||||
quiet = true
|
||||
dbpath = /var/lib/mongodb
|
||||
logpath = /var/log/mongodb/mongod.log
|
||||
logappend = true
|
32
community/mongodb/mongodb.install
Normal file
32
community/mongodb/mongodb.install
Normal file
|
@ -0,0 +1,32 @@
|
|||
# vim: syntax=sh
|
||||
|
||||
post_install() {
|
||||
useradd -r -g daemon -d /var/lib/mongodb -s /bin/bash mongodb
|
||||
chown -R mongodb:daemon /var/lib/mongodb
|
||||
chown -R mongodb:daemon /var/log/mongodb
|
||||
|
||||
if [ "$(uname -m)" != "x86_64" ]
|
||||
then
|
||||
echo '==> Warning: the 32 bit version of MongoDB is limited to about 2GB of data.'
|
||||
echo '==> See http://blog.mongodb.org/post/137788967/32-bit-limitations'
|
||||
fi
|
||||
}
|
||||
|
||||
post_upgrade() {
|
||||
chown -R mongodb:daemon /var/lib/mongodb
|
||||
chown -R mongodb:daemon /var/log/mongodb
|
||||
|
||||
if [ "$(vercmp $2 1.8.2-3)" -lt 0 ]
|
||||
then
|
||||
# have to fix my fudge up in 1.8.2-2 and 1.8.2-3
|
||||
# added july 5th, 2011
|
||||
usermod -s /bin/bash mongodb >& /dev/null
|
||||
echo 'The dbpath has changed from /var/state/mongodb to /var/lib/mongodb'
|
||||
echo 'Make sure you move your data files to the new dbpath before you start/restart mongodb'
|
||||
echo 'The logpath has changed from /var/log/mongod to /var/log/mongodb/mongod.log'
|
||||
fi
|
||||
}
|
||||
|
||||
pre_remove() {
|
||||
userdel mongodb
|
||||
}
|
10
community/mongodb/mongodb.service
Normal file
10
community/mongodb/mongodb.service
Normal file
|
@ -0,0 +1,10 @@
|
|||
[Unit]
|
||||
Description=High-performance, schema-free document-oriented database
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
User=mongodb
|
||||
ExecStart=/usr/bin/mongod --quiet --config /etc/mongodb.conf
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
21
community/mongodb/removeWerror.patch
Normal file
21
community/mongodb/removeWerror.patch
Normal file
|
@ -0,0 +1,21 @@
|
|||
--- a/SConstruct 2013-03-16 02:59:55.000000000 +0800
|
||||
+++ b/SConstruct 2013-03-20 10:55:20.009645869 +0800
|
||||
@@ -692,7 +692,7 @@
|
||||
"-Winvalid-pch"] )
|
||||
# env.Append( " -Wconversion" ) TODO: this doesn't really work yet
|
||||
if linux:
|
||||
- env.Append( CCFLAGS=["-Werror", "-pipe"] )
|
||||
+ env.Append( CCFLAGS=["-pipe"] )
|
||||
if not has_option('clang'):
|
||||
env.Append( CCFLAGS=["-fno-builtin-memcmp"] ) # glibc's memcmp is faster than gcc's
|
||||
|
||||
--- a/src/third_party/v8/SConscript 2013-04-17 03:21:23.000000000 +0800
|
||||
+++ b/src/third_party/v8/SConscript 2013-04-18 17:41:29.878618892 +0800
|
||||
@@ -47,7 +47,6 @@
|
||||
'gcc': {
|
||||
'all': {
|
||||
'CCFLAGS': ['-Wall',
|
||||
- '-Werror',
|
||||
'-W',
|
||||
'-Wno-unused-parameter',
|
||||
'-Woverloaded-virtual',
|
Loading…
Reference in a new issue