7 , enableStatic ? stdenv.hostPlatform.isStatic
12 version = "unstable-2019-09-11";
15 url = "https://git.suckless.org/9base";
16 rev = "63916da7bd6d73d9a405ce83fc4ca34845667cce";
17 hash = "sha256-CNK7Ycmcl5vkmtA5VKwKxGZz8AoIG1JH/LTKoYmWSBI=";
21 # expects to be used with getcallerpc macro or stub patch
22 # AR env var is now the location of `ar` not including the arg (`ar rc`)
23 ./config-substitutions.patch
25 # plan9port dropped their own getcallerpc implementations
26 # in favour of using gcc/clang's macros or a stub
27 # we can do this here too to extend platform support
28 # https://github.com/9fans/plan9port/commit/540caa5873bcc3bc2a0e1896119f5b53a0e8e630
29 # https://github.com/9fans/plan9port/commit/323e1a8fac276f008e6d5146a83cbc88edeabc87
30 ./getcallerpc-use-macro-or-stub.patch
33 # the 9yacc script needs to be executed to build other items
34 preBuild = lib.optionalString (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
35 substituteInPlace ./yacc/9yacc \
36 --replace "../yacc/yacc" "${lib.getExe' pkgsBuildHost._9base "yacc"}"
39 enableParallelBuilding = true;
41 nativeBuildInputs = [ pkg-config ];
42 NIX_CFLAGS_COMPILE = [
43 # workaround build failure on -fno-common toolchains like upstream
44 # gcc-10. Otherwise build fails as:
45 # ld: diffio.o:(.bss+0x16): multiple definition of `bflag'; diffdir.o:(.bss+0x6): first defined here
47 # hide really common warning that floods the logs:
48 # warning: #warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"
51 LDFLAGS = lib.optionalString enableStatic "-static";
53 "PREFIX=${placeholder "out"}"
56 "PREFIX_TROFF=${placeholder "troff"}"
59 outputs = [ "out" "man" "troff" ];
62 homepage = "https://tools.suckless.org/9base/";
63 description = "9base is a port of various original Plan 9 tools for Unix, based on plan9port";
65 9base is a port of various original Plan 9 tools for Unix, based on plan9port.
66 It also contains the Plan 9 libc, libbio, libregexp, libfmt and libutf.
67 The overall SLOC is about 66kSLOC, so this userland + all libs is much smaller than, e.g. bash.
68 9base can be used to run werc instead of the full blown plan9port.
70 license = with licenses; [ mit /* and */ lpl-102 ];
71 maintainers = with maintainers; [ jk ];
72 platforms = platforms.unix;
73 # needs additional work to support aarch64-darwin
74 # due to usage of _DARWIN_NO_64_BIT_INODE
75 broken = stdenv.isAarch64 && stdenv.isDarwin;