diff --git a/pkgs/tools/networking/nettee/default.nix b/pkgs/tools/networking/nettee/default.nix index 070c06d9c238..949cf1bde017 100644 --- a/pkgs/tools/networking/nettee/default.nix +++ b/pkgs/tools/networking/nettee/default.nix @@ -2,81 +2,35 @@ stdenv, lib, fetchurl, - cleanPackaging, + cmake, + versionCheckHook, }: -let - version = "0.3.5"; - hash = "sha256-WeZ18CLexdWy8RlHNh0Oo/6KXxzShZT8/xklAWyB8ss="; - -in -stdenv.mkDerivation { +stdenv.mkDerivation (finalAttrs: { pname = "nettee"; - inherit version; + version = "0.3.5"; src = fetchurl { - url = "mirror://sourceforge/nettee/nettee-${version}.tar.gz"; - inherit hash; + url = "mirror://sourceforge/nettee/nettee-${finalAttrs.version}.tar.gz"; + hash = "sha256-WeZ18CLexdWy8RlHNh0Oo/6KXxzShZT8/xklAWyB8ss="; }; + patches = [ ./fix-cmake-output.patch ]; + + nativeBuildInputs = [ cmake ]; + + nativeInstallCheckInputs = [ + versionCheckHook + ]; + versionCheckProgramArg = "-version"; + doInstallCheck = true; + meta = { - homepage = "http://saf.bio.caltech.edu/nettee.html"; + homepage = "https://sourceforge.net/projects/nettee"; description = ''Network "tee" program''; license = lib.licenses.gpl2Only; maintainers = with lib.maintainers; [ Profpatsch ]; platforms = lib.platforms.linux; mainProgram = "nettee"; }; - - outputs = [ - "bin" - "man" - "doc" - "out" - ]; - - patchPhase = '' - # h_addr field was removed - sed -e '1 i #define h_addr h_addr_list[0]' \ - -i nettee.c - ''; - - buildPhase = '' - cat README.TXT - mkdir -p $bin/bin - $CC -o $bin/bin/nettee \ - -Wall -pedantic -std=c99\ - -D_LARGEFILE64_SOURCE -D_POSIX_SOURCE -D_XOPEN_SOURCE\ - nettee.c rb.c nio.c - ''; - - installPhase = '' - ${ - cleanPackaging.commonFileActions { - docFiles = [ - "*.html" - "*.TXT" - "LICENSE" - "*.sh" - "topology.txt" - "beowulf.master" - "topology_info" - ]; - noiseFiles = [ - "*.c" - "*.h" - "nettee" - ]; - } - } $doc/share/doc/nettee - - mkdir -p $man/share/man/{man1,man3} - mv nettee.1 $man/share/man/man1 - mv nettee_cmd.3 $man/share/man/man3 - ''; - - postFixup = '' - ${cleanPackaging.checkForRemainingFiles} - ''; - -} +}) diff --git a/pkgs/tools/networking/nettee/fix-cmake-output.patch b/pkgs/tools/networking/nettee/fix-cmake-output.patch new file mode 100644 index 000000000000..205cfa36bc62 --- /dev/null +++ b/pkgs/tools/networking/nettee/fix-cmake-output.patch @@ -0,0 +1,25 @@ +Index: a/CMakeLists.txt +=================================================================== +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -6,17 +6,18 @@ + SET(FS11 -D_POSIX_SOURCE) + endif (UNIX) + + #modify next line if a different installation target is required +-SET(CMAKE_INSTALL_PREFIX "/usr/local") +-SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_INSTALL_PREFIX}/bin) ++#SET(CMAKE_INSTALL_PREFIX "/usr/local") ++#SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_INSTALL_PREFIX}/bin) + add_executable(nettee nettee.c rb.c nio.c) + ###add_executable(stub_child_process stub_child_process.c rb.c nio.c) + ###add_executable(stub_parent_process stub_parent_process.c rb.c nio.c) + # + target_compile_options(nettee PRIVATE ${FS9} ${FS10} ${FS11}) + ###target_compile_options(stub_child_process PRIVATE ${FS9} ${FS11}) + ###target_compile_options(stub_parent_process PRIVATE ${FS9} ${FS11}) ++install(TARGETS nettee DESTINATION "${CMAKE_INSTALL_PREFIX}/bin") + # + ##################################################### + # + #install man pages