From 3e8344d334d42824ac3061a919ac15b19a1bf21d Mon Sep 17 00:00:00 2001 From: Joel Taylor Date: Sun, 17 Aug 2014 13:17:13 -0700 Subject: [PATCH] suitable clang stdenv --- pkgs/applications/editors/vim/default.nix | 6 +- pkgs/applications/editors/vim/macvim.nix | 5 +- .../version-management/subversion/default.nix | 13 +-- pkgs/build-support/cabal/default.nix | 5 + pkgs/build-support/clang-wrapper/builder.sh | 40 +++++--- pkgs/build-support/clang-wrapper/default.nix | 2 + .../compilers/gcc/4.2-apple64/default.nix | 1 + .../compilers/ghc/7.4.2-binary.nix | 3 +- .../compilers/ghc/7.8.3-binary.nix | 93 +++++++++++++++++++ pkgs/development/compilers/ghc/7.8.3.nix | 2 - pkgs/development/compilers/llvm/3.3/clang.nix | 4 + .../interpreters/guile/clang.patch | 14 +++ .../interpreters/guile/default.nix | 6 +- pkgs/development/interpreters/lua-5/5.1.nix | 2 +- .../interpreters/perl/5.16/default.nix | 1 - .../development/interpreters/ruby/ruby-19.nix | 2 + pkgs/development/libraries/aspell/clang.patch | 18 ++++ pkgs/development/libraries/aspell/default.nix | 4 + pkgs/development/libraries/db/generic.nix | 4 + pkgs/development/libraries/db/osx.patch | 20 ++++ pkgs/development/libraries/gmp/5.1.x.nix | 3 + .../development/libraries/libedit/default.nix | 2 +- pkgs/development/libraries/libffi/default.nix | 2 +- .../libraries/libgcrypt/default.nix | 2 + .../libraries/libunistring/clang.patch | 14 +++ .../libraries/libunistring/default.nix | 2 + .../libraries/mesa-darwin/default.nix | 2 +- .../development/libraries/ncurses/clang.patch | 42 +++++++++ .../development/libraries/ncurses/default.nix | 4 +- .../libraries/readline/clang.patch | 13 +++ .../libraries/readline/readline6.nix | 5 + pkgs/development/libraries/serf/default.nix | 6 +- pkgs/development/libraries/zlib/default.nix | 4 +- pkgs/development/tools/misc/distcc/masq.nix | 4 + pkgs/servers/http/nginx/default.nix | 2 +- pkgs/servers/x11/xorg/overrides.nix | 1 + pkgs/stdenv/darwin/default.nix | 47 ++++++++++ pkgs/stdenv/default.nix | 8 +- pkgs/stdenv/generic/default.nix | 3 +- pkgs/tools/archivers/sharutils/default.nix | 6 +- pkgs/tools/misc/getopt/default.nix | 2 + pkgs/tools/security/gnupg/clang.patch | 13 +++ pkgs/tools/security/gnupg/default.nix | 1 + pkgs/tools/system/tree/default.nix | 1 + pkgs/tools/typesetting/tex/tetex/clang.patch | 13 +++ pkgs/tools/typesetting/tex/tetex/default.nix | 2 +- pkgs/top-level/all-packages.nix | 33 ++----- pkgs/top-level/haskell-defaults.nix | 4 +- 48 files changed, 415 insertions(+), 71 deletions(-) create mode 100644 pkgs/development/compilers/ghc/7.8.3-binary.nix create mode 100644 pkgs/development/interpreters/guile/clang.patch create mode 100644 pkgs/development/libraries/aspell/clang.patch create mode 100644 pkgs/development/libraries/db/osx.patch create mode 100644 pkgs/development/libraries/libunistring/clang.patch create mode 100644 pkgs/development/libraries/ncurses/clang.patch create mode 100644 pkgs/development/libraries/readline/clang.patch create mode 100644 pkgs/stdenv/darwin/default.nix create mode 100644 pkgs/tools/security/gnupg/clang.patch create mode 100644 pkgs/tools/typesetting/tex/tetex/clang.patch diff --git a/pkgs/applications/editors/vim/default.nix b/pkgs/applications/editors/vim/default.nix index 95f654eb8ca..8f27f540997 100644 --- a/pkgs/applications/editors/vim/default.nix +++ b/pkgs/applications/editors/vim/default.nix @@ -3,12 +3,12 @@ stdenv.mkDerivation rec { name = "vim-${version}"; - version = "7.4.335"; + version = "7.4.410"; src = fetchhg { url = "https://vim.googlecode.com/hg/"; - rev = "v7-4-335"; - sha256 = "0qnpzfcbi6fhz82pj68l4vrnigca1akq2ksrxz6krwlfhns6jhhj"; + rev = "v7-4-410"; + sha256 = "145llhj6gq2bh9b7p8xkxc388krrximq80b87f3cn4w4d4k9fhqp"; }; enableParallelBuilding = true; diff --git a/pkgs/applications/editors/vim/macvim.nix b/pkgs/applications/editors/vim/macvim.nix index feafa7b9977..ad40344f19f 100644 --- a/pkgs/applications/editors/vim/macvim.nix +++ b/pkgs/applications/editors/vim/macvim.nix @@ -1,9 +1,8 @@ -{ stdenv, stdenvAdapters, gccApple, fetchFromGitHub, ncurses, gettext, +{ stdenv, stdenvAdapters, fetchFromGitHub, ncurses, gettext, pkgconfig, cscope, python, ruby, tcl, perl, luajit }: -let inherit (stdenvAdapters.overrideGCC stdenv gccApple) mkDerivation; -in mkDerivation rec { +stdenv.mkDerivation rec { name = "macvim-${version}"; version = "7.4.355"; diff --git a/pkgs/applications/version-management/subversion/default.nix b/pkgs/applications/version-management/subversion/default.nix index 283ea759153..30283ad387c 100644 --- a/pkgs/applications/version-management/subversion/default.nix +++ b/pkgs/applications/version-management/subversion/default.nix @@ -15,7 +15,7 @@ assert httpServer -> httpd != null; assert pythonBindings -> swig != null && python != null; assert javahlBindings -> jdk != null && perl != null; -stdenv.mkDerivation rec { +stdenv.mkDerivation (rec { version = "1.8.10"; @@ -73,14 +73,15 @@ stdenv.mkDerivation rec { enableParallelBuilding = true; - # Hack to build on Mac OS X. The system header files use C99-style - # comments, but Subversion passes -std=c90. - NIX_CFLAGS_COMPILE = "-std=c99"; - meta = { description = "A version control system intended to be a compelling replacement for CVS in the open source community"; homepage = http://subversion.apache.org/; maintainers = with stdenv.lib.maintainers; [ eelco lovek323 ]; hydraPlatforms = stdenv.lib.platforms.linux ++ stdenv.lib.platforms.darwin; }; -} +} // stdenv.lib.optionalAttrs stdenv.isDarwin { + CXX = "clang++"; + CC = "clang"; + CPP = "clang -E"; + CXXCPP = "clang++ -E"; +}) diff --git a/pkgs/build-support/cabal/default.nix b/pkgs/build-support/cabal/default.nix index d73b4a1f364..bf91de0bd50 100644 --- a/pkgs/build-support/cabal/default.nix +++ b/pkgs/build-support/cabal/default.nix @@ -214,6 +214,10 @@ assert !enableStaticLibraries -> versionOlder "7.7" ghc.version; configureFlags+=" --ghc-option=-j$NIX_BUILD_CORES" ''} + ${optionalString self.stdenv.isDarwin '' + configureFlags+=" --with-gcc=clang" + ''} + echo "configure flags: $extraConfigureFlags $configureFlags" ./Setup configure --verbose --prefix="$out" --libdir='$prefix/lib/$compiler' \ --libsubdir='$pkgid' $extraConfigureFlags $configureFlags 2>&1 \ @@ -236,6 +240,7 @@ assert !enableStaticLibraries -> versionOlder "7.7" ghc.version; export GHC_PACKAGE_PATH=$(${ghc.GHCPackages}) test -n "$noHaddock" || ./Setup haddock --html --hoogle \ + --ghc-options=-optP-P \ ${optionalString self.hyperlinkSource "--hyperlink-source"} eval "$postBuild" diff --git a/pkgs/build-support/clang-wrapper/builder.sh b/pkgs/build-support/clang-wrapper/builder.sh index 0cdb2b96135..2dec6c59933 100644 --- a/pkgs/build-support/clang-wrapper/builder.sh +++ b/pkgs/build-support/clang-wrapper/builder.sh @@ -28,20 +28,32 @@ if test -z "$nativeLibc"; then fi if test -n "$nativeTools"; then - clangPath="$nativePrefix/bin" + if [ -n "$isDarwin" ]; then + clangPath="$clang/bin" + else + clangPath="$nativePrefix/bin" + fi ldPath="$nativePrefix/bin" else - basePath=`echo $gcc/lib/*/*/*` - # Need libgcc until the llvm compiler-rt library is complete - clangLDFlags="$clangLDFlags -L$basePath" - if test -e "$gcc/lib64"; then - clangLDFlags="$clangLDFlags -L$gcc/lib64" - else - clangLDFlags="$clangLDFlags -L$gcc/lib" + clangLDFlags="" + if test -d "$gcc/lib"; then + basePath=`echo $gcc/lib/*/*/*` + # Need libgcc until the llvm compiler-rt library is complete + clangLDFlags="$clangLDFlags -L$basePath" + if test -e "$gcc/lib64"; then + clangLDFlags="$clangLDFlags -L$gcc/lib64" + else + clangLDFlags="$clangLDFlags -L$gcc/lib" + fi fi - clangLDFlags="$clangLDFlags -L$clang/lib" - echo "$clangLDFlags" > $out/nix-support/clang-ldflags + if test -d "$clang/lib"; then + clangLDFlags="$clangLDFlags -L$clang/lib" + fi + + if [ -n "$clangLDFlags" ]; then + echo "$clangLDFlags" > $out/nix-support/clang-ldflags + fi # Need files like crtbegin.o from gcc # It's unclear if these will ever be provided by an LLVM project @@ -49,9 +61,9 @@ else clangCFlags="$clangCFlags -isystem$clang/lib/clang/$clangVersion/include" echo "$clangCFlags" > $out/nix-support/clang-cflags - - clangPath="$clang/bin" + ldPath="$binutils/bin" + clangPath="$clang/bin" fi @@ -125,6 +137,10 @@ test -n "$libc" && echo $libc > $out/nix-support/orig-libc doSubstitute "$addFlags" "$out/nix-support/add-flags.sh" doSubstitute "$setupHook" "$out/nix-support/setup-hook" +cat >> "$out/nix-support/setup-hook" << EOF +export CC=clang +export CXX=clang++ +EOF cp -p $utils $out/nix-support/utils.sh diff --git a/pkgs/build-support/clang-wrapper/default.nix b/pkgs/build-support/clang-wrapper/default.nix index 7a5d87127d9..e61c07ca9d2 100644 --- a/pkgs/build-support/clang-wrapper/default.nix +++ b/pkgs/build-support/clang-wrapper/default.nix @@ -26,6 +26,8 @@ stdenv.mkDerivation { (if name != "" then name else clangName + "-wrapper") + (if clang != null && clangVersion != "" then "-" + clangVersion else ""); + isDarwin = stdenv.isDarwin; + builder = ./builder.sh; setupHook = ./setup-hook.sh; clangWrapper = ./clang-wrapper.sh; diff --git a/pkgs/development/compilers/gcc/4.2-apple64/default.nix b/pkgs/development/compilers/gcc/4.2-apple64/default.nix index b2444ebb9bf..42d9f29e2b5 100644 --- a/pkgs/development/compilers/gcc/4.2-apple64/default.nix +++ b/pkgs/development/compilers/gcc/4.2-apple64/default.nix @@ -4,6 +4,7 @@ , gmp ? null, mpfr ? null, bison ? null, flex ? null }: +assert false; assert stdenv.isDarwin; assert langF77 -> gmp != null; diff --git a/pkgs/development/compilers/ghc/7.4.2-binary.nix b/pkgs/development/compilers/ghc/7.4.2-binary.nix index 7000081e5db..f6dc974227c 100644 --- a/pkgs/development/compilers/ghc/7.4.2-binary.nix +++ b/pkgs/development/compilers/ghc/7.4.2-binary.nix @@ -62,7 +62,8 @@ stdenv.mkDerivation rec { '' else ""); configurePhase = '' - ./configure --prefix=$out --with-gmp-libraries=${gmp}/lib --with-gmp-includes=${gmp}/include + ./configure --prefix=$out --with-gmp-libraries=${gmp}/lib --with-gmp-includes=${gmp}/include \ + --with-clang ''; # Stripping combined with patchelf breaks the executables (they die diff --git a/pkgs/development/compilers/ghc/7.8.3-binary.nix b/pkgs/development/compilers/ghc/7.8.3-binary.nix new file mode 100644 index 00000000000..f2c65c6ad05 --- /dev/null +++ b/pkgs/development/compilers/ghc/7.8.3-binary.nix @@ -0,0 +1,93 @@ +{stdenv, fetchurl, perl, ncurses, gmp}: + +stdenv.mkDerivation rec { + version = "7.8.3"; + + name = "ghc-${version}-binary"; + + src = + if stdenv.system == "i686-linux" then + fetchurl { + url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-i386-unknown-linux.tar.bz2"; + sha256 = "0gny7knhss0w0d9r6jm1gghrcb8kqjvj94bb7hxf9syrk4fxlcxi"; + } + else if stdenv.system == "x86_64-linux" then + fetchurl { + url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-x86_64-unknown-linux.tar.bz2"; + sha256 = "043jabd0lh6n1zlqhysngbpvlsdznsa2mmsj08jyqgahw9sjb5ns"; + } + else if stdenv.system == "i686-darwin" then + fetchurl { + url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-i386-apple-darwin.tar.bz2"; + sha256 = "1vrbs3pzki37hzym1f1nh07lrqh066z3ypvm81fwlikfsvk4djc0"; + } + else if stdenv.system == "x86_64-darwin" then + fetchurl { + url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-x86_64-apple-darwin.tar.bz2"; + sha256 = "1ja0cq5xyjcvjpvjmm4nzhkpmwfs2kjlldbc48lxcs9rmqi7rnay"; + } + else throw "cannot bootstrap GHC on this platform"; + + buildInputs = [perl]; + + postUnpack = + # Strip is harmful, see also below. It's important that this happens + # first. The GHC Cabal build system makes use of strip by default and + # has hardcoded paths to /usr/bin/strip in many places. We replace + # those below, making them point to our dummy script. + '' + mkdir "$TMP/bin" + for i in strip; do + echo '#! ${stdenv.shell}' > "$TMP/bin/$i" + chmod +x "$TMP/bin/$i" + done + PATH="$TMP/bin:$PATH" + '' + + # We have to patch the GMP paths for the integer-gmp package. + '' + find . -name integer-gmp.buildinfo \ + -exec sed -i "s@extra-lib-dirs: @extra-lib-dirs: ${gmp}/lib@" {} \; + '' + + # On Linux, use patchelf to modify the executables so that they can + # find editline/gmp. + (if stdenv.isLinux then '' + find . -type f -perm +100 \ + -exec patchelf --interpreter "$(cat $NIX_GCC/nix-support/dynamic-linker)" \ + --set-rpath "${ncurses}/lib:${gmp}/lib" {} \; + sed -i "s|/usr/bin/perl|perl\x00 |" ghc-${version}/ghc/stage2/build/tmp/ghc-stage2 + sed -i "s|/usr/bin/gcc|gcc\x00 |" ghc-${version}/ghc/stage2/build/tmp/ghc-stage2 + for prog in ld ar gcc strip ranlib; do + find . -name "setup-config" -exec sed -i "s@/usr/bin/$prog@$(type -p $prog)@g" {} \; + done + '' else ""); + + configurePhase = '' + ./configure --prefix=$out --with-gmp-libraries=${gmp}/lib \ + --with-gmp-includes=${gmp}/include + ''; + + # Stripping combined with patchelf breaks the executables (they die + # with a segfault or the kernel even refuses the execve). (NIXPKGS-85) + dontStrip = true; + + # No building is necessary, but calling make without flags ironically + # calls install-strip ... + buildPhase = "true"; + + postInstall = + '' + # Sanity check, can ghc create executables? + cd $TMP + mkdir test-ghc; cd test-ghc + cat > main.hs << EOF + module Main where + main = putStrLn "yes" + EOF + $out/bin/ghc --make main.hs + echo compilation ok + [ $(./main) == "yes" ] + ''; + + meta.license = stdenv.lib.licenses.bsd3; + meta.platforms = ["x86_64-linux" "i686-linux" "i686-darwin" "x86_64-darwin"]; +} diff --git a/pkgs/development/compilers/ghc/7.8.3.nix b/pkgs/development/compilers/ghc/7.8.3.nix index dbcba36fa8f..0971cbb1f93 100644 --- a/pkgs/development/compilers/ghc/7.8.3.nix +++ b/pkgs/development/compilers/ghc/7.8.3.nix @@ -26,8 +26,6 @@ stdenv.mkDerivation rec { export NIX_LDFLAGS="$NIX_LDFLAGS -rpath $out/lib/ghc-${version}" ''; - configureFlags = "--with-gcc=${stdenv.gcc}/bin/gcc"; - # required, because otherwise all symbols from HSffi.o are stripped, and # that in turn causes GHCi to abort stripDebugFlags = [ "-S" "--keep-file-symbols" ]; diff --git a/pkgs/development/compilers/llvm/3.3/clang.nix b/pkgs/development/compilers/llvm/3.3/clang.nix index 262e0bff248..72287560b24 100644 --- a/pkgs/development/compilers/llvm/3.3/clang.nix +++ b/pkgs/development/compilers/llvm/3.3/clang.nix @@ -1,5 +1,9 @@ { stdenv, fetchurl, perl, groff, llvm, cmake, libxml2, python }: +# be sure not to rebuild clang on darwin; some packages request it specifically +# we need to fix those +assert stdenv.isDarwin -> stdenv.gcc.nativeTools; + let version = "3.3"; gccReal = if (stdenv.gcc.gcc or null) == null then stdenv.gcc else stdenv.gcc.gcc; diff --git a/pkgs/development/interpreters/guile/clang.patch b/pkgs/development/interpreters/guile/clang.patch new file mode 100644 index 00000000000..4d0f342b211 --- /dev/null +++ b/pkgs/development/interpreters/guile/clang.patch @@ -0,0 +1,14 @@ +diff --git a/lib/stdint.in.h b/lib/stdint.in.h +index 889bca7..15d39b0 100644 +--- a/lib/stdint.in.h ++++ b/lib/stdint.in.h +@@ -74,7 +74,8 @@ + in would reinclude us, skipping our contents because + _@GUARD_PREFIX@_STDINT_H is defined. + The include_next requires a split double-inclusion guard. */ +-# @INCLUDE_NEXT@ @NEXT_STDINT_H@ ++# include ++// # @INCLUDE_NEXT@ @NEXT_STDINT_H@ + #endif + + #if ! defined _@GUARD_PREFIX@_STDINT_H && ! defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H diff --git a/pkgs/development/interpreters/guile/default.nix b/pkgs/development/interpreters/guile/default.nix index 2ddad5cde67..ad5d2f1cc58 100644 --- a/pkgs/development/interpreters/guile/default.nix +++ b/pkgs/development/interpreters/guile/default.nix @@ -7,11 +7,11 @@ else stdenv.mkDerivation) (rec { - name = "guile-2.0.9"; + name = "guile-2.0.11"; src = fetchurl { url = "mirror://gnu/guile/${name}.tar.xz"; - sha256 = "0nw9y8vjyz4r61v06p9msks5lm58pd91irmzg4k487vmv743h2pp"; + sha256 = "1qh3j7308qvsjgwf7h94yqgckpbgz2k3yqdkzsyhqcafvfka9l5f"; }; nativeBuildInputs = [ makeWrapper gawk pkgconfig ]; @@ -29,7 +29,7 @@ enableParallelBuilding = true; - patches = [ ./disable-gc-sensitive-tests.patch ./eai_system.patch ] ++ + patches = [ ./disable-gc-sensitive-tests.patch ./eai_system.patch ./clang.patch ] ++ (stdenv.lib.optional (coverageAnalysis != null) ./gcov-file-name.patch); # Explicitly link against libgcc_s, to work around the infamous diff --git a/pkgs/development/interpreters/lua-5/5.1.nix b/pkgs/development/interpreters/lua-5/5.1.nix index 444ecbc787a..b2ccc7fd642 100644 --- a/pkgs/development/interpreters/lua-5/5.1.nix +++ b/pkgs/development/interpreters/lua-5/5.1.nix @@ -29,7 +29,7 @@ stdenv.mkDerivation rec { configurePhase = if stdenv.isDarwin then '' - makeFlagsArray=( INSTALL_TOP=$out INSTALL_MAN=$out/share/man/man1 PLAT=macosx CFLAGS="-DLUA_USE_LINUX -fno-common -O2" LDFLAGS="" ) + makeFlagsArray=( INSTALL_TOP=$out INSTALL_MAN=$out/share/man/man1 PLAT=macosx CFLAGS="-DLUA_USE_LINUX -fno-common -O2" LDFLAGS="" CC=clang ) installFlagsArray=( TO_BIN="lua luac" TO_LIB="liblua.5.1.5.dylib" INSTALL_DATA='cp -d' ) '' else '' makeFlagsArray=( INSTALL_TOP=$out INSTALL_MAN=$out/share/man/man1 PLAT=linux CFLAGS="-DLUA_USE_LINUX -O2 -fPIC" LDFLAGS="-fPIC" ) diff --git a/pkgs/development/interpreters/perl/5.16/default.nix b/pkgs/development/interpreters/perl/5.16/default.nix index c1a5374c92e..344f91b2980 100644 --- a/pkgs/development/interpreters/perl/5.16/default.nix +++ b/pkgs/development/interpreters/perl/5.16/default.nix @@ -32,7 +32,6 @@ stdenv.mkDerivation rec { # Miniperl needs -lm. perl needs -lrt. configureFlags = [ "-de" - "-Dcc=gcc" "-Uinstallusrbinperl" "-Dinstallstyle=lib/perl5" "-Duseshrplib" diff --git a/pkgs/development/interpreters/ruby/ruby-19.nix b/pkgs/development/interpreters/ruby/ruby-19.nix index d18718184ba..963d462dc00 100644 --- a/pkgs/development/interpreters/ruby/ruby-19.nix +++ b/pkgs/development/interpreters/ruby/ruby-19.nix @@ -49,6 +49,8 @@ stdenv.mkDerivation rec { installFlags = stdenv.lib.optionalString docSupport "install-doc"; + CFLAGS = stdenv.lib.optionalString stdenv.isDarwin "-mmacosx-version-min=10.7"; + postInstall = '' # Bundler tries to create this directory mkdir -pv $out/${passthru.gemPath} diff --git a/pkgs/development/libraries/aspell/clang.patch b/pkgs/development/libraries/aspell/clang.patch new file mode 100644 index 00000000000..c4cfa426588 --- /dev/null +++ b/pkgs/development/libraries/aspell/clang.patch @@ -0,0 +1,18 @@ +--- interfaces/cc/aspell.h 2013-10-13 20:29:33.000000000 +0200 ++++ interfaces/cc/aspell.h 2013-10-13 20:30:01.000000000 +0200 +@@ -237,6 +237,7 @@ + /******************************** errors ********************************/ + + ++#ifndef __cplusplus + extern const struct AspellErrorInfo * const aerror_other; + extern const struct AspellErrorInfo * const aerror_operation_not_supported; + extern const struct AspellErrorInfo * const aerror_cant_copy; +@@ -322,6 +323,7 @@ + extern const struct AspellErrorInfo * const aerror_bad_magic; + extern const struct AspellErrorInfo * const aerror_expression; + extern const struct AspellErrorInfo * const aerror_invalid_expression; ++#endif + + + /******************************* speller *******************************/ diff --git a/pkgs/development/libraries/aspell/default.nix b/pkgs/development/libraries/aspell/default.nix index 734bcc0797c..a8d660e89a7 100644 --- a/pkgs/development/libraries/aspell/default.nix +++ b/pkgs/development/libraries/aspell/default.nix @@ -8,6 +8,10 @@ stdenv.mkDerivation rec { sha256 = "1qgn5psfyhbrnap275xjfrzppf5a83fb67gpql0kfqv37al869gm"; }; + patchPhase = '' + patch interfaces/cc/aspell.h < ${./clang.patch} + ''; + buildInputs = [ perl ]; doCheck = true; diff --git a/pkgs/development/libraries/db/generic.nix b/pkgs/development/libraries/db/generic.nix index 6217bc46124..9d3f87ad5cb 100644 --- a/pkgs/development/libraries/db/generic.nix +++ b/pkgs/development/libraries/db/generic.nix @@ -18,6 +18,10 @@ stdenv.mkDerivation rec { patches = extraPatches; + patchPhase = '' + patch src/dbinc/atomic.h < ${./osx.patch} + ''; + configureFlags = [ (if cxxSupport then "--enable-cxx" else "--disable-cxx") (if compat185 then "--enable-compat185" else "--disable-compat185") diff --git a/pkgs/development/libraries/db/osx.patch b/pkgs/development/libraries/db/osx.patch new file mode 100644 index 00000000000..398aa1d3700 --- /dev/null +++ b/pkgs/development/libraries/db/osx.patch @@ -0,0 +1,20 @@ +--- src/dbinc/atomic.h 2013-03-12 14:07:22.000000000 -0400 ++++ src/dbinc/atomic.h.change 2013-03-12 14:06:35.000000000 -0400 +@@ -144,7 +144,7 @@ + #define atomic_inc(env, p) __atomic_inc(p) + #define atomic_dec(env, p) __atomic_dec(p) + #define atomic_compare_exchange(env, p, o, n) \ +- __atomic_compare_exchange((p), (o), (n)) ++ __atomic_compare_exchange_db((p), (o), (n)) + static inline int __atomic_inc(db_atomic_t *p) + { + int temp; +@@ -176,7 +176,7 @@ + * http://gcc.gnu.org/onlinedocs/gcc-4.1.0/gcc/Atomic-Builtins.html + * which configure could be changed to use. + */ +-static inline int __atomic_compare_exchange( ++static inline int __atomic_compare_exchange_db( + db_atomic_t *p, atomic_value_t oldval, atomic_value_t newval) + { + atomic_value_t was; diff --git a/pkgs/development/libraries/gmp/5.1.x.nix b/pkgs/development/libraries/gmp/5.1.x.nix index 14a6d34d932..5bee2fe4336 100644 --- a/pkgs/development/libraries/gmp/5.1.x.nix +++ b/pkgs/development/libraries/gmp/5.1.x.nix @@ -16,10 +16,13 @@ stdenv.mkDerivation (rec { # Build a "fat binary", with routines for several sub-architectures # (x86), except on Solaris where some tests crash with "Memory fault". # See , for instance. + # + # no darwin because gmp uses ASM that clang doesn't like optional (!stdenv.isSunOS) "--enable-fat" ++ (if cxx then [ "--enable-cxx" ] else [ "--disable-cxx" ]) ++ optional (cxx && stdenv.isDarwin) "CPPFLAGS=-fexceptions" + ++ optional stdenv.isDarwin "ABI=64 CC=clang" ++ optional stdenv.is64bit "--with-pic" ; diff --git a/pkgs/development/libraries/libedit/default.nix b/pkgs/development/libraries/libedit/default.nix index 1382af16484..659f22b9b3b 100644 --- a/pkgs/development/libraries/libedit/default.nix +++ b/pkgs/development/libraries/libedit/default.nix @@ -12,7 +12,7 @@ stdenv.mkDerivation rec { NROFF = "${groff}/bin/nroff"; postInstall = '' - sed -i s/-lncurses/-lncursesw/g $out/lib/pkgconfig/libedit.pc + sed -i ${stdenv.lib.optionalString (stdenv.isDarwin && stdenv.gcc.nativeTools) "''"} s/-lncurses/-lncursesw/g $out/lib/pkgconfig/libedit.pc ''; # taken from gentoo http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/dev-libs/libedit/files/ diff --git a/pkgs/development/libraries/libffi/default.nix b/pkgs/development/libraries/libffi/default.nix index da5a080521c..20b697144a0 100644 --- a/pkgs/development/libraries/libffi/default.nix +++ b/pkgs/development/libraries/libffi/default.nix @@ -22,7 +22,7 @@ stdenv.mkDerivation rec { postInstall = # Install headers in the right place. - '' ln -s${if stdenv.isFreeBSD then "" else "r"}v "$out/lib/"libffi*/include "$out/include" + '' ln -s${if stdenv.isBSD then "" else "r"}v "$out/lib/"libffi*/include "$out/include" ''; meta = { diff --git a/pkgs/development/libraries/libgcrypt/default.nix b/pkgs/development/libraries/libgcrypt/default.nix index ed267e23c87..8cc5b924cce 100644 --- a/pkgs/development/libraries/libgcrypt/default.nix +++ b/pkgs/development/libraries/libgcrypt/default.nix @@ -10,6 +10,8 @@ stdenv.mkDerivation (rec { propagatedBuildInputs = [ libgpgerror ]; + configureFlags = stdenv.lib.optional stdenv.isDarwin "--disable-asm"; + doCheck = stdenv.system != "i686-linux"; # "basic" test fails after stdenv+glibc-2.18 # For some reason the tests don't find `libgpg-error.so'. diff --git a/pkgs/development/libraries/libunistring/clang.patch b/pkgs/development/libraries/libunistring/clang.patch new file mode 100644 index 00000000000..fdcbc0d528d --- /dev/null +++ b/pkgs/development/libraries/libunistring/clang.patch @@ -0,0 +1,14 @@ +diff --git a/lib/stdint.in.h b/lib/stdint.in.h +index 997e406..e0827f5 100644 +--- a/lib/stdint.in.h ++++ b/lib/stdint.in.h +@@ -53,7 +53,8 @@ + in would reinclude us, skipping our contents because + _GL_STDINT_H is defined. + The include_next requires a split double-inclusion guard. */ +-# @INCLUDE_NEXT@ @NEXT_STDINT_H@ ++# include ++// # @INCLUDE_NEXT@ @NEXT_STDINT_H@ + #endif + + #if ! defined _GL_STDINT_H && ! defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H diff --git a/pkgs/development/libraries/libunistring/default.nix b/pkgs/development/libraries/libunistring/default.nix index 2a87d7a3249..9470240fc14 100644 --- a/pkgs/development/libraries/libunistring/default.nix +++ b/pkgs/development/libraries/libunistring/default.nix @@ -8,6 +8,8 @@ stdenv.mkDerivation (rec { sha256 = "18q620269xzpw39dwvr9zpilnl2dkw5z5kz3mxaadnpv4k3kw3b1"; }; + patches = stdenv.lib.optional stdenv.isDarwin [ ./clang.patch ]; + propagatedBuildInputs = stdenv.lib.optional ((! (stdenv ? glibc)) || (stdenv ? cross && diff --git a/pkgs/development/libraries/mesa-darwin/default.nix b/pkgs/development/libraries/mesa-darwin/default.nix index 98936904be5..f259a397c84 100644 --- a/pkgs/development/libraries/mesa-darwin/default.nix +++ b/pkgs/development/libraries/mesa-darwin/default.nix @@ -1,4 +1,4 @@ -{ stdenv, stdenvAdapters, gccApple, fetchurl, pkgconfig, intltool, flex, bison +{ stdenv, stdenvAdapters, fetchurl, pkgconfig, intltool, flex, bison , python, libxml2Python, file, expat, makedepend, xorg, llvm, libffi, libvdpau , enableTextureFloats ? false # Texture floats are patented, see docs/patents.txt , enableExtraFeatures ? false # not maintained diff --git a/pkgs/development/libraries/ncurses/clang.patch b/pkgs/development/libraries/ncurses/clang.patch new file mode 100644 index 00000000000..ce33049bf40 --- /dev/null +++ b/pkgs/development/libraries/ncurses/clang.patch @@ -0,0 +1,42 @@ +diff -ruNp ncurses-5.8.orig/c++/cursesf.h ncurses-5.8/c++/cursesf.h +--- ncurses-5.8.orig/c++/cursesf.h 2005-08-13 21:08:24.000000000 +0300 ++++ ncurses-5.8/c++/cursesf.h 2011-04-03 18:29:29.000000000 +0300 +@@ -681,7 +681,7 @@ public: + const T* p_UserData = STATIC_CAST(T*)(0), + bool with_frame=FALSE, + bool autoDelete_Fields=FALSE) +- : NCursesForm (Fields, with_frame, autoDelete_Fields) { ++ : NCursesForm (&Fields, with_frame, autoDelete_Fields) { + if (form) + set_user (const_cast(p_UserData)); + }; +@@ -694,7 +694,7 @@ public: + const T* p_UserData = STATIC_CAST(T*)(0), + bool with_frame=FALSE, + bool autoDelete_Fields=FALSE) +- : NCursesForm (Fields, nlines, ncols, begin_y, begin_x, ++ : NCursesForm (&Fields, nlines, ncols, begin_y, begin_x, + with_frame, autoDelete_Fields) { + if (form) + set_user (const_cast(p_UserData)); +diff -ruNp ncurses-5.8.orig/c++/cursesm.h ncurses-5.8/c++/cursesm.h +--- ncurses-5.8.orig/c++/cursesm.h 2005-08-13 21:10:36.000000000 +0300 ++++ ncurses-5.8/c++/cursesm.h 2011-04-03 18:31:42.000000000 +0300 +@@ -639,7 +639,7 @@ public: + const T* p_UserData = STATIC_CAST(T*)(0), + bool with_frame=FALSE, + bool autoDelete_Items=FALSE) +- : NCursesMenu (Items, with_frame, autoDelete_Items) { ++ : NCursesMenu (&Items, with_frame, autoDelete_Items) { + if (menu) + set_user (const_cast(p_UserData)); + }; +@@ -651,7 +651,7 @@ public: + int begin_x = 0, + const T* p_UserData = STATIC_CAST(T*)(0), + bool with_frame=FALSE) +- : NCursesMenu (Items, nlines, ncols, begin_y, begin_x, with_frame) { ++ : NCursesMenu (&Items, nlines, ncols, begin_y, begin_x, with_frame) { + if (menu) + set_user (const_cast(p_UserData)); + }; diff --git a/pkgs/development/libraries/ncurses/default.nix b/pkgs/development/libraries/ncurses/default.nix index 631199bf87c..3aa27480a0f 100644 --- a/pkgs/development/libraries/ncurses/default.nix +++ b/pkgs/development/libraries/ncurses/default.nix @@ -18,7 +18,7 @@ stdenv.mkDerivation rec { sha256 = "0fsn7xis81za62afan0vvm38bvgzg5wfmv1m86flqcj0nj7jjilh"; }; - patches = [ ./patch-ac ]; + patches = [ ./patch-ac ./clang.patch ]; configureFlags = '' --with-shared --without-debug --enable-pc-files --enable-symlinks @@ -35,8 +35,6 @@ stdenv.mkDerivation rec { export configureFlags="$configureFlags --includedir=$out/include" export PKG_CONFIG_LIBDIR="$out/lib/pkgconfig" mkdir -p "$PKG_CONFIG_LIBDIR" - '' + lib.optionalString stdenv.isDarwin '' - substituteInPlace configure --replace -no-cpp-precomp "" ''; selfNativeBuildInput = true; diff --git a/pkgs/development/libraries/readline/clang.patch b/pkgs/development/libraries/readline/clang.patch new file mode 100644 index 00000000000..42bb0be09c3 --- /dev/null +++ b/pkgs/development/libraries/readline/clang.patch @@ -0,0 +1,13 @@ +diff --git a/support/shobj-conf b/support/shobj-conf +index 5a63e80..4b2a741 100644 +--- support/shobj-conf ++++ support/shobj-conf +@@ -189,7 +189,7 @@ darwin*|macosx*) + darwin[789]*|darwin10*) SHOBJ_LDFLAGS='' + SHLIB_XLDFLAGS='-dynamiclib -arch_only `/usr/bin/arch` -install_name $(libdir)/$@ -current_version $(SHLIB_MAJOR)$(SHLIB_MINOR) -compatibility_version $(SHLIB_MAJOR) -v' + ;; +- *) SHOBJ_LDFLAGS='-dynamic' ++ *) SHOBJ_LDFLAGS='-dynamiclib' + SHLIB_XLDFLAGS='-arch_only `/usr/bin/arch` -install_name $(libdir)/$@ -current_version $(SHLIB_MAJOR)$(SHLIB_MINOR) -compatibility_version $(SHLIB_MAJOR) -v' + ;; + esac diff --git a/pkgs/development/libraries/readline/readline6.nix b/pkgs/development/libraries/readline/readline6.nix index d72d6566bbc..bffa838d2b3 100644 --- a/pkgs/development/libraries/readline/readline6.nix +++ b/pkgs/development/libraries/readline/readline6.nix @@ -10,10 +10,15 @@ stdenv.mkDerivation (rec { propagatedBuildInputs = [ncurses]; + preConfigure = '' + export CC=clang + ''; + patchFlags = "-p0"; patches = [ ./link-against-ncurses.patch ./no-arch_only.patch + ./clang.patch ] ++ (let diff --git a/pkgs/development/libraries/serf/default.nix b/pkgs/development/libraries/serf/default.nix index 1e8eec6ae45..033e53e521d 100644 --- a/pkgs/development/libraries/serf/default.nix +++ b/pkgs/development/libraries/serf/default.nix @@ -18,9 +18,13 @@ stdenv.mkDerivation rec { buildPhase = '' scons PREFIX="$out" OPENSSL="${openssl}" ZLIB="${zlib}" APR="$(echo "${apr}"/bin/*-config)" \ - APU="$(echo "${aprutil}"/bin/*-config)" GSSAPI="${krb5}" CC="${stdenv.gcc}/bin/gcc" + APU="$(echo "${aprutil}"/bin/*-config)" GSSAPI="${krb5}" CC="${ + if stdenv.isDarwin then "clang" else "${stdenv.gcc}/bin/gcc" + }" ''; + NIX_CFLAGS_COMPILE = stdenv.lib.optionalString stdenv.isDarwin "-L/usr/lib"; + installPhase = '' scons install ''; diff --git a/pkgs/development/libraries/zlib/default.nix b/pkgs/development/libraries/zlib/default.nix index 0938e2a17a7..1b46c959448 100644 --- a/pkgs/development/libraries/zlib/default.nix +++ b/pkgs/development/libraries/zlib/default.nix @@ -15,7 +15,9 @@ stdenv.mkDerivation rec { configureFlags = if static then "" else "--shared"; - preConfigure = '' + preConfigure = stdenv.lib.optionalString stdenv.isDarwin '' + export CC=clang + '' + '' if test -n "$crossConfig"; then export CC=$crossConfig-gcc configureFlags=${if static then "" else "--shared"} diff --git a/pkgs/development/tools/misc/distcc/masq.nix b/pkgs/development/tools/misc/distcc/masq.nix index 753c35b5d3a..28b31cbb48d 100644 --- a/pkgs/development/tools/misc/distcc/masq.nix +++ b/pkgs/development/tools/misc/distcc/masq.nix @@ -3,6 +3,10 @@ stdenv.mkDerivation { name = "distcc-masq-${gccRaw.name}"; + meta = { + platforms = stdenv.lib.platforms.linux; + }; + phases = [ "installPhase" ]; installPhase = '' mkdir -p $out/bin diff --git a/pkgs/servers/http/nginx/default.nix b/pkgs/servers/http/nginx/default.nix index 700317bc799..204a33cd4a5 100644 --- a/pkgs/servers/http/nginx/default.nix +++ b/pkgs/servers/http/nginx/default.nix @@ -105,7 +105,7 @@ stdenv.mkDerivation rec { ++ optional (elem stdenv.system (with platforms; linux ++ freebsd)) "--with-file-aio"; - additionalFlags = optionalString stdenv.isDarwin "-Wno-error=deprecated-declarations"; + additionalFlags = optionalString stdenv.isDarwin "-Wno-error=deprecated-declarations -Wno-error=conditional-uninitialized"; preConfigure = '' export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I${libxml2}/include/libxml2 $additionalFlags" diff --git a/pkgs/servers/x11/xorg/overrides.nix b/pkgs/servers/x11/xorg/overrides.nix index 93afa06a7f2..66f74f30549 100644 --- a/pkgs/servers/x11/xorg/overrides.nix +++ b/pkgs/servers/x11/xorg/overrides.nix @@ -75,6 +75,7 @@ in # Remove useless DocBook XML files. rm -rf $out/share/doc ''; + CPP = stdenv.lib.optionalString stdenv.isDarwin "clang -E -"; }; libXfont = attrs: attrs // { diff --git a/pkgs/stdenv/darwin/default.nix b/pkgs/stdenv/darwin/default.nix new file mode 100644 index 00000000000..5c2044386c6 --- /dev/null +++ b/pkgs/stdenv/darwin/default.nix @@ -0,0 +1,47 @@ +{ stdenv, pkgs, config }: + +import ../generic rec { + inherit config; + + preHook = + '' + export NIX_ENFORCE_PURITY= + export NIX_IGNORE_LD_THROUGH_GCC=1 + export NIX_DONT_SET_RPATH=1 + export NIX_NO_SELF_RPATH=1 + dontFixLibtool=1 + stripAllFlags=" " # the Darwin "strip" command doesn't know "-s" + xargsFlags=" " + export MACOSX_DEPLOYMENT_TARGET=10.6 + export SDKROOT=$(/usr/bin/xcrun --show-sdk-path 2> /dev/null || true) + export NIX_CFLAGS_COMPILE+=" --sysroot=/var/empty -idirafter $SDKROOT/usr/include -F$SDKROOT/System/Library/Frameworks -Wno-multichar -Wno-deprecated-declarations" + export NIX_LDFLAGS_AFTER+=" -L$SDKROOT/usr/lib" + ''; + + initialPath = (import ../common-path.nix) {pkgs = pkgs;}; + + system = stdenv.system; + + gcc = import ../../build-support/clang-wrapper { + nativeTools = false; + nativePrefix = stdenv.lib.optionalString stdenv.isSunOS "/usr"; + nativeLibc = true; + inherit stdenv; + binutils = import ../../build-support/native-darwin-cctools-wrapper {inherit stdenv;}; + clang = pkgs.clang_34; + coreutils = pkgs.coreutils; + shell = pkgs.bash + "/bin/sh"; + }; + + shell = pkgs.bash + "/bin/sh"; + + fetchurlBoot = stdenv.fetchurlBoot; + + overrides = pkgs_: { + inherit gcc; + inherit (gcc) binutils; + inherit (pkgs) + gzip bzip2 xz bash coreutils diffutils findutils gawk + gnumake gnused gnutar gnugrep gnupatch perl; + }; +} diff --git a/pkgs/stdenv/default.nix b/pkgs/stdenv/default.nix index 47d1fb6d9f7..8e8be748795 100644 --- a/pkgs/stdenv/default.nix +++ b/pkgs/stdenv/default.nix @@ -33,6 +33,12 @@ rec { pkgs = stdenvNativePkgs; }; + stdenvDarwin = import ./darwin { + inherit config; + stdenv = stdenvNative; + pkgs = stdenvNativePkgs; + }; + # Linux standard environment. stdenvLinux = (import ./linux { inherit system allPackages platform config;}).stdenvLinux; @@ -47,7 +53,7 @@ rec { if system == "armv7l-linux" then stdenvLinux else if system == "mips64el-linux" then stdenvLinux else if system == "powerpc-linux" then /* stdenvLinux */ stdenvNative else - if system == "x86_64-darwin" then stdenvNix else + if system == "x86_64-darwin" then stdenvDarwin else if system == "x86_64-solaris" then stdenvNix else stdenvNative; } diff --git a/pkgs/stdenv/generic/default.nix b/pkgs/stdenv/generic/default.nix index 29e4455f7cb..b126e7bf36b 100644 --- a/pkgs/stdenv/generic/default.nix +++ b/pkgs/stdenv/generic/default.nix @@ -163,7 +163,8 @@ let isBSD = system == "i686-freebsd" || system == "x86_64-freebsd" || system == "i686-openbsd" - || system == "x86_64-openbsd"; + || system == "x86_64-openbsd" + || system == "x86_64-darwin"; isi686 = system == "i686-linux" || system == "i686-gnu" || system == "i686-freebsd" diff --git a/pkgs/tools/archivers/sharutils/default.nix b/pkgs/tools/archivers/sharutils/default.nix index f19564e4ad9..281a148a5ca 100644 --- a/pkgs/tools/archivers/sharutils/default.nix +++ b/pkgs/tools/archivers/sharutils/default.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchurl, gettext }: +{ stdenv, fetchurl, gettext, coreutils }: stdenv.mkDerivation rec { name = "sharutils-4.11.1"; @@ -12,11 +12,11 @@ stdenv.mkDerivation rec { '' # Fix for building on Glibc 2.16. Won't be needed once the # gnulib in sharutils is updated. - sed -i '/gets is a security hole/d' lib/stdio.in.h + sed -i ${stdenv.lib.optionalString (stdenv.isBSD && stdenv.gcc.nativeTools) "''"} '/gets is a security hole/d' lib/stdio.in.h ''; # GNU Gettext is needed on non-GNU platforms. - buildInputs = [ gettext ]; + buildInputs = [ gettext coreutils ]; doCheck = true; diff --git a/pkgs/tools/misc/getopt/default.nix b/pkgs/tools/misc/getopt/default.nix index 41bc2ffc99d..84d15a18747 100644 --- a/pkgs/tools/misc/getopt/default.nix +++ b/pkgs/tools/misc/getopt/default.nix @@ -7,4 +7,6 @@ stdenv.mkDerivation { url = http://tarballs.nixos.org/getopt-1.1.4.tar.gz; md5 = "02188ca68da27c4175d6e9f3da732101"; }; + + buildFlags = stdenv.lib.optional stdenv.isDarwin [ "CC=clang" ]; } diff --git a/pkgs/tools/security/gnupg/clang.patch b/pkgs/tools/security/gnupg/clang.patch new file mode 100644 index 00000000000..842785e5c93 --- /dev/null +++ b/pkgs/tools/security/gnupg/clang.patch @@ -0,0 +1,13 @@ +diff --git a/gl/stdint_.h b/gl/stdint_.h +index bc27595..303e81a 100644 +--- a/gl/stdint_.h ++++ b/gl/stdint_.h +@@ -62,7 +62,7 @@ + int{8,16,32,64}_t, uint{8,16,32,64}_t and __BIT_TYPES_DEFINED__. + also defines intptr_t and uintptr_t. */ + # define _GL_JUST_INCLUDE_ABSOLUTE_INTTYPES_H +-# include ++// # include + # undef _GL_JUST_INCLUDE_ABSOLUTE_INTTYPES_H + #elif @HAVE_SYS_INTTYPES_H@ + /* Solaris 7 has the types except the *_fast*_t types, and diff --git a/pkgs/tools/security/gnupg/default.nix b/pkgs/tools/security/gnupg/default.nix index 64e2be90d30..e00985b16ed 100644 --- a/pkgs/tools/security/gnupg/default.nix +++ b/pkgs/tools/security/gnupg/default.nix @@ -31,6 +31,7 @@ stdenv.mkDerivation rec { patchPhase = '' find tests -type f | xargs sed -e 's@/bin/pwd@${coreutils}&@g' -i find . -name pcsc-wrapper.c | xargs sed -i 's/typedef unsinged int pcsc_dword_t/typedef unsigned int pcsc_dword_t/' + patch gl/stdint_.h < ${./clang.patch} ''; checkPhase="GNUPGHOME=`pwd` ./agent/gpg-agent --daemon make check"; diff --git a/pkgs/tools/system/tree/default.nix b/pkgs/tools/system/tree/default.nix index e108589aaef..51de5998069 100644 --- a/pkgs/tools/system/tree/default.nix +++ b/pkgs/tools/system/tree/default.nix @@ -37,6 +37,7 @@ stdenv.mkDerivation { prefix=$out MANDIR=$out/share/man/man1 ${systemFlags} + CC=clang ) ''; diff --git a/pkgs/tools/typesetting/tex/tetex/clang.patch b/pkgs/tools/typesetting/tex/tetex/clang.patch new file mode 100644 index 00000000000..50d83f62443 --- /dev/null +++ b/pkgs/tools/typesetting/tex/tetex/clang.patch @@ -0,0 +1,13 @@ +diff --git a/texk/ps2pkm/type1.c b/texk/ps2pkm/type1.c +index 027bf1f..4dcbad0 100644 +--- a/texk/ps2pkm/type1.c ++++ b/texk/ps2pkm/type1.c +@@ -800,7 +800,7 @@ static void PSFakePush(Num) + static DOUBLE PSFakePop () + { + if (PSFakeTop >= 0) return(PSFakeStack[PSFakeTop--]); +- else Error0("PSFakePop : Stack empty\n"); ++ else { CC; IfTrace0(TRUE, "PSFakePop : Stack empty\n"); errflag = TRUE; return 0; } + /*NOTREACHED*/ + } + diff --git a/pkgs/tools/typesetting/tex/tetex/default.nix b/pkgs/tools/typesetting/tex/tetex/default.nix index 5cd3228aced..173571eda23 100644 --- a/pkgs/tools/typesetting/tex/tetex/default.nix +++ b/pkgs/tools/typesetting/tex/tetex/default.nix @@ -20,7 +20,7 @@ stdenv.mkDerivation { sed -i 57d texk/kpathsea/c-std.h ''; - patches = [ ./environment.patch ./getline.patch ]; + patches = [ ./environment.patch ./getline.patch ./clang.patch ]; setupHook = ./setup-hook.sh; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 49fc5f5658f..d4995b0e1d7 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -231,8 +231,6 @@ let else defaultStdenv; - stdenvApple = stdenvAdapters.overrideGCC allStdenvs.stdenvNative gccApple; - forceNativeDrv = drv : if crossSystem == null then drv else (drv // { crossDrv = drv.nativeDrv; }); @@ -2686,8 +2684,7 @@ let }; clangUnwrapped = llvm: pkg: callPackage pkg { - stdenv = if stdenv.isDarwin then stdenvApple else stdenv; - inherit llvm; + inherit stdenv llvm; }; clangSelf = clangWrapSelf llvmPackagesSelf.clang; @@ -2704,7 +2701,7 @@ let }; #Use this instead of stdenv to build with clang - clangStdenv = lowPrio (stdenvAdapters.overrideGCC stdenv clang); + clangStdenv = if stdenv.isDarwin then stdenv else lowPrio (stdenvAdapters.overrideGCC stdenv clang); libcxxStdenv = stdenvAdapters.overrideGCC stdenv (clangWrapSelf llvmPackages.clang); clean = callPackage ../development/compilers/clean { }; @@ -2912,16 +2909,6 @@ let else null; })); - gccApple = - assert stdenv.isDarwin; - wrapGCC (makeOverridable (import ../development/compilers/gcc/4.2-apple64) { - inherit fetchurl noSysDirs; - profiledCompiler = true; - # Since it fails to build with GCC 4.6, build it with the "native" - # Apple-GCC. - stdenv = allStdenvs.stdenvNative; - }); - gfortran = gfortran48; gfortran48 = wrapGCC (gcc48.gcc.override { @@ -3216,9 +3203,7 @@ let llvm_34 = llvmPackages_34.llvm; llvm_33 = llvm_v ../development/compilers/llvm/3.3/llvm.nix; - llvm_v = path: callPackage path { - stdenv = if stdenv.isDarwin then stdenvApple else stdenv; - }; + llvm_v = path: callPackage path { }; llvmPackages = if !stdenv.isDarwin then llvmPackages_34 else llvmPackages_34 // { # until someone solves build problems with _34 @@ -3956,7 +3941,7 @@ let bam = callPackage ../development/tools/build-managers/bam {}; binutils = if stdenv.isDarwin - then stdenv.gcc.binutils + then import ../build-support/native-darwin-cctools-wrapper {inherit stdenv;} else callPackage ../development/tools/misc/binutils { inherit noSysDirs; }; @@ -4097,10 +4082,12 @@ let wrapGCC (distcc.links extraConfig)) {}; distccStdenv = lowPrio (overrideGCC stdenv distccWrapper); - distccMasquerade = callPackage ../development/tools/misc/distcc/masq.nix { - gccRaw = gcc.gcc; - binutils = binutils; - }; + distccMasquerade = if stdenv.isDarwin + then null + else callPackage ../development/tools/misc/distcc/masq.nix { + gccRaw = gcc.gcc; + binutils = binutils; + }; docutils = builderDefsPackage (import ../development/tools/documentation/docutils) { inherit python pil makeWrapper; diff --git a/pkgs/top-level/haskell-defaults.nix b/pkgs/top-level/haskell-defaults.nix index 9a064212a40..93d8431b8d0 100644 --- a/pkgs/top-level/haskell-defaults.nix +++ b/pkgs/top-level/haskell-defaults.nix @@ -204,6 +204,8 @@ gmp = pkgs.gmp4; }); + ghc783Binary = lowPrio (callPackage ../development/compilers/ghc/7.8.3-binary.nix {}); + ghc6101BinaryDarwin = if stdenv.isDarwin then ghc704Binary else ghc6101Binary; ghc6121BinaryDarwin = if stdenv.isDarwin then ghc704Binary else ghc6121Binary; @@ -224,7 +226,7 @@ packages_ghc783 = packages { ghcPath = ../development/compilers/ghc/7.8.3.nix; - ghcBinary = ghc742Binary; + ghcBinary = ghc783Binary; prefFun = ghc783Prefs; };