xcbuild: rework to use lib.PLIST
This is a good way to test that plist works. Sorry for the large diff. There are a bunch of cleanups in here that needed to be done. Should make it possible to use in cross compilation.
This commit is contained in:
parent
3210dd3039
commit
c672e37f4a
@ -1,4 +1,5 @@
|
|||||||
{ stdenv, cmake, fetchFromGitHub, zlib, libxml2, libpng, CoreServices, CoreGraphics, ImageIO, ninja }:
|
{ stdenv, cmake, fetchFromGitHub, zlib, libxml2, libpng
|
||||||
|
, CoreServices, CoreGraphics, ImageIO, ninja }:
|
||||||
|
|
||||||
let
|
let
|
||||||
googletest = fetchFromGitHub {
|
googletest = fetchFromGitHub {
|
||||||
@ -17,7 +18,8 @@ let
|
|||||||
in stdenv.mkDerivation rec {
|
in stdenv.mkDerivation rec {
|
||||||
name = "xcbuild-${version}";
|
name = "xcbuild-${version}";
|
||||||
|
|
||||||
# Once a version is released that includes https://github.com/facebook/xcbuild/commit/183c087a6484ceaae860c6f7300caf50aea0d710,
|
# Once a version is released that includes
|
||||||
|
# https://github.com/facebook/xcbuild/commit/183c087a6484ceaae860c6f7300caf50aea0d710,
|
||||||
# we can stop doing this -pre thing.
|
# we can stop doing this -pre thing.
|
||||||
version = "0.1.2-pre";
|
version = "0.1.2-pre";
|
||||||
|
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
{ stdenv, sdk, writeText, platformName, xcbuild }:
|
{ runCommand, lib, sdk, platformName, writeText }:
|
||||||
|
|
||||||
let
|
let
|
||||||
|
|
||||||
|
inherit (lib.generators) toPLIST;
|
||||||
|
|
||||||
Info = {
|
Info = {
|
||||||
CFBundleIdentifier = platformName;
|
CFBundleIdentifier = platformName;
|
||||||
Type = "Platform";
|
Type = "Platform";
|
||||||
@ -283,24 +285,14 @@ let
|
|||||||
|
|
||||||
in
|
in
|
||||||
|
|
||||||
stdenv.mkDerivation {
|
runCommand "MacOSX.platform" {} ''
|
||||||
name = "MacOSX.platform";
|
install -D ${writeText "Info.plist" (toPLIST Info)} $out/Info.plist
|
||||||
buildInputs = [ xcbuild ];
|
install -D ${writeText "version.plist" (toPLIST Version)} $out/version.plist
|
||||||
buildCommand = ''
|
install -D ${writeText "Architectures.xcspec" (toPLIST Architectures)} $out/Developer/Library/Xcode/Specifications/Architectures.xcspec
|
||||||
mkdir -p $out/
|
install -D ${writeText "PackageTypes.xcspec" (toPLIST PackageTypes)} $out/Developer/Library/Xcode/Specifications/PackageTypes.xcspec
|
||||||
cd $out/
|
install -D ${writeText "ProductTypes.xcspec" (toPLIST ProductTypes)} $out/Developer/Library/Xcode/Specifications/ProductTypes.xcspec
|
||||||
|
|
||||||
plutil -convert xml1 -o Info.plist ${writeText "Info.plist" (builtins.toJSON Info)}
|
mkdir -p $out/Developer/SDKs/
|
||||||
plutil -convert xml1 -o version.plist ${writeText "version.plist" (builtins.toJSON Version)}
|
cd $out/Developer/SDKs/
|
||||||
|
cp -r ${sdk} ${sdk.name}
|
||||||
mkdir -p $out/Developer/Library/Xcode/Specifications/
|
''
|
||||||
cd $out/Developer/Library/Xcode/Specifications/
|
|
||||||
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)}
|
|
||||||
|
|
||||||
mkdir -p $out/Developer/SDKs/
|
|
||||||
cd $out/Developer/SDKs/
|
|
||||||
cp -r ${sdk} ${sdk.name}
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
{ stdenv, writeText, toolchainName, sdkName, xcbuild }:
|
{ runCommand, lib, toolchainName, sdkName, writeText }:
|
||||||
|
|
||||||
let
|
let
|
||||||
|
inherit (lib.generators) toPLIST;
|
||||||
|
|
||||||
# TODO: expose MACOSX_DEPLOYMENT_TARGET in nix so we can use it here.
|
# TODO: expose MACOSX_DEPLOYMENT_TARGET in nix so we can use it here.
|
||||||
version = "10.10";
|
version = "10.10";
|
||||||
|
|
||||||
@ -19,17 +21,9 @@ let
|
|||||||
};
|
};
|
||||||
in
|
in
|
||||||
|
|
||||||
stdenv.mkDerivation {
|
runCommand "MacOSX${version}.sdk" {
|
||||||
name = "MacOSX${version}.sdk";
|
|
||||||
inherit version;
|
inherit version;
|
||||||
|
} ''
|
||||||
buildInputs = [ xcbuild ];
|
install -D ${writeText "SDKSettings.plist" (toPLIST SDKSettings)} $out/SDKSettings.plist
|
||||||
|
install -D ${writeText "SystemVersion.plist" (toPLIST SystemVersion)} $out/System/Library/CoreServices/SystemVersion.plist
|
||||||
buildCommand = ''
|
''
|
||||||
mkdir -p $out/
|
|
||||||
plutil -convert xml1 -o $out/SDKSettings.plist ${writeText "SDKSettings.json" (builtins.toJSON SDKSettings)}
|
|
||||||
|
|
||||||
mkdir -p $out/System/Library/CoreServices/
|
|
||||||
plutil -convert xml1 -o $out/System/Library/CoreServices/SystemVersion.plist ${writeText "SystemVersion.plist" (builtins.toJSON SystemVersion)}
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
|
@ -1,16 +1,18 @@
|
|||||||
{stdenv, writeText, toolchainName, xcbuild, fetchurl
|
{ runCommand, toolchainName, fetchurl, makeWrapper, stdenv
|
||||||
, llvm, cctools, gcc, bootstrap_cmds, binutils
|
, buildPackages, lib, writeText }:
|
||||||
, yacc, flex, m4, unifdef, gperf, indent, ctags, makeWrapper
|
|
||||||
, xib2nib}:
|
|
||||||
|
|
||||||
let
|
let
|
||||||
|
|
||||||
|
inherit (lib) getBin optionalString;
|
||||||
|
inherit (lib.generators) toPLIST;
|
||||||
|
|
||||||
ToolchainInfo = {
|
ToolchainInfo = {
|
||||||
Identifier = toolchainName;
|
Identifier = toolchainName;
|
||||||
};
|
};
|
||||||
|
|
||||||
# We could pull this out of developer_cmds but it adds an annoying loop if we want to bootstrap and
|
# We could pull this out of developer_cmds but it adds an annoying
|
||||||
# this is just a tiny script so I'm not going to bother
|
# loop if we want to bootstrap and this is just a tiny script so I'm
|
||||||
|
# not going to bother.
|
||||||
mkdep-darwin-src = fetchurl {
|
mkdep-darwin-src = fetchurl {
|
||||||
url = "https://opensource.apple.com/source/developer_cmds/developer_cmds-63/mkdep/mkdep.sh";
|
url = "https://opensource.apple.com/source/developer_cmds/developer_cmds-63/mkdep/mkdep.sh";
|
||||||
sha256 = "0n4wpqfslfjs5zbys5yri8pfi2awyhlmknsf6laa5jzqbzq9x541";
|
sha256 = "0n4wpqfslfjs5zbys5yri8pfi2awyhlmknsf6laa5jzqbzq9x541";
|
||||||
@ -18,106 +20,44 @@ let
|
|||||||
};
|
};
|
||||||
in
|
in
|
||||||
|
|
||||||
stdenv.mkDerivation {
|
runCommand "nixpkgs.xctoolchain" {
|
||||||
name = "nixpkgs.xctoolchain";
|
nativeBuildInputs = [ makeWrapper ];
|
||||||
buildInputs = [ xcbuild makeWrapper ];
|
} (''
|
||||||
|
mkdir -p $out
|
||||||
|
install -D ${writeText "ToolchainInfo.plist" (toPLIST ToolchainInfo)} $out/ToolchainInfo.plist
|
||||||
|
|
||||||
## cctools should build on Linux but it doesn't currently
|
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
|
||||||
|
|
||||||
buildCommand = ''
|
for bin in ${getBin stdenv.cc}/bin/*; do
|
||||||
mkdir -p $out
|
ln -s $bin $out/usr/bin
|
||||||
plutil -convert xml1 -o $out/ToolchainInfo.plist ${writeText "ToolchainInfo.plist" (builtins.toJSON ToolchainInfo)}
|
done
|
||||||
|
|
||||||
mkdir -p $out/usr/include
|
for bin in ${getBin stdenv.cc.bintools.bintools}/bin/*; do
|
||||||
mkdir -p $out/usr/lib
|
if ! [ -e "$out/usr/bin/$(basename $bin)" ]; then
|
||||||
mkdir -p $out/usr/libexec
|
ln -s $bin $out/usr/bin
|
||||||
mkdir -p $out/usr/share
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
mkdir -p $out/usr/bin
|
ln -s ${buildPackages.yacc}/bin/yacc $out/usr/bin/yacc
|
||||||
cd $out/usr/bin
|
ln -s ${buildPackages.yacc}/bin/bison $out/usr/bin/bison
|
||||||
ln -s ${stdenv.cc}/bin/cpp
|
ln -s ${buildPackages.flex}/bin/flex $out/usr/bin/flex
|
||||||
ln -s ${stdenv.cc}/bin/c++
|
ln -s ${buildPackages.flex}/bin/flex++ $out/usr/bin/flex++
|
||||||
ln -s ${stdenv.cc}/bin/cc
|
ln -s $out/bin/flex $out/usr/bin/lex
|
||||||
ln -s c++ clang++
|
|
||||||
ln -s cc clang
|
|
||||||
|
|
||||||
ln -s ${llvm}/bin/llvm-cov
|
ln -s ${buildPackages.m4}/bin/m4 $out/usr/bin/m4
|
||||||
ln -s ${llvm}/bin/llvm-dsymutil
|
ln -s $out/usr/bin/m4 $out/usr/bin/gm4
|
||||||
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 ${buildPackages.unifdef}/bin/unifdef $out/usr/bin/unifdef
|
||||||
ln -s ${yacc}/bin/bison
|
ln -s ${buildPackages.unifdef}/bin/unifdefall $out/usr/bin/unifdefall
|
||||||
ln -s ${flex}/bin/flex
|
|
||||||
ln -s ${flex}/bin/flex++
|
|
||||||
|
|
||||||
ln -s flex lex
|
ln -s ${buildPackages.gperf}/bin/gperf $out/usr/bin/gperf
|
||||||
|
ln -s ${buildPackages.indent}/bin/indent $out/usr/bin/indent
|
||||||
ln -s ${m4}/bin/m4
|
ln -s ${buildPackages.ctags}/bin/ctags $out/usr/bin/ctags
|
||||||
ln -s m4 gm4
|
'' + optionalString stdenv.isDarwin ''
|
||||||
|
ln -s ${buildPackages.darwin.bootstrap_cmds}/bin/mig $out/usr/bin
|
||||||
ln -s ${unifdef}/bin/unifdef
|
ln -s ${mkdep-darwin-src} $out/usr/bin/mkdep
|
||||||
ln -s ${unifdef}/bin/unifdefall
|
'')
|
||||||
|
|
||||||
ln -s ${gperf}/bin/gperf
|
|
||||||
ln -s ${indent}/bin/indent
|
|
||||||
ln -s ${ctags}/bin/ctags
|
|
||||||
'' + 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
|
|
||||||
|
|
||||||
ln -s ${xib2nib}/bin/ibtool
|
|
||||||
'' +
|
|
||||||
# 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
|
|
||||||
'');
|
|
||||||
}
|
|
||||||
|
|
||||||
# other commands in /bin/
|
|
||||||
# asa
|
|
||||||
# cmpdylib (in cctools)
|
|
||||||
# ctf_insert (in cctools)
|
|
||||||
# dwarfdump
|
|
||||||
# lorder
|
|
||||||
# rebase
|
|
||||||
# rpcgen (in developer_cmds)
|
|
||||||
# what
|
|
||||||
|
|
||||||
|
|
||||||
# swift: see #11463
|
|
||||||
# swift
|
|
||||||
# swift-compress
|
|
||||||
# swift-demangle
|
|
||||||
# swift-stdlib-tool
|
|
||||||
# swift-update
|
|
||||||
# swiftc
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{ stdenv, callPackage, makeWrapper, writeText, CoreServices, ImageIO, CoreGraphics
|
{ stdenv, buildPackages, makeWrapper, writeText, runCommand
|
||||||
, cctools, bootstrap_cmds, binutils}:
|
, CoreServices, ImageIO, CoreGraphics }:
|
||||||
|
|
||||||
let
|
let
|
||||||
|
|
||||||
@ -7,20 +7,20 @@ let
|
|||||||
platformName = "com.apple.platform.macosx";
|
platformName = "com.apple.platform.macosx";
|
||||||
sdkName = "macosx10.10";
|
sdkName = "macosx10.10";
|
||||||
|
|
||||||
xcbuild = callPackage ./default.nix {
|
xcbuild = buildPackages.callPackage ./default.nix {
|
||||||
inherit CoreServices ImageIO CoreGraphics;
|
inherit CoreServices ImageIO CoreGraphics;
|
||||||
};
|
};
|
||||||
|
|
||||||
toolchain = callPackage ./toolchain.nix {
|
toolchain = buildPackages.callPackage ./toolchain.nix {
|
||||||
inherit cctools bootstrap_cmds toolchainName xcbuild binutils stdenv;
|
inherit toolchainName;
|
||||||
};
|
};
|
||||||
|
|
||||||
sdk = callPackage ./sdk.nix {
|
sdk = buildPackages.callPackage ./sdk.nix {
|
||||||
inherit toolchainName sdkName xcbuild;
|
inherit toolchainName sdkName;
|
||||||
};
|
};
|
||||||
|
|
||||||
platform = callPackage ./platform.nix {
|
platform = buildPackages.callPackage ./platform.nix {
|
||||||
inherit sdk platformName xcbuild;
|
inherit sdk platformName;
|
||||||
};
|
};
|
||||||
|
|
||||||
xcconfig = writeText "nix.xcconfig" ''
|
xcconfig = writeText "nix.xcconfig" ''
|
||||||
@ -32,7 +32,7 @@ in
|
|||||||
stdenv.mkDerivation {
|
stdenv.mkDerivation {
|
||||||
name = "xcbuild-wrapper-${xcbuild.version}";
|
name = "xcbuild-wrapper-${xcbuild.version}";
|
||||||
|
|
||||||
buildInputs = [ xcbuild makeWrapper ];
|
nativeBuildInputs = [ makeWrapper ];
|
||||||
|
|
||||||
setupHook = ./setup-hook.sh;
|
setupHook = ./setup-hook.sh;
|
||||||
|
|
||||||
@ -40,22 +40,21 @@ stdenv.mkDerivation {
|
|||||||
|
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
mkdir -p $out/bin
|
mkdir -p $out/bin
|
||||||
cd $out/bin/
|
|
||||||
|
|
||||||
for file in ${xcbuild}/bin/*; do
|
for file in ${xcbuild}/bin/*; do
|
||||||
ln -s $file
|
ln -s $file $out/bin
|
||||||
done
|
done
|
||||||
|
|
||||||
mkdir $out/usr
|
mkdir -p $out/usr
|
||||||
ln -s $out/bin $out/usr/bin
|
ln -s $out/bin $out/usr/bin
|
||||||
|
|
||||||
mkdir -p $out/Library/Xcode/
|
mkdir -p $out/Library/Xcode
|
||||||
ln -s ${xcbuild}/Library/Xcode/Specifications $out/Library/Xcode/Specifications
|
ln -s ${xcbuild}/Library/Xcode/Specifications $out/Library/Xcode/Specifications
|
||||||
|
|
||||||
mkdir -p $out/Platforms/
|
mkdir -p $out/Platforms
|
||||||
ln -s ${platform} $out/Platforms/nixpkgs.platform
|
ln -s ${platform} $out/Platforms/nixpkgs.platform
|
||||||
|
|
||||||
mkdir -p $out/Toolchains/
|
mkdir -p $out/Toolchains
|
||||||
ln -s ${toolchain} $out/Toolchains/nixpkgs.xctoolchain
|
ln -s ${toolchain} $out/Toolchains/nixpkgs.xctoolchain
|
||||||
|
|
||||||
wrapProgram $out/bin/xcodebuild \
|
wrapProgram $out/bin/xcodebuild \
|
||||||
|
@ -8570,8 +8570,7 @@ with pkgs;
|
|||||||
|
|
||||||
xcbuild = callPackage ../development/tools/xcbuild/wrapper.nix {
|
xcbuild = callPackage ../development/tools/xcbuild/wrapper.nix {
|
||||||
inherit (darwin.apple_sdk.frameworks) CoreServices CoreGraphics ImageIO;
|
inherit (darwin.apple_sdk.frameworks) CoreServices CoreGraphics ImageIO;
|
||||||
inherit (darwin) cctools bootstrap_cmds binutils;
|
stdenv = buildPackages.clangStdenv;
|
||||||
stdenv = clangStdenv;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
xmlindent = callPackage ../development/web/xmlindent {};
|
xmlindent = callPackage ../development/web/xmlindent {};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user