From 93c34c76163610ce60c4f0bc9278034205a01ddb Mon Sep 17 00:00:00 2001 From: Daiderd Jordan Date: Sun, 15 Jul 2018 10:33:23 +0200 Subject: [PATCH] stdenv: cleanup darwin bootstrapping Also gets rid of the full python and some of it's dependencies in the stdenv build closure. --- .../interpreters/python/cpython/2.7/boot.nix | 2 +- pkgs/stdenv/darwin/default.nix | 36 +++++++++++++------ pkgs/top-level/all-packages.nix | 7 ---- 3 files changed, 26 insertions(+), 19 deletions(-) diff --git a/pkgs/development/interpreters/python/cpython/2.7/boot.nix b/pkgs/development/interpreters/python/cpython/2.7/boot.nix index 79aa85def3c1..66f358e4b95b 100644 --- a/pkgs/development/interpreters/python/cpython/2.7/boot.nix +++ b/pkgs/development/interpreters/python/cpython/2.7/boot.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchurl, CF, configd, coreutils }: +{ stdenv, fetchurl, configd, CF, coreutils }: with stdenv.lib; diff --git a/pkgs/stdenv/darwin/default.nix b/pkgs/stdenv/darwin/default.nix index 366be3915802..b7b3640a9535 100644 --- a/pkgs/stdenv/darwin/default.nix +++ b/pkgs/stdenv/darwin/default.nix @@ -188,7 +188,18 @@ in rec { }; stage1 = prevStage: let - persistent = _: super: { python = super.python.override { configd = null; }; }; + persistent = self: super: with prevStage; { + cmake = super.cmake.override { + majorVersion = "3.9"; # FIXME: update ApplicationServices patch + isBootstrap = true; + useSharedLibraries = false; + }; + + python = super.callPackage ../../development/interpreters/python/cpython/2.7/boot.nix { + CF = null; # use CoreFoundation from bootstrap-tools + configd = null; + }; + }; in with prevStage; stageFun 1 prevStage { extraPreHook = "export NIX_CFLAGS_COMPILE+=\" -F${bootstrapTools}/Library/Frameworks\""; extraNativeBuildInputs = []; @@ -239,6 +250,9 @@ in rec { openssh sqlite sed serf openldap db cyrus-sasl expat apr-util findfreetype libssh curl cmake autoconf automake libtool cpio; + # Avoid pulling in a full python and it's extra dependencies for the llvm/clang builds. + libxml2 = super.libxml2.override { pythonSupport = false; }; + llvmPackages_5 = super.llvmPackages_5 // (let libraries = super.llvmPackages_5.libraries.extend (_: _: { inherit (llvmPackages_5) libcxx libcxxabi; @@ -281,6 +295,15 @@ in rec { ncurses libffi zlib gmp pcre gnugrep coreutils findutils diffutils patchutils; + # Hack to make sure we don't link ncurses in bootstrap tools. The proper + # solution is to avoid passing -L/nix-store/...-bootstrap-tools/lib, + # quite a sledgehammer just to get the C runtime. + gettext = super.gettext.overrideAttrs (drv: { + configureFlags = drv.configureFlags ++ [ + "--disable-curses" + ]; + }); + llvmPackages_5 = super.llvmPackages_5 // (let tools = super.llvmPackages_5.tools.extend (llvmSelf: _: { inherit (llvmPackages_5) llvm clang-unwrapped; @@ -303,16 +326,7 @@ in rec { extraPreHook = '' export PATH_LOCALE=${pkgs.darwin.locale}/share/locale ''; - overrides = lib.composeExtensions persistent (self: super: { - # Hack to make sure we don't link ncurses in bootstrap tools. The proper - # solution is to avoid passing -L/nix-store/...-bootstrap-tools/lib, - # quite a sledgehammer just to get the C runtime. - gettext = super.gettext.overrideAttrs (old: { - configureFlags = old.configureFlags ++ [ - "--disable-curses" - ]; - }); - }); + overrides = persistent; }; stdenvDarwin = prevStage: let diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index b8c41b9975da..507080514acb 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -6873,13 +6873,6 @@ with pkgs; inherit (stdenvAdapters) overrideCC; buildLlvmTools = buildPackages.llvmPackages_5.tools; targetLlvmLibraries = targetPackages.llvmPackages_5.libraries; - } // stdenv.lib.optionalAttrs (stdenv.isDarwin && hostPlatform == buildPlatform) { - cmake = buildPackages.cmake.override { - isBootstrap = true; - majorVersion = "3.9"; # 3.10.2: 'ApplicationServices/ApplicationServices.h' file not found - }; - libxml2 = libxml2.override { pythonSupport = false; }; - python2 = callPackage ../development/interpreters/python/cpython/2.7/boot.nix { inherit (darwin) CF configd; }; } // stdenv.lib.optionalAttrs (stdenv.cc.isGNU && stdenv.hostPlatform.isi686) { stdenv = overrideCC stdenv buildPackages.gcc6; # with gcc-7: undefined reference to `__divmoddi4' });