davix: add switches for optional features

This commit is contained in:
Shamrock Lee 2021-10-06 05:43:06 +08:00
parent 362cdf2cc6
commit 9e972605a0

View File

@ -1,10 +1,44 @@
{ lib, stdenv, fetchurl, cmake, pkg-config, openssl, libxml2, boost, python3, libuuid }:
{ lib
, stdenv
, fetchurl
, cmake
, pkg-config
, openssl
, libxml2
, boost
, python3
, libuuid
, curl
, gsoap
, enableTools ? true
# Build the bundled libcurl
# and, if defaultToLibCurl,
# use instead of an external one
, useEmbeddedLibcurl ? true
# Use libcurl instead of libneon
# Note that the libneon used is bundled in the project
# See https://github.com/cern-fts/davix/issues/23
, defaultToLibcurl ? false
, enableIpv6 ? true
, enableTcpNodelay ? true
# Build davix_copy.so
, enableThirdPartyCopy ? false
}:
let
boolToUpper = b: lib.toUpper (lib.boolToString b);
in
stdenv.mkDerivation rec {
version = "0.8.0";
pname = "davix";
nativeBuildInputs = [ cmake pkg-config python3 ];
buildInputs = [ openssl libxml2 boost libuuid ];
buildInputs = [
openssl
libxml2
boost
libuuid
] ++ lib.optional (defaultToLibcurl && !useEmbeddedLibcurl) curl
++ lib.optional (enableThirdPartyCopy) gsoap;
# using the url below since the github release page states
# "please ignore the GitHub-generated tarballs, as they are incomplete"
@ -20,6 +54,15 @@ stdenv.mkDerivation rec {
done
'';
cmakeFlags = [
"-DENABLE_TOOLS=${boolToUpper enableTools}"
"-DEMBEDDED_LIBCURL=${boolToUpper useEmbeddedLibcurl}"
"-DLIBCURL_BACKEND_BY_DEFAULT=${boolToUpper defaultToLibcurl}"
"-DENABLE_IPV6=${boolToUpper enableIpv6}"
"-DENABLE_TCP_NODELAY=${boolToUpper enableTcpNodelay}"
"-DENABLE_THIRD_PARTY_COPY=${boolToUpper enableThirdPartyCopy}"
];
meta = with lib; {
description = "Toolkit for Http-based file management";