nettee: fix build, switch to CMake

This commit is contained in:
Petr Zahradnik
2025-03-25 23:12:13 +01:00
parent dccbe20d9e
commit 84a3c4c879
2 changed files with 43 additions and 64 deletions
+18 -64
View File
@@ -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}
'';
}
})
@@ -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