Commit Graph

22 Commits

Author SHA1 Message Date
Artemis Tosini
d48f526db3
openbsd.{compat,compatHook}: init
OpenBSD does not provide a compatibility library for running
build tools on other OSes, but we still need one.
`openbsd.compat` inspired by the `freebsd.compat` package and provides
a header-only compatibility layer that can be used across multiple
openbsd build packages. The source is included in the nixpkgs tree
because it functions similarly to per-package patches.

`openbsd.compatHook` provides a build hook that can be added into
`extraNativeBuildInputs` to include `compat` in the library search
path as a system library.
2024-11-12 20:27:58 +00:00
Artemis Tosini
51a07b20cd
openbsd.mkDerivation: add extraNativeBuildInputs input
Some packages require extra hooks or tools.
Rather than overriding all of the nativeBuildInputs
and needing to specify all of them, add a field so that
we just need to specify inputs that are not always required.

Co-Authored-By: Audrey Dutcher <audrey@rhelmot.io>
2024-11-12 20:26:21 +00:00
John Ericson
50f7983ec7
openbsd.stand: init (#353925) 2024-11-08 09:14:30 -05:00
Artemis Tosini
f8cc3fce40
openbsd.makefs: init
OpenBSD's makefs is used to create filesystem images for ramdisks
or VM/install images. The build was fixed with a patch instead of
adding to `compat` because `makefs` relies heavily on unintended
and undocumted transitive header inclusions. Fixing with `compat`
causes hard-to-debug header loops.

Co-Authored-By: Audrey Dutcher <audrey@rhelmot.io>
2024-11-05 22:48:23 +00:00
Artemis Tosini
80d9fe945b
openbsd.stand: init
This stand package builds all variants of OpenBSD's
`stand` bootloader, including both UEFI and BIOS versions.

This package will likely need changes if we ever support
`aarch64-openbsd`, but that isn't even a target yet.

Co-Authored-By: Audrey Dutcher <audrey@rhelmot.io>
2024-11-05 22:35:14 +00:00
Artemis Tosini
fcd62ad082
openbsd.rtld: init
rtld contains ld.so, the dynamic linker on OpenBSD.
This package does not include related scripts (ldd and ldconfig),
because they would create a dependency loop.
rtld (run-time ld) is an os-agnostic term for dynamic linker.

For simplicity, also link this into the libc symlinkJoin package
2024-10-24 00:43:24 +00:00
Artemis Tosini
f5194c3579
openbsd.openbsdSetupHook: Fix bsd.prog.mk
bsd.prog.mk makes sure libc is built before programs that use it by
making all programs depend on core files.

We handle this dependency by referencing libc in cc-wrapper,
but that isn't sufficient to tell bsd.prog.mk that e.g. crtbegin.o
exists.

Clear libc-related variables to fix OpenBSD program build
2024-10-24 00:11:49 +00:00
Wolfgang Walther
9e836fddfe
openbsd: support structuredAttrs in setup hook
Tested openbsd.lorder with and without __structuredAttrs.
2024-09-08 22:11:10 +02:00
John Ericson
5f134ec6cf Clean up cross bootstrapping
For a long time, we've had `crossLibcStdenv`, `*Cross` libc attributes,
and `*bsdCross` pre-libc package sets. This was always bad because
having "cross" things is "not declarative": the naming doesn't reflect
what packages *need* but rather how we *provide* something. This is
ugly, and creates needless friction between cross and native building.

Now, almost all of these `*Cross` attributes are gone: just these are
kept:

- Glibc's and Musl's are kept, because those packages are widely used
  and I didn't want to risk changing the native builds of those at this
  time.

- generic `libcCross`, `theadsCross`, and friends, because these relate
  to the convolulted GCC bootstrap which still needs to be redone.

The BSD and obscure Linux or freestnanding libcs have conversely all
been made to use a new `stdenvNoLibc`, which is like the old
`crossLibcStdenv` except:

1. It usable for native and cross alike

2. It named according to what it *is* ("a standard environment without
   libc but with a C compiler"), rather than some non-compositional
   jargon ("the stdenv used for building libc when cross compiling",
   yuck).

I should have done this change long ago, but I was stymied because of
"infinite recursions". The problem was that in too many cases we are
overriding `stdenv` to *remove* things we don't need, and this risks
cyles since those more minimal stdenvs are used to build things in the
more maximal stdenvs.

The solution is to pass `stage.nix` `stdenvNoCC`, so we can override to
*build up* rather than *tear down*. For now, the full `stdenv` is also
passed, so I don't need to change the native bootstraps, but I can see
this changing as we make things more uniform and clean those up.

(adapted from commit 51f1ecaa59)
(adapted from commit 1743662e55)
2024-09-06 10:26:56 -04:00
Sigmanificient
6dd44107ac treewide: remove unused lib (and other) arguments 2024-07-26 11:18:09 +02:00
Sigmanificient
512e8afdb9 treewide: remove unused occurence of stdenv (and other) arguments
format (will squash)
2024-07-14 04:32:56 +02:00
John Ericson
676df1cf2d openbsd: Add static linking support
I've had better luck creating statically-linked binaries that work than
dynamically-linked ones, so this is needed quite practically.
2024-07-09 18:17:06 -04:00
John Ericson
56c2439a45 openbsd.libc: Create from constituent pkgs not hack
9d4e3b597fded2aee92cb7a7b2195072f812a6d3 but for OpenBSD instead of
NetBSD.
2024-06-29 12:48:30 -04:00
John Ericson
716d8a752a openbsd: Remove STRIP hack
This is just a FreeBSD thing, not OpenBSD or NetBSD thing.
2024-06-29 12:48:29 -04:00
John Ericson
744d7e7477 *bsdCross: Remove these package sets
I realized what rhelmot did in 61202561d9
(specify what packages just need `stdenvNoLibc`) is definitely the right
approach for this, and adjusted NetBSD and OpenBSD to likewise use it.
With that change, we don't need these confusing and ugly `*bsdCross`
package sets at all!

We can get rid of a lot more libc-related `*Cross`, and I will do so
soon, but this is the first step.

(adapted from commit 51f1ecaa59)
2024-06-21 11:47:36 -04:00
Vladimír Čunát
879821772c
Revert #320852: Clean up cross bootstrapping
It rebuilt stdenv on *-darwin; we can't do that in nixpkgs master.
This reverts commit 2f20501c5f, reversing
changes made to fd469c24af.
2024-06-21 07:48:24 +02:00
John Ericson
1743662e55 *bsd.mkDerivation: Fix comment about STRIPBIN 2024-06-20 10:55:02 -04:00
John Ericson
51f1ecaa59 Clean up cross bootstrapping
For a long time, we've had `crossLibcStdenv`, `*Cross` libc attributes,
and `*bsdCross` pre-libc package sets. This was always bad because
having "cross" things is "not declarative": the naming doesn't reflect
what packages *need* but rather how we *provide* something. This is
ugly, and creates needless friction between cross and native building.

Now, almost all of these `*Cross` attributes are gone: just these are
kept:

- Glibc's and Musl's are kept, because those packages are widely used
  and I didn't want to risk changing the native builds of those at this
  time.

- generic `libcCross`, `theadsCross`, and friends, because these relate
  to the convolulted GCC bootstrap which still needs to be redone.

The BSD and obscure Linux or freestnanding libcs have conversely all
been made to use a new `stdenvNoLibc`, which is like the old
`crossLibcStdenv` except:

1. It usable for native and cross alike

2. It named according to what it *is* ("a standard environment without
   libc but with a C compiler"), rather than some non-compositional
   jargon ("the stdenv used for building libc when cross compiling",
   yuck).

I should have done this change long ago, but I was stymied because of
"infinite recursions". The problem was that in too many cases we are
overriding `stdenv` to *remove* things we don't need, and this risks
cyles since those more minimal stdenvs are used to build things in the
more maximal stdenvs.

The solution is to pass `stage.nix` `stdenvNoCC`, so we can override to
*build up* rather than *tear down*. For now, the full `stdenv` is also
passed, so I don't need to change the native bootstraps, but I can see
this changing as we make things more uniform and clean those up.

Finally, the BSDs also had to be cleaned up, since they have a few
pre-libc dependencies, demanding a systematic approach. I realized what
rhelmot did in 61202561d9 (specify what
packages just need `stdenvNoLibc`) is definitely the right approach for
this, and adjusted NetBSD and OpenBSD to likewise use it.
2024-06-18 17:04:16 -04:00
Ali Abrar
888dee445d openbsd: init at 7.5 2024-05-26 10:55:56 -04:00
Matthew Bauer
6bc19398be openbsd: remove 2018-04-28 01:03:34 +00:00
Matthew Bauer
c65000af91 openbsd: fixup mg 2018-04-28 00:33:51 +00:00
Matthew Bauer
31ef995e37 bsd: init netbsd & openbsd userland
Adds a couple of useful NetBSD and OpenBSD derivations. Some of these
will be integrated into Nixpkgs later.

Noncomprehensive list:

- netbsd.getent
- netbsd.getconf
- netbsd.fts
- openbsd.mg
- netbsd.compat (can replace libbsd)
2018-04-24 14:16:35 -05:00