1 { lib, appleDerivation, stdenv, bison, flex }:
5 # Hard to get CC to pull this off without infinite recursion
6 targetTargetPrefix = lib.optionalString
7 (with stdenv; hostPlatform != targetPlatform)
8 (stdenv.targetPlatform.config + "-");
13 nativeBuildInputs = [ bison flex ];
18 # redundant file, don't know why apple not removing it.
22 flex --header-file=lexxer.yy.h -o lexxer.yy.c lexxer.l
24 $CC -std=gnu99 -Os -dead_strip -DMIG_VERSION=\"$pname-$version\" -I. -o migcom *.c
28 mkdir -p $out/bin $out/libexec $out/share/man/man1
31 cp mig.sh $out/bin/mig
32 cp migcom $out/libexec
33 ln -s $out/libexec/migcom $out/bin/migcom
34 cp mig.1 $out/share/man/man1
35 cp migcom.1 $out/share/man/man1
37 substituteInPlace $out/bin/mig \
38 --replace 'arch=`/usr/bin/arch`' 'arch=${stdenv.targetPlatform.darwinArch}' \
39 --replace '/usr/bin/' "" \
40 --replace '/bin/rmdir' "rmdir" \
41 --replace 'C=''${MIGCC}' "C=${targetTargetPrefix}cc"