From ecc209676905a5db87a20dfaab7813947004bbfc Mon Sep 17 00:00:00 2001 From: Eric Hameleers Date: Mon, 8 Mar 2021 10:18:45 +0000 Subject: mongodb: fixes to make it work on Slackware 14.2, and an improved initial setup --- mongodb/build/mongodb.SlackBuild | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/mongodb/build/mongodb.SlackBuild b/mongodb/build/mongodb.SlackBuild index bd2da0d6..a8061bdf 100755 --- a/mongodb/build/mongodb.SlackBuild +++ b/mongodb/build/mongodb.SlackBuild @@ -178,7 +178,7 @@ export LDFLAGS="$SLKLDFLAGS" export CXXFLAGS="$SLKCFLAGS" export CFLAGS="$SLKCFLAGS" export SCONSFLAGS="$NUMJOBS" -export LINKFLAGS="-Wl,-static-libgcc -static-libstdc++" +export LINKFLAGS="-Wl,-static -static-libgcc -static-libstdc++" scons core \ --prefix=/usr \ @@ -203,6 +203,35 @@ scons install \ # Remove install script for compass: rm -f $PKG/usr/bin/install_compass +# On Slackware older than 14.2+, also copy the libgcc_s.so and libstdc++.so +# libraries into the package, because the mongodb binaries will +# depend on it and a default Slackware will not contain this newer version +# (we used a newer version of gcc to compile mongodb): +if [ -n "$(grep ^[^+]*$ /etc/slackware-version)" ]; then + if [ $(cat /etc/slackware-version |cut -d' ' -f2 |cut -d. -f1) -le 14 ]; then + mkdir -p $PKG/usr/lib${LIBDIRSUFFIX}/mongodb + cp -ia /usr/lib${LIBDIRSUFFIX}/libgcc_s.so.* \ + $PKG/usr/lib${LIBDIRSUFFIX}/mongodb/ + GLIBCXXLIB=$(readlink -f /usr/lib${LIBDIRSUFFIX}/libstdc++.so.6) + cp -ia $GLIBCXXLIB $PKG/usr/lib${LIBDIRSUFFIX}/mongodb/ + ln -s $(basename $GLIBCXXLIB) \ + $PKG/usr/lib${LIBDIRSUFFIX}/mongodb/libstdc++.so.6 + + # Move mongodb binaries into the custom directory and create symlinks, + # so that we can preload the internal gcc libraries: + for MBIN in mongo mongod mongos ; do + mv -i $PKG/usr/bin/$MBIN $PKG/usr/lib${LIBDIRSUFFIX}/mongodb/ + cat < $PKG/usr/bin/${MBIN} +#!/bin/sh +MONGODIR=/usr/lib${LIBDIRSUFFIX}/mongodb +cd \$MONGODIR +LD_PRELOAD="\$MONGODIR/libstdc++.so.6 \$MONGODIR/libgcc_s.so.1" \$MONGODIR/\$(basename \$0) "\$@" +EOT + chmod 0755 $PKG/usr/bin/${MBIN} + done + fi +fi + # Add this to the doinst.sh: mkdir -p $PKG/install cat <> $PKG/install/doinst.sh @@ -233,6 +262,7 @@ preserve_perms() { config \$NEW } +config etc/mongod.conf.new preserve_perms etc/rc.d/rc.mongodb.new # Only way to create and use the correct uid and gid on the target system, @@ -263,6 +293,9 @@ EOINS # Install a rc script: install -D -m0755 $SRCDIR/rc.mongodb $PKG/etc/rc.d/rc.mongodb.new +# Install a basic configuration file which will be read by rc.mongodb: +install -D -m0644 $SRCDIR/mongod.conf.sample $PKG/etc/mongod.conf.new + # Create the database directory: mkdir -p $PKG/var/lib/mongodb chown ${MONGO_UID}:${MONGO_GID} $PKG/var/lib/mongodb @@ -272,6 +305,11 @@ mkdir -p $PKG/var/log/mongodb chown ${MONGO_UID} $PKG/var/log/mongodb chmod 750 $PKG/var/log/mongodb +# Create the pid directory: +mkdir -p $PKG/var/run/mongodb +chown ${MONGO_UID} $PKG/var/run/mongodb +chmod 750 $PKG/var/run/mongodb + # Add documentation: mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION cp -a $DOCS $PKG/usr/doc/$PRGNAM-$VERSION || true -- cgit v1.2.3-80-g2a13