parent
ec4910d9af
commit
dd4fd74f91
|
@ -1,37 +1,104 @@
|
||||||
{ stdenv, appleDerivation, xcbuild }:
|
{ stdenv, appleDerivation, xcbuild, lib, hostPlatform
|
||||||
|
, Librpcsvc, apple_sdk, pam, CF, openbsm }:
|
||||||
|
|
||||||
appleDerivation rec {
|
appleDerivation rec {
|
||||||
# xcbuild fails with:
|
# xcbuild fails with:
|
||||||
# /nix/store/fc0rz62dh8vr648qi7hnqyik6zi5sqx8-xcbuild-wrapper/nix-support/setup-hook: line 1: 9083 Segmentation fault: 11 xcodebuild OTHER_CFLAGS="$NIX_CFLAGS_COMPILE" OTHER_CPLUSPLUSFLAGS="$NIX_CFLAGS_COMPILE" OTHER_LDFLAGS="$NIX_LDFLAGS" build
|
# /nix/store/fc0rz62dh8vr648qi7hnqyik6zi5sqx8-xcbuild-wrapper/nix-support/setup-hook: line 1: 9083 Segmentation fault: 11 xcodebuild OTHER_CFLAGS="$NIX_CFLAGS_COMPILE" OTHER_CPLUSPLUSFLAGS="$NIX_CFLAGS_COMPILE" OTHER_LDFLAGS="$NIX_LDFLAGS" build
|
||||||
|
# see issue facebook/xcbuild#188
|
||||||
# buildInputs = [ xcbuild ];
|
# buildInputs = [ xcbuild ];
|
||||||
|
|
||||||
# # temporary install phase until xcodebuild has "install" support
|
buildInputs = [ Librpcsvc apple_sdk.frameworks.OpenDirectory pam CF
|
||||||
# installPhase = ''
|
apple_sdk.frameworks.IOKit openbsm ];
|
||||||
# mkdir -p $out/bin/
|
# NIX_CFLAGS_COMPILE = lib.optionalString hostPlatform.isi686 "-D__i386__"
|
||||||
# install system_cmds-*/Build/Products/Release/* $out/bin/
|
# + lib.optionalString hostPlatform.isx86_64 "-D__x86_64__"
|
||||||
|
# + lib.optionalString hostPlatform.isArm "-D__arm__";
|
||||||
|
NIX_CFLAGS_COMPILE = [ "-DDAEMON_UID=1"
|
||||||
|
"-DDAEMON_GID=1"
|
||||||
|
"-DDEFAULT_AT_QUEUE=\'a\'"
|
||||||
|
"-DDEFAULT_BATCH_QUEUE=\'b\'"
|
||||||
|
"-DPERM_PATH=\"/usr/lib/cron/\""
|
||||||
|
"-DOPEN_DIRECTORY"
|
||||||
|
"-DNO_DIRECT_RPC"
|
||||||
|
"-DAPPLE_GETCONF_UNDERSCORE"
|
||||||
|
"-DAPPLE_GETCONF_SPEC"
|
||||||
|
"-DUSE_PAM"
|
||||||
|
"-DUSE_BSM_AUDIT"
|
||||||
|
"-D_PW_NAME_LEN=MAXLOGNAME"
|
||||||
|
"-D_PW_YPTOKEN=\"__YP!\""
|
||||||
|
"-DAHZV1=64 "
|
||||||
|
"-DAU_SESSION_FLAG_HAS_TTY=0x4000"
|
||||||
|
"-DAU_SESSION_FLAG_HAS_AUTHENTICATED=0x4000"
|
||||||
|
] ++ lib.optional (!stdenv.isLinux) " -D__FreeBSD__ ";
|
||||||
|
|
||||||
# for n in 1 5 8; do
|
patchPhase = ''
|
||||||
# mkdir -p $out/share/man/man$n
|
substituteInPlace login.tproj/login.c \
|
||||||
# install */*.$n $out/share/man/man$n
|
--replace bsm/audit_session.h bsm/audit.h
|
||||||
# done
|
substituteInPlace login.tproj/login_audit.c \
|
||||||
# '';
|
--replace bsm/audit_session.h bsm/audit.h
|
||||||
|
'';
|
||||||
|
|
||||||
# For now we just build sysctl because that's all I need... Please open a
|
buildPhase = ''
|
||||||
# PR if you need any other utils before we fix the xcodebuild.
|
for dir in *.tproj; do
|
||||||
buildPhase = "cc sysctl.tproj/sysctl.c -o sysctl";
|
name=$(basename $dir)
|
||||||
|
name=''${name%.tproj}
|
||||||
|
|
||||||
installPhase =
|
CFLAGS=""
|
||||||
''
|
case $name in
|
||||||
mkdir -p $out/bin
|
arch) CFLAGS="-framework CoreFoundation";;
|
||||||
install sysctl $out/bin
|
atrun) CFLAGS="-Iat.tproj";;
|
||||||
for n in 5 8; do
|
chkpasswd)
|
||||||
mkdir -p $out/share/man/man$n
|
CFLAGS="-framework OpenDirectory -framework CoreFoundation -lpam";;
|
||||||
install sysctl.tproj/*.$n $out/share/man/man$n
|
getconf)
|
||||||
|
for f in getconf.tproj/*.gperf; do
|
||||||
|
cfile=''${f%.gperf}.c
|
||||||
|
LC_ALL=C awk -f getconf.tproj/fake-gperf.awk $f > $cfile
|
||||||
|
done
|
||||||
|
;;
|
||||||
|
iostat) CFLAGS="-framework IOKit -framework CoreFoundation";;
|
||||||
|
login) CFLAGS="-lbsm -lpam";;
|
||||||
|
nvram) CFLAGS="-framework CoreFoundation -framework IOKit";;
|
||||||
|
sadc) CFLAGS="-framework IOKit -framework CoreFoundation";;
|
||||||
|
sar) CFLAGS="-Isadc.tproj";;
|
||||||
|
esac
|
||||||
|
|
||||||
|
echo "Building $name"
|
||||||
|
|
||||||
|
case $name in
|
||||||
|
|
||||||
|
# These are all broken currently.
|
||||||
|
arch) continue;;
|
||||||
|
chpass) continue;;
|
||||||
|
dirhelper) continue;;
|
||||||
|
dynamic_pager) continue;;
|
||||||
|
fs_usage) continue;;
|
||||||
|
latency) continue;;
|
||||||
|
pagesize) continue;;
|
||||||
|
passwd) continue;;
|
||||||
|
reboot) continue;;
|
||||||
|
sc_usage) continue;;
|
||||||
|
shutdown) continue;;
|
||||||
|
trace) continue;;
|
||||||
|
|
||||||
|
*) cc $dir/*.c -I''${dir} $CFLAGS -o $name ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
'';
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
for dir in *.tproj; do
|
||||||
|
name=$(basename $dir)
|
||||||
|
name=''${name%.tproj}
|
||||||
|
[ -x $name ] && install -D $name $out/bin/$name
|
||||||
|
for n in 1 2 3 4 5 6 7 8 9; do
|
||||||
|
for f in $dir/*.$n; do
|
||||||
|
install -D $f $out/share/man/man$n/$(basename $f)
|
||||||
|
done
|
||||||
|
done
|
||||||
done
|
done
|
||||||
'';
|
'';
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
platforms = stdenv.lib.platforms.darwin;
|
platforms = stdenv.lib.platforms.darwin;
|
||||||
maintainers = with stdenv.lib.maintainers; [ shlevy ];
|
maintainers = with stdenv.lib.maintainers; [ shlevy matthewbauer ];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue