2018-07-06 23:53:50 +01:00
|
|
|
{ stdenv, appleDerivation, xcbuildHook
|
2019-02-07 01:13:51 +00:00
|
|
|
, Libc, xnu, libutil }:
|
2018-04-12 23:16:49 +01:00
|
|
|
|
|
|
|
appleDerivation {
|
2018-07-06 23:53:50 +01:00
|
|
|
nativeBuildInputs = [ xcbuildHook ];
|
2019-02-07 01:13:51 +00:00
|
|
|
buildInputs = [ libutil ];
|
2018-04-12 23:16:49 +01:00
|
|
|
|
|
|
|
NIX_CFLAGS_COMPILE = "-I.";
|
|
|
|
NIX_LDFLAGS = "-lutil";
|
|
|
|
patchPhase = ''
|
|
|
|
# ugly hacks for missing headers
|
|
|
|
# most are bsd related - probably should make this a drv
|
|
|
|
unpackFile ${Libc.src}
|
|
|
|
unpackFile ${xnu.src}
|
|
|
|
mkdir System sys machine i386
|
|
|
|
cp xnu-*/bsd/sys/disklabel.h sys
|
|
|
|
cp xnu-*/bsd/machine/disklabel.h machine
|
|
|
|
cp xnu-*/bsd/i386/disklabel.h i386
|
|
|
|
cp -r xnu-*/bsd/sys System
|
|
|
|
cp -r Libc-*/uuid System
|
2019-01-07 04:13:11 +00:00
|
|
|
substituteInPlace diskdev_cmds.xcodeproj/project.pbxproj \
|
|
|
|
--replace 'DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";' ""
|
2018-04-12 23:16:49 +01:00
|
|
|
'';
|
|
|
|
installPhase = ''
|
|
|
|
install -D Products/Release/libdisk.a $out/lib/libdisk.a
|
|
|
|
rm Products/Release/libdisk.a
|
2018-12-30 05:58:10 +00:00
|
|
|
for f in Products/Release/*; do
|
|
|
|
if [ -f $f ]; then
|
2019-01-07 04:13:11 +00:00
|
|
|
install -D $f $out/bin/$(basename $f)
|
|
|
|
fi
|
2018-04-12 23:16:49 +01:00
|
|
|
done
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = {
|
|
|
|
platforms = stdenv.lib.platforms.darwin;
|
|
|
|
maintainers = with stdenv.lib.maintainers; [ matthewbauer ];
|
|
|
|
};
|
|
|
|
}
|