xcbuild: Get rid of developer.nix, move to wrapper

also:

- add custom outputs "specs" for xcbuild
- get rid of unneeded tools
- update xcbuild
- add more comments
- fixup xcbuild derivations

Affected xcbuild derivations include:

- adv_cmds
- network_cmds
- basic_cmds
This commit is contained in:
Matthew Bauer 2016-11-12 15:51:25 -06:00
parent 4685bd7853
commit fc1f6f55ea
No known key found for this signature in database
GPG key ID: E04D0AD9469141C3
7 changed files with 35 additions and 55 deletions

View file

@ -1,18 +0,0 @@
{ stdenv, platform, toolchain, xcbuild, writeText }:
stdenv.mkDerivation {
name = "Xcode.app";
buildInputs = [ xcbuild ];
buildCommand = ''
mkdir -p $out/Contents/Developer/Library/Xcode/Specifications/
cp ${xcbuild}/Library/Xcode/Specifications/* $out/Contents/Developer/Library/Xcode/Specifications/
mkdir -p $out/Contents/Developer/Platforms/
cd $out/Contents/Developer/Platforms/
ln -s ${platform}
mkdir -p $out/Contents/Developer/Toolchains/
cd $out/Contents/Developer/Toolchains/
ln -s ${toolchain}
'';
}

View file

@ -12,33 +12,11 @@ let
ProjectName = "OSXPlatformSupport";
};
Tools = [
{
Identifier = "com.apple.build-tools.nmedit";
Type = "Tool";
Name = "Nmedit";
}
{
Identifier = "com.apple.compilers.resource-copier";
Type = "Tool";
Name = "Resource Copier";
}
{
Identifier = "com.apple.compilers.yacc";
Type = "Tool";
Name = "Yacc";
InputFileTypes = [ "sourcecode.yacc" ];
ExecDescription = "Yacc $(InputFile)";
}
{
Identifier = "com.apple.compilers.lex";
Type = "Tool";
Name = "Lex";
ExecDescription = "Lex $(InputFile)";
InputFileTypes = [ "sourcecode.lex" ];
}
];
# These files are all based off of Xcode spec fies found in
# /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Xcode/Speciications/.
# Based off of the MacOSX Architectures.xcpsec file. All i386 stuff
# is removed because NixPkgs only supports darwin-x86_64.
Architectures = [
{
Identifier = "Standard";
@ -81,6 +59,8 @@ let
}
];
# Based off of the MacOSX Package Types.xcpsec file. Only keep the
# bare minimum needed.
PackageTypes = [
{
Identifier = "com.apple.package-type.mach-o-executable";
@ -123,6 +103,9 @@ let
}
];
# Based off of the MacOSX Product Types.xcpsec file. All
# bundles/wrapper are removed, because we prefer dynamic products in
# NixPkgs.
ProductTypes = [
{
Identifier = "com.apple.product-type.tool";
@ -158,7 +141,6 @@ stdenv.mkDerivation {
mkdir -p $out/Developer/Library/Xcode/Specifications/
cd $out/Developer/Library/Xcode/Specifications/
plutil -convert xml1 -o Tools.xcspec ${writeText "Tools.xcspec" (builtins.toJSON Tools)}
plutil -convert xml1 -o Architectures.xcspec ${writeText "Architectures.xcspec" (builtins.toJSON Architectures)}
plutil -convert xml1 -o PackageTypes.xcspec ${writeText "PackageTypes.xcspec" (builtins.toJSON PackageTypes)}
plutil -convert xml1 -o ProductTypes.xcspec ${writeText "ProductTypes.xcspec" (builtins.toJSON ProductTypes)}

View file

@ -5,7 +5,7 @@ xcbuildBuildPhase() {
echo "running xcodebuild"
xcodebuild OTHER_CFLAGS="$NIX_CFLAGS_COMPILE" OTHER_LDFLAGS="$NIX_LDFLAGS" build
xcodebuild OTHER_CFLAGS="$NIX_CFLAGS_COMPILE" OTHER_CPLUSPLUSFLAGS="$NIX_CFLAGS_COMPILE" OTHER_LDFLAGS="$NIX_LDFLAGS" build
runHook postBuild
}

View file

@ -23,10 +23,6 @@ let
inherit sdk platformName xcbuild;
};
developer = callPackage ./developer.nix {
inherit platform toolchain xcbuild;
};
xcconfig = writeText "nix.xcconfig" ''
SDKROOT=${sdkName}
'';
@ -50,13 +46,22 @@ stdenv.mkDerivation {
ln -s $file
done
mkdir -p $out/Library/Xcode/
ln -s ${xcbuild}/Library/Xcode/Specifications $out/Library/Xcode/Specifications
mkdir -p $out/Platforms/
ln -s ${platform} $out/Platforms/
mkdir -p $out/Toolchains/
ln -s ${toolchain} $out/Toolchains/
wrapProgram $out/bin/xcodebuild \
--add-flags "-xcconfig ${xcconfig}" \
--add-flags "DERIVED_DATA_DIR=." \
--set DEVELOPER_DIR "${developer}"
--set DEVELOPER_DIR "$out"
wrapProgram $out/bin/xcrun \
--add-flags "-sdk ${sdkName}" \
--set DEVELOPER_DIR "${developer}"
--set DEVELOPER_DIR "$out"
'';
passthru = {

View file

@ -8,9 +8,13 @@ appleDerivation {
# - os/base_private.h
# - _simple.h
# We disable it here for now. TODO: build pkill inside adv_cmds
# We also disable locale here because of some issues with a missing
# "lstdc++".
patchPhase = ''
substituteInPlace adv_cmds.xcodeproj/project.pbxproj \
--replace "FD201DC214369B4200906237 /* pkill.c in Sources */," ""
--replace "FD201DC214369B4200906237 /* pkill.c in Sources */," "" \
--replace "FDF278D60FC6204E00D7A3C6 /* locale.cc in Sources */," ""
'';
# temporary install phase until xcodebuild has "install" support

View file

@ -3,6 +3,14 @@
appleDerivation rec {
buildInputs = [ xcbuild ];
# These PBXcp calls should be patched in xcbuild to allow them to
# automatically be prefixed.
patchPhase = ''
substituteInPlace basic_cmds.xcodeproj/project.pbxproj \
--replace "dstPath = /usr/share/man/man1;" "dstPath = $out/share/man/man1;" \
--replace "dstPath = /usr/share/man/man5;" "dstPath = $out/share/man/man5;"
'';
# temporary install phase until xcodebuild has "install" support
installPhase = ''
mkdir -p $out/bin/
@ -12,7 +20,6 @@ appleDerivation rec {
mkdir -p $out/share/man/man$n
install */*.$n $out/share/man/man$n
done
'';
meta = {

View file

@ -3,7 +3,7 @@
appleDerivation rec {
buildInputs = [ xcbuild openssl xnu Librpcsvc libpcap developer_cmds ];
NIX_CFLAGS_COMPILE = " -I./unbound -I${xnu}/Library/Frameworks/System.framework/Headers/ -D__APPLE_USE_RFC_2292 -DIPV6_DONTFRAG=14 -DINET6";
NIX_CFLAGS_COMPILE = " -I./unbound -I${xnu}/Library/Frameworks/System.framework/Headers/";
# "spray" requires some files that aren't compiling correctly in xcbuild.
# "rtadvd" seems to fail with some missing constants.