diff --git a/databases/mongodb80/Makefile b/databases/mongodb80/Makefile index 8849e49a7951..fda8c40cb474 100644 --- a/databases/mongodb80/Makefile +++ b/databases/mongodb80/Makefile @@ -1,166 +1,166 @@ PORTNAME= mongodb DISTVERSIONPREFIX= r DISTVERSION= 8.0.4 -PORTREVISION= 2 +PORTREVISION= 3 CATEGORIES= databases net MASTER_SITES= https://hg.mozilla.org/mozilla-central/raw-rev/:patches PKGNAMESUFFIX= ${DISTVERSION:R:S/.//} DISTFILES= 223087fdc29f18678f6174e9807b8780e439acf6:patches # https://bugzilla.mozilla.org/1894423 EXTRACT_ONLY= ${GH_ACCOUNT}-${GH_PROJECT}-${DISTVERSIONPREFIX}${DISTVERSION}_GH0.tar.gz \ ${GH_ACCOUNT}-forks-spidermonkey-${MOZJS_TAG}_GH0.tar.gz MAINTAINER= ronald@FreeBSD.org COMMENT= MongoDB Community Edition (8.0.x Branch) WWW= https://www.mongodb.com/docs/v8.0/ LICENSE= APACHE20 SSPLv1 # mongodb is SSPLv1, C++ driver is APACHE20 LICENSE_COMB= multi LICENSE_NAME_SSPLv1= Server Side Public License Version 1 LICENSE_FILE_SSPLv1= ${WRKSRC}/LICENSE-Community.txt LICENSE_PERMS_SSPLv1= dist-mirror dist-sell pkg-mirror pkg-sell auto-accept ONLY_FOR_ARCHS= aarch64 amd64 powerpc64le ONLY_FOR_ARCHS_REASON= only ported to amd64, aarch64, and powerpc64le on FreeBSD; upstream supports arm64, ppc64le, s390x, and x86-64 BUILD_DEPENDS= ${PY_SETUPTOOLS} \ ${PYTHON_PKGNAMEPREFIX}cheetah3>0:devel/py-cheetah3@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}distro>0:sysutils/py-distro@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}gitpython>0:devel/py-gitpython@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}packaging>0:devel/py-packaging@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}psutil>0:sysutils/py-psutil@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}pymongo>0:databases/py-pymongo@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}pyyaml>=3.11:devel/py-pyyaml@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}requests>0:www/py-requests@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}retry2>0:devel/py-retry2@${PY_FLAVOR} \ git:devel/git@tiny # build depends used while running ${WRKSRC}/src/third_party/mozjs/gen-config.sh BUILD_DEPENDS+= gm4:devel/m4 \ gsed:textproc/gsed LIB_DEPENDS= libcurl.so:ftp/curl \ libsnappy.so:archivers/snappy \ libstemmer.so:textproc/snowballstemmer \ libunwind.so:devel/libunwind \ libyaml-cpp.so:devel/yaml-cpp \ libzstd.so:archivers/zstd USES= compiler:c++20-lang cpe python:build scons shebangfix ssl # gmake is used while running ${WRKSRC}/src/third_party/mozjs/gen-config.sh USES+= gmake pkgconfig # mozjs tag comes from ${WRKSRC}/src/third_party/mozjs/get-sources.sh MOZJS_TAG= bb6edb4fcd43607c87de81df8c58db11a663634a USE_GITHUB= yes GH_ACCOUNT= mongodb mongodb-forks:mozjs GH_PROJECT= mongo spidermonkey:mozjs GH_TAGNAME= ${MOZJS_TAG}:mozjs USE_RC_SUBR= mongod SHEBANG_FILES= buildscripts/scons.py python_OLD_CMD= @python_interpreter@ CONFIGURE_ENV+= M4=${LOCALBASE}/bin/gm4 MAKE_ARGS= --allocator=system \ --cxx-std=20 \ --disable-warnings-as-errors \ --libc++ \ --runtime-hardening=on \ --ssl \ --use-system-libunwind \ --use-system-snappy \ --use-system-stemmer \ --use-system-yaml \ --use-system-zlib \ --use-system-zstd \ -j${MAKE_JOBS_NUMBER} \ AR=llvm-ar \ MONGO_VERSION=${DISTVERSION} \ VERBOSE=on CFLAGS+= -DBOOST_NO_CXX98_FUNCTION_BASE CONFLICTS_INSTALL= mongodb[0-9][0-9] EXTRACT_AFTER_ARGS= --exclude src/third_party/snappy-* \ --exclude src/third_party/libstemmer_c \ --exclude src/third_party/unwind \ --exclude src/third_party/yaml-cpp \ --exclude src/third_party/zlib-* \ --exclude src/third_party/zstandard \ --no-same-owner --no-same-permissions USERS= mongodb GROUPS= mongodb OPTIONS_DEFINE= LTO NOAVX SASL OPTIONS_DEFINE_aarch64= ARMV80A OPTIONS_DEFAULT= NOAVX SASL # MongoDB on non-LSE ARM cpu like Raspberry Pi can work but is unsupported upstream. # Can give corruption on high concurrency. # Please read https://jira.mongodb.org/browse/SERVER-71772. ARMV80A_DESC= Enable non-LSE ARM64 CPUs like RPI4. NOAVX_DESC= "Disable AVX instructions on amd64 (Sandybridge+)" ARMV80A_EXTRA_PATCHES= ${FILESDIR}/extrapatch-SConstruct LTO_MAKE_ARGS= --lto=on NOAVX_MAKE_ARGS= --experimental-optimization="-sandybridge" NOAVX_EXTRA_PATCHES= ${FILESDIR}/extrapatch-src_third__party_mozjs_SConscript \ ${FILESDIR}/extrapatch-src_third__party_mozjs_extract_mozglue_misc_SIMD.cpp SASL_LIB_DEPENDS= libsasl2.so:security/cyrus-sasl2 SASL_MAKE_ARGS= --use-sasl-client .include ALL_TARGET= install-servers # This ports is only following the Major Release. # https://docs.mongodb.com/manual/reference/versioning/ PORTSCOUT= limit:^7\.0\. CPE_PRODUCT= mongodb .if ${ARCH} == amd64 MOZJS_ARCH= x86_64 .elif ${ARCH} == powerpc64le MOZJS_ARCH= ppc64le .elif ${ARCH} == aarch64 MOZJS_ARCH= ${ARCH} .endif post-patch: ${PATCH} -d ${WRKSRC}/src/third_party/mozjs/extract --quiet -p1 -V none < ${DISTDIR}/223087fdc29f18678f6174e9807b8780e439acf6 pre-configure: # Verify we downloaded the proper mozjs git tag. ${SH} -c "test \"X`grep -E '^LIB_GIT_REVISION=' ${WRKSRC}/src/third_party/mozjs/get-sources.sh`\" = \"XLIB_GIT_REVISION=${MOZJS_TAG}\"" do-configure: # Replacement of ${WRKSRC}/src/third_party/mozjs/get-sources.sh ${LN} -sF ${WRKDIR}/spidermonkey-${MOZJS_TAG} ${WRKSRC}/src/third_party/mozjs/mozilla-release cd ${WRKSRC}/src/third_party/mozjs && PYTHON3="${PYTHON_CMD}" ${SH} ./gen-config.sh ${MOZJS_ARCH} freebsd do-build: ${WRKSRC}/buildscripts/scons.py -C ${WRKSRC} ${MAKE_ARGS} do-install: .for f in mongod mongos ${STRIP_CMD} ${STAGEDIR}${PREFIX}/bin/${f} .endfor ${INSTALL_DATA} ${WRKSRC}/rpm/mongod.conf ${STAGEDIR}${PREFIX}/etc/mongodb.conf.sample ${MKDIR} ${STAGEDIR}${DOCSDIR} .for doc in LICENSE-Community.txt MPL-2 README THIRD-PARTY-NOTICES ${MV} ${STAGEDIR}${PREFIX}/${doc} ${STAGEDIR}${DOCSDIR}/ .endfor ${INSTALL_MAN} ${WRKSRC}/debian/mongod.1 ${STAGEDIR}${PREFIX}/share/man/man1/ ${INSTALL_MAN} ${WRKSRC}/debian/mongos.1 ${STAGEDIR}${PREFIX}/share/man/man1/ ${INSTALL_MAN} ${WRKSRC}/debian/mongodb-parameters.5 ${STAGEDIR}${PREFIX}/share/man/man5/ ${RM} ${STAGEDIR}${PREFIX}/bin/resmoke.py do-test: ${SH} ${FILESDIR}/make.test.sh "${STAGEDIR}${PREFIX}/bin" .include diff --git a/databases/mongodb80/files/patch-src_mongo_platform_waitable__atomic.cpp b/databases/mongodb80/files/patch-src_mongo_platform_waitable__atomic.cpp index 92a361721080..e2c815567836 100644 --- a/databases/mongodb80/files/patch-src_mongo_platform_waitable__atomic.cpp +++ b/databases/mongodb80/files/patch-src_mongo_platform_waitable__atomic.cpp @@ -1,65 +1,58 @@ ---- src/mongo/platform/waitable_atomic.cpp.orig 2024-07-23 11:53:14 UTC +--- src/mongo/platform/waitable_atomic.cpp.orig 2024-11-20 23:53:48 UTC +++ src/mongo/platform/waitable_atomic.cpp @@ -34,6 +34,9 @@ #ifdef __linux__ #include #include +#elif defined(__FreeBSD__) +#include +#include #elif defined(_WIN32) #include #endif -@@ -228,6 +231,52 @@ bool waitUntil(const void* uaddr, - } - - if (__ulock_wait(UL_COMPARE_AND_WAIT, const_cast(uaddr), old, timeoutMicros) != -1) -+ return true; -+ -+ // There isn't a good list of possible errors, so assuming that anything other than a timeout -+ // error is a possible spurious wakeup. -+ return timeoutOverflow || errno != ETIMEDOUT; +@@ -233,6 +236,45 @@ bool waitUntil(const void* uaddr, + // There isn't a good list of possible errors, so assuming that anything other than a timeout + // error is a possible spurious wakeup. + return timeoutOverflow || errno != ETIMEDOUT; +} + +#elif defined(__FreeBSD__) + +void notifyOne(const void* uaddr) { -+ _umtx_op(const_cast(uaddr), UMTX_OP_WAKE, 1, NULL, NULL); ++ _umtx_op(const_cast(uaddr), UMTX_OP_WAKE_PRIVATE, 1, NULL, NULL); +} + +void notifyMany(const void* uaddr, int nToWake) { -+ _umtx_op(const_cast(uaddr), UMTX_OP_WAKE, nToWake, NULL, NULL); ++ _umtx_op(const_cast(uaddr), UMTX_OP_WAKE_PRIVATE, nToWake, NULL, NULL); +} + +void notifyAll(const void* uaddr) { -+ _umtx_op(const_cast(uaddr), UMTX_OP_WAKE, INT_MAX, NULL, NULL); ++ _umtx_op(const_cast(uaddr), UMTX_OP_WAKE_PRIVATE, INT_MAX, NULL, NULL); +} + +bool waitUntil(const void* uaddr, + uint32_t old, + boost::optional deadline) { -+ struct timespec timeout; -+ bool timeoutOverflow = false; ++ struct _umtx_time umtx_deadline; ++ void* uaddr2 = nullptr; ++ + if (deadline) { -+ int64_t micros = durationCount(*deadline - system_clock::now()); -+ if (micros <= 0) { -+ return false; // Synthesize a timeout. -+ } ++ umtx_deadline._timeout.tv_sec = durationCount(deadline->time_since_epoch()); ++ umtx_deadline._timeout.tv_nsec = durationCount( ++ deadline->time_since_epoch() - stdx::chrono::seconds(umtx_deadline._timeout.tv_sec)); ++ umtx_deadline._flags = UMTX_ABSTIME; ++ umtx_deadline._clockid = CLOCK_REALTIME_FAST; ++ uaddr2 = &umtx_deadline; ++ } + -+ if (micros > int64_t(std::numeric_limits::max())) { -+ // 2**32 micros is a little over an hour. If this happens, we wait as long as we can, -+ // then return as-if a spurious wakeup happened, rather than a timeout. This will cause -+ // the caller to loop and we will compute a smaller time each pass, eventually reaching -+ // a representable timeout. -+ micros = std::numeric_limits::max(); -+ timeoutOverflow = true; ++ int umtxOpRet; ++ if ((umtxOpRet = _umtx_op(const_cast(uaddr), UMTX_OP_WAIT_UINT_PRIVATE, old, (void*)sizeof(struct _umtx_time), uaddr2)) != 0) { ++ if (errno == ETIMEDOUT) { ++ return false; + } -+ -+ timeout.tv_sec = micros / 1000; -+ timeout.tv_nsec = (micros % 1000) * 1000; ++ invariant(umtxOpRet == 0, errorMessage(lastSystemError())); + } -+ -+ if (_umtx_op(const_cast(uaddr), UMTX_OP_WAIT, old, (void*)sizeof(struct timespec), &timeout) != -1) - return true; ++ return true; + } - // There isn't a good list of possible errors, so assuming that anything other than a timeout + #else