tools/Makefile.host revision 1.35 changed from
setting various NOxxx variables and .include <bsd.own.mk>
to
.include <bsd.hostinit.mk>
which sets the same NOxxx variables, .include <bsd.init.mk>
which optionally .include ../Makefile.inc before .include <bsd.own.mk>.
This chnage caused build failures with HAVE_LLVM=yes, so revert rev 1.35.
(Maybe to do with the .include ../Makefile.inc. The tools/llvm* build is
tricky, and it's easier to revert this change than debug.)
bsd.hostinit.mk sets a bunch of NOxxx variables before
including bsd.init.mk (which includes bsd.own.mk),
so simplify instead of replicating the NOxxx setup
for host tools.
Check the host CC support for all the warnings now in <bsd.own.mk>
and override appropriately in defs.mk.
In general there's a 1:1 mapping, with the special case
CC_WNO_ADDRESS_OF_PACKED_MEMBER which is set from both
@CC_WNO_ADDRESS_OF_PACKED_MEMBER@ (gcc) and
@CC_WNO_ERROR_ADDRESS_OF_PACKED_MEMBER@ (clang).
Rename compiler-warning-disable variables from
GCC_NO_warning
to
CC_WNO_warning
where warning is the full warning name as used by the compiler.
GCC_NO_IMPLICIT_FALLTHRU is CC_WNO_IMPLICIT_FALLTHROUGH
Using the convention CC_compilerflag, where compilerflag
is based on the full compiler flag name.
Building LLVM with a host gcc 13 fails and suggests including <cstdint>
in external/apache2/llvm/dist/llvm/include/llvm/Support/Signals.h .
Instead of this, joerg@ suggested not modifying the llvm vendor branch
but instead working around this in our LLVM build infrastructure.
Determine if the host CC supports flags to disable various
warnings similar to <bsd.own.mk> GCC_*, CLANG_*, and CC_*,
and override the <bsd.own.mk> equivalents in defs.mk.
Silences "warning: unknown warning option '...'" from our source.
External source (e.g., binutils and gcc) need their own fixes
to enhance their detection of supported clang compiler flags.
Define NB_CC_FLAG(FLAG) to use AX_CHECK_COMPILE_FLAG
to determine if the host compiler supports FLAG
and define and AC_SUBST CC_FLAG if so.
Use workarounds to force clang to hard-fail on unknown -Wwarning,
and gcc to use -WWARN to check unknown -Wno-WARN because the
latter doesn't cause an error in gcc.
In the future we could use NB_CC_FLAG([-fcommon]) for
older NetBSD release branches compiled with host gcc 10+.
Rework Darwin -no-cpp-precomp check to use NB_CC_FLAG().
Note: this flag probably hasn't been required on macOS (Darwin)
for a long time, but serves as a good example on how to use this.
Display varaibles at the end of configure to show what was detected.
Use "NB_" prefix not "AC_" for our macros ("AC_" is for autoconf).
Fail is NB_ macro isn't defined.
Use AC_DEFUN() instead of define().
Consistently use () in zero argument macro calls.
Use dispatch_semaphore_create() if present instead of sem_init().
macOS doesn't actually implement sem_init() (et al)
(even though it provides the prototypes as deprecated).
This was detected by the previous commit to ctfmerge
that added error handling.
Implement ctfmerge's barrier operations in terms of
dispatch(3) APIs such as dispatch_semaphore_create() (et al).
Update tools/compat/configure.ac to find dispatch_semaphore_create().
Fixes ctfmerge on macOS hosts.
Inspired by https://stackoverflow.com/a/27847103.
Use a more restrictive pattern to extract -j NNN from MAKEFLAGS
into GMAKE_J_ARGS, to avoid false positives when the source directory
has "-j" in the path (e.g "amd64-job-000012" or "src-j9999").
Previously this could pass either -"-j" or "-j BIGNUM" to gmake
and result in "vfork: Resource temporarily unavailable" failures.
PR misc/54456
Explicitly build with V=1 for MAKEVERBOSE >= 2
so that Makefile.gnuhost (automake) consumers
are more consistent with native builds.
(If the upstream is using AM_SILENT_RULES(yes)
then the default is V=0).
don't play with m68k-parse.c in tools/binutils/Makefile but disable
the rules that rebuild it so we always use the upstream version,
using the standard "NetBSD_DISABLED" method.
this was necessary to build on linux in 2014 (which may or may not
still ne necessary), but it also avoids triggering rebuild rules
based upon the timestamps on .y vs .c.
tested with amiga, amd64, and i386 "build.sh tools" builds.
'tools/elftoolchain/common' has been built.
This change aligns the 'tools' build with the regular build.
Subsequent commits will change 'tools/libctf' and
'tools/cft{merge,convert}' to use the new build paths.
Elftoolchain code.
Build and install <sys/elfdefinitions.h> in ${TOOLDIR}/include.
This change prepares the ground for upgrading libelf and libdwarf to
their current Elftoolchain versions.
The previous requirement was that tools should only use C89 features.
Several tools did not follow this rule for years. Since nobody
complained about not being able to build NetBSD in a C89 environment,
drop that rule, now requiring C99.
https://mail-index.netbsd.org/tech-toolchain/2022/01/30/msg004091.html
HOST_CPPFLAGS, HOST_CXXFLAGS, but not LIBRARY_PATH because it breaks
the build. These variables are necessary to support building NetBSD
from a GNU Guix or NixOS host, where /usr/include, /lib, and all
but /bin/sh do not exist. In many cases, support for HOST_CPPFLAGS
was incomplete. From Ryan Sundberg
Include a prototype for __nbcompat_heapsort. The tools for amiga now
build on Darwin where one Amiga specific tool uses heapsort.
Despite being a one-liner, ./build.sh -m amiga tools was tested on
NetBSD, Darwin, FreeBSD & Linux with the change.
Discussed various options with jdc & thorpej. Perhaps in the future
we could look at using qsort instead of heapsort as qsort is
standardised and more likely to be available. We could then remove
heapsort from the compatibility library.