1PORTNAME= mongodb 2DISTVERSIONPREFIX= r 3DISTVERSION= 8.0.12 4CATEGORIES= databases net 5PKGNAMESUFFIX= ${DISTVERSION:R:S/.//} 6 7MAINTAINER= ports@MidnightBSD.org 8COMMENT= MongoDB Community Edition (8.0.x Branch) 9WWW= https://www.mongodb.com/docs/v8.0/ 10 11LICENSE= Apache-2.0 SSPLv1 # mongodb is SSPLv1, C++ driver is APACHE20 12LICENSE_COMB= multi 13LICENSE_NAME_SSPLv1= Server Side Public License Version 1 14LICENSE_FILE_SSPLv1= ${WRKSRC}/LICENSE-Community.txt 15LICENSE_PERMS_SSPLv1= dist-mirror dist-sell pkg-mirror pkg-sell auto-accept 16 17ONLY_FOR_ARCHS= aarch64 amd64 powerpc64le 18ONLY_FOR_ARCHS_REASON= only ported to amd64, aarch64, and powerpc64le on FreeBSD; upstream supports arm64, ppc64le, s390x, and x86-64 19 20BUILD_DEPENDS= ${PY_SETUPTOOLS} \ 21 ${PYTHON_PKGNAMEPREFIX}cheetah3>0:devel/py-cheetah3@${PY_FLAVOR} \ 22 ${PYTHON_PKGNAMEPREFIX}distro>0:sysutils/py-distro@${PY_FLAVOR} \ 23 ${PYTHON_PKGNAMEPREFIX}gitpython>0:devel/py-gitpython@${PY_FLAVOR} \ 24 ${PYTHON_PKGNAMEPREFIX}packaging>0:devel/py-packaging@${PY_FLAVOR} \ 25 ${PYTHON_PKGNAMEPREFIX}psutil>0:sysutils/py-psutil@${PY_FLAVOR} \ 26 ${PYTHON_PKGNAMEPREFIX}pymongo>0:databases/py-pymongo@${PY_FLAVOR} \ 27 ${PYTHON_PKGNAMEPREFIX}pyyaml>=3.11:devel/py-pyyaml@${PY_FLAVOR} \ 28 ${PYTHON_PKGNAMEPREFIX}requests>0:www/py-requests@${PY_FLAVOR} \ 29 ${PYTHON_PKGNAMEPREFIX}retry2>0:devel/py-retry2@${PY_FLAVOR} \ 30 git:devel/git@tiny \ 31 rust-cbindgen>0:devel/rust-cbindgen 32# build depends used while running ${WRKSRC}/src/third_party/mozjs/gen-config.sh 33BUILD_DEPENDS+= gm4:devel/m4 \ 34 gsed:textproc/gsed 35LIB_DEPENDS= libcurl.so:ftp/curl \ 36 libsnappy.so:archivers/snappy \ 37 libstemmer.so:textproc/snowballstemmer \ 38 libunwind.so:devel/libunwind \ 39 libyaml-cpp.so:devel/yaml-cpp \ 40 libzstd.so:archivers/zstd 41 42FLAVORS= default armv80a 43 44armv80a_PKGNAMESUFFIX= ${DISTVERSION:R:S/.//}-armv80a 45 46USES= compiler:c++20-lang cpe python:build scons shebangfix ssl 47# gmake is used while running ${WRKSRC}/src/third_party/mozjs/gen-config.sh 48USES+= gmake pkgconfig 49CPE_PRODUCT= mongodb 50 51# mozjs tag comes from ${WRKSRC}/src/third_party/mozjs/get-sources.sh 52MOZJS_TAG= 5acd3be6c9563ad3e7ca6182285c69a38de47bab 53 54USE_GITHUB= yes 55GH_ACCOUNT= mongodb mongodb-forks:mozjs 56GH_PROJECT= mongo spidermonkey:mozjs 57GH_TAGNAME= ${MOZJS_TAG}:mozjs 58USE_RC_SUBR= mongod 59 60SHEBANG_FILES= buildscripts/scons.py 61python_OLD_CMD= @python_interpreter@ 62 63HAS_CONFIGURE= yes 64CONFIGURE_SCRIPT= gen-config.sh 65CONFIGURE_ARGS+= ${MOZJS_ARCH} \ 66 freebsd 67CONFIGURE_ENV+= PYTHON3="${PYTHON_CMD}" 68 69MAKE_ARGS= --allocator=system \ 70 --cxx-std=20 \ 71 --disable-warnings-as-errors \ 72 --libc++ \ 73 --runtime-hardening=on \ 74 --ssl \ 75 --use-system-libunwind \ 76 --use-system-snappy \ 77 --use-system-stemmer \ 78 --use-system-yaml \ 79 --use-system-zlib \ 80 --use-system-zstd \ 81 -j${MAKE_JOBS_NUMBER} \ 82 AR=llvm-ar \ 83 MONGO_VERSION=${DISTVERSION} \ 84 VERBOSE=on TARGET_OS=freebsd 85ALL_TARGET= install-servers 86 87CFLAGS+= -DBOOST_NO_CXX98_FUNCTION_BASE 88 89CONFLICTS_INSTALL= mongodb[0-9][0-9] 90 91EXTRACT_AFTER_ARGS= --exclude src/third_party/snappy-* \ 92 --exclude src/third_party/libstemmer_c \ 93 --exclude src/third_party/unwind \ 94 --exclude src/third_party/yaml-cpp \ 95 --exclude src/third_party/zlib-* \ 96 --exclude src/third_party/zstandard \ 97 --no-same-owner --no-same-permissions 98 99# This ports is only following the Major Release. 100# https://docs.mongodb.com/manual/reference/versioning/ 101PORTSCOUT= limit:^8\.0\. 102 103CONFIGURE_WRKSRC= ${MOZJS_WRKSRC} 104 105USERS= mongodb 106GROUPS= mongodb 107 108OPTIONS_DEFINE= LTO NOAVX SASL 109OPTIONS_DEFINE_aarch64= ARMV80A 110OPTIONS_DEFAULT= NOAVX SASL 111 112# MongoDB on non-LSE ARM cpu like Raspberry Pi can work but is unsupported upstream. 113# Can give corruption on high concurrency. 114# Please read https://jira.mongodb.org/browse/SERVER-71772. 115ARMV80A_DESC= Enable non-LSE ARM64 CPUs like RPI4. 116NOAVX_DESC= "Disable AVX instructions on amd64 (Sandybridge+)" 117 118ARMV80A_EXTRA_PATCHES= ${FILESDIR}/extrapatch-SConstruct 119 120LTO_MAKE_ARGS= --lto=on 121 122NOAVX_MAKE_ARGS= --experimental-optimization="-sandybridge" 123NOAVX_EXTRA_PATCHES= ${FILESDIR}/extrapatch-src_third__party_mozjs_SConscript \ 124 ${FILESDIR}/extrapatch-src_third__party_mozjs_extract_mozglue_misc_SIMD.cpp 125 126SASL_LIB_DEPENDS= libsasl2.so:security/cyrus-sasl2 127SASL_MAKE_ARGS= --use-sasl-client 128 129MOZJS_WRKSRC= ${WRKSRC}/src/third_party/mozjs 130 131.if ${FLAVOR:U} == armv80a 132OPTIONS_SET+= ARMV80A 133.endif 134 135.include <bsd.port.pre.mk> 136 137.if ${FLAVOR:U} == armv80a && ${ARCH} != aarch64 138IGNORE= flavor armv80a is only valid on aarch64 139.endif 140 141.if ${ARCH} == amd64 142MOZJS_ARCH= x86_64 143.elif ${ARCH} == powerpc64le 144MOZJS_ARCH= ppc64le 145.elif ${ARCH} == aarch64 146MOZJS_ARCH= ${ARCH} 147.endif 148 149post-extract: 150# Verify we downloaded the proper mozjs git tag. 151 ${SH} -xc "test \"X`grep -E '^LIB_GIT_REVISION=' ${MOZJS_WRKSRC}/get-sources.sh`\" = \"XLIB_GIT_REVISION=${MOZJS_TAG}\"" 152 153pre-configure: 154# Replacement of ${WRKSRC}/src/third_party/mozjs/get-sources.sh 155 ${LN} -sF ${WRKDIR}/spidermonkey-${MOZJS_TAG} ${MOZJS_WRKSRC}/mozilla-release 156 ${REINPLACE_CMD} -i.bak -e 's|DragonFly|MidnightBSD|g' ${WRKDIR}/spidermonkey-${MOZJS_TAG}/testing/mozbase/mozinfo/mozinfo/mozinfo.py 157 158do-build: 159 ${WRKSRC}/buildscripts/scons.py -C ${WRKSRC} ${MAKE_ARGS} 160 161do-install: 162.for f in mongod mongos 163 -${STRIP_CMD} ${PREFIX}/bin/${f} 164.endfor 165 ${INSTALL_DATA} ${WRKSRC}/rpm/mongod.conf ${PREFIX}/etc/mongodb.conf.sample 166 ${MKDIR} ${DOCSDIR} 167.for doc in LICENSE-Community.txt MPL-2 README THIRD-PARTY-NOTICES 168 ${MV} ${PREFIX}/${doc} ${DOCSDIR}/ 169.endfor 170 ${INSTALL_MAN} ${WRKSRC}/debian/mongod.1 ${PREFIX}/share/man/man1/ 171 ${INSTALL_MAN} ${WRKSRC}/debian/mongos.1 ${PREFIX}/share/man/man1/ 172 ${INSTALL_MAN} ${WRKSRC}/debian/mongodb-parameters.5 ${PREFIX}/share/man/man5/ 173 ${RM} ${PREFIX}/bin/resmoke.py 174 175do-test: 176 ${SH} ${FILESDIR}/make.test.sh "${PREFIX}/bin" 177 178.include <bsd.port.post.mk> 179