2017-03-22 04:22:15 +01:00
|
|
|
{stdenv, writeText, toolchainName, xcbuild, fetchurl
|
2016-11-10 21:53:28 +01:00
|
|
|
, llvm, cctools, gcc, bootstrap_cmds, binutils
|
2017-04-09 11:27:21 +02:00
|
|
|
, yacc, flex, m4, unifdef, gperf, indent, ctags, makeWrapper
|
2017-04-12 10:23:28 +02:00
|
|
|
, xib2nib}:
|
2016-06-26 06:45:55 +02:00
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
ToolchainInfo = {
|
|
|
|
Identifier = toolchainName;
|
|
|
|
};
|
|
|
|
|
2017-03-22 04:22:15 +01:00
|
|
|
# We could pull this out of developer_cmds but it adds an annoying loop if we want to bootstrap and
|
|
|
|
# this is just a tiny script so I'm not going to bother
|
|
|
|
mkdep-darwin-src = fetchurl {
|
|
|
|
url = "https://opensource.apple.com/source/developer_cmds/developer_cmds-63/mkdep/mkdep.sh";
|
|
|
|
sha256 = "0n4wpqfslfjs5zbys5yri8pfi2awyhlmknsf6laa5jzqbzq9x541";
|
|
|
|
executable = true;
|
|
|
|
};
|
2016-06-26 06:45:55 +02:00
|
|
|
in
|
|
|
|
|
|
|
|
stdenv.mkDerivation {
|
|
|
|
name = "nixpkgs.xctoolchain";
|
2016-11-06 01:51:15 +01:00
|
|
|
buildInputs = [ xcbuild makeWrapper ];
|
2016-11-10 21:53:28 +01:00
|
|
|
|
2017-03-22 04:22:15 +01:00
|
|
|
## cctools should build on Linux but it doesn't currently
|
2016-11-10 21:53:28 +01:00
|
|
|
|
2016-06-26 06:45:55 +02:00
|
|
|
buildCommand = ''
|
|
|
|
mkdir -p $out
|
2016-11-06 01:51:15 +01:00
|
|
|
plutil -convert xml1 -o $out/ToolchainInfo.plist ${writeText "ToolchainInfo.plist" (builtins.toJSON ToolchainInfo)}
|
2016-06-26 06:45:55 +02:00
|
|
|
|
|
|
|
mkdir -p $out/usr/include
|
|
|
|
mkdir -p $out/usr/lib
|
|
|
|
mkdir -p $out/usr/libexec
|
|
|
|
mkdir -p $out/usr/share
|
|
|
|
|
|
|
|
mkdir -p $out/usr/bin
|
|
|
|
cd $out/usr/bin
|
2016-11-10 21:53:28 +01:00
|
|
|
ln -s ${stdenv.cc}/bin/cpp
|
|
|
|
ln -s ${stdenv.cc}/bin/c++
|
|
|
|
ln -s ${stdenv.cc}/bin/cc
|
2016-06-26 06:45:55 +02:00
|
|
|
ln -s c++ clang++
|
2016-11-06 01:51:15 +01:00
|
|
|
ln -s cc clang
|
2016-06-26 06:45:55 +02:00
|
|
|
|
|
|
|
ln -s ${llvm}/bin/llvm-cov
|
|
|
|
ln -s ${llvm}/bin/llvm-dsymutil
|
|
|
|
ln -s ${llvm}/bin/llvm-dwarfdump
|
|
|
|
ln -s ${llvm}/bin/llvm-nm
|
|
|
|
ln -s ${llvm}/bin/llvm-objdump
|
|
|
|
ln -s ${llvm}/bin/llvm-otool
|
|
|
|
ln -s ${llvm}/bin/llvm-profdata
|
|
|
|
ln -s ${llvm}/bin/llvm-size
|
|
|
|
|
|
|
|
ln -s ${yacc}/bin/yacc
|
|
|
|
ln -s ${yacc}/bin/bison
|
|
|
|
ln -s ${flex}/bin/flex
|
|
|
|
ln -s ${flex}/bin/flex++
|
2016-11-06 01:51:15 +01:00
|
|
|
|
2016-06-26 06:45:55 +02:00
|
|
|
ln -s flex lex
|
2016-11-06 01:51:15 +01:00
|
|
|
|
2016-06-26 06:45:55 +02:00
|
|
|
ln -s ${m4}/bin/m4
|
|
|
|
ln -s m4 gm4
|
|
|
|
|
|
|
|
ln -s ${unifdef}/bin/unifdef
|
|
|
|
ln -s ${unifdef}/bin/unifdefall
|
|
|
|
|
2016-11-06 01:51:15 +01:00
|
|
|
ln -s ${gperf}/bin/gperf
|
|
|
|
ln -s ${indent}/bin/indent
|
|
|
|
ln -s ${ctags}/bin/ctags
|
2016-11-10 21:53:28 +01:00
|
|
|
'' + stdenv.lib.optionalString stdenv.isDarwin ''
|
|
|
|
ln -s ${bootstrap_cmds}/bin/mig
|
|
|
|
ln -s ${binutils}/bin/lipo
|
|
|
|
|
|
|
|
ln -s ${cctools}/bin/ar
|
|
|
|
ln -s ${cctools}/bin/as
|
|
|
|
ln -s ${cctools}/bin/nm
|
|
|
|
ln -s ${cctools}/bin/nmedit
|
|
|
|
ln -s ${cctools}/bin/ld
|
|
|
|
ln -s ${cctools}/bin/libtool
|
|
|
|
ln -s ${cctools}/bin/strings
|
|
|
|
ln -s ${cctools}/bin/strip
|
|
|
|
ln -s ${cctools}/bin/install_name_tool
|
|
|
|
ln -s ${cctools}/bin/bitcode_strip
|
|
|
|
ln -s ${cctools}/bin/codesign_allocate
|
|
|
|
ln -s ${cctools}/bin/dsymutil
|
|
|
|
ln -s ${cctools}/bin/dyldinfo
|
|
|
|
ln -s ${cctools}/bin/otool
|
|
|
|
ln -s ${cctools}/bin/unwinddump
|
|
|
|
ln -s ${cctools}/bin/size
|
|
|
|
ln -s ${cctools}/bin/segedit
|
|
|
|
ln -s ${cctools}/bin/pagestuff
|
|
|
|
ln -s ${cctools}/bin/ranlib
|
|
|
|
ln -s ${cctools}/bin/redo_prebinding
|
2017-04-09 11:27:21 +02:00
|
|
|
|
2017-04-12 10:23:28 +02:00
|
|
|
ln -s ${xib2nib}/bin/ibtool
|
2017-03-22 04:22:15 +01:00
|
|
|
'' +
|
|
|
|
# No point including the entire gcc closure if we don't already have it
|
|
|
|
(if stdenv.cc.isClang then ''
|
|
|
|
ln -s ${stdenv.cc.cc.llvm}/bin/llvm-cov gcov
|
|
|
|
ln -s ${mkdep-darwin-src} mkdep
|
|
|
|
'' else ''
|
|
|
|
ln -s ${gcc}/bin/gcov
|
|
|
|
ln -s ${gcc}/bin/mkdep
|
|
|
|
'');
|
2016-06-26 06:45:55 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
# other commands in /bin/
|
|
|
|
# asa
|
2016-11-06 01:51:15 +01:00
|
|
|
# cmpdylib (in cctools)
|
|
|
|
# ctf_insert (in cctools)
|
2016-06-26 06:45:55 +02:00
|
|
|
# dwarfdump
|
|
|
|
# lorder
|
|
|
|
# rebase
|
2016-11-06 01:51:15 +01:00
|
|
|
# rpcgen (in developer_cmds)
|
|
|
|
# what
|
|
|
|
|
|
|
|
|
|
|
|
# swift: see #11463
|
2016-06-26 06:45:55 +02:00
|
|
|
# swift
|
|
|
|
# swift-compress
|
|
|
|
# swift-demangle
|
|
|
|
# swift-stdlib-tool
|
|
|
|
# swift-update
|
|
|
|
# swiftc
|