Thanks for your work. Comments inlined below. On Fri, Apr 29, 2016 at 04:49:10PM -0400, Andrew Aldridge wrote: > I put in some upstream work last summer for MongoDB to support OpenBSD, and > finally found the time to update the port to 3.2.6. Any > feedback/critiques/issues would be very much appreciated! > > Caveats > ======= > > * No more i386 support. I can re-add this if there is demand, but running > MongoDB on 32-bit systems is both niche and requires turning off > WiredTiger. > > * The patch is necessary to work around a OpenBSD quirk that breaks a unit > test. With it, all unit tests pass. I haven't run the smoke test suite. > > * There is a compilation error with the version of boost from ports, so I > switched to the internal copy. I can try to work around this if there is > demand. > > * Several of the MongoDB utilities are now distributed separately as Go > applications. They aren't included at this point, and may(?) belong in > a separate port. > > Patch > ===== > > commit 259a5ce12b0fd16b92515ddf29fce6f7c86c6431 > Author: Andrew Aldridge <and...@river-openbsd.my.domain> > Date: Thu Mar 31 11:21:11 2016 -0400 > > Upgrade to 3.2.6 > > diff --git a/Makefile b/Makefile > index 8c03687..9b90aae 100644 > --- a/Makefile > +++ b/Makefile > @@ -2,12 +2,12 @@ > > PORTROACH = limitw:1,even > > -#atomic_int.h: error "unsupported compiler or platform" on other archs > -ONLY_FOR_ARCHS = i386 amd64 > +# WiredTiger doesn't support i386 > +ONLY_FOR_ARCHS = amd64
Change the comment to "The default storage engine (WiredTiger) only works on amd64". > > COMMENT = scalable, high-performance document-oriented database > > -DISTNAME = mongodb-src-r2.6.4 > +DISTNAME = mongodb-src-r3.2.6 > PKGNAME = ${DISTNAME:S/src-r//} > REVISION = 0 > CATEGORIES = databases > @@ -17,43 +17,54 @@ HOMEPAGE = http://www.mongodb.org/ > # Apache 2.0 + AGPLv3 > PERMIT_PACKAGE_CDROM = Yes > > -WANTLIB = boost_filesystem-mt boost_program_options-mt boost_system-mt \ > - boost_thread-mt c execinfo m pcap pcre pcrecpp pthread \ > - stdc++ v8 yaml-cpp > +WANTLIB = c execinfo kvm m pcap pcre pcrecpp pthread \ > + estdc++ yaml-cpp z > > MASTER_SITES = http://downloads.mongodb.org/src/ > > -MODULES = devel/scons > +MODULES = gcc4 devel/scons One module per line. > +ALL_TARGET = core tools > +MODSCONS_ENV = CC="egcc" \ > + CXX="eg++" \ Change both variables to: CC="${CC}" CXX="${CXX}". The gcc4 module adds a symlink to the proper compilers. > + CCFLAGS="${CFLAGS}" \ > + CXXFLAGS="${CXXFLAGS}" \ > + LINKFLAGS="${LDFLAGS}" \ > + CPPPATH="${LOCALBASE}/include \ > + LIBPATH="${LOCALBASE}/lib Missing quotes in CPPPATH and LIBPATH. > MODSCONS_FLAGS = --prefix="${PREFIX}" \ > - --cpppath="${LOCALBASE}/include/nspr" \ > - --extralib="pcrecpp" \ > - --usev8 \ > - --sharedclient \ > - --full \ > + --opt=on \ > + --allocator=system \ > --use-system-pcre \ > - --use-system-boost \ > - --use-system-v8 \ > - --use-system-yaml > + --use-system-yaml \ > + --use-system-zlib \ > + -j${MAKE_JOBS} Add also "DPB_PROPERTIES = parallel" below of "ONLY_FOR_ARCHS". > > MAKE_ENV += HOME="${HOME}" \ > TERM="${TERM}" \ > - CXXFLAGS="$(CXXFLAGS)" \ > - LIBmongoclient_VERSION="${LIBmongoclient_VERSION}" > -LIB_DEPENDS = devel/boost \ > - devel/libexecinfo \ > + CXXFLAGS="$(CXXFLAGS)" > +ALL_TARGET = core tools > +LIB_DEPENDS = devel/libexecinfo \ > devel/pcre \ > devel/yaml-cpp \ > - lang/libv8 > + lang/gcc/4.9,-libs > +TEST_DEPENDS = lang/python/2.7 \ > + devel/py-virtualenv \ > + textproc/py-yaml \ > + databases/py-mongo > + > +do-install: > + ${SETENV} ${MAKE_ENV} ${MODSCONS_BIN} -C ${WRKSRC} \ > + ${MODSCONS_ENV} ${MODSCONS_FLAGS} ${INSTALL_TARGET} > + > > post-install: > ${INSTALL_DATA_DIR} ${PREFIX}/share/examples/mongodb > ${INSTALL_DATA} ${FILESDIR}/mongodb.conf \ > ${PREFIX}/share/examples/mongodb > > -# Regression tests require at least 256 file descriptors and ~700MB > do-test: > @${SETENV} ${MAKE_ENV} ${MODSCONS_BIN} -C ${WRKSRC} \ > - ${MODSCONS_ENV} ${MODSCONS_FLAGS} test && \ > - ${WRKSRC}/test --dbpath ${WRKSRC}/unittest > + ${MODSCONS_ENV} ${MODSCONS_FLAGS} unittests > + cd ${WRKSRC} && python2.7 buildscripts/resmoke.py --suites=unittests > > .include <bsd.port.mk> > diff --git a/distinfo b/distinfo > index 2bf23a9..1139d2f 100644 > --- a/distinfo > +++ b/distinfo > @@ -1,2 +1,2 @@ > -SHA256 (mongodb-src-r2.6.4.tar.gz) = > B1QRpWD123QHAyuWLrtdoWoMypNuqCp9JkOUtNjLmcA= > -SIZE (mongodb-src-r2.6.4.tar.gz) = 14491215 > +SHA256 (mongodb-src-r3.2.6.tar.gz) = > BBWptQP2LkDSuof1VbVTdXoU+sKB0dalg9jYgLhyCSE= > +SIZE (mongodb-src-r3.2.6.tar.gz) = 29750170 > diff --git a/files/mongodb.conf b/files/mongodb.conf > index 004a41e..fb7703d 100644 > --- a/files/mongodb.conf > +++ b/files/mongodb.conf > @@ -1,23 +1,20 @@ > # $OpenBSD: mongodb.conf,v 1.1.1.1 2011/06/02 00:26:32 fgsch Exp $ > > -# Sample configuration. See mongod --help for more information. > -# > -# Note: To disable flag parameters comment them out or remove the line. > +# Sample configuration. See > +# https://docs.mongodb.org/manual/administration/configuration/ > +# for details. > > -# Location of the database files. > -dbpath = /var/mongodb/data > - > -# Specific IP address that mongod will listen on. > -bind_ip = 127.0.0.1 > - > -# Full filename path to where log messages will be written. > -logpath = /var/log/mongodb/mongodb.log > - > -# Append to the existing log file > -logappend = > - > -# Run in the background. Output will be redirected to logpath. > -fork = > - > -# Enable simple read-only REST interface > -rest = > +processManagement: > + fork: true > +net: > + # Only listen on the local network interface. Change this only if you > + # need a public-facing instance and have turned on authorization. > + bindIp: 127.0.0.1 > +storage: > + dbPath: /var/mongodb/data > + journal: > + enabled: true > +systemLog: > + destination: file > + path: /var/log/mongodb/mongodb.log > + logAppend: true > diff --git a/patches/patch-SConstruct b/patches/patch-SConstruct > deleted file mode 100644 > index aa4c381..0000000 > --- a/patches/patch-SConstruct > +++ /dev/null > @@ -1,48 +0,0 @@ > -$OpenBSD: patch-SConstruct,v 1.5 2014/12/10 19:59:29 dcoppa Exp $ > - > -Fixup detection of yaml-cpp system library > -https://github.com/mongodb/mongo/commit/44b0e3591839525a0c951319540488814e5c25fd > - > ---- SConstruct.orig Fri Aug 8 15:13:51 2014 > -+++ SConstruct Wed Dec 10 09:28:50 2014 > -@@ -814,7 +814,6 @@ if nix: > - # -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", > -@@ -828,6 +827,7 @@ if nix: > - > - env.Append( CPPDEFINES=["_FILE_OFFSET_BITS=64"] ) > - env.Append( CXXFLAGS=["-Wnon-virtual-dtor", "-Woverloaded-virtual"] ) > -+ env.Append( CXXFLAGS=os.environ['CXXFLAGS'] ) > - env.Append( LINKFLAGS=["-fPIC", "-pthread"] ) > - > - # SERVER-9761: Ensure early detection of missing symbols in dependent > libraries at program > -@@ -859,14 +859,9 @@ if nix: > - env.Append( CPPDEFINES=["MONGO_GCOV"] ) > - env.Append( LINKFLAGS=" -fprofile-arcs -ftest-coverage " ) > - > -- if optBuild: > -- env.Append( CCFLAGS=["-O3"] ) > -- else: > -- env.Append( CCFLAGS=["-O0"] ) > -- > - if debugBuild: > - if not optBuild: > -- env.Append( CCFLAGS=["-fstack-protector"] ) > -+ env.Append( CCFLAGS=["-fstack-protector", "-ggdb"] ) > - env.Append( LINKFLAGS=["-fstack-protector"] ) > - env.Append( SHLINKFLAGS=["-fstack-protector"] ) > - env['ENV']['GLIBCXX_FORCE_NEW'] = 1; # play nice with valgrind > -@@ -1352,7 +1347,7 @@ def doConfigure(myenv): > - conf.FindSysLibDep("stemmer", ["stemmer"]) > - > - if use_system_version_of_library("yaml"): > -- conf.FindSysLibDep("yaml", ["yaml"]) > -+ conf.FindSysLibDep("yaml", ["yaml-cpp"]) > - > - if use_system_version_of_library("boost"): > - if not conf.CheckCXXHeader( "boost/filesystem/operations.hpp" ): > diff --git a/patches/patch-src_mongo_SConscript > b/patches/patch-src_mongo_SConscript > deleted file mode 100644 > index 5d006f1..0000000 > --- a/patches/patch-src_mongo_SConscript > +++ /dev/null > @@ -1,12 +0,0 @@ > -$OpenBSD: patch-src_mongo_SConscript,v 1.2 2014/09/16 17:28:07 jasper Exp $ > ---- src/mongo/SConscript.orig Fri Aug 8 22:13:51 2014 > -+++ src/mongo/SConscript Tue Sep 16 16:08:02 2014 > -@@ -1163,7 +1163,7 @@ def installBinary( e, name ): > - if enforce_glibc: > - e.AddPostAction( name, checkGlibc ) > - > -- if (solaris or linux) and (not has_option("nostrip")): > -+ if not has_option("nostrip"): > - name = e.Command('stripped/%s' % name, name, Copy('$TARGET', > '$SOURCE'))[0] > - e.AddPostAction(name, 'strip $TARGET') > - > diff --git a/patches/patch-src_mongo_platform_random_cpp > b/patches/patch-src_mongo_platform_random_cpp > deleted file mode 100644 > index c3e0f34..0000000 > --- a/patches/patch-src_mongo_platform_random_cpp > +++ /dev/null > @@ -1,25 +0,0 @@ > -$OpenBSD: patch-src_mongo_platform_random_cpp,v 1.1 2013/12/10 17:30:41 > joshe Exp $ > ---- src/mongo/platform/random.cpp.orig Thu Oct 17 11:37:56 2013 > -+++ src/mongo/platform/random.cpp Mon Oct 28 20:21:29 2013 > -@@ -138,6 +138,21 @@ namespace mongo { > - return new InputStreamSecureRandom( "/dev/urandom" ); > - } > - > -+#elif defined(__OpenBSD__) > -+ > -+ class ARC4SecureRandom : public SecureRandom { > -+ public: > -+ int64_t nextInt64() { > -+ int64_t n; > -+ arc4random_buf(&n, sizeof(n)); > -+ return n; > -+ } > -+ }; > -+ > -+ SecureRandom* SecureRandom::create() { > -+ return new ARC4SecureRandom(); > -+ } > -+ > - #else > - class SRandSecureRandom : public SecureRandom { > - public: > diff --git a/patches/patch-src_mongo_shell_linenoise_utf8_h > b/patches/patch-src_mongo_shell_linenoise_utf8_h > deleted file mode 100644 > index 7a74852..0000000 > --- a/patches/patch-src_mongo_shell_linenoise_utf8_h > +++ /dev/null > @@ -1,17 +0,0 @@ > -$OpenBSD: patch-src_mongo_shell_linenoise_utf8_h,v 1.1 2015/06/29 08:13:50 > jasper Exp $ > - > -From 2d5d662a834fab72ee1431e3bb0a5ed5a0826177 Mon Sep 17 00:00:00 2001 > -From: Mark Benvenuto <mark.benven...@mongodb.com> > -Date: Tue, 19 Aug 2014 15:07:11 -0400 > -Subject: [PATCH] SERVER-8994: Boost 1.56 build fixes > - > ---- src/mongo/shell/linenoise_utf8.h.orig Sun Jun 28 22:15:05 2015 > -+++ src/mongo/shell/linenoise_utf8.h Sun Jun 28 22:15:18 2015 > -@@ -16,6 +16,7 @@ > - */ > - > - #include <boost/smart_ptr/scoped_array.hpp> > -+#include <algorithm> > - #include <string.h> > - > - namespace linenoise_utf8 { > diff --git a/patches/patch-src_mongo_util_signal_handlers_synchronous_cpp > b/patches/patch-src_mongo_util_signal_handlers_synchronous_cpp > new file mode 100644 > index 0000000..6d01e35 > --- /dev/null > +++ b/patches/patch-src_mongo_util_signal_handlers_synchronous_cpp > @@ -0,0 +1,12 @@ > +$OpenBSD$ > +--- src/mongo/util/signal_handlers_synchronous.cpp.orig Mon Apr 25 > 21:44:42 > 2016 > ++++ src/mongo/util/signal_handlers_synchronous.cpp Mon Apr 25 21:45:18 2016 > +@@ -266,7 +266,7 @@ void abruptQuitWithAddrSignal(int signalNum, siginfo_t > + MallocFreeOStreamGuard lk{}; > + > + const char* action = (signalNum == SIGSEGV || signalNum == SIGBUS) ? > "access" : "operation"; > +- mallocFreeOStream << "Invalid " << action << " at address: " << > siginfo->si_addr; > ++ mallocFreeOStream << "Invalid " << action << " at address: " << > reinterpret_cast<void*>(siginfo->si_addr); > + > + // Writing out message to log separate from the stack trace so at > least that much gets > + // logged. This is important because we may get here by jumping to an > invalid address which > diff --git a/patches/patch-src_third_party_s2_base_port_h > b/patches/patch-src_third_party_s2_base_port_h > deleted file mode 100644 > index 501a266..0000000 > --- a/patches/patch-src_third_party_s2_base_port_h > +++ /dev/null > @@ -1,30 +0,0 @@ > -$OpenBSD: patch-src_third_party_s2_base_port_h,v 1.2 2015/05/01 16:51:24 > ajacoutot Exp $ > ---- src/third_party/s2/base/port.h.orig Thu Oct 17 11:37:56 2013 > -+++ src/third_party/s2/base/port.h Mon Oct 28 20:57:58 2013 > -@@ -100,6 +100,14 @@ typedef uint16_t u_int16_t; > - #define __LITTLE_ENDIAN LITTLE_ENDIAN > - #define __BIG_ENDIAN BIG_ENDIAN > - > -+#elif defined __OpenBSD__ > -+ > -+#include <endian.h> > -+/* Let's try and follow the Linux convention */ > -+#define __BYTE_ORDER BYTE_ORDER > -+#define __LITTLE_ENDIAN LITTLE_ENDIAN > -+#define __BIG_ENDIAN BIG_ENDIAN > -+ > - #endif > - > - #if defined __sunos__ || defined __freebsd__ > -@@ -134,6 +142,11 @@ typedef uint16_t u_int16_t; > - #define bswap_16(x) bswap16(x) > - #define bswap_32(x) bswap32(x) > - #define bswap_64(x) bswap64(x) > -+#elif defined __OpenBSD__ > -+#include <endian.h> > -+#define bswap_16(x) swap16(x) > -+#define bswap_32(x) swap32(x) > -+#define bswap_64(x) swap64(x) > - #else > - #include <byteswap.h> > - #endif > diff --git a/pkg/PLIST b/pkg/PLIST > index 7c6c094..906d75e 100644 > --- a/pkg/PLIST > +++ b/pkg/PLIST > @@ -1,20 +1,11 @@ > @comment $OpenBSD: PLIST,v 1.5 2014/09/16 17:28:07 jasper Exp $ > @newgroup _mongodb:670 > @newuser _mongodb:670:670:daemon:MongoDB Account:/nonexistent:/sbin/nologin > -@bin bin/bsondump > @bin bin/mongo > @bin bin/mongod > -@bin bin/mongodump > -@bin bin/mongoexport > -@bin bin/mongofiles > -@bin bin/mongoimport > -@bin bin/mongooplog > @bin bin/mongoperf > -@bin bin/mongorestore > @bin bin/mongos > @bin bin/mongosniff > -@bin bin/mongostat > -@bin bin/mongotop > share/examples/mongodb/ > share/examples/mongodb/mongodb.conf > @sample ${SYSCONFDIR}/mongodb.conf > -- Juan Francisco Cantero Hurtado http://juanfra.info