databases/mongodb70: add new port

Mind that this is still a RC.

Changelog:
https://www.mongodb.com/docs/v7.0/release-notes/7.0/

* based on databases/mongodb60
* disabled --use-system-icu as version from ports gives an error on start-up:
  https://www.mongodb.com/community/forums/t/mongodb-7-0-rc0-cycle-in-dependency-graph-loadicudata/224571
* patch to compile asio-master with c++20
* commented out 'metrics_client' in SConstruct, symbol is not available in the repo, doesn't seem to be needed for the build
This commit is contained in:
Ronald Klop
2023-05-02 22:29:48 +02:00
parent 09731f9309
commit a677d700a6
12 changed files with 397 additions and 0 deletions
+1
View File
@@ -194,6 +194,7 @@
SUBDIR += mongodb44
SUBDIR += mongodb50
SUBDIR += mongodb60
SUBDIR += mongodb70
SUBDIR += movine
SUBDIR += mroonga
SUBDIR += mtop
+135
View File
@@ -0,0 +1,135 @@
PORTNAME= mongodb
DISTVERSIONPREFIX= r
DISTVERSION= 7.0.0-rc0
CATEGORIES= databases net
PKGNAMESUFFIX= ${DISTVERSION:R:S/.//}
MAINTAINER= ronald@FreeBSD.org
COMMENT= Distributed document-oriented "NoSQL" database (7.0.x Branch)
WWW= https://www.mongodb.com/docs/v7.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= ${PYTHON_PKGNAMEPREFIX}cheetah3>0:devel/py-cheetah3@${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}yaml>=3.11:devel/py-yaml@${PY_FLAVOR}
# build depends used while running ${WRKSRC}/src/third_party/mozjs/gen-config.sh
BUILD_DEPENDS+= autoconf2.13:devel/autoconf2.13 \
gsed:textproc/gsed
LIB_DEPENDS= libcurl.so:ftp/curl \
libpcre2-8.so:devel/pcre2 \
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
# 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= 82aac6af18abcd5bf188afbc821779ccb0ca0902
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@
MAKE_ARGS= --cxx-std=20 \
--disable-warnings-as-errors \
--libc++ \
--runtime-hardening=on \
--use-system-libunwind \
--use-system-pcre2 \
--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
CONFLICTS_INSTALL= mongodb[0-9][0-9]
USERS= mongodb
GROUPS= mongodb
OPTIONS_DEFINE= LTO SASL SSL NOAVX
OPTIONS_DEFAULT= LTO SASL SSL
NOAVX_DESC= "Disable AVX instructions on amd64 (Sandybridge+)"
LTO_MAKE_ARGS= --lto=on
NOAVX_MAKE_ARGS= --experimental-optimization="-sandybridge"
SASL_LIB_DEPENDS= libsasl2.so:security/cyrus-sasl2
SASL_MAKE_ARGS= --use-sasl-client
SSL_USES= ssl
SSL_MAKE_ARGS= --ssl
.include <bsd.port.pre.mk>
ALL_TARGET= install-core
# 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:
${RM} -rf ${WRKSRC}/src/third_party/pcre2
${RM} -rf ${WRKSRC}/src/third_party/snappy-*
${RM} -rf ${WRKSRC}/src/third_party/libstemmer_c
${RM} -rf ${WRKSRC}/src/third_party/unwind
${RM} -rf ${WRKSRC}/src/third_party/yaml-cpp
${RM} -rf ${WRKSRC}/src/third_party/zlib-*
${RM} -rf ${WRKSRC}/src/third_party/zstandard
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/mozilla-release/js/src && ${LOCALBASE}/bin/autoconf2.13
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
${RM} ${STAGEDIR}${PREFIX}/bin/resmoke.py
.include <bsd.port.post.mk>
+5
View File
@@ -0,0 +1,5 @@
TIMESTAMP = 1682425414
SHA256 (mongodb-mongo-r7.0.0-rc0_GH0.tar.gz) = 2876591e26ff60b3228371e7d97faa5b9d188445d86187c1e77cef8e09978df2
SIZE (mongodb-mongo-r7.0.0-rc0_GH0.tar.gz) = 113376874
SHA256 (mongodb-forks-spidermonkey-82aac6af18abcd5bf188afbc821779ccb0ca0902_GH0.tar.gz) = a365bf54ef4e4fd6a136cf6afa9c620ba0c8982402473b9bfac38928a688a9e0
SIZE (mongodb-forks-spidermonkey-82aac6af18abcd5bf188afbc821779ccb0ca0902_GH0.tar.gz) = 141291901
+53
View File
@@ -0,0 +1,53 @@
#!/bin/sh
# PROVIDE: mongod
# REQUIRE: NETWORK ldconfig
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#
# mongod_enable (bool): Set to "NO" by default.
# Set it to "YES" to enable mongod.
# mongod_dbpath (str): Default to "/var/db/mongodb"
# Base database directory.
# mongod_flags (str): Custom additional arguments to be passed to mongod.
# Default to "--logpath ${mongod_dbpath}/mongod.log --logappend".
# mongod_config (str): Default to "%%PREFIX%%/etc/mongodb.conf"
# Path to config file
#
. /etc/rc.subr
name="mongod"
rcvar=mongod_enable
load_rc_config $name
: ${mongod_enable="NO"}
: ${mongod_dbpath="/var/db/mongodb"}
: ${mongod_flags="--logpath ${mongod_dbpath}/mongod.log --logappend --setParameter=disabledSecureAllocatorDomains=\*"}
: ${mongod_user="mongodb"}
: ${mongod_group="mongodb"}
: ${mongod_config="%%PREFIX%%/etc/mongodb.conf"}
pidfile="${mongod_dbpath}/mongod.lock"
command=%%PREFIX%%/bin/${name}
command_args="--config $mongod_config --dbpath $mongod_dbpath --fork >/dev/null 2>/dev/null"
start_precmd="${name}_prestart"
mongod_create_dbpath()
{
mkdir ${mongod_dbpath} >/dev/null 2>/dev/null
[ $? -eq 0 ] && chown -R ${mongod_user}:${mongod_group} ${mongod_dbpath}
}
mongod_prestart()
{
if [ ! -d ${mongod_dbpath} ]; then
mongod_create_dbpath || return 1
fi
return 0
}
run_rc_command "$1"
@@ -0,0 +1,98 @@
--- SConstruct.orig 2023-04-24 16:15:19 UTC
+++ SConstruct
@@ -23,9 +23,9 @@ import SCons.Script
import SCons
import SCons.Script
-from mongo_tooling_metrics.client import get_mongo_metrics_client
-from mongo_tooling_metrics.errors import ExternalHostException
-from mongo_tooling_metrics.lib.top_level_metrics import SConsToolingMetrics
+#from mongo_tooling_metrics.client import get_mongo_metrics_client
+#from mongo_tooling_metrics.errors import ExternalHostException
+#from mongo_tooling_metrics.lib.top_level_metrics import SConsToolingMetrics
from site_scons.mongo import build_profiles
# This must be first, even before EnsureSConsVersion, if
@@ -1659,22 +1659,22 @@ env.AddMethod(lambda env, name, **kwargs: add_option(n
# The placement of this is intentional. Here we setup an atexit method to store tooling metrics.
# We should only register this function after env, env_vars and the parser have been properly initialized.
-try:
- metrics_client = get_mongo_metrics_client()
- metrics_client.register_metrics(
- SConsToolingMetrics,
- utc_starttime=datetime.utcnow(),
- artifact_dir=env.Dir('$BUILD_DIR').get_abspath(),
- env_vars=env_vars,
- env=env,
- parser=_parser,
- )
-except ExternalHostException as _:
- pass
-except Exception as _:
- print(
- "This MongoDB Virtual Workstation could not connect to the internal cluster\nThis is a non-issue, but if this message persists feel free to reach out in #server-dev-platform"
- )
+#try:
+# metrics_client = get_mongo_metrics_client()
+# metrics_client.register_metrics(
+# SConsToolingMetrics,
+# utc_starttime=datetime.utcnow(),
+# artifact_dir=env.Dir('$BUILD_DIR').get_abspath(),
+# env_vars=env_vars,
+# env=env,
+# parser=_parser,
+# )
+#except ExternalHostException as _:
+# pass
+#except Exception as _:
+# print(
+# "This MongoDB Virtual Workstation could not connect to the internal cluster\nThis is a non-issue, but if this message persists feel free to reach out in #server-dev-platform"
+# )
if get_option('build-metrics'):
env['BUILD_METRICS_ARTIFACTS_DIR'] = '$BUILD_ROOT/$VARIANT_DIR'
@@ -1812,9 +1812,9 @@ if has_option('variables-help'):
print(env_vars.GenerateHelpText(env))
Exit(0)
-unknown_vars = env_vars.UnknownVariables()
-if unknown_vars:
- env.FatalError("Unknown variables specified: {0}", ", ".join(list(unknown_vars.keys())))
+#unknown_vars = env_vars.UnknownVariables()
+#if unknown_vars:
+# env.FatalError("Unknown variables specified: {0}", ", ".join(list(unknown_vars.keys())))
install_actions.setup(env, get_option('install-action'))
@@ -3033,7 +3033,7 @@ if env.TargetOSIs('posix'):
# If runtime hardening is requested, then build anything
# destined for an executable with the necessary flags for PIE.
env.AppendUnique(
- PROGCCFLAGS=['-fPIE'],
+ PROGCCFLAGS=['-fpic'],
PROGLINKFLAGS=['-pie'],
)
@@ -3041,7 +3041,6 @@ if env.TargetOSIs('posix'):
env.Append(
CCFLAGS=[
"-fasynchronous-unwind-tables",
- "-g2" if not env.TargetOSIs('emscripten') else "-g",
"-Wall",
"-Wsign-compare",
"-Wno-unknown-pragmas",
@@ -3224,8 +3223,12 @@ if not env.TargetOSIs('windows', 'macOS') and (env.Too
# setting it for both C and C++ by setting both of CFLAGS and
# CXXFLAGS.
+ arm_march_flag = "armv8-a"
+ if get_option('use-hardware-crc32') == "on":
+ arm_march_flag += "+crc"
+
default_targeting_flags_for_architecture = {
- "aarch64": {"-march=": "armv8.2-a", "-mtune=": "generic"},
+ "aarch64": {"-march=": arm_march_flag, "-mtune=": "generic"},
"i386": {"-march=": "nocona", "-mtune=": "generic"},
"ppc64le": {"-mcpu=": "power8", "-mtune=": "power8", "-mcmodel=": "medium"},
"s390x": {"-march=": "z196", "-mtune=": "zEC12"},
@@ -0,0 +1,25 @@
--- buildscripts/scons.py.orig 2021-08-23 09:10:10 UTC
+++ buildscripts/scons.py
@@ -18,14 +18,14 @@ SITE_TOOLS_DIR = os.path.join(MONGODB_ROOT, 'site_scon
sys.path = [SCONS_DIR, SITE_TOOLS_DIR] + sys.path
-# pylint: disable=C0413
-from mongo.pip_requirements import verify_requirements, MissingRequirements
-
-try:
- verify_requirements('etc/pip/compile-requirements.txt')
-except MissingRequirements as ex:
- print(ex)
- sys.exit(1)
+## pylint: disable=C0413
+#from mongo.pip_requirements import verify_requirements, MissingRequirements
+#
+#try:
+# verify_requirements('etc/pip/compile-requirements.txt')
+#except MissingRequirements as ex:
+# print(ex)
+# sys.exit(1)
try:
import SCons.Script
@@ -0,0 +1,16 @@
--- rpm/mongod.conf.orig 2023-02-07 18:25:28 UTC
+++ rpm/mongod.conf
@@ -7,11 +7,11 @@ systemLog:
systemLog:
destination: file
logAppend: true
- path: /var/log/mongodb/mongod.log
+ path: /var/db/mongodb/mongod.log
# Where and how to store data.
storage:
- dbPath: /var/lib/mongo
+ dbPath: /var/db/mongo
# how the process runs
processManagement:
@@ -0,0 +1,10 @@
--- src/third_party/asio-master/asio/include/asio/detail/config.hpp.orig 2023-04-29 10:17:24 UTC
+++ src/third_party/asio-master/asio/include/asio/detail/config.hpp
@@ -19,6 +19,7 @@
// individual scons objects.
# define ASIO_STANDALONE // MongoDB
# define ASIO_SEPARATE_COMPILATION // MongoDB
+# define ASIO_HAS_STD_INVOKE_RESULT // FreeBSD
#if defined(ASIO_STANDALONE)
# define ASIO_DISABLE_BOOST_ARRAY 1
@@ -0,0 +1,30 @@
--- src/third_party/mozjs/gen-config.sh.orig 2022-08-05 16:21:29 UTC
+++ src/third_party/mozjs/gen-config.sh
@@ -29,6 +29,9 @@ case "$_Path" in
}
case "$_Path" in
+ "platform/aarch64/freebsd")
+ _CONFIG_OPTS="--host=aarch64-freebsd"
+ ;;
"platform/aarch64/linux")
_CONFIG_OPTS="--host=aarch64-linux"
;;
@@ -108,7 +111,7 @@ CFLAGS="$CFLAGS -D__STDC_FORMAT_MACROS" \
--disable-js-shell \
--disable-tests "$_CONFIG_OPTS"
-make recurse_export
+gmake recurse_export
cd ../../../..
@@ -159,7 +162,7 @@ find "$_Path/build" -name '*.cpp' |
find "$_Path/build" -name '*.cpp' |
while read unified_file ; do
echo "Processing $unified_file"
- sed $SEDOPTION \
+ gsed $SEDOPTION \
-e 's|#include ".*/js/src/|#include "|' \
-e 's|#error ".*/js/src/|#error "|' \
"$unified_file"
@@ -0,0 +1,14 @@
--- src/third_party/mozjs/get-sources.sh.orig 2022-09-08 09:53:27 UTC
+++ src/third_party/mozjs/get-sources.sh
@@ -12,9 +12,9 @@ LIB_GIT_REPO=git@github.com:mongodb-forks/spidermonkey
LIB_GIT_REVISION=82aac6af18abcd5bf188afbc821779ccb0ca0902
LIB_GIT_REPO=git@github.com:mongodb-forks/spidermonkey.git
-DEST_DIR=$(git rev-parse --show-toplevel)/src/third_party/mozjs
+DEST_DIR=$(realpath .)
-LIB_GIT_DIR=$(mktemp -d /tmp/import-spidermonkey.XXXXXX)
+LIB_GIT_DIR=$(mktemp -d /var/tmp/import-spidermonkey.XXXXXX)
trap "rm -rf $LIB_GIT_DIR" EXIT
git clone $LIB_GIT_REPO $LIB_GIT_DIR
+3
View File
@@ -0,0 +1,3 @@
Mongo (from "humongous") is a high-performance, open source,
schema-free, document-oriented database. A common name in the
"NOSQL" community.
+7
View File
@@ -0,0 +1,7 @@
bin/mongod
bin/mongos
@sample etc/mongodb.conf.sample
%%DOCSDIR%%/LICENSE-Community.txt
%%DOCSDIR%%/MPL-2
%%DOCSDIR%%/README
%%DOCSDIR%%/THIRD-PARTY-NOTICES