summary refs log tree commit diff
path: root/pkgs/tools/networking/davix/default.nix
blob: 7120e76821d62c27ff80d70016c411c22bc8342f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
{ 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" + lib.optionalString enableThirdPartyCopy "-copy";
  nativeBuildInputs = [ cmake pkg-config python3 ];
  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"
  # https://github.com/cern-fts/davix/releases/tag/R_0_8_0
  src = fetchurl {
    url = "https://github.com/cern-fts/davix/releases/download/R_${lib.replaceStrings ["."] ["_"] version}/davix-${version}.tar.gz";
    sha256 = "LxCNoECKg/tbnwxoFQ02C6cz5LOg/imNRbDTLSircSQ=";
  };

  preConfigure = ''
    find . -mindepth 1 -maxdepth 1 -type f -name "patch*.sh" -print0 | while IFS= read -r -d ''' file; do
      patchShebangs "$file"
    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; {
    broken = stdenv.isDarwin;
    description = "Toolkit for Http-based file management";

    longDescription = "Davix is a toolkit designed for file
    operations with Http based protocols (WebDav, Amazon S3, ...).
    Davix provides an API and a set of command line tools";

    license = licenses.lgpl2Plus;
    homepage = "https://github.com/cern-fts/davix";
    changelog = "https://github.com/cern-fts/davix/blob/R_${lib.replaceStrings ["."] ["_"] version}/RELEASE-NOTES.md";
    maintainers = with maintainers; [ adev ];
    platforms = platforms.all;
  };
}