2018-06-27 20:36:00 +01:00
|
|
|
{ runCommand, toolchainName, fetchurl, makeWrapper, stdenv
|
|
|
|
, buildPackages, lib, writeText }:
|
2016-06-26 05:45:55 +01:00
|
|
|
|
|
|
|
let
|
|
|
|
|
2018-06-27 20:36:00 +01:00
|
|
|
inherit (lib) getBin optionalString;
|
2018-06-28 16:12:39 +01:00
|
|
|
inherit (lib.generators) toPlist;
|
2018-06-27 20:36:00 +01:00
|
|
|
|
2016-06-26 05:45:55 +01:00
|
|
|
ToolchainInfo = {
|
|
|
|
Identifier = toolchainName;
|
|
|
|
};
|
|
|
|
|
2018-06-27 20:36:00 +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.
|
2017-03-22 03:22:15 +00:00
|
|
|
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 05:45:55 +01:00
|
|
|
in
|
|
|
|
|
2018-06-27 20:36:00 +01:00
|
|
|
runCommand "nixpkgs.xctoolchain" {
|
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
|
|
|
} (''
|
|
|
|
mkdir -p $out
|
2018-06-28 16:12:39 +01:00
|
|
|
install -D ${writeText "ToolchainInfo.plist" (toPlist {} ToolchainInfo)} $out/ToolchainInfo.plist
|
2018-06-27 20:36:00 +01: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
|
|
|
|
|
|
|
|
for bin in ${getBin stdenv.cc}/bin/*; do
|
|
|
|
ln -s $bin $out/usr/bin
|
|
|
|
done
|
|
|
|
|
|
|
|
for bin in ${getBin stdenv.cc.bintools.bintools}/bin/*; do
|
|
|
|
if ! [ -e "$out/usr/bin/$(basename $bin)" ]; then
|
|
|
|
ln -s $bin $out/usr/bin
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
ln -s ${buildPackages.yacc}/bin/yacc $out/usr/bin/yacc
|
|
|
|
ln -s ${buildPackages.yacc}/bin/bison $out/usr/bin/bison
|
|
|
|
ln -s ${buildPackages.flex}/bin/flex $out/usr/bin/flex
|
|
|
|
ln -s ${buildPackages.flex}/bin/flex++ $out/usr/bin/flex++
|
|
|
|
ln -s $out/bin/flex $out/usr/bin/lex
|
|
|
|
|
|
|
|
ln -s ${buildPackages.m4}/bin/m4 $out/usr/bin/m4
|
|
|
|
ln -s $out/usr/bin/m4 $out/usr/bin/gm4
|
|
|
|
|
|
|
|
ln -s ${buildPackages.unifdef}/bin/unifdef $out/usr/bin/unifdef
|
|
|
|
ln -s ${buildPackages.unifdef}/bin/unifdefall $out/usr/bin/unifdefall
|
|
|
|
|
|
|
|
ln -s ${buildPackages.gperf}/bin/gperf $out/usr/bin/gperf
|
|
|
|
ln -s ${buildPackages.indent}/bin/indent $out/usr/bin/indent
|
|
|
|
ln -s ${buildPackages.ctags}/bin/ctags $out/usr/bin/ctags
|
|
|
|
'' + optionalString stdenv.isDarwin ''
|
|
|
|
ln -s ${buildPackages.darwin.bootstrap_cmds}/bin/mig $out/usr/bin
|
|
|
|
ln -s ${mkdep-darwin-src} $out/usr/bin/mkdep
|
|
|
|
'')
|