Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

darwin.stdenv: use cmake without curl to bootstrap clang #21099

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 12 additions & 8 deletions pkgs/development/tools/build-managers/cmake/default.nix
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
{ stdenv, fetchurl, pkgconfig
, bzip2, curl, expat, libarchive, xz, zlib
, useNcurses ? false, ncurses, useQt4 ? false, qt4
, bzip2, expat, libarchive, xz, zlib

, useCurl ? true, curl ? null
, useNcurses ? false, ncurses ? null
, useQt4 ? false, qt4 ? null
, wantPS ? false, ps ? null
}:

with stdenv.lib;

assert wantPS -> (ps != null);
assert stdenv ? cc;
assert stdenv.cc ? libc;
assert useNcurses -> ncurses != null;
assert useQt4 -> qt4 != null;
assert wantPS -> ps != null;

let
os = stdenv.lib.optionalString;
Expand Down Expand Up @@ -36,8 +39,8 @@ stdenv.mkDerivation rec {

setupHook = ./setup-hook.sh;

buildInputs =
[ setupHook pkgconfig bzip2 curl expat libarchive xz zlib ]
buildInputs = [ setupHook pkgconfig bzip2 expat libarchive xz zlib ]
++ optional useCurl curl
++ optional useNcurses ncurses
++ optional useQt4 qt4;

Expand All @@ -58,6 +61,7 @@ stdenv.mkDerivation rec {
"--no-system-jsoncpp"
]
++ optional (!stdenv.isCygwin) "--system-libs"
Copy link
Member Author

@LnL7 LnL7 Dec 12, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the reason we use system libs? I would expect cmake to use the libraries from the derivations' buildInputs.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The decision here is whether cmake should use it's bundled copies of things like curl, or to prefer the ones it finds externally (like those provided by the buildInputs).

The configure/bootstrap's help message explains a bit:

  --system-libs           use all system-installed third-party libraries
                          (for use only by package maintainers)
  --no-system-libs        use all cmake-provided third-party libraries
                          (default)
  --system-curl           use system-installed curl library
  --no-system-curl        use cmake-provided curl library (default)
  --system-expat          use system-installed expat library
  --no-system-expat       use cmake-provided expat library (default)
  --system-jsoncpp        use system-installed jsoncpp library
  --no-system-jsoncpp     use cmake-provided jsoncpp library (default)
  --system-zlib           use system-installed zlib library
  --no-system-zlib        use cmake-provided zlib library (default)
  --system-bzip2          use system-installed bzip2 library
  --no-system-bzip2       use cmake-provided bzip2 library (default)
  --system-liblzma        use system-installed liblzma library
  --no-system-liblzma     use cmake-provided liblzma library (default)
  --system-libarchive     use system-installed libarchive library
  --no-system-libarchive  use cmake-provided libarchive library (default)

Copy link
Member Author

@LnL7 LnL7 Dec 12, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I'm just wondering why we give cmake a bunch of unnecessary dependencies, instead of just adding those to expressions that need them. I would prefer to make them explicit.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh you mean for things built with cmake? Not sure, but it was my understanding these libraries would be used to implement cmake functionality itself, not to be used for building/linking other things... but maybe that's not so.
Do you know? As you say, those should be explicitly listing the libraries they need via buildInputs.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(it does seem useful to prevent cmake from using curl/openssl/etc at all, since AFAIK they're only used to fetch sources which we shouldn't be doing anyway...)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's what I was thinking, and it looks like I missed --no-system-libarchive, if I use that I can get rid of openssl without most of #21101

++ optional (!useCurl) "--no-system-curl"
++ optional useQt4 "--qt-gui"
++ ["--"]
++ optional (!useNcurses) "-DBUILD_CursesDialog=OFF";
Expand All @@ -70,6 +74,6 @@ stdenv.mkDerivation rec {
homepage = http://www.cmake.org/;
description = "Cross-Platform Makefile Generator";
platforms = if useQt4 then qt4.meta.platforms else platforms.all;
maintainers = with maintainers; [ urkud mornfall ttuegel ];
maintainers = with maintainers; [ urkud mornfall ttuegel lnl7 ];
};
}
32 changes: 29 additions & 3 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5127,9 +5127,35 @@ in
inherit (stdenvAdapters) overrideCC;
};

llvmPackages_37 = callPackage ../development/compilers/llvm/3.7 {
inherit (stdenvAdapters) overrideCC;
};
llvmPackages_37 =
let

libarchiveBoot = callPackage ../development/libraries/libarchive { xarSupport = false; };

libxml2Boot = callPackage ../development/libraries/libxml2 { pythonSupport = false; };

cmakeBoot = callPackage ../development/tools/build-managers/cmake {
libarchive = libarchiveBoot;
useCurl = false;
wantPS = stdenv.isDarwin;
inherit (darwin) ps;
};

# This is used to bootstrap clang, don't use this as a runtime dependency.
python27Boot = callPackage ../development/interpreters/python/cpython/2.7/boot.nix {
self = python27Boot;
inherit (darwin) CF configd;
};

llvmPackages = callPackage ../development/compilers/llvm/3.7 {
cmake = cmakeBoot;
libxml2 = libxml2Boot;
python2 = python27Boot;
inherit (stdenvAdapters) overrideCC;
};

in
llvmPackages;

llvmPackages_38 = callPackage ../development/compilers/llvm/3.8 {
inherit (stdenvAdapters) overrideCC;
Expand Down