Commit 5212570b authored by Natanael Copa's avatar Natanael Copa

testing/mongodb: new aport

High-performance, schema-free document-oriented database
http://www.mongodb.org

ref #1182
parent 26c4e189
# Contributor: Natanael Copa <ncopa@alpinelinux.org>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=mongodb
pkgver=2.4.4
pkgrel=0
pkgdesc="High-performance, schema-free document-oriented database"
url="http://www.mongodb.org"
arch="all"
license="AGPLv3 and zlib and ASL 2.0"
depends=""
depends_dev="boost-dev python-dev pcre-dev readline-dev libpcap-dev
snappy-dev v8-dev"
makedepends="scons $depends_dev"
install=""
subpackages="$pkgname-dev $pkgname-libs $pkgname-server"
source="http://fastdl.mongodb.org/src/mongodb-src-r$pkgver.tar.gz
mongodb-2.2-r1-fix-scons.patch
mongodb-2.4.4-fix-sharedclient.patch
mongodb-2.2.4-use-system-version.patch
uclibc-libc-version.patch
mongodb.confd
mongodb.initd
mongodb.logrotate
mongos.confd
mongos.initd
"
_builddir="$srcdir"/mongodb-src-r$pkgver
prepare() {
local i
cd "$_builddir"
for i in $source; do
case $i in
*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
esac
done
# sed -i -e '/Werror/d' SConstruct || return 1
}
build() {
cd "$_builddir"
export SCONSFLAGS="$MAKEFLAGS"
scons \
--cc="$CC" \
--cxx="$CXX" \
--full \
--nostrip \
--prefix="$pkgdir"/usr \
--sharedclient \
--ssl \
--use-system-all \
--usev8 \
. \
|| return 1
}
package() {
cd "$_builddir"
export SCONSFLAGS="$MAKEFLAGS"
scons install . \
--cc="$CC" \
--cxx="$CXX" \
--full \
--nostrip \
--prefix="$pkgdir"/usr \
--sharedclient \
--ssl \
--use-system-all \
--usev8 \
|| return 1
for i in $source; do
local _mode _dir
case $i in
*.initd) _mode=755; _dir="$pkgdir"/etc/init.d ;;
*.confd) _mode=644; _dir="$pkgdir"/etc/conf.d ;;
*.logrotate) _mode=644; _dir="$pkgdir"/etc/logrotate.d ;;
*) continue;;
esac
install -D -m $_mode "$srcdir"/$i "$_dir"/${i%.*} || return 1
done
}
libs() {
pkgdesc="MongoDB shared libraries"
mkdir -p "$subpkgdir"/usr
mv "$pkgdir"/usr/lib "$subpkgdir"/usr/
}
server() {
pkgdesc="MongoDB server, sharding server"
mkdir -p "$subpkgdir"/usr/bin "$subpkgdir"/etc
mv "$pkgdir"/usr/bin/mongod \
"$pkgdir"/usr/bin/mongos \
"$subpkgdir"/usr/bin/ || return 1
mv "$pkgdir"/etc/* "$subpkgdir"/etc/ || return 1
}
md5sums="6674d22591c52dc7009b84800e9295b5 mongodb-src-r2.4.4.tar.gz
624887501b5a8b99ecf7f6043a4873d4 mongodb-2.2-r1-fix-scons.patch
48dd5de6ddd588ede2909009e1372b19 mongodb-2.4.4-fix-sharedclient.patch
a5933e42383e887adcb35986c4e359a8 mongodb-2.2.4-use-system-version.patch
fc38e47db518165b6663ba45af17a4ea uclibc-libc-version.patch
7d2f94bed7bfacd32fcd52dfd931f077 mongodb.confd
7bfbe9bd5da9254ab4981c7c3b8ac2bc mongodb.initd
49df78833de4cb6e2b9b1ab9da52c3ac mongodb.logrotate
33b23ee722f6e5d15eb6d9c2723a346f mongos.confd
e2e7904c561364545a48077ba4e84dc3 mongos.initd"
sha256sums="ea3db3e730290d030853f7a22cbbc5edfbe33dd538ec67d551a7e88f6d4db240 mongodb-src-r2.4.4.tar.gz
cd136dea1ee03cfe8009cfe1e787478115f1f73209f3a770794c36813d1374df mongodb-2.2-r1-fix-scons.patch
30ab8a6eb6f410b58df478276037ec1b694f72d3772311130b6258123c906cc5 mongodb-2.4.4-fix-sharedclient.patch
a70eebd1cef135d2940dda2705012f5bfab68580f54d62d4d56995e27a725d51 mongodb-2.2.4-use-system-version.patch
01f5974e74554c6b2456984f387ab8e753cbdd5dd6a401e51ee1b1876cc11b74 uclibc-libc-version.patch
a4ca29c577428c02cd0b0a8b46756df5f53a05519c9d13c270533cf99b9b819d mongodb.confd
ee590071ade60cffdd28ce5bd1e685bcfb49878fb88a21adea0cf30867587ade mongodb.initd
76994c32d999def5c925bd7be3f96687b3406f1d67b89aa6a4df8053025b1e01 mongodb.logrotate
2afd582564623da0e928ca667d37bef467334c82d08b49301f1f6c16ba177767 mongos.confd
0b7dafba846962f473c406e09d80923e07cf03bb8ba727b3e0408fbef28b23da mongos.initd"
sha512sums="f72aee0a9c979756741902eb87775d154de45660596ec4507274a7719d376869510f192cf7777840821cb491cfe009beced8891e3f243c761ee758ab023a457d mongodb-src-r2.4.4.tar.gz
741c4438b1f2060023ddb053317021f680a33d535299350f8775f602fd0221e7f96be0ca2694861611dfe449cb09fea4f3075018a6fc9f3c32ee978c075f3e97 mongodb-2.2-r1-fix-scons.patch
4f3e3e57ff38b5173fac972dbafa68119afccda505a8ca77326e78b715cf81401fa36bcd04297a52782b877c0c58cccee21938e6d780d30fbcf23cdf14ada5dd mongodb-2.4.4-fix-sharedclient.patch
bb91d6eb5ec9d1c44b0a95d6831b3cf75401c62f15649f01cecf0ef3b976658f3508220dab887155e8bda0bc28b868cb069d985e51d386b1633124acb445d781 mongodb-2.2.4-use-system-version.patch
59993b64edef35490d3fd765850046f8757d10f6eb7fe2e5a9488cb020cffcc0ca690ca2a1807fe66ffb40b0a2d583ba240f09982c9d9c0ca1cab7fbedc37eb6 uclibc-libc-version.patch
9bcd870742c31bf25f34188ddc3c414de1103e9860dea9f54eee276b89bc2cf1226abab1749c5cda6a6fb0880e541373754e5e83d63cc7189d4b9c274fd555c3 mongodb.confd
c0634af4653a3b3ca1a72671460e8ea11cce99b84a48782c5cdcc27453d7ead1e89a61d0ce225febda68913dd04e972b4d6a911060b1e5c4ecfbfc1e991e7b12 mongodb.initd
8c089b1a11f494e4148fb4646265964c925bf937633a65e395ee1361d42facf837871dd493a9a2e0f480ae0e0829dbd3ed60794c5334e2716332e131fc5c2c51 mongodb.logrotate
61d8734cef644187eeadc821c89e63a3fbf61860fe2db6e74557b1c6760fe83ba7549cb04f9e3aacea4d8e7e4d81a3b1bc0d5e29715eca33c4761adb17ea9ab7 mongos.confd
28b54e19efd977721549b95e23d34b070c1af0648d5ae60e2457c86a3c18e5cbb6a56fa147d13a38ac540cf9315ac8f74cddaa3c7baafc56c8c6e5596ebef0c0 mongos.initd"
--- a/SConstruct 2012-08-29 16:21:35.107094792 +0200
+++ b/SConstruct 2012-08-29 19:09:16.964893217 +0200
@@ -677,7 +677,6 @@
# -Winvalid-pch Warn if a precompiled header (see Precompiled Headers) is found in the search path but can't be used.
env.Append( CCFLAGS=["-fPIC",
"-fno-strict-aliasing",
- "-ggdb",
"-pthread",
"-Wall",
"-Wsign-compare",
@@ -685,14 +684,15 @@
"-Winvalid-pch"] )
# env.Append( " -Wconversion" ) TODO: this doesn't really work yet
if linux:
- env.Append( CCFLAGS=["-Werror", "-pipe"] )
+ # env.Append( CPPDEFINES=["XP_UNIX=1"] )
if not has_option('clang'):
env.Append( CCFLAGS=["-fno-builtin-memcmp"] ) # glibc's memcmp is faster than gcc's
env.Append( CPPDEFINES=["_FILE_OFFSET_BITS=64"] )
- env.Append( CXXFLAGS=["-Wnon-virtual-dtor", "-Woverloaded-virtual"] )
+ env.Append( CXXFLAGS=os.environ['CXXFLAGS'])
+ env.Append( LINKFLAGS=os.environ['LDFLAGS'] )
env.Append( LINKFLAGS=["-fPIC", "-pthread", "-rdynamic"] )
- env.Append( LIBS=[] )
+ env.Append( LIBS=['pcre', 'pcrecpp', 'snappy'] )
#make scons colorgcc friendly
for key in ('HOME', 'TERM'):
@@ -703,6 +703,7 @@
if linux and has_option( "sharedclient" ):
env.Append( LINKFLAGS=" -Wl,--as-needed -Wl,-zdefs " )
+ env.Append( SHLINKFLAGS=" -Wl,-soname=libmongoclient.so " )
if linux and has_option( "gcov" ):
env.Append( CXXFLAGS=" -fprofile-arcs -ftest-coverage " )
@@ -712,7 +713,7 @@
env.Append( CCFLAGS=["-O0", "-fstack-protector"] )
env['ENV']['GLIBCXX_FORCE_NEW'] = 1; # play nice with valgrind
else:
- env.Append( CCFLAGS=["-O3"] )
+ env.Append( CXXFLAGS=["-O3"] )
if debugLogging:
env.Append( CPPDEFINES=["_DEBUG"] );
diff -urp mongodb-src-r2.2.4.orig/SConstruct mongodb-src-r2.2.4/SConstruct
--- mongodb-src-r2.2.4.orig/SConstruct 2013-05-02 14:59:37.226000000 -0500
+++ mongodb-src-r2.2.4/SConstruct 2013-05-02 15:04:25.164000000 -0500
@@ -249,7 +249,7 @@ def printLocalInfo():
printLocalInfo()
-boostLibs = [ "thread" , "filesystem" , "program_options", "system" ]
+boostLibs = [ "thread" , "filesystem" , "iostreams" , "program_options", "system" ]
onlyServer = len( COMMAND_LINE_TARGETS ) == 0 or ( len( COMMAND_LINE_TARGETS ) == 1 and str( COMMAND_LINE_TARGETS[0] ) in [ "mongod" , "mongos" , "test" ] )
nix = False
@@ -791,6 +791,28 @@ def doConfigure(myenv):
print( "c++ compiler not installed!" )
Exit(1)
+ if use_system_version_of_library("snappy"):
+ if not conf.CheckCXXHeader("snappy.h"):
+ print( "can't find snappy header" )
+ Exit(1)
+ if not conf.CheckLib("libsnappy"):
+ print( "can't find snappy library" )
+ Exit(1)
+
+ if use_system_version_of_library("pcre"):
+ if not conf.CheckCXXHeader("pcre.h"):
+ print( "can't find pcre header" )
+ Exit(1)
+ if not conf.CheckLib("libpcre"):
+ print( "can't find pcre library" )
+ Exit(1)
+ if not conf.CheckCXXHeader("pcrecpp.h"):
+ print( "can't find pcrecpp header" )
+ Exit(1)
+ if not conf.CheckLib("libpcrecpp"):
+ print( "can't find pcrecpp library" )
+ Exit(1)
+
if use_system_version_of_library("boost"):
if not conf.CheckCXXHeader( "boost/filesystem/operations.hpp" ):
print( "can't find boost headers" )
Only in mongodb-src-r2.2.4: SConstruct.orig
diff --git a/src/mongo/SConscript b/src/mongo/SConscript
index c026ce9..bbd900c 100644
--- a/src/mongo/SConscript
+++ b/src/mongo/SConscript
@@ -452,7 +452,7 @@
env.Library('stacktrace', 'util/stacktrace.cpp')
env.Program('lame_stacktrace_test', 'util/lame_stacktrace_test.cpp',
- LIBDEPS=['stacktrace',
+ LIBDEPS=['stacktrace', 'foundation', 'mongocommon', 'alltools',
'$BUILD_DIR/mongo/base/base'])
serverOnlyFiles += mmapFiles
@@ -654,10 +654,6 @@
"defaultversion",
"gridfs",
"notmongodormongos"])
-env.Library("allclient", "client/clientOnly.cpp", LIBDEPS=["clientandshell"])
-
-if has_option( "sharedclient" ):
- sharedClientLibName = str( env.SharedLibrary( "mongoclient", [], LIBDEPS=["allclient"] )[0] )
# dbtests test binary
env.StaticLibrary('testframework', ['dbtests/framework.cpp'], LIBDEPS=['unittest/unittest'])
@@ -806,12 +802,6 @@
env.Install( "$INSTALL_DIR/include/" + id, Glob( id + "*.h" ) )
env.Install( "$INSTALL_DIR/include/" + id, Glob( id + "*.hpp" ) )
-#lib
-if installSetup.libraries:
- env.Install('$INSTALL_DIR/$NIX_LIB_DIR', '#${LIBPREFIX}mongoclient${LIBSUFFIX}')
- if has_option( "sharedclient" ):
- env.Install( "$INSTALL_DIR/$NIX_LIB_DIR", '#${SHLIBPREFIX}mongoclient${SHLIBSUFFIX}')
-
# Stage the top-level mongodb banners
distsrc = env.Dir('#distsrc')
env.Append(MODULE_BANNERS = [distsrc.File('README'),
@@ -842,8 +832,8 @@
'#/${SERVER_ARCHIVE}',
['#buildscripts/make_archive.py'] + env["MODULE_BANNERS"] + distBinaries,
' '.join(['$PYTHON ${SOURCES[0]} -o $TARGET'] + module_banner_transforms + [
- '--transform ${str(Dir(BUILD_DIR))}/mongo/stripped=$SERVER_DIST_BASENAME/bin',
- '--transform ${str(Dir(BUILD_DIR))}/mongo=$SERVER_DIST_BASENAME/bin',
+ '--transform "${str(Dir(BUILD_DIR))}/mongo/stripped=$SERVER_DIST_BASENAME/bin"',
+ '--transform "${str(Dir(BUILD_DIR))}/mongo=$SERVER_DIST_BASENAME/bin"',
'${TEMPFILE(SOURCES[1:])}']))
#final alias
diff --git a/src/SConscript.client b/src/SConscript.client
index b88a54f..a15bbb3 100644
--- a/src/SConscript.client
+++ b/src/SConscript.client
@@ -4,6 +4,7 @@
# programs.
Import('env clientEnv')
+Import("has_option")
env.Command(['mongo/base/error_codes.h', 'mongo/base/error_codes.cpp',],
['mongo/base/generate_error_codes.py', 'mongo/base/error_codes.err'],
@@ -36,7 +37,6 @@ clientSourceBasic = [
'mongo/client/dbclient.cpp',
'mongo/client/dbclient_rs.cpp',
'mongo/client/dbclientcursor.cpp',
- 'mongo/client/distlock.cpp',
'mongo/client/gridfs.cpp',
'mongo/client/model.cpp',
'mongo/client/sasl_client_authenticate.cpp',
@@ -83,7 +83,6 @@ clientSourceBasic = [
'mongo/util/timer.cpp',
'mongo/util/trace.cpp',
'mongo/util/util.cpp',
- 'mongo/util/version.cpp',
]
clientSourceSasl = ['mongo/client/sasl_client_authenticate_impl.cpp',
@@ -93,6 +92,7 @@ clientSourceAll = clientSourceBasic + clientSourceSasl
if env['MONGO_BUILD_SASL_CLIENT']:
clientSource = clientSourceAll
+ env.Append(LIBS="sasl2")
else:
clientSource = clientSourceBasic
@@ -133,16 +133,18 @@ for path in clientHeaderDirectories:
clientHeaders.extend(Glob('mongo/%s/*.h' % path))
clientHeaders.extend(Glob('mongo/%s/*.hpp' % path))
-mongoclient_lib = env.Library('mongoclient', clientSource),
-mongoclient_install = env.Install('#/', [
- mongoclient_lib,
- #env.SharedLibrary('mongoclient', clientSource),
- ])
+
+mongoclient_libs = [ env.Library('mongoclient', clientSource) ]
+if has_option( "sharedclient" ):
+ mongoclient_libs.append( env.SharedLibrary('mongoclient', clientSource) )
+
+mongoclient_install = env.Install('#/', mongoclient_libs)
+
env.Alias('mongoclient', mongoclient_install)
clientTests = clientEnv.Install('#/', [
clientEnv.Program(target,
- [source, mongoclient_lib]) for (target, source) in exampleSourceMap])
+ [source, mongoclient_libs[-1]]) for (target, source) in exampleSourceMap])
clientTests.append(
clientEnv.Install('#/', clientEnv.Program('bsondemo', 'mongo/bson/bsondemo/bsondemo.cpp')))
@@ -168,16 +170,18 @@
'mongo/bson/bsondemo/bsondemo.cpp',
],
'${PYTHON} ${SOURCES[0]} -o $TARGET '
- '--transform ${str(Dir(BUILD_DIR))}/client_build=$CLIENT_DIST_BASENAME/src '
- '--transform ${str(Dir(BUILD_DIR))}=$CLIENT_DIST_BASENAME/src '
- '--transform distsrc/client=$CLIENT_DIST_BASENAME '
- '--transform =$CLIENT_DIST_BASENAME/ '
+ '--transform "${str(Dir(BUILD_DIR))}/client_build=$CLIENT_DIST_BASENAME/src" '
+ '--transform "${str(Dir(BUILD_DIR))}=$CLIENT_DIST_BASENAME/src" '
+ '--transform "distsrc/client=$CLIENT_DIST_BASENAME" '
+ '--transform "=$CLIENT_DIST_BASENAME/" '
'${TEMPFILE(SOURCES[1:])}'))
# install
prefix = GetOption("prefix")
env.Install(prefix + "/lib", '${LIBPREFIX}mongoclient${LIBSUFFIX}')
+if has_option( "sharedclient" ):
+ env.Install(prefix + "/lib", '${SHLIBPREFIX}mongoclient${SHLIBSUFFIX}')
for x in clientHeaderDirectories:
inst = env.Install(prefix + "/include/mongo/" + x,
# Mongodb essentials
MONGODB_EXEC="/usr/bin/mongod"
MONGODB_RUN="/var/run/mongodb"
MONGODB_DATA="/var/lib/mongodb"
MONGODB_USER="mongodb"
# Listen to specified IP, comment this to listen to all
MONGODB_IP="127.0.0.1"
# Listen to specified port
MONGODB_PORT="27017"
# Set extra options here, such as disabling the admin web server
MONGODB_OPTIONS="--journal"
#!/sbin/runscript
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-db/mongodb/files/mongodb.initd,v 1.5 2013/01/18 11:19:27 ultrabug Exp $
depend() {
need net
}
start() {
checkpath -d -m 0750 -o "${MONGODB_USER}":mongodb "${MONGODB_RUN}"
# Listen to MONGODB_IP if configured
[ -z "${MONGODB_IP}" ] || MONGODB_OPTIONS="--bind_ip ${MONGODB_IP} ${MONGODB_OPTIONS}"
# Baselayout-1 user should use --chuid instead of --user
local USEROPT="--user"
if [ ! -f /etc/init.d/sysfs ]; then
USEROPT="--chuid"
fi
ebegin "Starting ${SVCNAME}"
start-stop-daemon --background --start --make-pidfile \
--pidfile ${MONGODB_RUN:-/var/run/mongodb}/${SVCNAME}.pid \
${USEROPT} ${MONGODB_USER:-mongodb} \
--exec ${MONGODB_EXEC:-/usr/bin/mongod} \
-- \
--port ${MONGODB_PORT:-27017} \
--dbpath ${MONGODB_DATA:-/var/lib/mongodb} \
--unixSocketPrefix ${MONGODB_RUN:-/var/run/mongodb} \
--logappend --logpath /var/log/mongodb/${SVCNAME}.log \
${MONGODB_OPTIONS}
eend $?
}
stop() {
ebegin "Stopping ${SVCNAME}"
start-stop-daemon --stop --pidfile ${MONGODB_RUN:-/var/run/mongodb}/${SVCNAME}.pid
eend $?
}
# Default log rotation / compression keeps 1 year of logs.
/var/log/mongodb/*.log {
daily
rotate 365
dateext
copytruncate
delaycompress
compress
notifempty
extension gz
sharedscripts
missingok
}
# Mongos essentials
MONGOS_EXEC="/usr/bin/mongos"
MONGOS_RUN="/var/run/mongodb"
MONGOS_USER="mongodb"
# Listen to specified IP, comment this to listen to all
MONGOS_IP="127.0.0.1"
# Listen to specified port
MONGOS_PORT="27018"
# 1 to 3 comma separated config servers (mandatory)
MONGOS_CONFIGDB=""
# Set extra options here
MONGOS_OPTIONS=""
#!/sbin/runscript
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-db/mongodb/files/mongos.initd,v 1.3 2013/01/18 11:19:27 ultrabug Exp $
depend() {
need net
}
checkconfig() {
if [ -z "${MONGOS_CONFIGDB}" ]; then
eerror "MONGOS_CONFIGDB is not defined, check your configuration file !"
return 1
fi
return 0
}
start() {
checkconfig || return 1
checkpath -d -m 0750 -o "${MONGOS_USER}":mongodb "${MONGOS_RUN}"
# Listen to MONGOS_IP if configured
[ -z "${MONGOS_IP}" ] || MONGOS_OPTIONS="--bind_ip ${MONGOS_IP} ${MONGOS_OPTIONS}"
local USEROPT="--user"
ebegin "Starting ${SVCNAME}"
start-stop-daemon --background --start --make-pidfile \
--pidfile ${MONGOS_RUN:-/var/run/mongodb}/${SVCNAME}.pid \
${USEROPT} ${MONGOS_USER:-mongodb} \
--exec ${MONGOS_EXEC:-/usr/bin/mongos} \
-- \
--port ${MONGOS_PORT:-27018} \
--unixSocketPrefix ${MONGOS_RUN:-/var/run/mongodb} \
--logappend --logpath /var/log/mongodb/${SVCNAME}.log \
--configdb ${MONGOS_CONFIGDB} \
${MONGOS_OPTIONS}
eend $?
}
stop() {
ebegin "Stopping ${SVCNAME}"
start-stop-daemon --stop --pidfile ${MONGOS_RUN:-/var/run/mongodb}/${SVCNAME}.pid
eend $?
}
--- ./src/mongo/util/processinfo_linux2.cpp.orig 2013-06-10 19:46:43.082371900 +0000
+++ ./src/mongo/util/processinfo_linux2.cpp 2013-06-10 20:01:45.581386405 +0000
@@ -20,7 +20,11 @@
#include <stdio.h>
#include <unistd.h>
#include <sys/mman.h>
+#if defined(__UCLIBC__)
+#define gnu_get_libc_version(x) "uClibc"
+#else
#include <gnu/libc-version.h>
+#endif
#include <sys/utsname.h>
#include "processinfo.h"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment