nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 boost,
3 cmake,
4 fetchFromGitHub,
5 gtest,
6 libpcap,
7 openssl,
8 lib,
9 stdenv,
10}:
11
12stdenv.mkDerivation rec {
13 pname = "libtins";
14 version = "4.5";
15
16 src = fetchFromGitHub {
17 owner = "mfontanini";
18 repo = "libtins";
19 rev = "v${version}";
20 sha256 = "sha256-zL4C2Cgs9Y3NebL8MPQBO5j8Bm6xhl8ZggQBPJLRn0o=";
21 };
22
23 patches = [
24 # Required for gtest 1.17+:
25 # https://github.com/NixOS/nixpkgs/issues/425358
26 # See also an upstream report for gtest 1.13+ and C++14:
27 # https://github.com/mfontanini/libtins/issues/
28 ./0001-force-cpp-17.patch
29 # Update CMake minimum required version for CMake 4 compatibility
30 # https://github.com/mfontanini/libtins/pull/553
31 ./cmake-3.10.patch
32 ];
33
34 postPatch = ''
35 rm -rf googletest
36 cp -r ${gtest.src} googletest
37 chmod -R a+w googletest
38 '';
39
40 nativeBuildInputs = [
41 cmake
42 gtest
43 ];
44 buildInputs = [
45 openssl
46 libpcap
47 boost
48 ];
49
50 cmakeFlags = [
51 # CMake 4 dropped support of versions lower than 3.5,
52 # versions lower than 3.10 are deprecated.
53 (lib.cmakeFeature "CMAKE_POLICY_VERSION_MINIMUM" "3.10")
54 ];
55
56 configureFlags = [
57 "--with-boost-libdir=${boost.out}/lib"
58 "--with-boost=${boost.dev}"
59 ];
60
61 doCheck = true;
62 checkTarget = "tests test";
63
64 meta = {
65 description = "High-level, multiplatform C++ network packet sniffing and crafting library";
66 homepage = "https://libtins.github.io/";
67 changelog = "https://raw.githubusercontent.com/mfontanini/libtins/v${version}/CHANGES.md";
68 license = lib.licenses.bsd2;
69 maintainers = with lib.maintainers; [ fdns ];
70 platforms = lib.platforms.unix;
71 };
72}