2021-05-28 09:39:13 +00:00
|
|
|
{ lib, stdenv, stdenvNoCC, appleDerivation', xcbuildHook
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
# headersOnly is true when building for libSystem
|
|
|
|
, headersOnly ? false }:
|
|
|
|
|
2021-05-28 09:39:13 +00:00
|
|
|
appleDerivation' (if headersOnly then stdenvNoCC else stdenv) {
|
2020-04-24 23:36:52 +00:00
|
|
|
nativeBuildInputs = lib.optional (!headersOnly) xcbuildHook;
|
|
|
|
|
|
|
|
prePatch = ''
|
|
|
|
substituteInPlace tzlink.c \
|
|
|
|
--replace '#include <xpc/xpc.h>' ""
|
|
|
|
'';
|
|
|
|
|
|
|
|
xcbuildFlags = [ "-target" "util" ];
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/include
|
|
|
|
'' + lib.optionalString headersOnly ''
|
|
|
|
cp *.h $out/include
|
|
|
|
'' + lib.optionalString (!headersOnly)''
|
|
|
|
mkdir -p $out/lib $out/include
|
|
|
|
|
|
|
|
cp Products/Release/*.dylib $out/lib
|
|
|
|
cp Products/Release/*.h $out/include
|
|
|
|
|
|
|
|
# TODO: figure out how to get this to be right the first time around
|
|
|
|
install_name_tool -id $out/lib/libutil.dylib $out/lib/libutil.dylib
|
|
|
|
'';
|
|
|
|
|
2021-02-19 19:06:45 +00:00
|
|
|
# FIXME: headers are different against headersOnly. And all the headers are NOT in macos, do we really want them?
|
|
|
|
# appleHeaders = ''
|
|
|
|
# libutil.h
|
|
|
|
# mntopts.h
|
|
|
|
# tzlink.h
|
|
|
|
# wipefs.h
|
|
|
|
# '';
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
meta = with lib; {
|
|
|
|
maintainers = with maintainers; [ copumpkin ];
|
|
|
|
platforms = platforms.darwin;
|
|
|
|
license = licenses.apsl20;
|
|
|
|
};
|
|
|
|
}
|