mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-16 14:54:29 +01:00
Clean up command-line tools a bit to allow us to use an impure
hdiutil (for an upcoming bootstrapped stdenv for darwin!) Closes #4382
This commit is contained in:
parent
ae32accc47
commit
aa7839c145
4 changed files with 59 additions and 75 deletions
|
@ -1,37 +1,71 @@
|
|||
{ stdenv, callPackage, fetchadc, xpwn, xar, gzip, cpio }:
|
||||
{ stdenv, fetchadc, xar, gzip, cpio }:
|
||||
|
||||
let
|
||||
cmdline_packages = stdenv.mkDerivation {
|
||||
name = "osx-10.9-command-line-tools-packages";
|
||||
name = "command-line-tools-mac-os-10.9";
|
||||
|
||||
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";
|
||||
};
|
||||
pkg = { installPhase }: stdenv.mkDerivation {
|
||||
name = "${name}.pkg";
|
||||
|
||||
phases = [ "unpackPhase" "installPhase" ];
|
||||
phases = [ "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
|
||||
'';
|
||||
inherit installPhase;
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
description = "Basis for the Mac OS command-line tools package";
|
||||
description = "Developer tools .pkg file";
|
||||
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; };
|
||||
|
||||
basic = pkg: stdenv.mkDerivation {
|
||||
inherit name;
|
||||
|
||||
phases = [ "unpackPhase" "installPhase" ];
|
||||
|
||||
outputs = [ "sdk" "tools" ];
|
||||
|
||||
unpackPhase = ''
|
||||
${xar}/bin/xar -x -f "${pkg}"
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
start="$(pwd)"
|
||||
mkdir -p $sdk
|
||||
mkdir -p $tools
|
||||
|
||||
cd $sdk
|
||||
cat $start/DevSDK_OSX109.pkg/Payload | ${gzip}/bin/gzip -d | ${cpio}/bin/cpio -idm
|
||||
|
||||
cd $tools
|
||||
cat $start/CLTools_Executables.pkg/Payload | ${gzip}/bin/gzip -d | ${cpio}/bin/cpio -idm
|
||||
'';
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
description = "Mac OS command-line developer tools and SDK";
|
||||
maintainers = with maintainers; [ copumpkin ];
|
||||
platforms = platforms.darwin;
|
||||
license = licenses.unfree;
|
||||
};
|
||||
};
|
||||
in rec {
|
||||
dmg = 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";
|
||||
};
|
||||
|
||||
pure = { xpwn }: basic (pkg {
|
||||
installPhase = ''
|
||||
${xpwn}/bin/hdutil ${dmg} extract "Command Line Tools (OS X 10.9).pkg" $out
|
||||
'';
|
||||
});
|
||||
|
||||
impure = basic (pkg {
|
||||
installPhase = ''
|
||||
/usr/bin/hdiutil attach ${dmg} -mountpoint clt-mount -nobrowse
|
||||
cp "clt-mount/Command Line Tools (OS X 10.9).pkg" $out
|
||||
/usr/bin/hdiutil unmount clt-mount
|
||||
'';
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
{ 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;
|
||||
};
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
{ 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;
|
||||
};
|
||||
}
|
|
@ -7563,7 +7563,7 @@ let
|
|||
cramfsswap = callPackage ../os-specific/linux/cramfsswap { };
|
||||
|
||||
darwin = let
|
||||
cmdline = callPackage ../os-specific/darwin/command-line-tools {};
|
||||
cmdline = (callPackage ../os-specific/darwin/command-line-tools {}).pure { inherit xpwn; };
|
||||
in rec {
|
||||
cctools = forceNativeDrv (callPackage ../os-specific/darwin/cctools-port {
|
||||
cross = assert crossSystem != null; crossSystem;
|
||||
|
|
Loading…
Reference in a new issue