Skip to content

Commit 690b7f7

Browse files
committed
netbase: init at 0.1
1 parent cdcb465 commit 690b7f7

File tree

1 file changed

+83
-0
lines changed

1 file changed

+83
-0
lines changed
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
{
2+
lib,
3+
stdenv,
4+
fetchFromGitHub,
5+
byacc,
6+
clang,
7+
llvm,
8+
gnumake,
9+
bzip2,
10+
zlib,
11+
musl-fts,
12+
}:
13+
14+
stdenv.mkDerivation (finalAttrs: {
15+
pname = "netbase";
16+
version = "0.1";
17+
18+
src = fetchFromGitHub {
19+
owner = "littlefly365";
20+
repo = "Netbase";
21+
tag = "v${finalAttrs.version}";
22+
hash = "sha256-o/O3pqdYY3Q/ut7P7sbYaivlWJuwhhGmMrMBSPbslV4=";
23+
};
24+
25+
strictDeps = true;
26+
27+
nativeBuildInputs = [
28+
byacc
29+
clang
30+
llvm
31+
gnumake
32+
];
33+
34+
buildInputs = [
35+
bzip2
36+
zlib
37+
]
38+
++ lib.optionals stdenv.hostPlatform.isMusl [ musl-fts ];
39+
40+
env = lib.optionalAttrs stdenv.hostPlatform.isMusl {
41+
NIX_CFLAGS_COMPILE = "-I${musl-fts}/include";
42+
NIX_LDFLAGS = "-L${musl-fts}/lib";
43+
};
44+
45+
postPatch = ''
46+
substituteInPlace bin/ksh/Makefile \
47+
--replace-fail '$(pwd)' '$(CURDIR)'
48+
'';
49+
50+
buildPhase = ''
51+
runHook preBuild
52+
53+
export LDFTS=${lib.optionalString stdenv.hostPlatform.isMusl "-lfts"}
54+
make -f GNUmakefile -j$NIX_BUILD_CORES
55+
56+
runHook postBuild
57+
'';
58+
59+
installPhase = ''
60+
runHook preInstall
61+
62+
mkdir -p $out/bin
63+
64+
for dir in build/bin build/sbin build/usr.bin; do
65+
if [ -d "$dir" ]; then
66+
for prog in "$dir"/*; do
67+
[ -f "$prog" ] || continue
68+
install -m755 "$prog" "$out/bin/$(basename "$prog")"
69+
done
70+
fi
71+
done
72+
73+
runHook postInstall
74+
'';
75+
76+
meta = {
77+
description = "Port of NetBSD userland utilities";
78+
homepage = "https://github.com/littlefly365/Netbase";
79+
license = lib.licenses.bsd3;
80+
maintainers = with lib.maintainers; [ iamanaws ];
81+
platforms = lib.platforms.linux;
82+
};
83+
})

0 commit comments

Comments
 (0)