Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{
2 lib,
3 stdenv,
4 fetchurl,
5}:
6
7stdenv.mkDerivation rec {
8 pname = "tsocks";
9 version = "1.8beta5";
10
11 src = fetchurl {
12 url = "mirror://sourceforge/tsocks/${pname}-${version}.tar.gz";
13 sha256 = "0ixkymiph771dcdzvssi9dr2pk1bzaw9zv85riv3xl40mzspx7c4";
14 };
15
16 patches = [ ./poll.patch ];
17
18 preConfigure = ''
19 sed -i -e "s,\\\/usr,"$(echo $out|sed -e "s,\\/,\\\\\\\/,g")",g" tsocks
20 substituteInPlace configure \
21 --replace-fail "main(){return(0);}" "int main(){return(0);}"
22 substituteInPlace tsocks --replace /usr $out
23 '';
24
25 configureFlags = [
26 "--libdir=${placeholder "out"}/lib"
27 ];
28
29 preBuild = ''
30 # We don't need the saveme binary, it is in fact never stored and we're
31 # never injecting stuff into ld.so.preload anyway
32 sed -i \
33 -e "s,TARGETS=\(.*\)..SAVE.\(.*\),TARGETS=\1\2," \
34 -e "/SAVE/d" Makefile
35 '';
36
37 meta = with lib; {
38 description = "Transparent SOCKS v4 proxying library";
39 mainProgram = "tsocks";
40 homepage = "https://tsocks.sourceforge.net/";
41 license = lib.licenses.gpl2;
42 maintainers = with maintainers; [ edwtjo ];
43 platforms = platforms.unix;
44 broken = stdenv.hostPlatform.isDarwin;
45 };
46}