nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchpatch,
5 fetchFromGitHub,
6 cmake,
7 pkg-config,
8 openssl,
9 libxml2,
10 python3,
11 libuuid,
12 curl,
13 gsoap,
14 rapidjson,
15 zlib,
16 enableTools ? true,
17 # Use libcurl instead of libneon
18 # Note that the libneon used is bundled in the project
19 # See https://github.com/cern-fts/davix/issues/23
20 defaultToLibcurl ? false,
21 enableIpv6 ? true,
22 enableTcpNodelay ? true,
23 # Build davix_copy.so
24 enableThirdPartyCopy ? false,
25}:
26
27let
28 boolToUpper = b: lib.toUpper (lib.boolToString b);
29in
30stdenv.mkDerivation rec {
31 version = "0.8.10";
32 pname = "davix" + lib.optionalString enableThirdPartyCopy "-copy";
33 nativeBuildInputs = [
34 cmake
35 pkg-config
36 python3
37 ];
38 buildInputs = [
39 curl
40 libxml2
41 openssl
42 rapidjson
43 zlib
44 ]
45 ++ lib.optional (!stdenv.hostPlatform.isDarwin) libuuid
46 ++ lib.optional enableThirdPartyCopy gsoap;
47
48 src = fetchFromGitHub {
49 owner = "cern-fts";
50 repo = "davix";
51 tag = "R_${lib.replaceStrings [ "." ] [ "_" ] version}";
52 hash = "sha256-n4NeHBgQwGwgHAFQzPc3oEP9k3F/sqrTmkI/zHW+Miw=";
53 };
54
55 preConfigure = ''
56 find . -mindepth 1 -maxdepth 1 -type f -name "patch*.sh" -print0 | while IFS= read -r -d ''' file; do
57 patchShebangs "$file"
58 done
59 '';
60
61 cmakeFlags = [
62 "-DDAVIX_TESTS=OFF"
63 "-DENABLE_TOOLS=${boolToUpper enableTools}"
64 "-DEMBEDDED_LIBCURL=OFF"
65 "-DLIBCURL_BACKEND_BY_DEFAULT=${boolToUpper defaultToLibcurl}"
66 "-DENABLE_IPV6=${boolToUpper enableIpv6}"
67 "-DENABLE_TCP_NODELAY=${boolToUpper enableTcpNodelay}"
68 "-DENABLE_THIRD_PARTY_COPY=${boolToUpper enableThirdPartyCopy}"
69 ];
70
71 patches = [
72 # Update CMake minimum requirement and supported versions, backport from unreleased davix 0.8.11
73 (fetchpatch {
74 url = "https://github.com/cern-fts/davix/commit/687d424c9f87888c94d96f3ea010de11ef70cd23.patch";
75 hash = "sha256-FNXOQrY0gsMK+D4jwbJmYyEqD3lFui0giXUd+Rr0jLk=";
76 })
77 ];
78
79 # Transitive dependency of gsoap (only supports static library builds)
80 env.NIX_LDFLAGS = "-lz";
81
82 meta = {
83 description = "Toolkit for Http-based file management";
84
85 longDescription = "Davix is a toolkit designed for file
86 operations with Http based protocols (WebDav, Amazon S3, ...).
87 Davix provides an API and a set of command line tools";
88
89 license = lib.licenses.lgpl2Plus;
90 homepage = "https://github.com/cern-fts/davix";
91 changelog = "https://github.com/cern-fts/davix/blob/R_${
92 lib.replaceStrings [ "." ] [ "_" ] version
93 }/RELEASE-NOTES.md";
94 maintainers = with lib.maintainers; [ adev ];
95 platforms = lib.platforms.all;
96 };
97}