Reverts d43df749ac
NetBSD makefiles strip local symbols from libs using `OBJCOPY?=objcopy`,
which is missing on macOS. GNU objcopy appears to succeed but produces
broken .a libs which do not link into dependers.
(As this issue does not fail the netbsd.compat build,
downstream netbsd.install is added to passthru.tests.)
Since `OBJCOPY` is only used for stripping, we can:
* skip stripping with the hacky `OBJCOPY=echo`
* use cctools strip, which is invoked in the same way
The latter is obviously preferable if it works.
Indeed, locals are stripped, although it doesn't affect size much.
Comparison:
`OBJCOPY=echo`:
```
$ du -b result/lib/*.a
347784 result/lib/libnbcompat.a
357120 result/lib/libnbcompat_p.a
```
`OBJCOPY=${cctools}/bin/strip`:
```
$ du -b result/lib/*.a
347008 result/lib/libnbcompat.a
357120 result/lib/libnbcompat_p.a
```
Not to netbsd, where it isn't needed, but elsewhere.
A few things going on here:
- Make compat use the "regular" not "host" makefile infra. This,
however, makes more assumptions that the toolchain is BSD-like, and
so we need to compensate for them with the likes of:
- `LORDER=...` and `TSORT=...`
- Move `export INSTALL_*` to install's setup hook so they don't interfere
with coreutils install
- Don't use `DESTDIR` for installing include files, instead set `INCSDIR`.
This is more proper, but doesn't work when `INCSDIR` is set multiple
times, unfortunately, as CLI defs override all other assignments. So
instead set `INCSDIR0` on the CLI, and do some `INCSDIR =
${INCSDIR0}/...` in the relevant packages.
- `INCSDIR` is set just in the NetBSD setup hook because FreeBSD uses
`INCLUDEDIR`.
I plan on doing the sources for FreeBSD differently. Indeed we might
want to change this for NetBSD too eventually.
In any event, the way we manage sources is not intrinsically the same
across BSDs so it makes sense to pull this out.
We need netbsdCross.ld_elf_so to be the dynamic linker in cross
netbsd's bintools, but netbsdCross doesn't have a libc in stdenv. So
instead, use netbsdCross.libc for netbsdCross.ld_elf_so.
Notes:
- compat: Needs a header from common merged with it's wrapper.
- librt: Needs the jemalloc sources.
- libc: install libc_pic.a
This was the behaviour on NetBSD 8.0, and ld.elf_so (in its current
configuration) requires it. We could also have disabled PIC in
ld.elf_so.
- sys: fix build
We use a more recent version of binutils than NetBSD 9.1 does, so we
need to backport a patch from CURRENT.
Co-authored-by: John Ericson <John.Ericson@Obsidian.Systems>
"common" is just a lot of shared code, not a component in and of
itself. There's no Makefile, so if we try to build it Make will go up
a directory and try to build all of NetBSD.
This is another one of those packages that's just a rebuild of a
certain part of libc...
Tested by building pkgsCross.x86_64-netbsd.netbsd.librt on
x86_64-linux.
libc's postPatch was entirely fixes for librt, so move that to librt
and inherit it in libc.
82c231d17e ("netbsd: Generalize builder to any-bsd setup hook")
missed libterminfo when it added bsdSetupHook to every other
package. (I checked it didn't miss anything else.)
It also didn't change a NETBSDSRCDIR to BSDSRCDIR, but in fairness
that line was added about half an hour before the setupHook change was
merged in a16384e118.
Fixes: 82c231d17e ("netbsd: Generalize builder to any-bsd setup hook")
Tested building pkgsCross.x86_64-netbsd.netbsd.libm from x86_64-linux.
At some point we should probably set SHLIBINSTALLDIR in the setupHook,
but I think I'd like to get everything working first, and then make
changes that affect all the builds like that. It's easier to spot
regressions when you know _everything_ worked before.
- No splicing makes everything less finnicky.
- Normal bootstrapping matches e.g. linux where kernel headers are also
`stdenvNoCC` but part of this stage.
Before, we were only building the headers, firmware, and bootloader.
CONFIG could be overridden to use another pre-defined kernel, but
there's no way to pass a custom kernel configuration yet.
Tested booting the built kernel in a NetBSD VM.