lol
1{ bdbSupport ? false # build support for Berkeley DB repositories
2, httpServer ? false # build Apache DAV module
3, httpSupport ? false # client must support http
4, pythonBindings ? false
5, perlBindings ? false
6, javahlBindings ? false
7, saslSupport ? false
8, stdenv, fetchurl, apr, aprutil, zlib, sqlite, openssl, lz4, utf8proc
9, apacheHttpd ? null, expat, swig ? null, jdk ? null, python ? null, perl ? null
10, sasl ? null, serf ? null
11}:
12
13assert bdbSupport -> aprutil.bdbSupport;
14assert httpServer -> apacheHttpd != null;
15assert pythonBindings -> swig != null && python != null;
16assert javahlBindings -> jdk != null && perl != null;
17
18let
19
20 common = { version, sha256, extraBuildInputs ? [ ] }: stdenv.mkDerivation (rec {
21 inherit version;
22 name = "subversion-${version}";
23
24 src = fetchurl {
25 url = "mirror://apache/subversion/${name}.tar.bz2";
26 inherit sha256;
27 };
28
29 # Can't do separate $lib and $bin, as libs reference bins
30 outputs = [ "out" "dev" "man" ];
31
32 buildInputs = [ zlib apr aprutil sqlite openssl ]
33 ++ extraBuildInputs
34 ++ stdenv.lib.optional httpSupport serf
35 ++ stdenv.lib.optional pythonBindings python
36 ++ stdenv.lib.optional perlBindings perl
37 ++ stdenv.lib.optional saslSupport sasl;
38
39 patches = [ ./apr-1.patch ];
40
41 # SVN build seems broken on gcc5:
42 # https://gcc.gnu.org/gcc-5/porting_to.html
43 CPPFLAGS = "-P";
44
45 configureFlags = [
46 (stdenv.lib.withFeature bdbSupport "berkeley-db")
47 (stdenv.lib.withFeatureAs httpServer "apxs" "${apacheHttpd.dev}/bin/apxs")
48 (stdenv.lib.withFeatureAs (pythonBindings || perlBindings) "swig" swig)
49 (stdenv.lib.withFeatureAs saslSupport "sasl" sasl)
50 (stdenv.lib.withFeatureAs httpSupport "serf" serf)
51 "--disable-keychain"
52 "--with-zlib=${zlib.dev}"
53 "--with-sqlite=${sqlite.dev}"
54 ] ++ stdenv.lib.optionals javahlBindings [
55 "--enable-javahl"
56 "--with-jdk=${jdk}"
57 ];
58
59 preBuild = ''
60 makeFlagsArray=(APACHE_LIBEXECDIR=$out/modules)
61 '';
62
63 postInstall = ''
64 if test -n "$pythonBindings"; then
65 make swig-py swig_pydir=$(toPythonPath $out)/libsvn swig_pydir_extra=$(toPythonPath $out)/svn
66 make install-swig-py swig_pydir=$(toPythonPath $out)/libsvn swig_pydir_extra=$(toPythonPath $out)/svn
67 fi
68
69 if test -n "$perlBindings"; then
70 make swig-pl-lib
71 make install-swig-pl-lib
72 cd subversion/bindings/swig/perl/native
73 perl Makefile.PL PREFIX=$out
74 make install
75 cd -
76 fi
77
78 mkdir -p $out/share/bash-completion/completions
79 cp tools/client-side/bash_completion $out/share/bash-completion/completions/subversion
80
81 for f in $out/lib/*.la $out/lib/python*/site-packages/*/*.la; do
82 substituteInPlace $f \
83 --replace "${expat.dev}/lib" "${expat.out}/lib" \
84 --replace "${zlib.dev}/lib" "${zlib.out}/lib" \
85 --replace "${sqlite.dev}/lib" "${sqlite.out}/lib" \
86 --replace "${openssl.dev}/lib" "${openssl.out}/lib"
87 done
88 '';
89
90 inherit perlBindings pythonBindings;
91
92 enableParallelBuilding = true;
93
94 checkInputs = [ python ];
95 doCheck = false; # fails 10 out of ~2300 tests
96
97 meta = with stdenv.lib; {
98 description = "A version control system intended to be a compelling replacement for CVS in the open source community";
99 license = licenses.asl20;
100 homepage = http://subversion.apache.org/;
101 maintainers = with maintainers; [ eelco lovek323 ];
102 platforms = platforms.linux ++ platforms.darwin;
103 };
104
105 } // stdenv.lib.optionalAttrs stdenv.isDarwin {
106 CXX = "clang++";
107 CC = "clang";
108 CPP = "clang -E";
109 CXXCPP = "clang++ -E";
110 });
111
112in {
113 subversion18 = common {
114 version = "1.8.19";
115 sha256 = "1gp6426gkdza6ni2whgifjcmjb4nq34ljy07yxkrhlarvfq6ks2n";
116 };
117
118 subversion19 = common {
119 version = "1.9.7";
120 sha256 = "08qn94zaqcclam2spb4h742lvhxw8w5bnrlya0fm0bp17hriicf3";
121 };
122
123 subversion_1_10 = common {
124 version = "1.10.2";
125 sha256 = "127dysfc31q4dhbbxaznh9kqixy9jd44kgwji2gdwj6rb2lf6dav";
126 extraBuildInputs = [ lz4 utf8proc ];
127 };
128}