2019-02-07 01:13:51 +00:00
|
|
|
{ stdenv, appleDerivation, xcbuild, ncurses, libutil }:
|
2015-11-07 01:44:02 +00:00
|
|
|
|
2019-02-07 01:13:51 +00:00
|
|
|
appleDerivation {
|
|
|
|
# We can't just run the root build, because https://github.com/facebook/xcbuild/issues/264
|
2015-11-13 02:59:17 +00:00
|
|
|
|
2019-02-07 01:13:51 +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
|
2015-11-07 01:44:02 +00:00
|
|
|
|
2019-02-07 01:13:51 +00:00
|
|
|
# We also disable locale here because of some issues with a missing
|
|
|
|
# "lstdc++".
|
2015-11-07 01:44:02 +00:00
|
|
|
patchPhase = ''
|
2019-02-07 01:13:51 +00:00
|
|
|
substituteInPlace adv_cmds.xcodeproj/project.pbxproj \
|
|
|
|
--replace "FD201DC214369B4200906237 /* pkill.c in Sources */," "" \
|
|
|
|
--replace "FDF278D60FC6204E00D7A3C6 /* locale.cc in Sources */," "" \
|
|
|
|
--replace '/usr/lib/libtermcap.dylib' 'libncurses.dylib'
|
2015-11-13 02:59:17 +00:00
|
|
|
'';
|
|
|
|
|
2015-02-08 06:53:52 +00:00
|
|
|
buildPhase = ''
|
2019-02-07 01:13:51 +00:00
|
|
|
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)
|
2019-01-03 21:09:44 +00:00
|
|
|
|
2019-02-07 01:13:51 +00:00
|
|
|
for i in $targets; do
|
|
|
|
xcodebuild SYMROOT=$PWD/Products OBJROOT=$PWD/Intermediates -target $i
|
|
|
|
done
|
2015-02-08 06:53:52 +00:00
|
|
|
'';
|
|
|
|
|
2019-02-07 01:13:51 +00:00
|
|
|
# temporary install phase until xcodebuild has "install" support
|
2015-02-08 06:53:52 +00:00
|
|
|
installPhase = ''
|
2018-12-30 05:58:10 +00:00
|
|
|
for f in Products/Release/*; do
|
|
|
|
if [ -f $f ]; then
|
|
|
|
install -D $file $out/bin/$(basename $f)
|
2019-01-04 16:28:22 +00:00
|
|
|
fi
|
2018-10-03 05:14:32 +01:00
|
|
|
done
|
2015-11-13 02:59:17 +00:00
|
|
|
|
2019-02-07 01:13:51 +00:00
|
|
|
mkdir -p $out/System/Library/LaunchDaemons
|
|
|
|
install fingerd/finger.plist $out/System/Library/LaunchDaemons
|
2015-11-13 02:59:17 +00:00
|
|
|
|
2019-02-07 01:13:51 +00:00
|
|
|
# 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
|
2015-02-08 06:53:52 +00:00
|
|
|
'';
|
|
|
|
|
2019-02-07 01:13:51 +00:00
|
|
|
nativeBuildInputs = [ xcbuild ];
|
|
|
|
buildInputs = [ ncurses libutil ];
|
2015-11-07 01:44:02 +00:00
|
|
|
|
2015-02-08 06:53:52 +00:00
|
|
|
meta = {
|
|
|
|
platforms = stdenv.lib.platforms.darwin;
|
2019-02-07 01:13:51 +00:00
|
|
|
maintainers = with stdenv.lib.maintainers; [ matthewbauer ];
|
2015-02-08 06:53:52 +00:00
|
|
|
};
|
|
|
|
}
|