summaryrefslogtreecommitdiffstats
path: root/system/mongodb
diff options
context:
space:
mode:
Diffstat (limited to 'system/mongodb')
-rw-r--r--system/mongodb/files/rc.mongodb11
-rw-r--r--system/mongodb/mongodb.SlackBuild53
-rw-r--r--system/mongodb/mongodb.info12
-rw-r--r--system/mongodb/patches/01_mongodb-4.4.1-boost.patch23
-rw-r--r--system/mongodb/patches/02_mongodb-4.4.1-gcc11.patch12
-rw-r--r--system/mongodb/patches/03_mongodb-5.0.2-fix-scons.patch32
-rw-r--r--system/mongodb/patches/05_mongodb-5.0.2-skip-no-exceptions.patch13
-rw-r--r--system/mongodb/patches/mongodb-5.0.2-no-compass.patch (renamed from system/mongodb/patches/04_mongodb-5.0.2-no-compass.patch)0
-rw-r--r--system/mongodb/patches/mongodb-5.0.2-skip-reqs-check.patch (renamed from system/mongodb/patches/06_mongodb-5.0.2-skip-reqs-check.patch)0
-rw-r--r--system/mongodb/patches/mongodb-7.0.2-sconstruct.patch159
10 files changed, 198 insertions, 117 deletions
diff --git a/system/mongodb/files/rc.mongodb b/system/mongodb/files/rc.mongodb
index 47ca19be76..f0b178c3cf 100644
--- a/system/mongodb/files/rc.mongodb
+++ b/system/mongodb/files/rc.mongodb
@@ -7,7 +7,7 @@
#
PID=/var/state/mongodb.pid
-LOG=/var/log/mongodb
+LOG=/var/log/mongodb/mongodb.log
DBPATH=/var/lib/mongodb
USER=mongo
GROUP=mongo
@@ -15,17 +15,16 @@ SHELL=${SHELL:-/bin/bash}
mongo_start() {
touch $LOG
- chown $GROUP.$USER $LOG
+ chown $GROUP:$USER $LOG
touch $PID
- chown $GROUP.$USER $PID
+ chown $GROUP:$USER $PID
su -l $USER -s $SHELL -c "/usr/bin/mongod \
--dbpath=$DBPATH \
--fork \
--pidfilepath=$PID \
--logappend \
- --logpath=$LOG \
- --nohttpinterface \
+ --logpath=$LOG
" && {
echo "MongoDB server started successfully."
} || {
@@ -41,7 +40,7 @@ mongo_stop() {
echo "Failed to stop MongoDB server" > /dev/stderr
exit 1
}
- # rm $PID
+ rm -f $PID
}
mongo_restart() {
diff --git a/system/mongodb/mongodb.SlackBuild b/system/mongodb/mongodb.SlackBuild
index e2d613fe69..e1b70f5443 100644
--- a/system/mongodb/mongodb.SlackBuild
+++ b/system/mongodb/mongodb.SlackBuild
@@ -3,6 +3,7 @@
# Slackware build script for MongoDB
# Copyright 2015 Miguel De Anda <miguel@thedeanda.com>
+# Copyright 2023-2024 Willy Sudiarto Raharjo <willysr@slackbuilds.org>
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@@ -26,11 +27,10 @@
cd $(dirname $0) ; CWD=$(pwd)
PRGNAM="mongodb"
-VERSION=${VERSION:-5.0.4}
+VERSION=${VERSION:-7.0.9}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
PKGTYPE=${PKGTYPE:-tgz}
-MAKEJOBS=${MAKEJOBS:-1}
if [ -z "$ARCH" ]; then
case "$( uname -m )" in
@@ -40,9 +40,6 @@ if [ -z "$ARCH" ]; then
esac
fi
-# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
-# the name of the created package would be, and then exit. This information
-# could be useful to other scripts.
if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
exit 0
@@ -68,10 +65,8 @@ fi
set -e
-# Bail if user or group isn't valid on your system
-if ! getent passwd mongo 1>/dev/null 2>/dev/null; then
-
-cat << EOF
+bailout() {
+ cat << EOF
You must have a mongo user to run this script
@@ -79,18 +74,12 @@ cat << EOF
# useradd -u $MONGO_USER -d /var/lib/$PRGNAM -s /bin/false -g mongo mongo
EOF
+ exit 1
+}
- exit
-elif ! getent group mongo 1>/dev/null 2>/dev/null; then
-
-cat << EOF
-
- You must have a mongo group to run this script
- # groupadd -g $MONGO_GROUP mongo
-
-EOF
- exit
-fi
+# Bail if user or group isn't valid on your system
+getent passwd mongo &>/dev/null || bailout
+getent group mongo &>/dev/null || bailout
rm -fr $TMP/$SRC_FLDR $PKG
mkdir -p $TMP $PKG $OUTPUT
@@ -101,7 +90,7 @@ cd $SRC_FLDR
rm -fR src/third_party/{boost,pcre-*,snappy-*,yaml-cpp,zlib-*}
# remove compass
rm -fR src/mongo/installer/compass
-chown -R root.root .
+chown -R root:root .
find -L . \
\( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
-o -perm 511 \) -exec chmod 755 {} \; -o \
@@ -111,24 +100,37 @@ find -L . \
# thanks gentoo, also for these patches
for i in $CWD/patches/* ; do patch -p1 < $i ; done
+sed -i "s|GCC 11.3|GCC 11.2|g" SConstruct
+sed -i "s|__GNUC_MINOR__ < 3|__GNUC_MINOR__ < 2|g" SConstruct
+
scons_opts=(
--disable-warnings-as-errors
--use-system-boost
- --use-system-pcre
+ --use-system-pcre2
--use-system-snappy
--use-system-yaml
--use-system-zlib
--use-system-zstd
--use-sasl-client
+ --use-system-libbson
+ --use-system-mongo-c
--ssl
)
+# Thanks to Lockywolf
+# scons can use multiple jobs. For convenience, read MAKEFLAGS from the environment, if set
+JOBS="$( echo $MAKEFLAGS | sed 's,.*-j *\([0-9][0-9]*\)*.*,\1,' )"
+# or if no MAKEFLAGS, use the number of cores minus 1
+JOBS="${JOBS:-$(( $( nproc ) - 1 ))}"
+# or 1, if we really have one core
+[ "$JOBS" = "0" ] && JOBS=1
+
if [ "$ARCH" = "x86_64" ]; then
PREFIX=${PKG}/usr CFLAGS="$SLKCFLAGS" CXXFLAGS="$SLKCFLAGS" LDFLAGS="-L /lib$LIBDIRSUFFIX -L/usr/lib$LIBDIRSUFFIX" \
- ./buildscripts/scons.py "${scons_opts[@]}" --jobs="$MAKEJOBS" install-core
+ ./buildscripts/scons.py "${scons_opts[@]}" --force-jobs --jobs="$JOBS" install-core
else
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
+ ./buildscripts/scons.py "${scons_opts[@]}" --force-jobs --jobs="$JOBS" --wiredtiger=off install-core
fi
# manual install
@@ -145,6 +147,7 @@ for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; r
mkdir -p ${PKG}/usr/doc/${PRGNAM}-${VERSION}
cp distsrc/* ${PKG}/usr/doc/${PRGNAM}-${VERSION}
+cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
mkdir -p $PKG/etc/{logrotate,rc}.d
cat $CWD/files/mongodb.conf > $PKG/etc/mongodb.conf.new
@@ -154,7 +157,7 @@ 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
+chown mongo:mongo $PKG/var/{lib,log}/mongodb
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
diff --git a/system/mongodb/mongodb.info b/system/mongodb/mongodb.info
index 0be3f143bc..7e2ff199e5 100644
--- a/system/mongodb/mongodb.info
+++ b/system/mongodb/mongodb.info
@@ -1,10 +1,10 @@
PRGNAM="mongodb"
-VERSION="5.0.4"
+VERSION="7.0.9"
HOMEPAGE="https://www.mongodb.org/"
DOWNLOAD="UNSUPPORTED"
MD5SUM=""
-DOWNLOAD_x86_64="https://fastdl.mongodb.org/src/mongodb-src-r5.0.4.tar.gz"
-MD5SUM_x86_64="366a864aaf21cc391e910f46a3051461"
-REQUIRES="cheetah3 psutil snappy snowballstemmer yaml-cpp"
-MAINTAINER="Miguel De Anda"
-EMAIL="miguel@thedeanda.com"
+DOWNLOAD_x86_64="https://fastdl.mongodb.org/src/mongodb-src-r7.0.9.tar.gz"
+MD5SUM_x86_64="96815d47735f5caf1bb024c7b4df8f6a"
+REQUIRES="cheetah3 python3-psutil snappy snowballstemmer yaml-cpp python3-jsonschema mongo-c-driver pymongo"
+MAINTAINER="Willy Sudiarto Raharjo"
+EMAIL="willysr@slackbuilds.org"
diff --git a/system/mongodb/patches/01_mongodb-4.4.1-boost.patch b/system/mongodb/patches/01_mongodb-4.4.1-boost.patch
deleted file mode 100644
index 009ca6826a..0000000000
--- a/system/mongodb/patches/01_mongodb-4.4.1-boost.patch
+++ /dev/null
@@ -1,23 +0,0 @@
-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
deleted file mode 100644
index a6ff02dcf6..0000000000
--- a/system/mongodb/patches/02_mongodb-4.4.1-gcc11.patch
+++ /dev/null
@@ -1,12 +0,0 @@
-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 <cstdlib>
- #include <string>
- #include <vector>
-+#include <optional>
-
- #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
deleted file mode 100644
index 2d1a2f9312..0000000000
--- a/system/mongodb/patches/03_mongodb-5.0.2-fix-scons.patch
+++ /dev/null
@@ -1,32 +0,0 @@
-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/05_mongodb-5.0.2-skip-no-exceptions.patch b/system/mongodb/patches/05_mongodb-5.0.2-skip-no-exceptions.patch
deleted file mode 100644
index ae69befcea..0000000000
--- a/system/mongodb/patches/05_mongodb-5.0.2-skip-no-exceptions.patch
+++ /dev/null
@@ -1,13 +0,0 @@
-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/04_mongodb-5.0.2-no-compass.patch b/system/mongodb/patches/mongodb-5.0.2-no-compass.patch
index 7772515772..7772515772 100644
--- a/system/mongodb/patches/04_mongodb-5.0.2-no-compass.patch
+++ b/system/mongodb/patches/mongodb-5.0.2-no-compass.patch
diff --git a/system/mongodb/patches/06_mongodb-5.0.2-skip-reqs-check.patch b/system/mongodb/patches/mongodb-5.0.2-skip-reqs-check.patch
index 823d481c20..823d481c20 100644
--- a/system/mongodb/patches/06_mongodb-5.0.2-skip-reqs-check.patch
+++ b/system/mongodb/patches/mongodb-5.0.2-skip-reqs-check.patch
diff --git a/system/mongodb/patches/mongodb-7.0.2-sconstruct.patch b/system/mongodb/patches/mongodb-7.0.2-sconstruct.patch
new file mode 100644
index 0000000000..822bd81d0b
--- /dev/null
+++ b/system/mongodb/patches/mongodb-7.0.2-sconstruct.patch
@@ -0,0 +1,159 @@
+diff --git a/SConstruct b/SConstruct
+index 92d557b..80ee9e8 100644
+--- a/SConstruct
++++ b/SConstruct
+@@ -23,7 +23,6 @@ from pkg_resources import parse_version
+
+ import SCons
+ import SCons.Script
+-from mongo_tooling_metrics.lib.top_level_metrics import SConsToolingMetrics
+ from site_scons.mongo import build_profiles
+
+ # This must be first, even before EnsureSConsVersion, if
+@@ -1649,13 +1648,6 @@ env.AddMethod(lambda env, name, **kwargs: add_option(name, **kwargs), 'AddOption
+
+ # The placement of this is intentional. Here we setup an atexit method to store tooling metrics.
+ # We should only register this function after env, env_vars and the parser have been properly initialized.
+-SConsToolingMetrics.register_metrics(
+- utc_starttime=datetime.utcnow(),
+- artifact_dir=env.Dir('$BUILD_DIR').get_abspath(),
+- env_vars=env_vars,
+- env=env,
+- parser=_parser,
+-)
+
+ if get_option('build-metrics'):
+ env['BUILD_METRICS_ARTIFACTS_DIR'] = '$BUILD_ROOT/$VARIANT_DIR'
+@@ -3026,7 +3018,6 @@ if env.TargetOSIs('posix'):
+ env.Append(
+ CCFLAGS=[
+ "-fasynchronous-unwind-tables",
+- "-g2" if not env.TargetOSIs('emscripten') else "-g",
+ "-Wall",
+ "-Wsign-compare",
+ "-Wno-unknown-pragmas",
+@@ -3093,6 +3084,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
+@@ -3143,7 +3136,7 @@ if env.TargetOSIs('posix'):
+ ], )
+
+ #make scons colorgcc friendly
+- for key in ('HOME', 'TERM'):
++ for key in ('HOME', 'TERM', 'PATH'):
+ try:
+ env['ENV'][key] = os.environ[key]
+ except KeyError:
+@@ -3543,33 +3536,6 @@ def doConfigure(myenv):
+ myenv.AddMethod(
+ functools.partial(var_func, var=var, func=CheckFlag), f"Check{var}Supported")
+
+- if myenv.ToolchainIs('gcc', 'clang'):
+- # This tells clang/gcc to use the gold linker if it is available - we prefer the gold linker
+- # because it is much faster. Don't use it if the user has already configured another linker
+- # selection manually.
+- if any(flag.startswith('-fuse-ld=') for flag in env['LINKFLAGS']):
+- myenv.FatalError(
+- f"Use the '--linker' option instead of modifying the LINKFLAGS directly.")
+-
+- linker_ld = get_option('linker')
+- if linker_ld == 'auto':
+- if not env.TargetOSIs('darwin', 'macOS'):
+- if not myenv.AddToLINKFLAGSIfSupported('-fuse-ld=lld'):
+- myenv.FatalError(
+- f"The recommended linker 'lld' is not supported with the current compiler configuration, you can try the 'gold' linker with '--linker=gold'."
+- )
+- elif link_model.startswith("dynamic") and linker_ld == 'bfd':
+- # BFD is not supported due to issues with it causing warnings from some of
+- # the third party libraries that mongodb is linked with:
+- # https://jira.mongodb.org/browse/SERVER-49465
+- myenv.FatalError(f"Linker {linker_ld} is not supported with dynamic link model builds.")
+- else:
+- if not myenv.AddToLINKFLAGSIfSupported(f'-fuse-ld={linker_ld}'):
+- myenv.FatalError(f"Linker {linker_ld} could not be configured.")
+-
+- if has_option('gcov') and myenv.AddToCCFLAGSIfSupported('-fprofile-update=single'):
+- myenv.AppendUnique(LINKFLAGS=['-fprofile-update=single'])
+-
+ detectCompiler = Configure(
+ myenv,
+ help=False,
+@@ -4621,43 +4587,6 @@ def doConfigure(myenv):
+ if optBuild == "off" and myenv.ToolchainIs('clang') and env.TargetOSIs('darwin'):
+ myenv.AddToLINKFLAGSIfSupported("-Wl,-no_deduplicate")
+
+- # Apply any link time optimization settings as selected by the 'lto' option.
+- if has_option('lto'):
+- if myenv.ToolchainIs('msvc'):
+- # Note that this is actually more aggressive than LTO, it is whole program
+- # optimization due to /GL. However, this is historically what we have done for
+- # windows, so we are keeping it.
+- #
+- # /GL implies /LTCG, so no need to say it in CCFLAGS, but we do need /LTCG on the
+- # link flags.
+- myenv.Append(CCFLAGS=['/GL'])
+- myenv.Append(LINKFLAGS=['/LTCG'])
+- myenv.Append(ARFLAGS=['/LTCG'])
+- elif myenv.ToolchainIs('gcc', 'clang'):
+- # For GCC and clang, the flag is -flto, and we need to pass it both on the compile
+- # and link lines.
+- if not myenv.AddToCCFLAGSIfSupported('-flto') or \
+- not myenv.AddToLINKFLAGSIfSupported('-flto'):
+- myenv.ConfError("Link time optimization requested, "
+- "but selected compiler does not honor -flto")
+-
+- if myenv.TargetOSIs('darwin'):
+- myenv.AddToLINKFLAGSIfSupported('-Wl,-object_path_lto,${TARGET}.lto')
+- else:
+- # According to intel benchmarks -fno-plt increases perf
+- # See PM-2215
+- if linker_ld != "gold":
+- myenv.ConfError("lto compilation currently only works with the --linker=gold")
+- if link_model != "object":
+- myenv.ConfError(
+- "lto compilation currently only works with the --link-model=object")
+- if not myenv.AddToCCFLAGSIfSupported('-fno-plt') or \
+- not myenv.AddToLINKFLAGSIfSupported('-fno-plt'):
+- myenv.ConfError("-fno-plt is not supported by the compiler")
+-
+- else:
+- myenv.ConfError("Don't know how to enable --lto on current toolchain")
+-
+ if get_option('runtime-hardening') == "on" and optBuild != "off":
+ # Older glibc doesn't work well with _FORTIFY_SOURCE=2. Selecting 2.11 as the minimum was an
+ # emperical decision, as that is the oldest non-broken glibc we seem to require. It is possible
+@@ -5120,17 +5049,13 @@ def doConfigure(myenv):
+ "BOOST_LOG_NO_SHORTHAND_NAMES",
+ "BOOST_LOG_USE_NATIVE_SYSLOG",
+ "BOOST_LOG_WITHOUT_THREAD_ATTR",
++ "BOOST_LOG_DYN_LINK",
+ "BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS",
+ "BOOST_SYSTEM_NO_DEPRECATED",
+ "BOOST_THREAD_USES_DATETIME",
+ ("BOOST_THREAD_VERSION", "5"),
+ ])
+
+- 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")
+@@ -5327,6 +5252,9 @@ def doConfigure(myenv):
+
+ mongoc_mode = get_option('use-system-mongo-c')
+ conf.env['MONGO_HAVE_LIBMONGOC'] = False
++ conf.env.ParseConfig('pkg-config libbson-1.0 libmongoc-1.0 --cflags')
++ conf.env['LIBDEPS_LIBBSON_SYSLIBDEP'] = 'bson-1.0'
++
+ if mongoc_mode != 'off':
+ if conf.CheckLibWithHeader(
+ ["mongoc-1.0"],