Add Apple command-line tools

Closes #4365
This commit is contained in:
Daniel Peebles 2014-10-01 21:57:27 -04:00 committed by Mateusz Kowalczyk
parent 59418454e6
commit c55c435ade
5 changed files with 107 additions and 9 deletions

View File

@ -10,8 +10,8 @@ let
];
in
{ # URL to fetch.
url
{ # Path to fetch.
path
# Hash of the downloaded file
, sha256
@ -19,13 +19,14 @@ in
, # Additional curl options needed for the download to succeed.
curlOpts ? ""
, # Name of the file. If empty, use the basename of `url' (or of the
# first element of `urls').
, # Name of the file. If empty, use the basename of `path'.
name ? ""
}:
stdenv.mkDerivation {
name = if name != "" then name else baseNameOf (toString url);
url = "https://developer.apple.com/downloads/download.action?path=${path}";
name = if name != "" then name else baseNameOf path;
builder = ./builder.sh;
buildInputs = [ curl ];
@ -39,7 +40,7 @@ stdenv.mkDerivation {
outputHash = sha256;
outputHashMode = "flat";
inherit curlOpts url adc_user adc_pass;
inherit curlOpts adc_user adc_pass;
preferLocalBuild = true;
}
}

View File

@ -0,0 +1,37 @@
{ stdenv, callPackage, fetchadc, xpwn, xar, gzip, cpio }:
let
cmdline_packages = stdenv.mkDerivation {
name = "osx-10.9-command-line-tools-packages";
src = fetchadc {
# Isn't this a beautiful path? Note the subtle differences before and after the slash!
path = "Developer_Tools/command_line_tools_os_x_10.9_for_xcode__xcode_6/command_line_tools_for_os_x_10.9_for_xcode_6.dmg";
sha256 = "0zrpf73r3kfk9pdh6p6j6w1sbw7s2pp0f8rd83660r5hk1y3j5jc";
};
phases = [ "unpackPhase" "installPhase" ];
outputs = [ "devsdk" "cltools" ];
unpackPhase = ''
${xpwn}/bin/hdutil $src extract "Command Line Tools (OS X 10.9).pkg" "Command Line Tools (OS X 10.9).pkg"
${xar}/bin/xar -x -f "Command Line Tools (OS X 10.9).pkg"
'';
installPhase = ''
cp -r DevSDK_OSX109.pkg/ $devsdk
cp -r CLTools_Executables.pkg/ $cltools
'';
meta = with stdenv.lib; {
description = "Basis for the Mac OS command-line tools package";
maintainers = with maintainers; [ copumpkin ];
platforms = platforms.darwin;
license = licenses.unfree;
};
};
in {
sdk = callPackage ./sdk.nix { inherit cmdline_packages; };
tools = callPackage ./tools.nix { inherit cmdline_packages; };
}

View File

@ -0,0 +1,25 @@
{ stdenv, cpio, gzip, cmdline_packages }:
stdenv.mkDerivation {
name = "osx-command-line-sdk-10.9";
src = cmdline_packages.devsdk;
phases = [ "unpackPhase" "installPhase" "fixupPhase" ];
unpackPhase = ''
cat $src/Payload | ${gzip}/bin/gzip -d | ${cpio}/bin/cpio -idm
'';
installPhase = ''
mkdir -p $out
cp -r System $out
cp -r usr/* $out
'';
meta = with stdenv.lib; {
description = "Apple command-line tools SDK (headers and man pages)";
maintainers = with maintainers; [ copumpkin ];
platforms = platforms.darwin;
license = licenses.unfree;
};
}

View File

@ -0,0 +1,25 @@
{ stdenv, cpio, gzip, cmdline_packages }:
stdenv.mkDerivation {
name = "osx-command-line-sdk-10.9";
src = cmdline_packages.cltools;
phases = [ "unpackPhase" "installPhase" "fixupPhase" ];
unpackPhase = ''
cat $src/Payload | ${gzip}/bin/gzip -d | ${cpio}/bin/cpio -idm
'';
installPhase = ''
mkdir -p $out
cp -r Library/Developer/CommandLineTools/Library $out
cp -r Library/Developer/CommandLineTools/usr/* $out
'';
meta = with stdenv.lib; {
description = "Apple command-line developer tools";
maintainers = with maintainers; [ copumpkin ];
platforms = platforms.darwin;
license = licenses.unfree;
};
}

View File

@ -285,7 +285,12 @@ let
fetchadc = import ../build-support/fetchadc {
inherit curl stdenv;
inherit (config) adc_user adc_pass;
adc_user = if config ? adc_user
then config.adc_user
else throw "You need an adc_user attribute in your config to download files from Apple Developer Connection";
adc_pass = if config ? adc_pass
then config.adc_pass
else throw "You need an adc_pass attribute in your config to download files from Apple Developer Connection";
};
fetchbower = import ../build-support/fetchbower {
@ -7550,7 +7555,9 @@ let
cramfsswap = callPackage ../os-specific/linux/cramfsswap { };
darwin = rec {
darwin = let
cmdline = callPackage ../os-specific/darwin/command-line-tools {};
in rec {
cctools = forceNativeDrv (callPackage ../os-specific/darwin/cctools-port {
cross = assert crossSystem != null; crossSystem;
inherit maloader;
@ -7569,6 +7576,9 @@ let
osx_private_sdk = callPackage ../os-specific/darwin/osx-private-sdk { inherit osx_sdk; };
security_tool = callPackage ../os-specific/darwin/security-tool { inherit osx_private_sdk; };
cmdline_sdk = cmdline.sdk;
cmdline_tools = cmdline.tools;
};
devicemapper = lvm2;