From ee7351d889a7d25ea107fa900d4f218467887d4d Mon Sep 17 00:00:00 2001 From: Nikolay Amiantov Date: Fri, 13 Apr 2018 12:59:59 +0300 Subject: [PATCH] shadowsocks-libev: 2.5.5 -> 3.1.3 --- .../networking/shadowsocks-libev/default.nix | 59 +++++++------------ 1 file changed, 22 insertions(+), 37 deletions(-) diff --git a/pkgs/tools/networking/shadowsocks-libev/default.nix b/pkgs/tools/networking/shadowsocks-libev/default.nix index 46fd9e54950a..cbbc36b383bf 100644 --- a/pkgs/tools/networking/shadowsocks-libev/default.nix +++ b/pkgs/tools/networking/shadowsocks-libev/default.nix @@ -1,47 +1,32 @@ -{ withMbedTLS ? true -, enableSystemSharedLib ? true -, stdenv, fetchurl, zlib -, openssl ? null -, mbedtls ? null -, libev ? null -, libsodium ? null -, udns ? null -, asciidoc -, xmlto -, docbook_xml_dtd_45 -, docbook_xsl -, libxslt -, pcre +{ stdenv, fetchurl, fetchgit, cmake +, libsodium, mbedtls, libev, c-ares, pcre +, asciidoc, xmlto, docbook_xml_dtd_45, docbook_xsl, libxslt }: -let - - version = "2.5.5"; - sha256 = "46a72367b7301145906185f1e4136e39d6792d27643826e409ab708351b6d0dd"; - -in - -with stdenv.lib; - stdenv.mkDerivation rec { name = "shadowsocks-libev-${version}"; - src = fetchurl { - url = "https://github.com/shadowsocks/shadowsocks-libev/archive/v${version}.tar.gz"; - inherit sha256; + version = "3.1.3"; + + # Git tag includes CMake build files which are much more convenient. + # fetchgit because submodules. + src = fetchgit { + url = "https://github.com/shadowsocks/shadowsocks-libev"; + rev = "refs/tags/v${version}"; + sha256 = "16q91xh6ixfv7b5rl31an11101irv08119klfx5qgj4i6h7c41s7"; }; - buildInputs = [ zlib asciidoc xmlto docbook_xml_dtd_45 docbook_xsl libxslt pcre ] - ++ optional (!withMbedTLS) openssl - ++ optional withMbedTLS mbedtls - ++ optionals enableSystemSharedLib [libev libsodium udns]; + buildInputs = [ libsodium mbedtls libev c-ares pcre ]; + nativeBuildInputs = [ cmake asciidoc xmlto docbook_xml_dtd_45 docbook_xsl libxslt ]; - configureFlags = optional withMbedTLS - [ "--with-crypto-library=mbedtls" - "--with-mbedtls=${mbedtls}" - ] - ++ optional enableSystemSharedLib "--enable-system-shared-lib"; + cmakeFlags = [ "-DWITH_STATIC=OFF" ]; - meta = { + postInstall = '' + cp lib/* $out/lib + chmod +x $out/bin/* + mv $out/pkgconfig $out/lib + ''; + + meta = with stdenv.lib; { description = "A lightweight secured SOCKS5 proxy"; longDescription = '' Shadowsocks-libev is a lightweight secured SOCKS5 proxy for embedded devices and low-end boxes. @@ -50,6 +35,6 @@ stdenv.mkDerivation rec { homepage = https://github.com/shadowsocks/shadowsocks-libev; license = licenses.gpl3Plus; maintainers = [ maintainers.nfjinjing ]; - platforms = platforms.all; + platforms = platforms.linux; }; }