biome: 1.9.2 -> 1.9.3
[NixPkgs.git] / pkgs / tools / networking / shadowsocks-libev / default.nix
blobb6544c60edaff8a825cc31297c70768adbc4056f
1 { lib, stdenv, fetchFromGitHub, cmake
2 , libsodium, mbedtls_2, libev, c-ares, pcre
3 , asciidoc, xmlto, docbook_xml_dtd_45, docbook_xsl, libxslt
4 }:
6 stdenv.mkDerivation rec {
7   pname = "shadowsocks-libev";
8   version = "3.3.5";
10   # Git tag includes CMake build files which are much more convenient.
11   src = fetchFromGitHub {
12     owner = "shadowsocks";
13     repo = pname;
14     rev = "refs/tags/v${version}";
15     sha256 = "1iqpmhxk354db1x08axg6wrdy9p9a4mz0h9351i3mf3pqd1v6fdw";
16     fetchSubmodules = true;
17   };
19   buildInputs = [ libsodium mbedtls_2 libev c-ares pcre ];
20   nativeBuildInputs = [ cmake asciidoc xmlto docbook_xml_dtd_45
21                         docbook_xsl libxslt ];
23   cmakeFlags = [ "-DWITH_STATIC=OFF"  "-DCMAKE_BUILD_WITH_INSTALL_NAME_DIR=ON"
24     # RPATH of binary /nix/store/.../bin/... contains a forbidden reference to /build/
25     "-DCMAKE_SKIP_BUILD_RPATH=ON"
26   ];
28   postPatch = ''
29     # https://github.com/shadowsocks/shadowsocks-libev/issues/2901
30     substituteInPlace CMakeLists.txt \
31       --replace '# pkg-config' \
32                 '# pkg-config
33                  include(GNUInstallDirs)'
34     substituteInPlace cmake/shadowsocks-libev.pc.cmake \
35       --replace @prefix@ @CMAKE_INSTALL_PREFIX@ \
36       --replace '$'{prefix}/@CMAKE_INSTALL_BINDIR@ @CMAKE_INSTALL_FULL_BINDIR@ \
37       --replace '$'{exec_prefix}/@CMAKE_INSTALL_FULL_LIBDIR@ @CMAKE_INSTALL_FULL_LIBDIR@ \
38       --replace '$'{prefix}/@CMAKE_INSTALL_INCLUDEDIR@ @CMAKE_INSTALL_FULL_INCLUDEDIR@ \
39       --replace '$'{prefix}/@CMAKE_INSTALL_DATAROOTDIR@ @CMAKE_INSTALL_FULL_DATAROOTDIR@ \
40       --replace '$'{prefix}/@CMAKE_INSTALL_MANDIR@ @CMAKE_INSTALL_FULL_MANDIR@
42     # https://github.com/dcreager/libcork/issues/173 but needs a different patch (yay vendoring)
43     substituteInPlace libcork/src/libcork.pc.in \
44       --replace '$'{exec_prefix}/@CMAKE_INSTALL_LIBDIR@ @CMAKE_INSTALL_FULL_LIBDIR@ \
45       --replace '$'{prefix}/@CMAKE_INSTALL_INCLUDEDIR@ @CMAKE_INSTALL_FULL_INCLUDEDIR@
46   '';
48   postInstall = ''
49     cp lib/* $out/lib
50   '';
52   meta = with lib; {
53     description = "Lightweight secured SOCKS5 proxy";
54     longDescription = ''
55       Shadowsocks-libev is a lightweight secured SOCKS5 proxy for embedded devices and low-end boxes.
56       It is a port of Shadowsocks created by @clowwindy, which is maintained by @madeye and @linusyang.
57     '';
58     homepage = "https://github.com/shadowsocks/shadowsocks-libev";
59     license = licenses.gpl3Plus;
60     maintainers = [ ];
61     platforms = platforms.all;
62   };