darwin.xnu: use unwrapped clang for MIGCC

the mig header build requires a 32 bit arch but the wrapped compiler
specifies `-arch 64-bit-arch` on the command line causing compile
failures. This was worked around for aarch64 by patching out the 32 bit
arch but that ignores the comment and the code saying that 32 bit arch
is required and thus will generate the wrong sizes for the structures in
the headers. Using the unwrapped clang mig can pass whatever arch it
desires.
This commit is contained in:
Reno Dakota 2024-07-03 23:18:32 +00:00
parent 176a56c40f
commit bae30f206d
No known key found for this signature in database

View File

@ -44,8 +44,7 @@ appleDerivation' (if headersOnly then stdenvNoCC else stdenv) (
--replace " -o 0" "" \
--replace '$SRC/$mig' '-I$DSTROOT/include $SRC/$mig' \
--replace '$SRC/servers/netname.defs' '-I$DSTROOT/include $SRC/servers/netname.defs' \
--replace '$BUILT_PRODUCTS_DIR/mig_hdr' '$BUILT_PRODUCTS_DIR' \
--replace 'MACHINE_ARCH=armv7' 'MACHINE_ARCH=arm64' # this might break the comments saying 32-bit is required
--replace '$BUILT_PRODUCTS_DIR/mig_hdr' '$BUILT_PRODUCTS_DIR'
patchShebangs .
'' + lib.optionalString (lib.versionAtLeast stdenv.hostPlatform.darwinSdkVersion "11") ''
@ -72,11 +71,7 @@ appleDerivation' (if headersOnly then stdenvNoCC else stdenv) (
HOST_FLEX = "flex";
HOST_BISON = "bison";
HOST_GM4 = "m4";
# use unwrapped clang to generate headers because wrapper is not compatible with a 32 bit -arch.
# aarch64 should likely do this as well and remove the --replace MACHINE_ARCH above
MIGCC = if stdenv.isx86_64 && lib.versionAtLeast stdenv.hostPlatform.darwinSdkVersion "11"
then "${lib.getBin pkgsBuildBuild.stdenv.cc.cc}/bin/clang"
else "cc";
MIGCC = "${lib.getBin pkgsBuildBuild.stdenv.cc.cc}/bin/clang";
ARCHS = arch;
ARCH_CONFIGS = arch;