{openonload,tcpdirect}: init at 9.0 (#443738)

authored by Sandro and committed by GitHub 6cf07e0f 1e1399f4

+263
+10
pkgs/by-name/op/openonload/openonload.pc.in
···
··· 1 + prefix=@dev@ 2 + includedir=${prefix}/include 3 + libdir=@lib@/lib 4 + 5 + Name: openonload 6 + Description: OpenOnLoad high performance network stack from Solarflare 7 + URL: http://www.openonload.org/ 8 + Version: @version@ 9 + Cflags: -isystem${includedir} 10 + Libs: -L${libdir} -Wl,-rpath,${libdir} @dash_l@
+158
pkgs/by-name/op/openonload/package.nix
···
··· 1 + { 2 + lib, 3 + stdenv, 4 + fetchFromGitHub, 5 + coreutils, 6 + libpcap, 7 + which, 8 + libcap, 9 + makeWrapper, 10 + nix-update-script, 11 + perl, 12 + libmnl, 13 + }: 14 + 15 + stdenv.mkDerivation rec { 16 + pname = "openonload"; 17 + version = "9.0.2"; 18 + 19 + src = fetchFromGitHub { 20 + owner = "Xilinx-CNS"; 21 + repo = "onload"; 22 + rev = "v${version}"; 23 + hash = "sha256-wyvTtOjD6fwuT2OGGhr10F0Q7hXE97mGREhq7Ns14hw="; 24 + }; 25 + 26 + nativeBuildInputs = [ 27 + which 28 + makeWrapper 29 + ]; 30 + 31 + buildInputs = [ 32 + libcap 33 + libpcap 34 + ]; 35 + 36 + configurePhase = '' 37 + runHook preConfigure 38 + export PATH="$PWD/scripts:$PATH" 39 + patchShebangs --build \ 40 + scripts/ \ 41 + src/driver/ 42 + substituteInPlace \ 43 + scripts/mmaketool \ 44 + scripts/onload \ 45 + scripts/onload_build \ 46 + scripts/onload_install \ 47 + scripts/shell-fns/fns \ 48 + scripts/shell-fns/mmake-fns \ 49 + --replace-fail "/bin/pwd" "${coreutils}/bin/pwd" 50 + substituteInPlace \ 51 + scripts/mmaketool \ 52 + scripts/onload_install \ 53 + scripts/sfcaffinity_config \ 54 + --replace-fail "/bin/ls" "${coreutils}/bin/ls" 55 + 56 + # Disable compiler checks that are disabled for Ubuntu: https://github.com/Xilinx-CNS/onload/blob/713eff9c3a105c51fb062527e01e1663c4e61e28/scripts/mmakebuildtree#L337-L344 57 + substituteInPlace scripts/mmakebuildtree \ 58 + --replace-fail 'W_NO_UNUSED_RESULT= 59 + ' "" 60 + export W_NO_UNUSED_RESULT=1 W_NO_IGNORED_ATTRIBUTES=1 61 + 62 + # Patch unit tests to be run during check phase 63 + substituteInPlace src/tests/onload/{oof,cplane_unit,cplane_sysunit,onload_remote_monitor/internal_tests}/mmake.mk \ 64 + --replace-fail '/usr/bin/timeout' '${coreutils}/bin/timeout' 65 + 66 + # Honor NIX_BUILD_CORES in onload_build script 67 + substituteInPlace scripts/onload_build --replace-fail 'nproc' 'echo "$NIX_BUILD_CORES"' 68 + runHook postConfigure 69 + ''; 70 + 71 + # This only builds the 64 bit libraries, not the kernel module. 72 + buildPhase = '' 73 + runHook preBuild 74 + ./scripts/onload_build --user64 75 + runHook postBuild 76 + ''; 77 + 78 + doCheck = true; 79 + nativeCheckInputs = [ 80 + perl 81 + ]; 82 + checkInputs = [ 83 + libmnl 84 + ]; 85 + checkPhase = '' 86 + runHook preCheck 87 + # Build all tests in parallel, the script does it in sequence 88 + make -C "$(mmaketool --toppath)/build/$(mmaketool --userbuild)" -j$NIX_BUILD_CORES 89 + scripts/run_unit_tests.sh 90 + runHook postCheck 91 + ''; 92 + 93 + outputs = [ 94 + "out" 95 + "lib" 96 + "dev" 97 + ]; 98 + 99 + installPhase = '' 100 + runHook preInstall 101 + mkdir -p $out 102 + i_prefix=$out scripts/onload_install --nobuild --userfiles --headers \ 103 + --bindir=/bin \ 104 + --sbindir=/bin \ 105 + --usrsbindir=/bin \ 106 + --libexecdir=/libexec \ 107 + --includedir=/include \ 108 + --lib64dir=/lib 109 + 110 + mkdir -p $dev/lib 111 + mv -v $out/include $dev 112 + mv -v $out/lib/*.a $dev/lib 113 + mkdir -p $lib 114 + mv -v $out/lib $lib 115 + 116 + substituteInPlace $out/bin/onload --replace-fail "/usr/libexec" "$out/libexec" 117 + # This tool looks for libonload.so in environment, point default to the actual library 118 + wrapProgram $out/bin/onload \ 119 + --set-default ONLOAD_PRELOAD $out/lib/libonload.so 120 + 121 + # These scripts assume other binaries from this package are in PATH 122 + wrapProgram $out/bin/onload_tcpdump \ 123 + --prefix PATH : $out/bin 124 + wrapProgram $out/bin/orm_webserver \ 125 + --prefix PATH : $out/bin 126 + 127 + cp -v $(find build/gnu_x86_64/tools -type f -executable -print | grep -v '/debug/' | grep -v '.so$') $out/bin 128 + # Capture the test apps for validating performance/host set-up 129 + cp -v $(find build/gnu_x86_64/tests/ef_vi -type f -executable -print) $out/bin 130 + 131 + mkdir -p $dev/lib/pkgconfig/ 132 + export dash_l="-lonload_ext" 133 + substituteAll ${./openonload.pc.in} $dev/lib/pkgconfig/openonload.pc 134 + export dash_l="-l:libonload_ext.a" 135 + substituteAll ${./openonload.pc.in} $dev/lib/pkgconfig/openonload-static.pc 136 + runHook postInstall 137 + ''; 138 + 139 + preFixup = '' 140 + # The test apps have a build directory in RPATH, which patchelf can't 141 + # remove by default because the required library libefcp.so is there. 142 + # By removing the library, patchelf is unblocked from removing the build 143 + # directory from RPATH. This doesn't break the binary because the library 144 + # is also available from other RPATH entries. 145 + rm -v build/gnu_x86_64/lib/cplane/*.so* 146 + ''; 147 + 148 + passthru.updateScript = nix-update-script { }; 149 + 150 + meta = with lib; { 151 + description = "OpenOnLoad high performance network stack from Solarflare"; 152 + homepage = "https://www.openonload.org"; 153 + license = lib.licenses.gpl2; 154 + maintainers = with maintainers; [ YorikSar ]; 155 + # ARM64 build fails, see https://github.com/Xilinx-CNS/onload/issues/253 156 + platforms = [ "x86_64-linux" ]; 157 + }; 158 + }
+85
pkgs/by-name/tc/tcpdirect/package.nix
···
··· 1 + { 2 + lib, 3 + stdenv, 4 + fetchFromGitHub, 5 + libpcap, 6 + which, 7 + libcap, 8 + makeWrapper, 9 + nix-update-script, 10 + openonload, 11 + }: 12 + 13 + stdenv.mkDerivation rec { 14 + pname = "tcpdirect"; 15 + version = "9.0.2.45"; 16 + 17 + src = fetchFromGitHub { 18 + owner = "Xilinx-CNS"; 19 + repo = "tcpdirect"; 20 + rev = "tcpdirect-${version}"; 21 + hash = "sha256-7VQwep078hXdXE4pqGUe2CLqnPdDuWupcyuC+NCM5Ms="; 22 + }; 23 + 24 + nativeBuildInputs = [ 25 + which 26 + makeWrapper 27 + ]; 28 + 29 + buildInputs = [ 30 + libcap 31 + libpcap 32 + openonload 33 + ]; 34 + 35 + enableParallelBuilding = true; 36 + makeFlags = [ 37 + "CITOOLS_LIB=${lib.getDev openonload}/lib/libcitools1.a" 38 + "CIUL_LIB=${lib.getDev openonload}/lib/libciul1.a" 39 + ]; 40 + 41 + outputs = [ 42 + "out" 43 + "lib" 44 + "dev" 45 + ]; 46 + 47 + installPhase = '' 48 + runHook preInstall 49 + mkdir -p $out/bin $lib/lib $dev/lib $dev/include 50 + 51 + cp -dv \ 52 + build/bin/zf_internal/shared/* \ 53 + build/bin/zf_apps/shared/* \ 54 + build/bin/zf_stackdump \ 55 + build/bin/trade_sim/shared/* \ 56 + $out/bin 57 + 58 + cp -dv build/lib/libonload_zf.so* $lib/lib 59 + cp -dv build/lib/libonload_zf_static.a $dev/lib 60 + cp -rdv src/include/zf $dev/include 61 + 62 + mkdir -p $dev/lib/pkgconfig 63 + export dash_l="-lonload_zf" 64 + substituteAll ${./tcpdirect.pc.in} $dev/lib/pkgconfig/tcpdirect.pc 65 + export dash_l="-l:libonload_zf_static.a" 66 + substituteAll ${./tcpdirect.pc.in} $dev/lib/pkgconfig/tcpdirect-static.pc 67 + runHook postInstall 68 + ''; 69 + 70 + postFixup = '' 71 + # zf_init from libonload_zf dynamically loads libefcp.so from openonload 72 + patchelf --add-rpath ${openonload.lib}/lib $lib/lib/libonload_zf.so 73 + ''; 74 + 75 + passthru.updateScript = nix-update-script { }; 76 + 77 + meta = with lib; { 78 + description = "Ultra low latency kernel bypass TCP and UDP implementation for AMD Solarflare network adapters"; 79 + homepage = "https://www.openonload.org"; 80 + license = lib.licenses.mit; 81 + maintainers = with maintainers; [ YorikSar ]; 82 + # ARM64 build fails, see https://github.com/Xilinx-CNS/onload/issues/253 83 + platforms = [ "x86_64-linux" ]; 84 + }; 85 + }
+10
pkgs/by-name/tc/tcpdirect/tcpdirect.pc.in
···
··· 1 + prefix=@dev@ 2 + includedir=${prefix}/include 3 + libdir=@lib@/lib 4 + 5 + Name: tcpdirect 6 + Description: Low latency, zero-copy TCP and UDP stack for SolarFlare NICs 7 + URL: http://www.xilinx.com 8 + Version: @version@ 9 + Cflags: -isystem${includedir} 10 + Libs: -L${libdir} -Wl,-rpath,${libdir} @dash_l@