Merge pull request #214932 from 06kellyjac/9base
_9base: init at unstable-2019-09-11
This commit is contained in:
commit
3b7361edb8
4 changed files with 260 additions and 0 deletions
56
pkgs/by-name/_9/_9base/config-substitutions.patch
Normal file
56
pkgs/by-name/_9/_9base/config-substitutions.patch
Normal file
|
@ -0,0 +1,56 @@
|
|||
diff --git a/config.mk b/config.mk
|
||||
index 1ebfd49..ec076b3 100644
|
||||
--- a/config.mk
|
||||
+++ b/config.mk
|
||||
@@ -1,25 +1,17 @@
|
||||
# Customize to fit your system
|
||||
|
||||
# paths
|
||||
-PREFIX = /usr/local/plan9
|
||||
MANPREFIX = ${PREFIX}/share/man
|
||||
|
||||
VERSION = 7
|
||||
-OBJTYPE = 386
|
||||
-#OBJTYPE = arm
|
||||
-#OBJTYPE = x86_64
|
||||
-#OBJTYPE = sun4u
|
||||
|
||||
# Linux/BSD
|
||||
#CFLAGS += -Wall -Wno-missing-braces -Wno-parentheses -Wno-switch -c -I. -DPREFIX="\"${PREFIX}\""
|
||||
CFLAGS += -c -I. -DPLAN9PORT -DPREFIX="\"${PREFIX}\""
|
||||
-LDFLAGS += -static
|
||||
|
||||
# Solaris
|
||||
#CFLAGS = -fast -xtarget=ultra -D__sun__ -c -I. -DPREFIX="\"${PREFIX}\""
|
||||
#LDFLAGS = -dn
|
||||
|
||||
# compiler
|
||||
-AR = ar rc
|
||||
-CC = cc
|
||||
YACC = ../yacc/9yacc
|
||||
diff --git a/lib9/Makefile b/lib9/Makefile
|
||||
index b83ab2b..e3744a4 100644
|
||||
--- a/lib9/Makefile
|
||||
+++ b/lib9/Makefile
|
||||
@@ -221,7 +221,7 @@ uninstall:
|
||||
|
||||
${LIB}: ${OFILES}
|
||||
@echo AR ${TARG}
|
||||
- @${AR} ${LIB} ${OFILES}
|
||||
+ @${AR} rc ${LIB} ${OFILES}
|
||||
|
||||
.c.o:
|
||||
@echo CC $<
|
||||
diff --git a/troff/Makefile b/troff/Makefile
|
||||
index b4e3d88..3aac6bf 100644
|
||||
--- a/troff/Makefile
|
||||
+++ b/troff/Makefile
|
||||
@@ -6,7 +6,7 @@ TARG = troff
|
||||
OFILES = n1.o n2.o n3.o n4.o n5.o t6.o n6.o n7.o n8.o n9.o t10.o\
|
||||
n10.o t11.o ni.o hytab.o suftab.o dwbinit.o mbwc.o
|
||||
MANFILES = troff.1
|
||||
-TROFFDIR = ${PREFIX}/lib/troff
|
||||
+TROFFDIR = ${PREFIX_TROFF}/lib/troff
|
||||
|
||||
include ../std.mk
|
||||
|
12
pkgs/by-name/_9/_9base/dont-strip.patch
Normal file
12
pkgs/by-name/_9/_9base/dont-strip.patch
Normal file
|
@ -0,0 +1,12 @@
|
|||
diff --git a/sam/Makefile b/sam/Makefile
|
||||
index 17ada1f..1e9e9b8 100644
|
||||
--- a/sam/Makefile
|
||||
+++ b/sam/Makefile
|
||||
@@ -10,7 +10,6 @@ MANFILES = sam.1
|
||||
include ../config.mk
|
||||
|
||||
all: ${TARG}
|
||||
- @strip ${TARG}
|
||||
@echo built ${TARG}
|
||||
|
||||
install: ${TARG}
|
115
pkgs/by-name/_9/_9base/getcallerpc-use-macro-or-stub.patch
Normal file
115
pkgs/by-name/_9/_9base/getcallerpc-use-macro-or-stub.patch
Normal file
|
@ -0,0 +1,115 @@
|
|||
diff --git a/lib9/Makefile b/lib9/Makefile
|
||||
index b83ab2b..2836b38 100644
|
||||
--- a/lib9/Makefile
|
||||
+++ b/lib9/Makefile
|
||||
@@ -145,7 +145,7 @@ LIB9OFILES=\
|
||||
exitcode.o\
|
||||
fcallfmt.o\
|
||||
get9root.o\
|
||||
- getcallerpc-$(OBJTYPE).o\
|
||||
+ getcallerpc.o\
|
||||
getenv.o\
|
||||
getfields.o\
|
||||
getnetconn.o\
|
||||
diff --git a/lib9/getcallerpc-386.c b/lib9/getcallerpc-386.c
|
||||
deleted file mode 100644
|
||||
index 1367370..0000000
|
||||
--- a/lib9/getcallerpc-386.c
|
||||
+++ /dev/null
|
||||
@@ -1,7 +0,0 @@
|
||||
-#include <lib9.h>
|
||||
-
|
||||
-ulong
|
||||
-getcallerpc(void *x)
|
||||
-{
|
||||
- return (((ulong*)(x))[-1]);
|
||||
-}
|
||||
diff --git a/lib9/getcallerpc-PowerMacintosh.c b/lib9/getcallerpc-PowerMacintosh.c
|
||||
deleted file mode 100644
|
||||
index 679a72c..0000000
|
||||
--- a/lib9/getcallerpc-PowerMacintosh.c
|
||||
+++ /dev/null
|
||||
@@ -1,7 +0,0 @@
|
||||
-#include <lib9.h>
|
||||
-
|
||||
-ulong
|
||||
-getcallerpc(void *x)
|
||||
-{
|
||||
- return (((ulong*)(x))[-4]);
|
||||
-}
|
||||
diff --git a/lib9/getcallerpc-arm.c b/lib9/getcallerpc-arm.c
|
||||
deleted file mode 100644
|
||||
index 9bb4a95..0000000
|
||||
--- a/lib9/getcallerpc-arm.c
|
||||
+++ /dev/null
|
||||
@@ -1,8 +0,0 @@
|
||||
-#include <lib9.h>
|
||||
-
|
||||
-ulong
|
||||
-getcallerpc(void *x)
|
||||
-{
|
||||
- return ((ulong*)x)[-2];
|
||||
-}
|
||||
-
|
||||
diff --git a/lib9/getcallerpc-power.c b/lib9/getcallerpc-power.c
|
||||
deleted file mode 100644
|
||||
index b4bf698..0000000
|
||||
--- a/lib9/getcallerpc-power.c
|
||||
+++ /dev/null
|
||||
@@ -1,11 +0,0 @@
|
||||
-#include <lib9.h>
|
||||
-
|
||||
-ulong
|
||||
-getcallerpc(void *x)
|
||||
-{
|
||||
- ulong *lp;
|
||||
-
|
||||
- lp = x;
|
||||
-
|
||||
- return lp[-1];
|
||||
-}
|
||||
diff --git a/lib9/getcallerpc-ppc.c b/lib9/getcallerpc-ppc.c
|
||||
deleted file mode 100644
|
||||
index 679a72c..0000000
|
||||
--- a/lib9/getcallerpc-ppc.c
|
||||
+++ /dev/null
|
||||
@@ -1,7 +0,0 @@
|
||||
-#include <lib9.h>
|
||||
-
|
||||
-ulong
|
||||
-getcallerpc(void *x)
|
||||
-{
|
||||
- return (((ulong*)(x))[-4]);
|
||||
-}
|
||||
diff --git a/lib9/getcallerpc-x86_64.c b/lib9/getcallerpc-x86_64.c
|
||||
deleted file mode 100644
|
||||
index 1367370..0000000
|
||||
--- a/lib9/getcallerpc-x86_64.c
|
||||
+++ /dev/null
|
||||
@@ -1,7 +0,0 @@
|
||||
-#include <lib9.h>
|
||||
-
|
||||
-ulong
|
||||
-getcallerpc(void *x)
|
||||
-{
|
||||
- return (((ulong*)(x))[-1]);
|
||||
-}
|
||||
diff --git a/lib9/getcallerpc.c b/lib9/getcallerpc.c
|
||||
new file mode 100644
|
||||
index 0000000..7d2cdd7
|
||||
--- /dev/null
|
||||
+++ b/lib9/getcallerpc.c
|
||||
@@ -0,0 +1,12 @@
|
||||
+#include <lib9.h>
|
||||
+
|
||||
+/*
|
||||
+ * On gcc and clang, getcallerpc is a macro invoking a compiler builtin.
|
||||
+ * If the macro in libc.h did not trigger, there's no implementation.
|
||||
+ */
|
||||
+#undef getcallerpc
|
||||
+ulong
|
||||
+getcallerpc(void *v)
|
||||
+{
|
||||
+ return 1;
|
||||
+}
|
||||
\ No newline at end of file
|
77
pkgs/by-name/_9/_9base/package.nix
Normal file
77
pkgs/by-name/_9/_9base/package.nix
Normal file
|
@ -0,0 +1,77 @@
|
|||
{ lib
|
||||
, stdenv
|
||||
, fetchgit
|
||||
, pkg-config
|
||||
, patches ? [ ]
|
||||
, pkgsBuildHost
|
||||
, enableStatic ? stdenv.hostPlatform.isStatic
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation {
|
||||
pname = "9base";
|
||||
version = "unstable-2019-09-11";
|
||||
|
||||
src = fetchgit {
|
||||
url = "https://git.suckless.org/9base";
|
||||
rev = "63916da7bd6d73d9a405ce83fc4ca34845667cce";
|
||||
hash = "sha256-CNK7Ycmcl5vkmtA5VKwKxGZz8AoIG1JH/LTKoYmWSBI=";
|
||||
};
|
||||
|
||||
patches = [
|
||||
# expects to be used with getcallerpc macro or stub patch
|
||||
# AR env var is now the location of `ar` not including the arg (`ar rc`)
|
||||
./config-substitutions.patch
|
||||
./dont-strip.patch
|
||||
# plan9port dropped their own getcallerpc implementations
|
||||
# in favour of using gcc/clang's macros or a stub
|
||||
# we can do this here too to extend platform support
|
||||
# https://github.com/9fans/plan9port/commit/540caa5873bcc3bc2a0e1896119f5b53a0e8e630
|
||||
# https://github.com/9fans/plan9port/commit/323e1a8fac276f008e6d5146a83cbc88edeabc87
|
||||
./getcallerpc-use-macro-or-stub.patch
|
||||
] ++ patches;
|
||||
|
||||
# the 9yacc script needs to be executed to build other items
|
||||
preBuild = lib.optionalString (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
|
||||
substituteInPlace ./yacc/9yacc \
|
||||
--replace "../yacc/yacc" "${lib.getExe' pkgsBuildHost._9base "yacc"}"
|
||||
'';
|
||||
|
||||
enableParallelBuilding = true;
|
||||
strictDeps = true;
|
||||
nativeBuildInputs = [ pkg-config ];
|
||||
NIX_CFLAGS_COMPILE = [
|
||||
# workaround build failure on -fno-common toolchains like upstream
|
||||
# gcc-10. Otherwise build fails as:
|
||||
# ld: diffio.o:(.bss+0x16): multiple definition of `bflag'; diffdir.o:(.bss+0x6): first defined here
|
||||
"-fcommon"
|
||||
# hide really common warning that floods the logs:
|
||||
# warning: #warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"
|
||||
"-D_DEFAULT_SOURCE"
|
||||
];
|
||||
LDFLAGS = lib.optionalString enableStatic "-static";
|
||||
makeFlags = [
|
||||
"PREFIX=${placeholder "out"}"
|
||||
];
|
||||
installFlags = [
|
||||
"PREFIX_TROFF=${placeholder "troff"}"
|
||||
];
|
||||
|
||||
outputs = [ "out" "man" "troff" ];
|
||||
|
||||
meta = with lib; {
|
||||
homepage = "https://tools.suckless.org/9base/";
|
||||
description = "9base is a port of various original Plan 9 tools for Unix, based on plan9port";
|
||||
longDescription = ''
|
||||
9base is a port of various original Plan 9 tools for Unix, based on plan9port.
|
||||
It also contains the Plan 9 libc, libbio, libregexp, libfmt and libutf.
|
||||
The overall SLOC is about 66kSLOC, so this userland + all libs is much smaller than, e.g. bash.
|
||||
9base can be used to run werc instead of the full blown plan9port.
|
||||
'';
|
||||
license = with licenses; [ mit /* and */ lpl-102 ];
|
||||
maintainers = with maintainers; [ jk ];
|
||||
platforms = platforms.unix;
|
||||
# needs additional work to support aarch64-darwin
|
||||
# due to usage of _DARWIN_NO_64_BIT_INODE
|
||||
broken = stdenv.isAarch64 && stdenv.isDarwin;
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue