diff --git a/system/mongodb/README b/system/mongodb/README index bf5583fcc2..f2e41d4aff 100644 --- a/system/mongodb/README +++ b/system/mongodb/README @@ -7,9 +7,15 @@ the provided init script: # groupadd -g 285 mongo # useradd -u 285 -d /var/lib/mongodb -s /bin/false -g mongo mongo - You'll also need to add the following to /etc/rc.d/rc.local if [ -x /etc/rc.d/rc.mongodb ]; then /etc/rc.d/rc.mongodb start fi + +NOTE: mongodb 5.0 requires use of the AVX instruction set: check if +your cpu supports it with + + grep avx /proc/cpuinfo | uniq + +(no output means it doesn't) diff --git a/system/mongodb/doinst.sh b/system/mongodb/doinst.sh index 43120b22ae..8721b3d5ee 100644 --- a/system/mongodb/doinst.sh +++ b/system/mongodb/doinst.sh @@ -23,3 +23,6 @@ preserve_perms() { } preserve_perms etc/rc.d/rc.mongodb.new +config etc/mongodb.conf.new +config etc/mongos.conf.new +config etc/logrotate.d/mongodb.new diff --git a/system/mongodb/files/mongodb.conf b/system/mongodb/files/mongodb.conf new file mode 100644 index 0000000000..83b4cc0589 --- /dev/null +++ b/system/mongodb/files/mongodb.conf @@ -0,0 +1,34 @@ +# !! IMPORTANT !! +# +# This file uses the YAML format as described in the documentation: +# http://docs.mongodb.org/manual/reference/configuration-options/ + +storage: + dbPath: "/var/lib/mongodb" + #engine: wiredTiger + +systemLog: + destination: file + path: "/var/log/mongodb/mongodb.log" + quiet: true + logAppend: true + +net: + port: 27017 + bindIp: 127.0.0.1 + #ssl: + # mode: disabled + +#security: + #keyFile: + #clusterAuthMode: + +#replication: + #replSetName: + +# Specifies one of the MongoDB parameters described here: +# http://docs.mongodb.org/manual/reference/parameters/ +# +# You can specify multiple setParameter fields such as: +# setParameter: {enableTestCommands: 1} +#setParameter: diff --git a/system/mongodb/files/mongodb.logrotate b/system/mongodb/files/mongodb.logrotate new file mode 100644 index 0000000000..f95a438b5b --- /dev/null +++ b/system/mongodb/files/mongodb.logrotate @@ -0,0 +1,13 @@ +# 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 +} diff --git a/system/mongodb/files/mongos.conf b/system/mongodb/files/mongos.conf new file mode 100644 index 0000000000..fc0068962c --- /dev/null +++ b/system/mongodb/files/mongos.conf @@ -0,0 +1,30 @@ +# !! IMPORTANT !! +# +# This file uses the YAML format as described in the documentation: +# http://docs.mongodb.org/manual/reference/configuration-options/ + +systemLog: + destination: file + path: "/var/log/mongodb/mongos.log" + quiet: true + logAppend: true + +net: + port: 27017 + bindIp: 127.0.0.1 + ssl: + mode: disabled + +#security: + #keyFile: + #clusterAuthMode: + +#sharding: + #configDB: + +# Specifies one of the MongoDB parameters described here: +# http://docs.mongodb.org/manual/reference/parameters/ +# +# You can specify multiple setParameter fields such as: +# setParameter: {enableTestCommands: 1} +#setParameter: diff --git a/system/mongodb/rc.mongodb b/system/mongodb/files/rc.mongodb similarity index 100% rename from system/mongodb/rc.mongodb rename to system/mongodb/files/rc.mongodb diff --git a/system/mongodb/mongodb.SlackBuild b/system/mongodb/mongodb.SlackBuild index 57e9b2dfd4..e2d613fe69 100644 --- a/system/mongodb/mongodb.SlackBuild +++ b/system/mongodb/mongodb.SlackBuild @@ -26,7 +26,7 @@ cd $(dirname $0) ; CWD=$(pwd) PRGNAM="mongodb" -VERSION=${VERSION:-3.4.24} +VERSION=${VERSION:-5.0.4} BUILD=${BUILD:-1} TAG=${TAG:-_SBo} PKGTYPE=${PKGTYPE:-tgz} @@ -58,6 +58,14 @@ MONGO_GROUP=${MONGO_GROUP:-285} SRC_FILE=$PRGNAM-src-r$VERSION.tar.gz SRC_FLDR=$PRGNAM-src-r$VERSION +if [ "$ARCH" = "x86_64" ]; then + SLKCFLAGS="-O2 -fPIC" + LIBDIRSUFFIX="64" +else + SLKCFLAGS="-O2" + LIBDIRSUFFIX="" +fi + set -e # Bail if user or group isn't valid on your system @@ -89,6 +97,10 @@ mkdir -p $TMP $PKG $OUTPUT cd $TMP tar xvf $CWD/$SRC_FILE cd $SRC_FLDR +# remove bundled libs +rm -fR src/third_party/{boost,pcre-*,snappy-*,yaml-cpp,zlib-*} +# remove compass +rm -fR src/mongo/installer/compass chown -R root.root . find -L . \ \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \ @@ -96,28 +108,57 @@ find -L . \ \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \ -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \; +# thanks gentoo, also for these patches +for i in $CWD/patches/* ; do patch -p1 < $i ; done + +scons_opts=( + --disable-warnings-as-errors + --use-system-boost + --use-system-pcre + --use-system-snappy + --use-system-yaml + --use-system-zlib + --use-system-zstd + --use-sasl-client + --ssl +) + if [ "$ARCH" = "x86_64" ]; then - scons -j $MAKEJOBS --ssl --disable-warnings-as-errors --prefix=${PKG}/usr core install + PREFIX=${PKG}/usr CFLAGS="$SLKCFLAGS" CXXFLAGS="$SLKCFLAGS" LDFLAGS="-L /lib$LIBDIRSUFFIX -L/usr/lib$LIBDIRSUFFIX" \ + ./buildscripts/scons.py "${scons_opts[@]}" --jobs="$MAKEJOBS" install-core else - scons -j $MAKEJOBS --ssl --disable-warnings-as-errors --prefix=${PKG}/usr core --wiredtiger=off install + PREFIX=${PKG}/usr CFLAGS="$SLKCFLAGS" CXXFLAGS="$SLKCFLAGS" LDFLAGS="-L /lib$LIBDIRSUFFIX -L/usr/lib$LIBDIRSUFFIX" \ + ./buildscripts/scons.py "${scons_opts[@]}" --jobs="$MAKEJOBS" --wiredtiger=off install-core fi +# manual install +( cd build/install/bin + for i in * ; do install -D -m 0755 $i $PKG/usr/bin/$i ; done ) +( cd debian + for i in *.1 ; do install -D -m 0644 $i $PKG/usr/man/man1/$i ; done ) + find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \ | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true +find $PKG/usr/man -type f -exec gzip -9 {} \; +for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done mkdir -p ${PKG}/usr/doc/${PRGNAM}-${VERSION} cp distsrc/* ${PKG}/usr/doc/${PRGNAM}-${VERSION} -mkdir -p $PKG/etc/rc.d -cat $CWD/rc.mongodb > $PKG/etc/rc.d/rc.mongodb.new +mkdir -p $PKG/etc/{logrotate,rc}.d +cat $CWD/files/mongodb.conf > $PKG/etc/mongodb.conf.new +cat $CWD/files/mongos.conf > $PKG/etc/mongos.conf.new +cat $CWD/files/mongodb.logrotate > $PKG/etc/logrotate.d/mongodb.new +cat $CWD/files/rc.mongodb > $PKG/etc/rc.d/rc.mongodb.new + +mkdir -p $PKG/var/{lib,log}/mongodb +chmod 750 $PKG/var/{lib,log}/mongodb +chown mongo.mongo $PKG/var/{lib,log}/mongodb mkdir -p $PKG/install cat $CWD/slack-desc > $PKG/install/slack-desc cat $CWD/doinst.sh > $PKG/install/doinst.sh -mkdir -p $PKG/var/lib/mongodb -chown mongo.mongo $PKG/var/lib/mongodb - cd $PKG /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE diff --git a/system/mongodb/mongodb.info b/system/mongodb/mongodb.info index c563a13750..8667a74781 100644 --- a/system/mongodb/mongodb.info +++ b/system/mongodb/mongodb.info @@ -1,10 +1,10 @@ PRGNAM="mongodb" -VERSION="3.4.24" +VERSION="5.0.4" HOMEPAGE="https://www.mongodb.org/" DOWNLOAD="UNSUPPORTED" MD5SUM="" -DOWNLOAD_x86_64="https://fastdl.mongodb.org/src/mongodb-src-r3.4.24.tar.gz" -MD5SUM_x86_64="2033a6857e9e71bb2faede3a262c4524" -REQUIRES="" +DOWNLOAD_x86_64="https://fastdl.mongodb.org/src/mongodb-src-r5.0.4.tar.gz" +MD5SUM_x86_64="366a864aaf21cc391e910f46a3051461" +REQUIRES="cheetah3 psutil python3-PyYAML snappy snowballstemmer yaml-cpp" MAINTAINER="Miguel De Anda" EMAIL="miguel@thedeanda.com" diff --git a/system/mongodb/patches/01_mongodb-4.4.1-boost.patch b/system/mongodb/patches/01_mongodb-4.4.1-boost.patch new file mode 100644 index 0000000000..009ca6826a --- /dev/null +++ b/system/mongodb/patches/01_mongodb-4.4.1-boost.patch @@ -0,0 +1,23 @@ +diff --git a/SConstruct b/SConstruct +index 89c044ab..0484e475 100644 +--- a/SConstruct ++++ b/SConstruct +@@ -3511,17 +3511,11 @@ def doConfigure(myenv): + "BOOST_LOG_NO_SHORTHAND_NAMES", + "BOOST_LOG_USE_NATIVE_SYSLOG", + "BOOST_LOG_WITHOUT_THREAD_ATTR", ++ "BOOST_LOG_DYN_LINK", + "ABSL_FORCE_ALIGNED_ACCESS", + ] + ) + +- if link_model.startswith("dynamic") and not link_model == 'dynamic-sdk': +- conf.env.AppendUnique( +- CPPDEFINES=[ +- "BOOST_LOG_DYN_LINK", +- ] +- ) +- + if use_system_version_of_library("boost"): + if not conf.CheckCXXHeader( "boost/filesystem/operations.hpp" ): + myenv.ConfError("can't find boost headers") diff --git a/system/mongodb/patches/02_mongodb-4.4.1-gcc11.patch b/system/mongodb/patches/02_mongodb-4.4.1-gcc11.patch new file mode 100644 index 0000000000..a6ff02dcf6 --- /dev/null +++ b/system/mongodb/patches/02_mongodb-4.4.1-gcc11.patch @@ -0,0 +1,12 @@ +https://bugs.gentoo.org/768339 + +--- a/src/mongo/db/exec/plan_stats.h ++++ b/src/mongo/db/exec/plan_stats.h +@@ -33,6 +33,7 @@ + #include + #include + #include ++#include + + #include "mongo/db/index/multikey_paths.h" + diff --git a/system/mongodb/patches/03_mongodb-5.0.2-fix-scons.patch b/system/mongodb/patches/03_mongodb-5.0.2-fix-scons.patch new file mode 100644 index 0000000000..2d1a2f9312 --- /dev/null +++ b/system/mongodb/patches/03_mongodb-5.0.2-fix-scons.patch @@ -0,0 +1,32 @@ +diff --git a/SConstruct b/SConstruct +index 115de78a..613110b7 100644 +--- a/SConstruct ++++ b/SConstruct +@@ -2366,7 +2366,6 @@ if env.TargetOSIs('posix'): + + # -Winvalid-pch Warn if a precompiled header (see Precompiled Headers) is found in the search path but can't be used. + env.Append( CCFLAGS=["-fasynchronous-unwind-tables", +- "-ggdb" if not env.TargetOSIs('emscripten') else "-g", + "-Wall", + "-Wsign-compare", + "-Wno-unknown-pragmas", +@@ -2422,6 +2421,8 @@ if env.TargetOSIs('posix'): + + # env.Append( " -Wconversion" ) TODO: this doesn't really work yet + env.Append( CXXFLAGS=["-Woverloaded-virtual"] ) ++ env.Append( CXXFLAGS=os.environ['CXXFLAGS'] ) ++ env.Append( LINKFLAGS=os.environ['LDFLAGS'] ) + + # On OS X, clang doesn't want the pthread flag at link time, or it + # issues warnings which make it impossible for us to declare link +@@ -2473,8 +2474,8 @@ if env.TargetOSIs('posix'): + ], + ) + +- #make scons colorgcc friendly +- for key in ('HOME', 'TERM'): ++ #make scons colorgcc, distcc, ccache friendly ++ for key in ('HOME', 'PATH', 'TERM'): + try: + env['ENV'][key] = os.environ[key] + except KeyError: diff --git a/system/mongodb/patches/04_mongodb-5.0.2-no-compass.patch b/system/mongodb/patches/04_mongodb-5.0.2-no-compass.patch new file mode 100644 index 0000000000..7772515772 --- /dev/null +++ b/system/mongodb/patches/04_mongodb-5.0.2-no-compass.patch @@ -0,0 +1,12 @@ +diff --git a/src/mongo/installer/SConscript b/src/mongo/installer/SConscript +index 5bd89fe9..489e70ac 100644 +--- a/src/mongo/installer/SConscript ++++ b/src/mongo/installer/SConscript +@@ -7,7 +7,6 @@ env = env.Clone() + + env.SConscript( + dirs=[ +- 'compass', + 'msi', + ], + exports=[ diff --git a/system/mongodb/patches/05_mongodb-5.0.2-skip-no-exceptions.patch b/system/mongodb/patches/05_mongodb-5.0.2-skip-no-exceptions.patch new file mode 100644 index 0000000000..ae69befcea --- /dev/null +++ b/system/mongodb/patches/05_mongodb-5.0.2-skip-no-exceptions.patch @@ -0,0 +1,13 @@ +diff --git a/SConstruct b/SConstruct +index 613110b7..4987e24e 100644 +--- a/SConstruct ++++ b/SConstruct +@@ -2958,7 +2958,7 @@ def doConfigure(myenv): + + # This warning was added in clang-5 and incorrectly flags our implementation of + # exceptionToStatus(). See https://bugs.llvm.org/show_bug.cgi?id=34804 +- AddToCCFLAGSIfSupported(myenv, "-Wno-exceptions") ++ #AddToCCFLAGSIfSupported(myenv, "-Wno-exceptions") + + # Enable sized deallocation support. + AddToCXXFLAGSIfSupported(myenv, '-fsized-deallocation') diff --git a/system/mongodb/patches/06_mongodb-5.0.2-skip-reqs-check.patch b/system/mongodb/patches/06_mongodb-5.0.2-skip-reqs-check.patch new file mode 100644 index 0000000000..823d481c20 --- /dev/null +++ b/system/mongodb/patches/06_mongodb-5.0.2-skip-reqs-check.patch @@ -0,0 +1,24 @@ +diff --git a/buildscripts/scons.py b/buildscripts/scons.py +index 534fca32..c38f64df 100755 +--- a/buildscripts/scons.py ++++ b/buildscripts/scons.py +@@ -19,13 +19,13 @@ SITE_TOOLS_DIR = os.path.join(MONGODB_ROOT, 'site_scons') + sys.path = [SCONS_DIR, SITE_TOOLS_DIR] + sys.path + + # pylint: disable=C0413 +-from mongo.pip_requirements import verify_requirements, MissingRequirements ++#from mongo.pip_requirements import verify_requirements, MissingRequirements + +-try: +- verify_requirements('etc/pip/compile-requirements.txt') +-except MissingRequirements as ex: +- print(ex) +- sys.exit(1) ++#try: ++# verify_requirements('etc/pip/compile-requirements.txt') ++#except MissingRequirements as ex: ++# print(ex) ++# sys.exit(1) + + try: + import SCons.Script