From 6e101e57444e68eab5a771e9d28a37e387ee3150 Mon Sep 17 00:00:00 2001 From: Yuriy Taraday Date: Thu, 12 Jun 2025 14:39:07 +0200 Subject: [PATCH] tcpdirect: init at 9.0.2.45 --- pkgs/by-name/tc/tcpdirect/package.nix | 85 +++++++++++++++++++++++ pkgs/by-name/tc/tcpdirect/tcpdirect.pc.in | 10 +++ 2 files changed, 95 insertions(+) create mode 100644 pkgs/by-name/tc/tcpdirect/package.nix create mode 100644 pkgs/by-name/tc/tcpdirect/tcpdirect.pc.in diff --git a/pkgs/by-name/tc/tcpdirect/package.nix b/pkgs/by-name/tc/tcpdirect/package.nix new file mode 100644 index 000000000000..ca476ac23bb9 --- /dev/null +++ b/pkgs/by-name/tc/tcpdirect/package.nix @@ -0,0 +1,85 @@ +{ + lib, + stdenv, + fetchFromGitHub, + libpcap, + which, + libcap, + makeWrapper, + nix-update-script, + openonload, +}: + +stdenv.mkDerivation rec { + pname = "tcpdirect"; + version = "9.0.2.45"; + + src = fetchFromGitHub { + owner = "Xilinx-CNS"; + repo = "tcpdirect"; + rev = "tcpdirect-${version}"; + hash = "sha256-7VQwep078hXdXE4pqGUe2CLqnPdDuWupcyuC+NCM5Ms="; + }; + + nativeBuildInputs = [ + which + makeWrapper + ]; + + buildInputs = [ + libcap + libpcap + openonload + ]; + + enableParallelBuilding = true; + makeFlags = [ + "CITOOLS_LIB=${lib.getDev openonload}/lib/libcitools1.a" + "CIUL_LIB=${lib.getDev openonload}/lib/libciul1.a" + ]; + + outputs = [ + "out" + "lib" + "dev" + ]; + + installPhase = '' + runHook preInstall + mkdir -p $out/bin $lib/lib $dev/lib $dev/include + + cp -dv \ + build/bin/zf_internal/shared/* \ + build/bin/zf_apps/shared/* \ + build/bin/zf_stackdump \ + build/bin/trade_sim/shared/* \ + $out/bin + + cp -dv build/lib/libonload_zf.so* $lib/lib + cp -dv build/lib/libonload_zf_static.a $dev/lib + cp -rdv src/include/zf $dev/include + + mkdir -p $dev/lib/pkgconfig + export dash_l="-lonload_zf" + substituteAll ${./tcpdirect.pc.in} $dev/lib/pkgconfig/tcpdirect.pc + export dash_l="-l:libonload_zf_static.a" + substituteAll ${./tcpdirect.pc.in} $dev/lib/pkgconfig/tcpdirect-static.pc + runHook postInstall + ''; + + postFixup = '' + # zf_init from libonload_zf dynamically loads libefcp.so from openonload + patchelf --add-rpath ${openonload.lib}/lib $lib/lib/libonload_zf.so + ''; + + passthru.updateScript = nix-update-script { }; + + meta = with lib; { + description = "Ultra low latency kernel bypass TCP and UDP implementation for AMD Solarflare network adapters"; + homepage = "https://www.openonload.org"; + license = lib.licenses.mit; + maintainers = with maintainers; [ YorikSar ]; + # ARM64 build fails, see https://github.com/Xilinx-CNS/onload/issues/253 + platforms = [ "x86_64-linux" ]; + }; +} diff --git a/pkgs/by-name/tc/tcpdirect/tcpdirect.pc.in b/pkgs/by-name/tc/tcpdirect/tcpdirect.pc.in new file mode 100644 index 000000000000..061b624cf472 --- /dev/null +++ b/pkgs/by-name/tc/tcpdirect/tcpdirect.pc.in @@ -0,0 +1,10 @@ +prefix=@dev@ +includedir=${prefix}/include +libdir=@lib@/lib + +Name: tcpdirect +Description: Low latency, zero-copy TCP and UDP stack for SolarFlare NICs +URL: http://www.xilinx.com +Version: @version@ +Cflags: -isystem${includedir} +Libs: -L${libdir} -Wl,-rpath,${libdir} @dash_l@