16 Libc = apple-sdk.sourceRelease "Libc";
18 # Older versions of xnu are missing required headers. The one for the 11.3 SDK doesn’t define a needed function
19 # that was added in 11.3. This version of xnu has everything that’s needed.
20 xnu = apple-sdk_12.sourceRelease "xnu";
22 privateHeaders = stdenvNoCC.mkDerivation {
23 name = "adv_cmds-deps-private-headers";
26 install -D -t "$out/include/os" \
27 '${Libc}/os/assumes.h' \
28 '${xnu}/libkern/os/base_private.h'
32 # bootstrap_cmds is used to build libkrb5, which is a transitive dependency of Meson due to OpenLDAP.
33 # This causes an infinite recursion unless Meson’s tests are disabled.
34 mkAppleDerivation' = mkAppleDerivation.override {
35 meson = meson.overrideAttrs { doInstallCheck = false; };
39 releaseName = "bootstrap_cmds";
46 xcodeHash = "sha256-N28WLkFo8fXiQqqpmRmOBE3BzqXHIy94fhZIxEkmOw4=";
47 xcodeProject = "mig.xcodeproj";
50 # Make sure that `mig` in nixpkgs uses the correct clang
51 (replaceVars ./patches/0001-Specify-MIGCC-for-use-with-substitute.patch {
52 clang = "${lib.getBin buildPackages.targetPackages.clang}/bin/${buildPackages.targetPackages.clang.targetPrefix}clang";
54 # `mig` by default only removes the working directory at the end of the script.
55 # If an error happens, it is left behind. Always clean it up.
56 ./patches/0002-Always-remove-working-directory.patch
60 # Fix the name to something Meson will like.
61 substituteInPlace migcom.tproj/lexxer.l \
62 --replace-fail 'y.tab.h' 'parser.tab.h'
65 env.NIX_CFLAGS_COMPILE = "-I${privateHeaders}/include";
73 mv "$out/bin/mig.sh" "$out/bin/mig"
74 chmod a+x "$out/bin/mig"
75 patchShebangs --build "$out/bin/mig"
77 substituteInPlace "$out/bin/mig" \
78 --replace-fail 'arch=`/usr/bin/arch`' 'arch=${stdenv.targetPlatform.darwinArch}' \
79 --replace-fail '/usr/bin/mktemp' '${lib.getBin buildPackages.coreutils}/bin/mktemp' \
80 --replace-fail '/usr/bin/xcrun' '${buildPackages.xcbuild.xcrun}/bin/xcrun'
83 meta.description = "Contains mig command for generating headers from definitions";