Changes:
1. `-soname` should be `-install_name` on Darwin
2. Version suffix should placed before extension suffix (libucontext.so.1 -> libucontext.1.dylib)
3. Check for architecture specific include directory, and include it while building
4. `EXPORT_UNPREFIXED` macro shouldn't be set since Darwin don't support aliases
5. Choose correct subdir for arm64
6. Use `-dynamiclib` instead of `-shared` on Darwin for adding version info (`-current_version` and `-compatibility_version`)
This helps with cross compile setups, where host_cpu != target_cpu
therefore detecting it on the fly will end up with wrong cpu to build
for
Signed-off-by: Khem Raj <raj.khem@gmail.com>
_GNU_SOURCE can be defined without defining REG_X macros so it is not a
good indicator. (QEMU for example defines it in the build system.) x86
and x86_64 should have consistant looking defs.h so ifndef guards are
added to each REG_X definition.
This is needed because in libucontext.h we include "libucontext/bits.h".
We therefore need to have bits.h in somepath/libucontext/bits.h. In the
Makefile, somepath/freestanding/bits.h was copied to the right path but
in the meson build system, the include copy happens at the end.
The Makefile on ARMv7l devices (e.g. Raspberry Pi 400 running the
stock Raspbian distro) was failing to deduct the architecture and
empty libraries were being built as a result. Building with Meson
works fine; only building with make generated empty libraries.
Add an override for armv7l -> arm in the Makefile to address this.
this is not idiomatic, and should not be done (and it did not even
work in the first place); meson is capable of building both
libraries via library() and then you can choose on commandline
it defaults to only shared, but we want both out of box, so specify
that