_9base: init at unstable-2019-09-11

+260
+56
pkgs/by-name/_9/_9base/config-substitutions.patch
···
··· 1 + diff --git a/config.mk b/config.mk 2 + index 1ebfd49..ec076b3 100644 3 + --- a/config.mk 4 + +++ b/config.mk 5 + @@ -1,25 +1,17 @@ 6 + # Customize to fit your system 7 + 8 + # paths 9 + -PREFIX = /usr/local/plan9 10 + MANPREFIX = ${PREFIX}/share/man 11 + 12 + VERSION = 7 13 + -OBJTYPE = 386 14 + -#OBJTYPE = arm 15 + -#OBJTYPE = x86_64 16 + -#OBJTYPE     = sun4u 17 + 18 + # Linux/BSD 19 + #CFLAGS += -Wall -Wno-missing-braces -Wno-parentheses -Wno-switch -c -I. -DPREFIX="\"${PREFIX}\"" 20 + CFLAGS += -c -I. -DPLAN9PORT -DPREFIX="\"${PREFIX}\"" 21 + -LDFLAGS += -static 22 + 23 + # Solaris 24 + #CFLAGS = -fast -xtarget=ultra -D__sun__ -c -I. -DPREFIX="\"${PREFIX}\"" 25 + #LDFLAGS = -dn 26 + 27 + # compiler 28 + -AR = ar rc 29 + -CC = cc 30 + YACC = ../yacc/9yacc 31 + diff --git a/lib9/Makefile b/lib9/Makefile 32 + index b83ab2b..e3744a4 100644 33 + --- a/lib9/Makefile 34 + +++ b/lib9/Makefile 35 + @@ -221,7 +221,7 @@ uninstall: 36 + 37 + ${LIB}: ${OFILES} 38 + @echo AR ${TARG} 39 + - @${AR} ${LIB} ${OFILES} 40 + + @${AR} rc ${LIB} ${OFILES} 41 + 42 + .c.o: 43 + @echo CC $< 44 + diff --git a/troff/Makefile b/troff/Makefile 45 + index b4e3d88..3aac6bf 100644 46 + --- a/troff/Makefile 47 + +++ b/troff/Makefile 48 + @@ -6,7 +6,7 @@ TARG = troff 49 + OFILES = n1.o n2.o n3.o n4.o n5.o t6.o n6.o n7.o n8.o n9.o t10.o\ 50 + n10.o t11.o ni.o hytab.o suftab.o dwbinit.o mbwc.o 51 + MANFILES = troff.1 52 + -TROFFDIR = ${PREFIX}/lib/troff 53 + +TROFFDIR = ${PREFIX_TROFF}/lib/troff 54 + 55 + include ../std.mk 56 +
+12
pkgs/by-name/_9/_9base/dont-strip.patch
···
··· 1 + diff --git a/sam/Makefile b/sam/Makefile 2 + index 17ada1f..1e9e9b8 100644 3 + --- a/sam/Makefile 4 + +++ b/sam/Makefile 5 + @@ -10,7 +10,6 @@ MANFILES = sam.1 6 + include ../config.mk 7 + 8 + all: ${TARG} 9 + - @strip ${TARG} 10 + @echo built ${TARG} 11 + 12 + install: ${TARG}
+115
pkgs/by-name/_9/_9base/getcallerpc-use-macro-or-stub.patch
···
··· 1 + diff --git a/lib9/Makefile b/lib9/Makefile 2 + index b83ab2b..2836b38 100644 3 + --- a/lib9/Makefile 4 + +++ b/lib9/Makefile 5 + @@ -145,7 +145,7 @@ LIB9OFILES=\ 6 + exitcode.o\ 7 + fcallfmt.o\ 8 + get9root.o\ 9 + - getcallerpc-$(OBJTYPE).o\ 10 + + getcallerpc.o\ 11 + getenv.o\ 12 + getfields.o\ 13 + getnetconn.o\ 14 + diff --git a/lib9/getcallerpc-386.c b/lib9/getcallerpc-386.c 15 + deleted file mode 100644 16 + index 1367370..0000000 17 + --- a/lib9/getcallerpc-386.c 18 + +++ /dev/null 19 + @@ -1,7 +0,0 @@ 20 + -#include <lib9.h> 21 + - 22 + -ulong 23 + -getcallerpc(void *x) 24 + -{ 25 + - return (((ulong*)(x))[-1]); 26 + -} 27 + diff --git a/lib9/getcallerpc-PowerMacintosh.c b/lib9/getcallerpc-PowerMacintosh.c 28 + deleted file mode 100644 29 + index 679a72c..0000000 30 + --- a/lib9/getcallerpc-PowerMacintosh.c 31 + +++ /dev/null 32 + @@ -1,7 +0,0 @@ 33 + -#include <lib9.h> 34 + - 35 + -ulong 36 + -getcallerpc(void *x) 37 + -{ 38 + - return (((ulong*)(x))[-4]); 39 + -} 40 + diff --git a/lib9/getcallerpc-arm.c b/lib9/getcallerpc-arm.c 41 + deleted file mode 100644 42 + index 9bb4a95..0000000 43 + --- a/lib9/getcallerpc-arm.c 44 + +++ /dev/null 45 + @@ -1,8 +0,0 @@ 46 + -#include <lib9.h> 47 + - 48 + -ulong 49 + -getcallerpc(void *x) 50 + -{ 51 + - return ((ulong*)x)[-2]; 52 + -} 53 + - 54 + diff --git a/lib9/getcallerpc-power.c b/lib9/getcallerpc-power.c 55 + deleted file mode 100644 56 + index b4bf698..0000000 57 + --- a/lib9/getcallerpc-power.c 58 + +++ /dev/null 59 + @@ -1,11 +0,0 @@ 60 + -#include <lib9.h> 61 + - 62 + -ulong 63 + -getcallerpc(void *x) 64 + -{ 65 + - ulong *lp; 66 + - 67 + - lp = x; 68 + - 69 + - return lp[-1]; 70 + -} 71 + diff --git a/lib9/getcallerpc-ppc.c b/lib9/getcallerpc-ppc.c 72 + deleted file mode 100644 73 + index 679a72c..0000000 74 + --- a/lib9/getcallerpc-ppc.c 75 + +++ /dev/null 76 + @@ -1,7 +0,0 @@ 77 + -#include <lib9.h> 78 + - 79 + -ulong 80 + -getcallerpc(void *x) 81 + -{ 82 + - return (((ulong*)(x))[-4]); 83 + -} 84 + diff --git a/lib9/getcallerpc-x86_64.c b/lib9/getcallerpc-x86_64.c 85 + deleted file mode 100644 86 + index 1367370..0000000 87 + --- a/lib9/getcallerpc-x86_64.c 88 + +++ /dev/null 89 + @@ -1,7 +0,0 @@ 90 + -#include <lib9.h> 91 + - 92 + -ulong 93 + -getcallerpc(void *x) 94 + -{ 95 + - return (((ulong*)(x))[-1]); 96 + -} 97 + diff --git a/lib9/getcallerpc.c b/lib9/getcallerpc.c 98 + new file mode 100644 99 + index 0000000..7d2cdd7 100 + --- /dev/null 101 + +++ b/lib9/getcallerpc.c 102 + @@ -0,0 +1,12 @@ 103 + +#include <lib9.h> 104 + + 105 + +/* 106 + + * On gcc and clang, getcallerpc is a macro invoking a compiler builtin. 107 + + * If the macro in libc.h did not trigger, there's no implementation. 108 + + */ 109 + +#undef getcallerpc 110 + +ulong 111 + +getcallerpc(void *v) 112 + +{ 113 + + return 1; 114 + +} 115 + \ No newline at end of file
+77
pkgs/by-name/_9/_9base/package.nix
···
··· 1 + { lib 2 + , stdenv 3 + , fetchgit 4 + , pkg-config 5 + , patches ? [ ] 6 + , pkgsBuildHost 7 + , enableStatic ? stdenv.hostPlatform.isStatic 8 + }: 9 + 10 + stdenv.mkDerivation { 11 + pname = "9base"; 12 + version = "unstable-2019-09-11"; 13 + 14 + src = fetchgit { 15 + url = "https://git.suckless.org/9base"; 16 + rev = "63916da7bd6d73d9a405ce83fc4ca34845667cce"; 17 + hash = "sha256-CNK7Ycmcl5vkmtA5VKwKxGZz8AoIG1JH/LTKoYmWSBI="; 18 + }; 19 + 20 + patches = [ 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 24 + ./dont-strip.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 31 + ] ++ patches; 32 + 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"}" 37 + ''; 38 + 39 + enableParallelBuilding = true; 40 + strictDeps = 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 46 + "-fcommon" 47 + # hide really common warning that floods the logs: 48 + # warning: #warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" 49 + "-D_DEFAULT_SOURCE" 50 + ]; 51 + LDFLAGS = lib.optionalString enableStatic "-static"; 52 + makeFlags = [ 53 + "PREFIX=${placeholder "out"}" 54 + ]; 55 + installFlags = [ 56 + "PREFIX_TROFF=${placeholder "troff"}" 57 + ]; 58 + 59 + outputs = [ "out" "man" "troff" ]; 60 + 61 + meta = with lib; { 62 + homepage = "https://tools.suckless.org/9base/"; 63 + description = "9base is a port of various original Plan 9 tools for Unix, based on plan9port"; 64 + longDescription = '' 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. 69 + ''; 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; 76 + }; 77 + }