mongoc: rework packaging
This commit is contained in:
parent
82a6d7e31d
commit
32b12fe23c
|
@ -1,52 +1,59 @@
|
||||||
{
|
{ lib
|
||||||
lib,
|
, stdenv
|
||||||
stdenv,
|
, fetchFromGitHub
|
||||||
fetchzip,
|
, cmake
|
||||||
cmake,
|
, pkg-config
|
||||||
pkg-config,
|
, openssl
|
||||||
perl,
|
, zlib
|
||||||
openssl,
|
, zstd
|
||||||
zlib,
|
, icu
|
||||||
cyrus_sasl,
|
, cyrus_sasl
|
||||||
libbson,
|
, snappy
|
||||||
snappy,
|
, darwin
|
||||||
darwin,
|
|
||||||
}:
|
}:
|
||||||
let
|
|
||||||
inherit (darwin.apple_sdk.frameworks) Security;
|
|
||||||
in
|
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
pname = "mongoc";
|
pname = "mongoc";
|
||||||
version = "1.23.4";
|
version = "1.23.4";
|
||||||
|
|
||||||
src = fetchzip {
|
src = fetchFromGitHub {
|
||||||
url = "https://github.com/mongodb/mongo-c-driver/releases/download/${version}/mongo-c-driver-${version}.tar.gz";
|
owner = "mongodb";
|
||||||
sha256 = "sha256-mJBaRaX0hphvMdTII79DVn1g2uBmpRlObMiJ673Ijpw=";
|
repo = "mongo-c-driver";
|
||||||
|
rev = "refs/tags/${version}";
|
||||||
|
hash = "sha256-jYEEWbm00V3zhzxH8jBkrj/+OC6CGjbh5qofNYmsdTk=";
|
||||||
};
|
};
|
||||||
|
|
||||||
# https://github.com/NixOS/nixpkgs/issues/25585
|
|
||||||
preFixup = ''rm -rf "$(pwd)" '';
|
|
||||||
# https://github.com/mongodb/mongo-c-driver/pull/1157
|
|
||||||
# related:
|
|
||||||
# https://github.com/NixOS/nixpkgs/issues/144170
|
|
||||||
# mongoc's cmake incorrectly injects a prefix to library paths, breaking Nix. This removes the prefix from paths.
|
|
||||||
postPatch = ''
|
postPatch = ''
|
||||||
substituteInPlace src/libmongoc/CMakeLists.txt \
|
substituteInPlace src/libbson/CMakeLists.txt src/libmongoc/CMakeLists.txt \
|
||||||
--replace "\\\''${prefix}/" ""
|
|
||||||
substituteInPlace src/libbson/CMakeLists.txt \
|
|
||||||
--replace "\\\''${prefix}/" ""
|
--replace "\\\''${prefix}/" ""
|
||||||
'';
|
'';
|
||||||
|
|
||||||
nativeBuildInputs = [cmake pkg-config perl];
|
nativeBuildInputs = [
|
||||||
buildInputs = [openssl zlib cyrus_sasl] ++ lib.optionals stdenv.isDarwin [Security];
|
cmake
|
||||||
propagatedBuildInputs = [libbson snappy];
|
pkg-config
|
||||||
|
];
|
||||||
|
|
||||||
# -DMONGOC_TEST_USE_CRYPT_SHARED=OFF
|
buildInputs = [
|
||||||
# The `mongodl.py` script is causing issues, and you also need to disabled sandboxing for it. However, it is used only to run some tests.
|
openssl
|
||||||
# https://www.mongodb.com/community/forums/t/problem-downloading-crypt-shared-when-installing-the-mongodb-c-driver/189370
|
zlib
|
||||||
cmakeFlags = ["-DCMAKE_BUILD_TYPE=Release" "-DENABLE_AUTOMATIC_INIT_AND_CLEANUP=OFF" "-DMONGOC_TEST_USE_CRYPT_SHARED=OFF"];
|
zstd
|
||||||
|
icu
|
||||||
|
cyrus_sasl
|
||||||
|
snappy
|
||||||
|
] ++ lib.optionals stdenv.isDarwin [
|
||||||
|
darwin.apple_sdk.frameworks.Security
|
||||||
|
];
|
||||||
|
|
||||||
enableParallelBuilding = true;
|
cmakeFlags = [
|
||||||
|
"-DBUILD_VERSION=${version}"
|
||||||
|
"-DENABLE_UNINSTALL=OFF"
|
||||||
|
"-DENABLE_AUTOMATIC_INIT_AND_CLEANUP=OFF"
|
||||||
|
];
|
||||||
|
|
||||||
|
# remove forbidden reference to $TMPDIR
|
||||||
|
preFixup = ''
|
||||||
|
rm -rf src/{libmongoc,libbson}
|
||||||
|
'';
|
||||||
|
|
||||||
meta = with lib; {
|
meta = with lib; {
|
||||||
broken = stdenv.isDarwin && stdenv.isx86_64;
|
broken = stdenv.isDarwin && stdenv.isx86_64;
|
||||||
|
@ -54,7 +61,7 @@ stdenv.mkDerivation rec {
|
||||||
homepage = "http://mongoc.org";
|
homepage = "http://mongoc.org";
|
||||||
license = licenses.asl20;
|
license = licenses.asl20;
|
||||||
mainProgram = "mongoc-stat";
|
mainProgram = "mongoc-stat";
|
||||||
maintainers = with maintainers; [archer-65];
|
maintainers = with maintainers; [ archer-65 ];
|
||||||
platforms = platforms.all;
|
platforms = platforms.all;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue