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

Add isGNU and isClang attributes to cc-wrapper
This commit is contained in:
Eric Seidel
2015-05-14 10:09:07 -07:00
30 changed files with 42 additions and 32 deletions

View File

@@ -129,7 +129,7 @@ stdenv.mkDerivation rec {
"--disable-stripping"
# Disable mmx support for 0.6.90
(verFix null "0.6.90" "--disable-mmx")
] ++ optional (stdenv.cc.cc.isClang or false) "--cc=clang";
] ++ optional stdenv.cc.isClang "--cc=clang";
nativeBuildInputs = [ perl pkgconfig texinfo yasm ];

View File

@@ -21,7 +21,7 @@ stdenv.mkDerivation rec {
++ optional (precision != "double") "--enable-${precision}"
# all x86_64 have sse2
++ optional stdenv.isx86_64 "--enable-sse2"
++ optional (stdenv.cc.cc.isGNU or false) "--enable-openmp";
++ optional stdenv.cc.isGNU "--enable-openmp";
enableParallelBuilding = true;

View File

@@ -18,7 +18,7 @@ stdenv.mkDerivation (rec {
patches = [ ./deadlock.patch ]
++ map fetchurl (import ./debian-patches.nix)
++ stdenv.lib.optional (stdenv.cc.cc.isClang or false) ./returnval.patch;
++ stdenv.lib.optional stdenv.cc.isClang ./returnval.patch;
meta = with stdenv.lib; {

View File

@@ -7,7 +7,7 @@
with stdenv.lib;
assert !stdenv.isDarwin -> stdenv.cc.cc.isGNU or false;
assert !stdenv.isDarwin -> stdenv.cc.isGNU;
# TODO:
# * Add gio-module-fam

View File

@@ -8,7 +8,7 @@
, withGd ? false, gd ? null, libpng ? null
}:
assert stdenv.cc.cc.isGNU or false;
assert stdenv.cc.isGNU;
let
build = import ./common.nix;

View File

@@ -37,7 +37,7 @@ stdenv.mkDerivation rec {
makeFlags = [
"SHELL=${stdenv.shell}"
"INSTALL_ROOT=$(out)"
] ++ optional (stdenv.cc.cc.isClang or false) "CC=clang";
] ++ optional stdenv.cc.isClang "CC=clang";
preInstall = "mkdir -p $out/{bin,lib,man/man1,man/man3,include/gsm}";

View File

@@ -10,7 +10,7 @@ stdenv.mkDerivation rec {
postPatch = ''
sed -i 's/^\(CFLAGS.*\)$/\1 -fPIC/' Makefile
'' + stdenv.lib.optionalString (stdenv.cc.cc.isClang or false) ''
'' + stdenv.lib.optionalString stdenv.cc.isClang ''
substituteInPlace Makefile libjbig/Makefile pbmtools/Makefile \
--replace "CC = gcc" "CC = clang"
'';

View File

@@ -10,7 +10,7 @@ stdenv.mkDerivation {
# gcc 4.8 optimisations break judy.
# http://sourceforge.net/p/judy/mailman/message/31995144/
preConfigure = stdenv.lib.optionalString (stdenv.cc.cc.isGNU or false) ''
preConfigure = stdenv.lib.optionalString stdenv.cc.isGNU ''
configureFlagsArray+=("CFLAGS=-fno-strict-aliasing -fno-aggressive-loop-optimizations")
'';

View File

@@ -12,7 +12,7 @@ stdenv.mkDerivation rec {
nativeBuildInputs = [ pkgconfig ];
configureFlags = if (stdenv.cc.cc.isClang or false)
configureFlags = if stdenv.cc.isClang
then [ "--disable-werror" ] else null;
CXXFLAGS="--std=gnu++0x"; # For c++11 constants in lcms2.h

View File

@@ -12,7 +12,7 @@ stdenv.mkDerivation rec {
NIX_CFLAGS_COMPILE = if stdenv.isDarwin then "-D__unix" else null;
# This dead code causes a duplicate symbol error in Clang so just remove it
postPatch = if (stdenv.cc.cc.isClang or false) then ''
postPatch = if stdenv.cc.isClang then ''
substituteInPlace jpeg/ejpeg.h --replace "int No_JPEG_Header_Flag" ""
'' else null;

View File

@@ -12,7 +12,7 @@ stdenv.mkDerivation rec {
# optimize.diff is taken from https://projects.archlinux.org/svntogit/packages.git/tree/trunk/optimize.diff?h=packages/libmad
# It is included here in order to fix a build failure in Clang
# But it may be useful to fix other, currently unknown problems as well
++ stdenv.lib.optional (stdenv.cc.cc.isClang or false) [ ./optimize.diff ];
++ stdenv.lib.optional stdenv.cc.isClang [ ./optimize.diff ];
nativeBuildInputs = [ autoconf ];

View File

@@ -23,7 +23,7 @@ stdenv.mkDerivation {
# Clang generates warnings in Boost's header files
# -Werror causes these warnings to be interpreted as errors
# Simplest solution: disable -Werror
configureFlags = if (stdenv.cc.cc.isClang or false)
configureFlags = if stdenv.cc.isClang
then [ "--disable-werror" ] else null;
meta = {

View File

@@ -8,7 +8,7 @@ stdenv.mkDerivation rec {
sha256 = "120jkda2q58p0n68banh64vsfm3hgqnacagj425d218cr4ycdkyb";
};
NIX_LDFLAGS = stdenv.lib.optionalString (stdenv.cc.cc.isGNU or false) "-lssp";
NIX_LDFLAGS = stdenv.lib.optionalString stdenv.cc.isGNU "-lssp";
doCheck = true;

View File

@@ -14,7 +14,7 @@ stdenv.mkDerivation rec {
postInstall = glib.flattenInclude;
patches = stdenv.lib.optional (stdenv.cc.cc.isClang or false) ./fix-clang36.patch;
patches = stdenv.lib.optional stdenv.cc.isClang ./fix-clang36.patch;
meta = {
homepage = http://pixman.org;