2018-07-21 01:44:44 +01:00
|
|
|
{ stdenv, appleDerivation, xcbuild, ncurses, libutil-new }:
|
2016-10-20 09:17:24 +01:00
|
|
|
|
2016-11-10 04:24:59 +00:00
|
|
|
appleDerivation {
|
2017-10-12 02:31:59 +01:00
|
|
|
# We can't just run the root build, because https://github.com/facebook/xcbuild/issues/264
|
2016-11-10 20:56:58 +00:00
|
|
|
|
|
|
|
# pkill requires special private headers that are unavailable in
|
|
|
|
# NixPkgs. These ones are needed:
|
|
|
|
# - xpc/xpxc.h
|
|
|
|
# - os/base_private.h
|
|
|
|
# - _simple.h
|
|
|
|
# We disable it here for now. TODO: build pkill inside adv_cmds
|
2016-11-12 21:51:25 +00:00
|
|
|
|
|
|
|
# We also disable locale here because of some issues with a missing
|
|
|
|
# "lstdc++".
|
2016-10-20 09:17:24 +01:00
|
|
|
patchPhase = ''
|
2016-11-07 22:09:10 +00:00
|
|
|
substituteInPlace adv_cmds.xcodeproj/project.pbxproj \
|
2016-11-12 21:51:25 +00:00
|
|
|
--replace "FD201DC214369B4200906237 /* pkill.c in Sources */," "" \
|
2017-10-12 02:31:59 +01:00
|
|
|
--replace "FDF278D60FC6204E00D7A3C6 /* locale.cc in Sources */," "" \
|
2019-01-07 04:31:21 +00:00
|
|
|
--replace '/usr/lib/libtermcap.dylib' 'libncurses.dylib' \
|
|
|
|
--replace 'DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";' ""
|
2017-10-12 02:31:59 +01:00
|
|
|
'';
|
|
|
|
|
|
|
|
buildPhase = ''
|
|
|
|
targets=$(xcodebuild -list \
|
|
|
|
| awk '/Targets:/{p=1;print;next} p&&/^\s*$/{p=0};p' \
|
|
|
|
| tail -n +2 | sed 's/^[ \t]*//' \
|
|
|
|
| grep -v -e Desktop -e Embedded -e mklocale -e colldef)
|
|
|
|
|
|
|
|
for i in $targets; do
|
2018-04-16 05:21:00 +01:00
|
|
|
xcodebuild SYMROOT=$PWD/Products OBJROOT=$PWD/Intermediates -target $i
|
2017-10-12 02:31:59 +01:00
|
|
|
done
|
2016-10-20 09:17:24 +01:00
|
|
|
'';
|
|
|
|
|
2016-11-08 03:55:31 +00:00
|
|
|
# temporary install phase until xcodebuild has "install" support
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/bin/
|
2018-04-08 06:27:14 +01:00
|
|
|
install Products/Release/* $out/bin/
|
2016-11-08 03:55:31 +00:00
|
|
|
|
2016-11-10 04:24:59 +00:00
|
|
|
for n in 1 8; do
|
|
|
|
mkdir -p $out/share/man/man$n
|
|
|
|
install */*.$n $out/share/man/man$n
|
2016-11-08 03:55:31 +00:00
|
|
|
done
|
2016-11-10 04:24:59 +00:00
|
|
|
|
|
|
|
mkdir -p $out/System/Library/LaunchDaemons
|
|
|
|
install fingerd/finger.plist $out/System/Library/LaunchDaemons
|
|
|
|
|
|
|
|
# from variant_links.sh
|
|
|
|
# ln -s $out/bin/pkill $out/bin/pgrep
|
|
|
|
# ln -s $out/share/man/man1/pkill.1 $out/share/man/man1/pgrep.1
|
2016-11-08 03:55:31 +00:00
|
|
|
'';
|
|
|
|
|
2018-07-06 23:53:50 +01:00
|
|
|
nativeBuildInputs = [ xcbuild ];
|
|
|
|
buildInputs = [ ncurses libutil-new ];
|
2016-10-20 09:17:24 +01:00
|
|
|
|
|
|
|
meta = {
|
|
|
|
platforms = stdenv.lib.platforms.darwin;
|
|
|
|
maintainers = with stdenv.lib.maintainers; [ matthewbauer ];
|
|
|
|
};
|
|
|
|
}
|