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