tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
lol
0
fork
atom
overview
issues
pulls
pipelines
torsocks: fix build on darwin
Pavol Rusnak
2 years ago
e56258dd
2565ab7b
+66
-14
2 changed files
expand all
collapse all
unified
split
pkgs
tools
security
tor
torsocks-gethostbyaddr-darwin.patch
torsocks.nix
+33
pkgs/tools/security/tor/torsocks-gethostbyaddr-darwin.patch
···
1
1
+
diff --git a/tests/test_dns.c b/tests/test_dns.c
2
2
+
index 7e07663..acf095c 100644
3
3
+
--- a/tests/test_dns.c
4
4
+
+++ b/tests/test_dns.c
5
5
+
@@ -76,6 +76,8 @@ static void test_gethostbyname(const struct test_host *host)
6
6
+
return;
7
7
+
}
8
8
+
9
9
+
+#ifdef __linux__
10
10
+
+
11
11
+
static void test_gethostbyaddr_r_failed(void)
12
12
+
{
13
13
+
int result;
14
14
+
@@ -129,6 +131,8 @@ static void test_gethostbyaddr_r(const struct test_host *host)
15
15
+
ok(1, "Resolved address");
16
16
+
}
17
17
+
18
18
+
+#endif
19
19
+
+
20
20
+
static void test_gethostbyaddr(const struct test_host *host)
21
21
+
{
22
22
+
struct hostent *he;
23
23
+
@@ -199,8 +203,10 @@ int main(int argc, char **argv)
24
24
+
test_getaddrinfo(&tor_check);
25
25
+
test_gethostbyname(&tor_dir_auth1);
26
26
+
test_gethostbyaddr(&tor_dir_auth2);
27
27
+
+#ifdef __linux__
28
28
+
test_gethostbyaddr_r(&tor_dir_auth2);
29
29
+
test_gethostbyaddr_r_failed();
30
30
+
+#endif
31
31
+
test_getaddrinfo(&tor_localhost);
32
32
+
33
33
+
end:
+33
-14
pkgs/tools/security/tor/torsocks.nix
···
1
1
-
{ lib, stdenv, fetchgit, fetchurl, autoreconfHook, libcap }:
1
1
+
{ lib
2
2
+
, stdenv
3
3
+
, fetchFromGitLab
4
4
+
, fetchpatch
5
5
+
, autoreconfHook
6
6
+
, libcap
7
7
+
}:
2
8
3
9
stdenv.mkDerivation rec {
4
10
pname = "torsocks";
5
5
-
version = "2.3.0";
11
11
+
version = "2.4.0";
6
12
7
7
-
src = fetchgit {
8
8
-
url = "https://git.torproject.org/torsocks.git";
9
9
-
rev = "refs/tags/v${version}";
10
10
-
sha256 = "0x0wpcigf22sjxg7bm0xzqihmsrz51hl4v8xf91qi4qnmr4ny1hb";
13
13
+
src = fetchFromGitLab {
14
14
+
domain = "gitlab.torproject.org";
15
15
+
group = "tpo";
16
16
+
owner = "core";
17
17
+
repo = "torsocks";
18
18
+
rev = "v${version}";
19
19
+
sha256 = "sha256-ocJkoF9LMLC84ukFrm5pzjp/1gaXqDz8lzr9TdG+f88=";
11
20
};
12
21
13
13
-
nativeBuildInputs = [ autoreconfHook ];
14
14
-
15
15
-
patches = lib.optional stdenv.isDarwin
16
16
-
(fetchurl {
17
17
-
url = "https://trac.torproject.org/projects/tor/raw-attachment/ticket/28538/0001-Fix-macros-for-accept4-2.patch";
18
18
-
sha256 = "97881f0b59b3512acc4acb58a0d6dfc840d7633ead2f400fad70dda9b2ba30b0";
19
19
-
});
22
22
+
patches = [
23
23
+
# fix compatibility with C99
24
24
+
# https://gitlab.torproject.org/tpo/core/torsocks/-/merge_requests/9
25
25
+
(fetchpatch {
26
26
+
url = "https://gitlab.torproject.org/tpo/core/torsocks/-/commit/1171bf2fd4e7a0cab02cf5fca59090b65af9cd29.patch";
27
27
+
hash = "sha256-qu5/0fy72+02QI0cVE/6YrR1kPuJxsZfG8XeODqVOPY=";
28
28
+
})
29
29
+
# tsocks_libc_accept4 only exists on Linux, use tsocks_libc_accept on other platforms
30
30
+
(fetchpatch {
31
31
+
url = "https://gitlab.torproject.org/tpo/core/torsocks/uploads/eeec9833512850306a42a0890d283d77/0001-Fix-macros-for-accept4-2.patch";
32
32
+
hash = "sha256-XWi8+UFB8XgBFSl5QDJ+hLu/dH4CvAwYbeZz7KB10Bs=";
33
33
+
})
34
34
+
# no gethostbyaddr_r on darwin
35
35
+
./torsocks-gethostbyaddr-darwin.patch
36
36
+
];
20
37
21
38
postPatch = ''
22
39
# Patch torify_app()
···
29
46
src/bin/torsocks.in
30
47
'';
31
48
49
49
+
nativeBuildInputs = [ autoreconfHook ];
50
50
+
32
51
doInstallCheck = true;
33
52
installCheckTarget = "check-recursive";
34
53
35
54
meta = {
36
55
description = "Wrapper to safely torify applications";
37
37
-
homepage = "https://github.com/dgoulet/torsocks";
56
56
+
homepage = "https://gitlab.torproject.org/tpo/core/torsocks";
38
57
license = lib.licenses.gpl2;
39
58
platforms = lib.platforms.unix;
40
59
maintainers = with lib.maintainers; [ thoughtpolice ];