lol

Merge pull request #7817 from gridaphobe/cc-wrapper-isgnu-isclang

Add isGNU and isClang attributes to cc-wrapper

+42 -32
+1 -1
pkgs/applications/graphics/inkscape/default.nix
··· 18 patchShebangs share/extensions 19 '' 20 # Clang gets misdetected, so hardcode the right answer 21 - + stdenv.lib.optionalString (stdenv.cc.cc.isClang or false) '' 22 substituteInPlace src/ui/tool/node.h \ 23 --replace "#if __cplusplus >= 201103L" "#if true" 24 '';
··· 18 patchShebangs share/extensions 19 '' 20 # Clang gets misdetected, so hardcode the right answer 21 + + stdenv.lib.optionalString stdenv.cc.isClang '' 22 substituteInPlace src/ui/tool/node.h \ 23 --replace "#if __cplusplus >= 201103L" "#if true" 24 '';
+1 -1
pkgs/applications/networking/browsers/opera/default.nix
··· 6 , kdeSupport ? false, qt4, kdelibs 7 }: 8 9 - assert stdenv.isLinux && stdenv.cc.cc.isGNU or false && stdenv.cc.libc != null; 10 11 let 12 mirror = http://get.geo.opera.com/pub/opera;
··· 6 , kdeSupport ? false, qt4, kdelibs 7 }: 8 9 + assert stdenv.isLinux && stdenv.cc.isGNU && stdenv.cc.libc != null; 10 11 let 12 mirror = http://get.geo.opera.com/pub/opera;
+2 -1
pkgs/build-support/cc-wrapper/default.nix
··· 10 , zlib ? null, extraPackages ? [] 11 , dyld ? null # TODO: should this be a setup-hook on dyld? 12 , setupHook ? ./setup-hook.sh 13 }: 14 15 with stdenv.lib; ··· 41 # The wrapper scripts use 'cat', so we may need coreutils. 42 coreutils = if nativeTools then null else coreutils; 43 44 - passthru = { inherit nativeTools nativeLibc nativePrefix; }; 45 46 buildCommand = 47 ''
··· 10 , zlib ? null, extraPackages ? [] 11 , dyld ? null # TODO: should this be a setup-hook on dyld? 12 , setupHook ? ./setup-hook.sh 13 + , isGNU ? false, isClang ? false 14 }: 15 16 with stdenv.lib; ··· 42 # The wrapper scripts use 'cat', so we may need coreutils. 43 coreutils = if nativeTools then null else coreutils; 44 45 + passthru = { inherit nativeTools nativeLibc nativePrefix isGNU isClang; }; 46 47 buildCommand = 48 ''
+1 -1
pkgs/development/compilers/gcl/default.nix
··· 10 11 ( 12 assert a.stdenv ? cc ; 13 - assert a.stdenv.cc.cc.isGNU or false ; 14 assert a.stdenv.cc ? libc ; 15 assert a.stdenv.cc.libc != null ; 16
··· 10 11 ( 12 assert a.stdenv ? cc ; 13 + assert a.stdenv.cc.isGNU ; 14 assert a.stdenv.cc ? libc ; 15 assert a.stdenv.cc.libc != null ; 16
+1 -1
pkgs/development/compilers/llvm/3.5/clang.nix
··· 1 { stdenv, fetch, cmake, libxml2, libedit, llvm, version, clang-tools-extra_src }: 2 let 3 - gcc = if stdenv.cc.cc.isGNU or false then stdenv.cc.cc else stdenv.cc.cc.gcc; 4 in stdenv.mkDerivation { 5 name = "clang-${version}"; 6
··· 1 { stdenv, fetch, cmake, libxml2, libedit, llvm, version, clang-tools-extra_src }: 2 let 3 + gcc = if stdenv.cc.isGNU then stdenv.cc.cc else stdenv.cc.cc.gcc; 4 in stdenv.mkDerivation { 5 name = "clang-${version}"; 6
+1 -1
pkgs/development/compilers/llvm/3.6/clang/default.nix
··· 1 { stdenv, fetch, cmake, libxml2, libedit, llvm, version, clang-tools-extra_src }: 2 3 let 4 - gcc = if stdenv.cc.cc.isGNU or false then stdenv.cc.cc else stdenv.cc.cc.gcc; 5 in stdenv.mkDerivation { 6 name = "clang-${version}"; 7
··· 1 { stdenv, fetch, cmake, libxml2, libedit, llvm, version, clang-tools-extra_src }: 2 3 let 4 + gcc = if stdenv.cc.isGNU then stdenv.cc.cc else stdenv.cc.cc.gcc; 5 in stdenv.mkDerivation { 6 name = "clang-${version}"; 7
+1 -1
pkgs/development/guile-modules/guile-lib/default.nix
··· 1 {stdenv, fetchurl, guile, texinfo}: 2 3 - assert stdenv ? cc && stdenv.cc.cc.isGNU or false; 4 5 stdenv.mkDerivation rec { 6 name = "guile-lib-0.2.2";
··· 1 {stdenv, fetchurl, guile, texinfo}: 2 3 + assert stdenv ? cc && stdenv.cc.isGNU; 4 5 stdenv.mkDerivation rec { 6 name = "guile-lib-0.2.2";
+1 -1
pkgs/development/libraries/ffmpeg/generic.nix
··· 129 "--disable-stripping" 130 # Disable mmx support for 0.6.90 131 (verFix null "0.6.90" "--disable-mmx") 132 - ] ++ optional (stdenv.cc.cc.isClang or false) "--cc=clang"; 133 134 nativeBuildInputs = [ perl pkgconfig texinfo yasm ]; 135
··· 129 "--disable-stripping" 130 # Disable mmx support for 0.6.90 131 (verFix null "0.6.90" "--disable-mmx") 132 + ] ++ optional stdenv.cc.isClang "--cc=clang"; 133 134 nativeBuildInputs = [ perl pkgconfig texinfo yasm ]; 135
+1 -1
pkgs/development/libraries/fftw/default.nix
··· 21 ++ optional (precision != "double") "--enable-${precision}" 22 # all x86_64 have sse2 23 ++ optional stdenv.isx86_64 "--enable-sse2" 24 - ++ optional (stdenv.cc.cc.isGNU or false) "--enable-openmp"; 25 26 enableParallelBuilding = true; 27
··· 21 ++ optional (precision != "double") "--enable-${precision}" 22 # all x86_64 have sse2 23 ++ optional stdenv.isx86_64 "--enable-sse2" 24 + ++ optional stdenv.cc.isGNU "--enable-openmp"; 25 26 enableParallelBuilding = true; 27
+1 -1
pkgs/development/libraries/gamin/default.nix
··· 18 19 patches = [ ./deadlock.patch ] 20 ++ map fetchurl (import ./debian-patches.nix) 21 - ++ stdenv.lib.optional (stdenv.cc.cc.isClang or false) ./returnval.patch; 22 23 24 meta = with stdenv.lib; {
··· 18 19 patches = [ ./deadlock.patch ] 20 ++ map fetchurl (import ./debian-patches.nix) 21 + ++ stdenv.lib.optional stdenv.cc.isClang ./returnval.patch; 22 23 24 meta = with stdenv.lib; {
+1 -1
pkgs/development/libraries/glib/default.nix
··· 7 8 with stdenv.lib; 9 10 - assert !stdenv.isDarwin -> stdenv.cc.cc.isGNU or false; 11 12 # TODO: 13 # * Add gio-module-fam
··· 7 8 with stdenv.lib; 9 10 + assert !stdenv.isDarwin -> stdenv.cc.isGNU; 11 12 # TODO: 13 # * Add gio-module-fam
+1 -1
pkgs/development/libraries/glibc/default.nix
··· 8 , withGd ? false, gd ? null, libpng ? null 9 }: 10 11 - assert stdenv.cc.cc.isGNU or false; 12 13 let 14 build = import ./common.nix;
··· 8 , withGd ? false, gd ? null, libpng ? null 9 }: 10 11 + assert stdenv.cc.isGNU; 12 13 let 14 build = import ./common.nix;
+1 -1
pkgs/development/libraries/gsm/default.nix
··· 37 makeFlags = [ 38 "SHELL=${stdenv.shell}" 39 "INSTALL_ROOT=$(out)" 40 - ] ++ optional (stdenv.cc.cc.isClang or false) "CC=clang"; 41 42 preInstall = "mkdir -p $out/{bin,lib,man/man1,man/man3,include/gsm}"; 43
··· 37 makeFlags = [ 38 "SHELL=${stdenv.shell}" 39 "INSTALL_ROOT=$(out)" 40 + ] ++ optional stdenv.cc.isClang "CC=clang"; 41 42 preInstall = "mkdir -p $out/{bin,lib,man/man1,man/man3,include/gsm}"; 43
+1 -1
pkgs/development/libraries/jbigkit/default.nix
··· 10 11 postPatch = '' 12 sed -i 's/^\(CFLAGS.*\)$/\1 -fPIC/' Makefile 13 - '' + stdenv.lib.optionalString (stdenv.cc.cc.isClang or false) '' 14 substituteInPlace Makefile libjbig/Makefile pbmtools/Makefile \ 15 --replace "CC = gcc" "CC = clang" 16 '';
··· 10 11 postPatch = '' 12 sed -i 's/^\(CFLAGS.*\)$/\1 -fPIC/' Makefile 13 + '' + stdenv.lib.optionalString stdenv.cc.isClang '' 14 substituteInPlace Makefile libjbig/Makefile pbmtools/Makefile \ 15 --replace "CC = gcc" "CC = clang" 16 '';
+1 -1
pkgs/development/libraries/judy/default.nix
··· 10 11 # gcc 4.8 optimisations break judy. 12 # http://sourceforge.net/p/judy/mailman/message/31995144/ 13 - preConfigure = stdenv.lib.optionalString (stdenv.cc.cc.isGNU or false) '' 14 configureFlagsArray+=("CFLAGS=-fno-strict-aliasing -fno-aggressive-loop-optimizations") 15 ''; 16
··· 10 11 # gcc 4.8 optimisations break judy. 12 # http://sourceforge.net/p/judy/mailman/message/31995144/ 13 + preConfigure = stdenv.lib.optionalString stdenv.cc.isGNU '' 14 configureFlagsArray+=("CFLAGS=-fno-strict-aliasing -fno-aggressive-loop-optimizations") 15 ''; 16
+1 -1
pkgs/development/libraries/libcdr/default.nix
··· 12 13 nativeBuildInputs = [ pkgconfig ]; 14 15 - configureFlags = if (stdenv.cc.cc.isClang or false) 16 then [ "--disable-werror" ] else null; 17 18 CXXFLAGS="--std=gnu++0x"; # For c++11 constants in lcms2.h
··· 12 13 nativeBuildInputs = [ pkgconfig ]; 14 15 + configureFlags = if stdenv.cc.isClang 16 then [ "--disable-werror" ] else null; 17 18 CXXFLAGS="--std=gnu++0x"; # For c++11 constants in lcms2.h
+1 -1
pkgs/development/libraries/libfpx/default.nix
··· 12 NIX_CFLAGS_COMPILE = if stdenv.isDarwin then "-D__unix" else null; 13 14 # This dead code causes a duplicate symbol error in Clang so just remove it 15 - postPatch = if (stdenv.cc.cc.isClang or false) then '' 16 substituteInPlace jpeg/ejpeg.h --replace "int No_JPEG_Header_Flag" "" 17 '' else null; 18
··· 12 NIX_CFLAGS_COMPILE = if stdenv.isDarwin then "-D__unix" else null; 13 14 # This dead code causes a duplicate symbol error in Clang so just remove it 15 + postPatch = if stdenv.cc.isClang then '' 16 substituteInPlace jpeg/ejpeg.h --replace "int No_JPEG_Header_Flag" "" 17 '' else null; 18
+1 -1
pkgs/development/libraries/libmad/default.nix
··· 12 # optimize.diff is taken from https://projects.archlinux.org/svntogit/packages.git/tree/trunk/optimize.diff?h=packages/libmad 13 # It is included here in order to fix a build failure in Clang 14 # But it may be useful to fix other, currently unknown problems as well 15 - ++ stdenv.lib.optional (stdenv.cc.cc.isClang or false) [ ./optimize.diff ]; 16 17 nativeBuildInputs = [ autoconf ]; 18
··· 12 # optimize.diff is taken from https://projects.archlinux.org/svntogit/packages.git/tree/trunk/optimize.diff?h=packages/libmad 13 # It is included here in order to fix a build failure in Clang 14 # But it may be useful to fix other, currently unknown problems as well 15 + ++ stdenv.lib.optional stdenv.cc.isClang [ ./optimize.diff ]; 16 17 nativeBuildInputs = [ autoconf ]; 18
+1 -1
pkgs/development/libraries/librevenge/default.nix
··· 23 # Clang generates warnings in Boost's header files 24 # -Werror causes these warnings to be interpreted as errors 25 # Simplest solution: disable -Werror 26 - configureFlags = if (stdenv.cc.cc.isClang or false) 27 then [ "--disable-werror" ] else null; 28 29 meta = {
··· 23 # Clang generates warnings in Boost's header files 24 # -Werror causes these warnings to be interpreted as errors 25 # Simplest solution: disable -Werror 26 + configureFlags = if stdenv.cc.isClang 27 then [ "--disable-werror" ] else null; 28 29 meta = {
+1 -1
pkgs/development/libraries/libsodium/default.nix
··· 8 sha256 = "120jkda2q58p0n68banh64vsfm3hgqnacagj425d218cr4ycdkyb"; 9 }; 10 11 - NIX_LDFLAGS = stdenv.lib.optionalString (stdenv.cc.cc.isGNU or false) "-lssp"; 12 13 doCheck = true; 14
··· 8 sha256 = "120jkda2q58p0n68banh64vsfm3hgqnacagj425d218cr4ycdkyb"; 9 }; 10 11 + NIX_LDFLAGS = stdenv.lib.optionalString stdenv.cc.isGNU "-lssp"; 12 13 doCheck = true; 14
+1 -1
pkgs/development/libraries/pixman/default.nix
··· 14 15 postInstall = glib.flattenInclude; 16 17 - patches = stdenv.lib.optional (stdenv.cc.cc.isClang or false) ./fix-clang36.patch; 18 19 meta = { 20 homepage = http://pixman.org;
··· 14 15 postInstall = glib.flattenInclude; 16 17 + patches = stdenv.lib.optional stdenv.cc.isClang ./fix-clang36.patch; 18 19 meta = { 20 homepage = http://pixman.org;
+1 -1
pkgs/development/tools/misc/astyle/default.nix
··· 12 sha256 = "1b0f4wm1qmgcswmixv9mwbp86hbdqxk754hml8cjv5vajvqwdpzv"; 13 }; 14 15 - sourceRoot = if (stdenv.cc.cc.isClang or false) 16 then "astyle/build/clang" 17 else "astyle/build/gcc"; 18
··· 12 sha256 = "1b0f4wm1qmgcswmixv9mwbp86hbdqxk754hml8cjv5vajvqwdpzv"; 13 }; 14 15 + sourceRoot = if stdenv.cc.isClang 16 then "astyle/build/clang" 17 else "astyle/build/gcc"; 18
+1 -1
pkgs/servers/x11/xorg/overrides.nix
··· 80 }; 81 82 libxkbfile = attrs: attrs // { 83 - patches = lib.optional (stdenv.cc.cc.isClang or false) ./libxkbfile-clang36.patch; 84 }; 85 86 libpciaccess = attrs : attrs // {
··· 80 }; 81 82 libxkbfile = attrs: attrs // { 83 + patches = lib.optional stdenv.cc.isClang ./libxkbfile-clang36.patch; 84 }; 85 86 libpciaccess = attrs : attrs // {
+8 -6
pkgs/stdenv/darwin/default.nix
··· 90 cc = "/usr"; 91 outPath = nativePrefix; 92 }; 93 }; 94 }; 95 pkgs = allPackages { ··· 129 130 cc = import ../../build-support/cc-wrapper { 131 inherit stdenv; 132 - nativeTools = false; 133 - nativeLibc = true; 134 - binutils = pkgs.darwin.cctools; 135 - cc = pkgs.llvmPackages.clang-unwrapped; 136 - coreutils = pkgs.coreutils; 137 - shell = "${pkgs.bash}/bin/bash"; 138 extraPackages = [ pkgs.libcxx ]; 139 }; 140 141 shell = "${pkgs.bash}/bin/bash";
··· 90 cc = "/usr"; 91 outPath = nativePrefix; 92 }; 93 + isClang = true; 94 }; 95 }; 96 pkgs = allPackages { ··· 130 131 cc = import ../../build-support/cc-wrapper { 132 inherit stdenv; 133 + nativeTools = false; 134 + nativeLibc = true; 135 + binutils = pkgs.darwin.cctools; 136 + cc = pkgs.llvmPackages.clang-unwrapped; 137 + coreutils = pkgs.coreutils; 138 + shell = "${pkgs.bash}/bin/bash"; 139 extraPackages = [ pkgs.libcxx ]; 140 + isClang = true; 141 }; 142 143 shell = "${pkgs.bash}/bin/bash";
+2
pkgs/stdenv/linux/default.nix
··· 91 nativeTools = false; 92 nativeLibc = false; 93 cc = gccPlain; 94 libc = glibc; 95 inherit binutils coreutils; 96 name = name; ··· 234 gcc = lib.makeOverridable (import ../../build-support/cc-wrapper) { 235 nativeTools = false; 236 nativeLibc = false; 237 cc = stage4.stdenv.cc.cc; 238 libc = stage4.pkgs.glibc; 239 inherit (stage4.pkgs) binutils coreutils;
··· 91 nativeTools = false; 92 nativeLibc = false; 93 cc = gccPlain; 94 + isGNU = true; 95 libc = glibc; 96 inherit binutils coreutils; 97 name = name; ··· 235 gcc = lib.makeOverridable (import ../../build-support/cc-wrapper) { 236 nativeTools = false; 237 nativeLibc = false; 238 + isGNU = true; 239 cc = stage4.stdenv.cc.cc; 240 libc = stage4.pkgs.glibc; 241 inherit (stage4.pkgs) binutils coreutils;
+1
pkgs/stdenv/nix/default.nix
··· 20 inherit stdenv; 21 binutils = pkgs.binutils; 22 cc = pkgs.gcc.cc; 23 coreutils = pkgs.coreutils; 24 shell = pkgs.bash + "/bin/sh"; 25 };
··· 20 inherit stdenv; 21 binutils = pkgs.binutils; 22 cc = pkgs.gcc.cc; 23 + isGNU = true; 24 coreutils = pkgs.coreutils; 25 shell = pkgs.bash + "/bin/sh"; 26 };
+1 -1
pkgs/tools/networking/atftp/default.nix
··· 1 { lib, stdenv, fetchurl, readline, tcp_wrappers, pcre, makeWrapper }: 2 assert stdenv.isLinux; 3 - assert stdenv.cc.cc.isGNU or false; 4 let 5 version = "0.7"; 6 debianPatch = fetchurl {
··· 1 { lib, stdenv, fetchurl, readline, tcp_wrappers, pcre, makeWrapper }: 2 assert stdenv.isLinux; 3 + assert stdenv.cc.isGNU; 4 let 5 version = "0.7"; 6 debianPatch = fetchurl {
+1 -1
pkgs/tools/security/tor/default.nix
··· 13 # ./configure time check for any of this. 14 buildInputs = [ libevent openssl zlib torsocks ]; 15 16 - CFLAGS = stdenv.lib.optionalString (stdenv.cc.cc.isGNU or false) "-lgcc_s"; 17 18 # Patch 'torify' to point directly to torsocks. 19 patchPhase = ''
··· 13 # ./configure time check for any of this. 14 buildInputs = [ libevent openssl zlib torsocks ]; 15 16 + CFLAGS = stdenv.lib.optionalString stdenv.cc.isGNU "-lgcc_s"; 17 18 # Patch 'torify' to point directly to torsocks. 19 patchPhase = ''
+1 -1
pkgs/tools/video/rtmpdump/default.nix
··· 24 ++ optional gnutlsSupport "CRYPTO=GNUTLS" 25 ++ optional opensslSupport "CRYPTO=OPENSSL" 26 ++ optional stdenv.isDarwin "SYS=darwin" 27 - ++ optional (stdenv.cc.cc.isClang or false) "CC=clang"; 28 29 buildInputs = [ zlib ] 30 ++ optional gnutlsSupport gnutls
··· 24 ++ optional gnutlsSupport "CRYPTO=GNUTLS" 25 ++ optional opensslSupport "CRYPTO=OPENSSL" 26 ++ optional stdenv.isDarwin "SYS=darwin" 27 + ++ optional stdenv.cc.isClang "CC=clang"; 28 29 buildInputs = [ zlib ] 30 ++ optional gnutlsSupport gnutls
+4
pkgs/top-level/all-packages.nix
··· 3437 3438 clangWrapSelf = build: (import ../build-support/cc-wrapper) { 3439 cc = build; 3440 stdenv = clangStdenv; 3441 libc = glibc; 3442 binutils = binutils; ··· 4497 nativePrefix = stdenv.cc.nativePrefix or ""; 4498 cc = baseCC; 4499 libc = libc; 4500 inherit stdenv binutils coreutils zlib; 4501 }; 4502 ··· 4536 nativePrefix = stdenv.cc.nativePrefix or ""; 4537 cc = baseGCC; 4538 libc = glibc; 4539 inherit stdenv binutils coreutils zlib; 4540 setupHook = ../build-support/cc-wrapper/setup-hook-stdinc.sh; 4541 };
··· 3437 3438 clangWrapSelf = build: (import ../build-support/cc-wrapper) { 3439 cc = build; 3440 + isClang = true; 3441 stdenv = clangStdenv; 3442 libc = glibc; 3443 binutils = binutils; ··· 4498 nativePrefix = stdenv.cc.nativePrefix or ""; 4499 cc = baseCC; 4500 libc = libc; 4501 + isGNU = baseCC.isGNU or false; 4502 + isClang = baseCC.isClang or false; 4503 inherit stdenv binutils coreutils zlib; 4504 }; 4505 ··· 4539 nativePrefix = stdenv.cc.nativePrefix or ""; 4540 cc = baseGCC; 4541 libc = glibc; 4542 + isGNU = true; 4543 inherit stdenv binutils coreutils zlib; 4544 setupHook = ../build-support/cc-wrapper/setup-hook-stdinc.sh; 4545 };