diff --git a/dev-libs/libmongocrypt/Manifest b/dev-libs/libmongocrypt/Manifest new file mode 100644 index 0000000..e453b35 --- /dev/null +++ b/dev-libs/libmongocrypt/Manifest @@ -0,0 +1 @@ +DIST libmongocrypt-1.10.0.tar.gz 4166115 BLAKE2B ca206622ceefab98c037e5987bb370560cd9b26d6281f0fa4c5a1a6680bafc2a664ff8b292ba4725994eb5da996081bb3eb3250526357e5cd6cdf7e4a8499015 SHA512 a994a69112e6af4a21f4118a61e33110fdfef4adb1018f1ebdaef4e25c1211ac4957b24879f67ebb6adb0b0e6dff5bef69fe8b6dad18adcc0a7780de1cea1d7f diff --git a/dev-libs/libmongocrypt/files/inteldfp.patch b/dev-libs/libmongocrypt/files/inteldfp.patch new file mode 100644 index 0000000..e8b0030 --- /dev/null +++ b/dev-libs/libmongocrypt/files/inteldfp.patch @@ -0,0 +1,133 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 4285f3d39..fe09b8857 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -7,6 +7,10 @@ elseif (DEFINED CMAKE_MSVC_RUNTIME_LIBRARY) + message (WARNING "The CMAKE_MSVC_RUNTIME_LIBRARY variable is set, but CMake is too old to understand it") + endif () + ++if (POLICY CMP0135) ++ cmake_policy (SET CMP0135 NEW) ++endif () ++ + project (mongocrypt C) + + # Used for the csfle-markup util: +diff --git a/cmake/IntelDFP.cmake b/cmake/IntelDFP.cmake +index da0cdc2fd..cb6bb48d4 100644 +--- a/cmake/IntelDFP.cmake ++++ b/cmake/IntelDFP.cmake +@@ -1,7 +1,5 @@ + + include (FetchContent) +-find_program (GIT_EXECUTABLE git) +-find_program (PATCH_EXECUTABLE patch) + + # When updating the version of IntelDFP, also update the version in etc/purls.txt + set (_default_url "${PROJECT_SOURCE_DIR}/third-party/IntelRDFPMathLib20U2.tar.xz") +@@ -19,18 +17,22 @@ if (NOT INTEL_DFP_LIBRARY_URL_SHA256 STREQUAL "no-verify") + set (_hash_arg URL_HASH "${INTEL_DFP_LIBRARY_URL_HASH}") + endif () + +-# Make the PATCH_COMMAND a no-op if it was disabled +-set (patch_command) +-set (patch_input_opt) + if (NOT INTEL_DFP_LIBRARY_PATCH_ENABLED) +- set (patch_command "${CMAKE_COMMAND}" -E true) +-elseif (GIT_EXECUTABLE) +- set (patch_command "${GIT_EXECUTABLE}" --work-tree= apply) +-else () +- set (patch_command "${PATCH_EXECUTABLE}" --dir=) +- set (patch_input_opt -i) ++ set (patch_disabled ON) + endif () + ++include (Patch) ++make_patch_command (patch_command ++ STRIP_COMPONENTS 4 ++ DIRECTORY "" ++ DISABLED "${patch_disabled}" ++ PATCHES ++ "${PROJECT_SOURCE_DIR}/etc/mongo-inteldfp-s390x.patch" ++ "${PROJECT_SOURCE_DIR}/etc/mongo-inteldfp-MONGOCRYPT-571.patch" ++ "${PROJECT_SOURCE_DIR}/etc/mongo-inteldfp-libmongocrypt-pr-625.patch" ++ "${PROJECT_SOURCE_DIR}/etc/mongo-inteldfp-alpine-arm-fix.patch" ++ ) ++ + # NOTE: The applying of the patch expects the correct input directly from the + # expanded archive. If the patch needs to be reapplied, you may see errors + # about trying to update the intel_dfp component. If you are seeing such +@@ -40,14 +42,7 @@ FetchContent_Declare ( + intel_dfp + URL "${_default_url}" + ${_hash_arg} +- PATCH_COMMAND +- ${patch_command} +- -p 4 # Strip four path components +- ${patch_input_opt} "${PROJECT_SOURCE_DIR}/etc/mongo-inteldfp-s390x.patch" +- ${patch_input_opt} "${PROJECT_SOURCE_DIR}/etc/mongo-inteldfp-MONGOCRYPT-571.patch" +- ${patch_input_opt} "${PROJECT_SOURCE_DIR}/etc/mongo-inteldfp-libmongocrypt-pr-625.patch" +- ${patch_input_opt} "${PROJECT_SOURCE_DIR}/etc/mongo-inteldfp-alpine-arm-fix.patch" +- --verbose ++ PATCH_COMMAND ${patch_command} --verbose + ) + + FetchContent_GetProperties (intel_dfp) +diff --git a/cmake/Patch.cmake b/cmake/Patch.cmake +new file mode 100644 +index 000000000..057e91a48 +--- /dev/null ++++ b/cmake/Patch.cmake +@@ -0,0 +1,52 @@ ++find_program(GIT_EXECUTABLE git) ++find_program(PATCH_EXECUTABLE patch) ++ ++#[[ ++ Form a new Patch-applying command for the given inputs ++ ++ make_patch_command( ++ ++ [DISABLED ] ++ [DIRECTORY ] ++ [STRIP_COMPONENTS ] ++ PATCHES [ ...] ++ ) ++]] ++function(make_patch_command out) ++ cmake_parse_arguments(PARSE_ARGV 1 patch "" "DIRECTORY;STRIP_COMPONENTS;DISABLED" "PATCHES") ++ if(patch_DISABLED) ++ # Use a placeholder "no-op" patch command. ++ set(cmd "${CMAKE_COMMAND}" "-E" "true") ++ elseif(GIT_EXECUTABLE) ++ # git ... ++ set(cmd ${GIT_EXECUTABLE}) ++ ++ if(patch_DIRECTORY) ++ # git --work-tree=... ++ list(APPEND cmd --work-tree=${patch_DIRECTORY}) ++ endif() ++ # git ... apply ... ++ list(APPEND cmd apply) ++ # git ... apply -pN ... ++ if(patch_STRIP_COMPONENTS) ++ list(APPEND cmd -p${patch_STRIP_COMPONENTS}) ++ endif() ++ # git accepts patch filepaths as positional arguments ++ list(APPEND cmd ${patch_PATCHES}) ++ else() ++ # patch ... ++ set(cmd ${PATCH_EXECUTABLE}) ++ if(patch_DIRECTORY) ++ # patch --dir=... ++ list(APPEND cmd --dir=${patch_DIRECTORY}) ++ endif() ++ # patch ... -pN ... ++ if(patch_STRIP_COMPONENTS) ++ list(APPEND cmd -p${patch_STRIP_COMPONENTS}) ++ endif() ++ # Prepend "--input=" to each patch filepath and add them to the argv ++ list(TRANSFORM patch_PATCHES PREPEND "--input=") ++ list(APPEND cmd ${patch_PATCHES}) ++ endif() ++ set("${out}" "${cmd}" PARENT_SCOPE) ++endfunction() diff --git a/dev-libs/libmongocrypt/files/skip-tests.txt b/dev-libs/libmongocrypt/files/skip-tests.txt new file mode 100644 index 0000000..0e3df23 --- /dev/null +++ b/dev-libs/libmongocrypt/files/skip-tests.txt @@ -0,0 +1,38 @@ +# This file lists known failing or flaky tests that for some reason or another +# cannot be fixed and rather should be skipped in Evergreen builds. Note that +# listing a test in this file will result in the test being skipped on all +# platforms, build variants, tasks, etc. +# +# The format of this file is as follows: +# - one test per line, with an optional comment (total lines in file < 1,000) +# - comments begin with a hash (#) character and continue to the end of the line +# - lines starting with the comment character and blank lines are ignored +# - specify test names as they are known to the test runner (e.g., /some/test) +# - specify sub-tests of spec tests by an additional slash (/) and the quoted description +# (e.g., /some/spec/test/"sub-test 1") +# - placing a comment at the end of a line will cause the test runner to output +# the comment text as the skip reason when the test is skipped +# +# Example entries: +# /skip/entire/test # this will be output by the runner as the skip reason +# /skip/part/of/spec/test/"sub-test description" # this will also be output + +#/change_stream/live/track_resume_token # (CDRIVER-4344) Condition 'bson_compare (resume_token, &doc2_rt) == 0' failed +#/ClientPool/pop_timeout # (CDRIVER-4348) precondition failed: duration_usec / 1000 >= 1990 + +#/change_streams/legacy/change-streams # (CDRIVER-4350) Could not establish stream for node 127.0.0.1:8000: [TLS handshake failed: Connection timed out calling hello on '127.0.0.1:8000'] +#/change_streams/legacy/change-streams-resume-allowlist # (CDRIVER-4350) Could not establish stream for node 127.0.0.1:8000: [TLS handshake failed: Connection timed out calling hello on '127.0.0.1:8000'] +#/change_streams/legacy/change-streams-resume-errorLabels # (CDRIVER-4350) Could not establish stream for node 127.0.0.1:8000: [TLS handshake failed: Connection timed out calling hello on '127.0.0.1:8000'] +#/unified/entity-find-cursor # (CDRIVER-4350) Could not establish stream for node 127.0.0.1:8000: [TLS handshake failed: Connection timed out calling hello on '127.0.0.1:8000'] +#/change_streams/legacy/change-streams-errors # (CDRIVER-4350) Could not establish stream for node 127.0.0.1:8000: [TLS handshake failed: Connection timed out calling hello on '127.0.0.1:8000'] (on ASAN Tests Ubuntu 18.04 build variant) + +#/transactions/legacy/mongos-recovery-token/"commitTransaction retry fails on new mongos" # fails with server selection timeout (CDRIVER-4268) +#/transactions/legacy/pin-mongos/"unpin after transient error within a transaction and commit" # (CDRIVER-4351) server selection timeout (on ASAN Tests Ubuntu 18.04 build variant) +#/Samples # (CDRIVER-4352) strange "heartbeat failed" error + +#/client_side_encryption/bypass_spawning_mongocryptd/mongocryptdBypassSpawn # Fails if crypt_shared is visible + +/MongoDB/handshake/null_args #potentially gcc14 related + +/http/get # we dont run simplehttp on gentoo +/http/post # we dont run simplehttp on gentoo diff --git a/dev-libs/libmongocrypt/libmongocrypt-1.10.0.ebuild b/dev-libs/libmongocrypt/libmongocrypt-1.10.0.ebuild new file mode 100644 index 0000000..2bbd697 --- /dev/null +++ b/dev-libs/libmongocrypt/libmongocrypt-1.10.0.ebuild @@ -0,0 +1,75 @@ +# Copyright 1999-2024 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit cmake + +DESCRIPTION="C library for Client Side and Queryable Encryption in MongoDB" +HOMEPAGE="https://github.com/mongodb/libmongocrypt" +SRC_URI="https://github.com/mongodb/libmongocrypt/archive/refs/tags/${PV}.tar.gz -> ${P}.tar.gz" + +LICENSE="Apache-2.0" +SLOT="0" +KEYWORDS="~amd64 ~arm64 ~hppa ~riscv ~x86" +IUSE="static-libs test" +REQUIRED_USE="test? ( static-libs )" + +# No tests on x86 because tests require dev-db/mongodb which don't support +# x86 anymore (bug #645994) +RESTRICT="x86? ( test ) + !test? ( test )" + +RDEPEND=" + >=dev-libs/libbson-1.17.0[static-libs?] + dev-libs/openssl:= +" +DEPEND="${RDEPEND} + test? ( + dev-db/mongodb + dev-libs/libbson[static-libs] + )" + +#PATCHES=( +# "${FILESDIR}/inteldfp.patch" +#) + +src_prepare() { + cmake_src_prepare + + # remove doc files +# sed -i '/^\s*install\s*(FILES COPYING NEWS/,/^\s*)/{d}' CMakeLists.txt || die + + # enable tests +# sed -i '/message (STATUS "disabling test-libmongoc since using system libbson")/{d}' CMakeLists.txt || die +# sed -i '/SET (ENABLE_TESTS OFF)/{d}' CMakeLists.txt || die +# sed -i 's/message (FATAL_ERROR "System libbson built without static library target")/message (STATUS "System libbson built without static library target")/' CMakeLists.txt || die +# sed -i 's##"bson/bson-private.h"#' src/libbson/tests/test-bson.c || die +} + +src_configure() { + local mycmakeargs=( + -DCMAKE_SKIP_RPATH=ON # mongoc-stat insecure runpath + -DUSE_SHARED_LIBBSON=ON + -DMONGOCRYPT_MONGOC_DIR=USE-SYSTEM + -DENABLE_ONLINE_TESTS=OFF + -DBUILD_VERSION=${PV} + -DMONGOCRYPT_ENABLE_DECIMAL128=OFF + -DENABLE_STATIC="$(usex static-libs ON OFF)" + ) + + cmake_src_configure +} + +# FEATURES="test -network-sandbox" USE="static-libs" emerge dev-libs/mongo-c-driver +#src_test() { +# local PORT=27099 +# mongod --setParameter enableTestCommands=1 --enableMajorityReadConcern \ +# --port ${PORT} --bind_ip 127.0.0.1 --nounixsocket --fork \ +# --dbpath="${T}" --logpath="${T}/mongod.log" || die +# MONGOC_TEST_URI="mongodb://[127.0.0.1]:${PORT}" \ +# MONGOC_ENABLE_MAJORITY_READ_CONCERN=on \ +# ../mongo-c-driver-${PV}_build/src/libmongoc/test-libmongoc \ +# --skip-tests "${FILESDIR}/skip-tests.txt" || die +# kill $(<"${T}/mongod.lock") +#} diff --git a/dev-libs/libmongocrypt/metadata.xml b/dev-libs/libmongocrypt/metadata.xml new file mode 100644 index 0000000..6969885 --- /dev/null +++ b/dev-libs/libmongocrypt/metadata.xml @@ -0,0 +1,11 @@ + + + + + ultrabug@gentoo.org + Alexys Jacob + + + mongodb/mongo-c-driver + +