Skip to content

Commit 888dee4

Browse files
ali-abrarEricson2314
authored andcommitted
openbsd: init at 7.5
1 parent ad6fa01 commit 888dee4

20 files changed

Lines changed: 491 additions & 7 deletions

File tree

lib/systems/default.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ let
9393
else if final.isAndroid then "bionic"
9494
else if final.isLinux /* default */ then "glibc"
9595
else if final.isFreeBSD then "fblibc"
96+
else if final.isOpenBSD then "oblibc"
9697
else if final.isNetBSD then "nblibc"
9798
else if final.isAvr then "avrlibc"
9899
else if final.isGhcjs then null

lib/systems/examples.nix

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,11 @@ rec {
342342
useLLVM = true;
343343
};
344344

345+
x86_64-openbsd = {
346+
config = "x86_64-unknown-openbsd";
347+
useLLVM = true;
348+
};
349+
345350
#
346351
# WASM
347352
#

lib/systems/parse.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,7 @@ rec {
469469
elem (elemAt l 2) [ "wasi" "redox" "mmixware" "ghcjs" "mingw32" ] ||
470470
hasPrefix "freebsd" (elemAt l 2) ||
471471
hasPrefix "netbsd" (elemAt l 2) ||
472+
hasPrefix "openbsd" (elemAt l 2) ||
472473
hasPrefix "genode" (elemAt l 2)
473474
then {
474475
cpu = elemAt l 0;

pkgs/os-specific/bsd/freebsd/lib/default.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@
1414
}
1515
.${stdenv'.hostPlatform.parsed.cpu.name} or stdenv'.hostPlatform.parsed.cpu.name;
1616

17-
install-wrapper = builtins.readFile ./install-wrapper.sh;
17+
install-wrapper = builtins.readFile ../../lib/install-wrapper.sh;
1818
}
File renamed without changes.

pkgs/os-specific/bsd/netbsd/pkgs/install/package.nix

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@
1717
# HACK: to ensure parent directories exist. This emulates GNU
1818
# install’s -D option. No alternative seems to exist in BSD install.
1919
let
20-
binstall = writeShellScript "binstall" ''
21-
set -eu
22-
for last in "$@"; do true; done
23-
mkdir -p $(dirname $last)
24-
@out@/bin/xinstall "$@"
25-
'';
20+
binstall = writeShellScript "binstall" (
21+
builtins.readFile ../../../lib/install-wrapper.sh
22+
+ ''
23+
@out@/bin/xinstall "''${args[@]}"
24+
''
25+
);
2626
in
2727
mkDerivation {
2828
path = "usr.bin/xinstall";
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
{
2+
stdenv,
3+
lib,
4+
stdenvNoCC,
5+
makeScopeWithSplicing',
6+
generateSplicesForMkScope,
7+
pkgs,
8+
buildPackages,
9+
netbsd,
10+
}:
11+
12+
makeScopeWithSplicing' {
13+
otherSplices = generateSplicesForMkScope "openbsd";
14+
f = (
15+
self:
16+
lib.packagesFromDirectoryRecursive {
17+
callPackage = self.callPackage;
18+
directory = ./pkgs;
19+
}
20+
// {
21+
libc = self.callPackage ./pkgs/libc/package.nix {
22+
inherit (self) csu include lorder;
23+
inherit (buildPackages.openbsd) makeMinimal;
24+
inherit (buildPackages.netbsd)
25+
install
26+
gencat
27+
rpcgen
28+
tsort
29+
;
30+
};
31+
makeMinimal = buildPackages.netbsd.makeMinimal.override { inherit (self) make-rules; };
32+
mkDerivation = self.callPackage ./pkgs/mkDerivation.nix {
33+
inherit stdenv;
34+
inherit (buildPackages.netbsd) install;
35+
};
36+
include = self.callPackage ./pkgs/include/package.nix {
37+
inherit (buildPackages.openbsd) makeMinimal;
38+
inherit (buildPackages.netbsd) install rpcgen mtree;
39+
};
40+
csu = self.callPackage ./pkgs/csu.nix {
41+
inherit (self) include;
42+
inherit (buildPackages.openbsd) makeMinimal;
43+
inherit (buildPackages.netbsd) install;
44+
};
45+
make-rules = self.callPackage ./pkgs/make-rules/package.nix { };
46+
lorder = self.callPackage ./pkgs/lorder.nix { inherit (buildPackages.netbsd) install; };
47+
}
48+
);
49+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
lib,
3+
mkDerivation,
4+
bsdSetupHook,
5+
openbsdSetupHook,
6+
makeMinimal,
7+
install,
8+
include,
9+
}:
10+
11+
mkDerivation {
12+
path = "lib/csu";
13+
nativeBuildInputs = [
14+
bsdSetupHook
15+
openbsdSetupHook
16+
makeMinimal
17+
install
18+
];
19+
buildInputs = [ include ];
20+
meta.platforms = lib.platforms.openbsd;
21+
extraPaths = [ "libexec/ld.so" ];
22+
}
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
{
2+
lib,
3+
mkDerivation,
4+
makeMinimal,
5+
bsdSetupHook,
6+
openbsdSetupHook,
7+
install,
8+
rpcgen,
9+
mtree,
10+
pax,
11+
buildPackages,
12+
}:
13+
mkDerivation {
14+
path = "include";
15+
noCC = true;
16+
17+
extraPaths = [
18+
"lib"
19+
#"sys"
20+
"sys/arch"
21+
# LDIRS from the mmakefile
22+
"sys/crypto"
23+
"sys/ddb"
24+
"sys/dev"
25+
"sys/isofs"
26+
"sys/miscfs"
27+
"sys/msdosfs"
28+
"sys/net"
29+
"sys/netinet"
30+
"sys/netinet6"
31+
"sys/netmpls"
32+
"sys/net80211"
33+
"sys/nfs"
34+
"sys/ntfs"
35+
"sys/scsi"
36+
"sys/sys"
37+
"sys/ufs"
38+
"sys/uvm"
39+
];
40+
41+
nativeBuildInputs = [
42+
bsdSetupHook
43+
install
44+
makeMinimal
45+
mtree
46+
openbsdSetupHook
47+
pax
48+
rpcgen
49+
];
50+
51+
makeFlags = [
52+
"RPCGEN_CPP=${buildPackages.stdenv.cc.cc}/bin/cpp"
53+
"-B"
54+
];
55+
56+
headersOnly = true;
57+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
diff --git a/lib/libc/Makefile b/lib/libc/Makefile
2+
index 4bb4b67fcbb..1c8a8e08e60 100644
3+
--- a/lib/libc/Makefile
4+
+++ b/lib/libc/Makefile
5+
@@ -6,7 +6,6 @@
6+
.include <bsd.own.mk>
7+
8+
LIB=c
9+
-LIBREBUILD=y
10+
CLEANFILES+=tags Symbols.map
11+
CFLAGS+=-Wimplicit
12+
#CFLAGS+=-Werror

0 commit comments

Comments
 (0)