···11-# `-B@out@/bin' forces clang to use ld-wrapper.sh when calling ld.
22-export NIX_CFLAGS_COMPILE="-B@out@/bin/ $NIX_CFLAGS_COMPILE"
33-44-if test -e @out@/nix-support/libc-cflags; then
55- export NIX_CFLAGS_COMPILE="$(cat @out@/nix-support/libc-cflags) $NIX_CFLAGS_COMPILE"
66-fi
77-88-if test -e @out@/nix-support/clang-cflags; then
99- export NIX_CFLAGS_COMPILE="$(cat @out@/nix-support/clang-cflags) $NIX_CFLAGS_COMPILE"
1010-fi
1111-1212-if test -e @out@/nix-support/libc-ldflags; then
1313- export NIX_LDFLAGS="$NIX_LDFLAGS $(cat @out@/nix-support/libc-ldflags)"
1414-fi
1515-1616-if test -e @out@/nix-support/clang-ldflags; then
1717- export NIX_LDFLAGS="$NIX_LDFLAGS $(cat @out@/nix-support/clang-ldflags)"
1818-fi
1919-2020-if test -e @out@/nix-support/libc-ldflags-before; then
2121- export NIX_LDFLAGS_BEFORE="$(cat @out@/nix-support/libc-ldflags-before) $NIX_LDFLAGS_BEFORE"
2222-fi
2323-2424-export NIX_GCC_WRAPPER_FLAGS_SET=1
-137
pkgs/build-support/clang-wrapper/builder.sh
···11-source $stdenv/setup
22-33-44-mkdir -p $out/bin
55-mkdir -p $out/nix-support
66-77-88-if test -z "$nativeLibc"; then
99- dynamicLinker="$libc/lib/$dynamicLinker"
1010- echo $dynamicLinker > $out/nix-support/dynamic-linker
1111-1212- if test -e $libc/lib/32/ld-linux.so.2; then
1313- echo $libc/lib/32/ld-linux.so.2 > $out/nix-support/dynamic-linker-m32
1414- fi
1515-1616- # The "-B$libc/lib/" flag is a quick hack to force clang to link
1717- # against the crt1.o from our own glibc, rather than the one in
1818- # /usr/lib. (This is only an issue when using an `impure'
1919- # compiler/linker, i.e., one that searches /usr/lib and so on.)
2020- echo "-B$libc/lib/ -idirafter $libc/include" > $out/nix-support/libc-cflags
2121-2222- echo "-L$libc/lib" > $out/nix-support/libc-ldflags
2323-2424- # The dynamic linker is passed in `ldflagsBefore' to allow
2525- # explicit overrides of the dynamic linker by callers to clang/ld
2626- # (the *last* value counts, so ours should come first).
2727- echo "-dynamic-linker $dynamicLinker" > $out/nix-support/libc-ldflags-before
2828-fi
2929-3030-if test -n "$nativeTools"; then
3131- clangPath="$nativePrefix/bin"
3232- ldPath="$nativePrefix/bin"
3333-else
3434- basePath=`echo $gcc/lib/*/*/*`
3535- # Need libgcc until the llvm compiler-rt library is complete
3636- clangLDFlags="$clangLDFlags -L$basePath"
3737- if test -e "$gcc/lib64"; then
3838- clangLDFlags="$clangLDFlags -L$gcc/lib64"
3939- else
4040- clangLDFlags="$clangLDFlags -L$gcc/lib"
4141- fi
4242-4343- clangLDFlags="$clangLDFlags -L$clang/lib"
4444- echo "$clangLDFlags" > $out/nix-support/clang-ldflags
4545-4646- # Need files like crtbegin.o from gcc
4747- # It's unclear if these will ever be provided by an LLVM project
4848- clangCFlags="$clangCFlags -B$basePath"
4949-5050- clangCFlags="$clangCFlags -isystem$clang/lib/clang/$clangVersion/include"
5151- echo "$clangCFlags" > $out/nix-support/clang-cflags
5252-5353- clangPath="$clang/bin"
5454- ldPath="$binutils/bin"
5555-fi
5656-5757-5858-doSubstitute() {
5959- local src=$1
6060- local dst=$2
6161- local uselibcxx=
6262- local uselibcxxabi=
6363- if test -n "$libcxx" && echo $dst | fgrep ++; then uselibcxx=$libcxx; fi
6464- if test -n "$libcxxabi" && echo $dst | fgrep ++; then uselibcxxabi=$libcxxabi; fi
6565- # Can't use substitute() here, because replace may not have been
6666- # built yet (in the bootstrap).
6767- sed \
6868- -e "s^@out@^$out^g" \
6969- -e "s^@shell@^$shell^g" \
7070- -e "s^@libcxx@^$uselibcxx^g" \
7171- -e "s^@libcxxabi@^$uselibcxxabi^g" \
7272- -e "s^@clang@^$clang^g" \
7373- -e "s^@clangProg@^$clangProg^g" \
7474- -e "s^@binutils@^$binutils^g" \
7575- -e "s^@coreutils@^$coreutils^g" \
7676- -e "s^@libc@^$libc^g" \
7777- -e "s^@ld@^$ldPath/ld^g" \
7878- < "$src" > "$dst"
7979-}
8080-8181-8282-# Make wrapper scripts around clang and clang++. Also make symlinks
8383-# cc and c++
8484-mkClangWrapper() {
8585- local dst=$1
8686- local src=$2
8787-8888- if ! test -f "$src"; then
8989- echo "$src does not exist (skipping)"
9090- return 1
9191- fi
9292-9393- clangProg="$src"
9494- doSubstitute "$clangWrapper" "$dst"
9595- chmod +x "$dst"
9696-}
9797-9898-if mkClangWrapper $out/bin/clang $clangPath/clang
9999-then
100100- ln -sv clang $out/bin/cc
101101-fi
102102-103103-if mkClangWrapper $out/bin/clang++ $clangPath/clang++
104104-then
105105- ln -sv clang++ $out/bin/c++
106106-fi
107107-108108-109109-# Create a symlink to as (the assembler). This is useful when a
110110-# clang-wrapper is installed in a user environment, as it ensures that
111111-# the right assembler is called.
112112-ln -s $ldPath/as $out/bin/as
113113-114114-115115-# Make a wrapper around the linker.
116116-doSubstitute "$ldWrapper" "$out/bin/ld"
117117-chmod +x "$out/bin/ld"
118118-119119-120120-# Emit a setup hook. Also store the path to the original Clang and
121121-# libc.
122122-test -n "$clang" && echo $clang > $out/nix-support/orig-clang
123123-test -n "$libc" && echo $libc > $out/nix-support/orig-libc
124124-125125-doSubstitute "$addFlags" "$out/nix-support/add-flags.sh"
126126-127127-doSubstitute "$setupHook" "$out/nix-support/setup-hook"
128128-129129-cp -p $utils $out/nix-support/utils.sh
130130-131131-132132-# Propagate the wrapped clang so that if you install the wrapper, you get
133133-# llvm tools, the manpages, etc. as well (including for binutils
134134-# and Glibc).
135135-if test -z "$nativeTools"; then
136136- echo $clang $binutils $libc > $out/nix-support/propagated-user-env-packages
137137-fi
-150
pkgs/build-support/clang-wrapper/clang-wrapper.sh
···11-#! @shell@ -e
22-33-if test -n "$NIX_GCC_WRAPPER_START_HOOK"; then
44- source "$NIX_GCC_WRAPPER_START_HOOK"
55-fi
66-77-if test -z "$NIX_GCC_WRAPPER_FLAGS_SET"; then
88- source @out@/nix-support/add-flags.sh
99-fi
1010-1111-source @out@/nix-support/utils.sh
1212-1313-1414-# Figure out if linker flags should be passed. Clang prints annoying
1515-# warnings when they are not needed. (does it really? Copied from gcc-wrapper)
1616-dontLink=0
1717-getVersion=0
1818-nonFlagArgs=0
1919-2020-for i in "$@"; do
2121- if test "$i" = "-c"; then
2222- dontLink=1
2323- elif test "$i" = "-S"; then
2424- dontLink=1
2525- elif test "$i" = "-E"; then
2626- dontLink=1
2727- elif test "$i" = "-E"; then
2828- dontLink=1
2929- elif test "$i" = "-M"; then
3030- dontLink=1
3131- elif test "$i" = "-MM"; then
3232- dontLink=1
3333- elif test "$i" = "-x"; then
3434- # At least for the cases c-header or c++-header we should set dontLink.
3535- # I expect no one use -x other than making precompiled headers.
3636- dontLink=1
3737- elif test "${i:0:1}" != "-"; then
3838- nonFlagArgs=1
3939- elif test "$i" = "-m32"; then
4040- if test -e @out@/nix-support/dynamic-linker-m32; then
4141- NIX_LDFLAGS="$NIX_LDFLAGS -dynamic-linker $(cat @out@/nix-support/dynamic-linker-m32)"
4242- fi
4343- fi
4444-done
4545-4646-# If we pass a flag like -Wl, then clang will call the linker unless it
4747-# can figure out that it has to do something else (e.g., because of a
4848-# "-c" flag). So if no non-flag arguments are given, don't pass any
4949-# linker flags. This catches cases like "clang" (should just print
5050-# "clang: no input files") and "clang -v" (should print the version).
5151-if test "$nonFlagArgs" = "0"; then
5252- dontLink=1
5353-fi
5454-5555-# Optionally filter out paths not refering to the store.
5656-params=("$@")
5757-if test "$NIX_ENFORCE_PURITY" = "1" -a -n "$NIX_STORE"; then
5858- rest=()
5959- n=0
6060- while test $n -lt ${#params[*]}; do
6161- p=${params[n]}
6262- p2=${params[$((n+1))]}
6363- if test "${p:0:3}" = "-L/" && badPath "${p:2}"; then
6464- skip $p
6565- elif test "$p" = "-L" && badPath "$p2"; then
6666- n=$((n + 1)); skip $p2
6767- elif test "${p:0:3}" = "-I/" && badPath "${p:2}"; then
6868- skip $p
6969- elif test "$p" = "-I" && badPath "$p2"; then
7070- n=$((n + 1)); skip $p2
7171- elif test "$p" = "-isystem" && badPath "$p2"; then
7272- n=$((n + 1)); skip $p2
7373- else
7474- rest=("${rest[@]}" "$p")
7575- fi
7676- n=$((n + 1))
7777- done
7878- params=("${rest[@]}")
7979- NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE --sysroot=/var/empty"
8080-fi
8181-8282-if test -n "@libcxx@"; then
8383- NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -isystem@libcxx@/include/c++/v1 -stdlib=libc++"
8484- NIX_CFLAGS_LINK="$NIX_CFLAGS_LINK -L@libcxx@/lib -stdlib=libc++ -L@libcxxabi@/lib -lc++abi"
8585-fi
8686-8787-# Add the flags for the C compiler proper.
8888-extraAfter=($NIX_CFLAGS_COMPILE)
8989-extraBefore=()
9090-9191-if test "$dontLink" != "1"; then
9292-9393- # Add the flags that should only be passed to the compiler when
9494- # linking.
9595- extraAfter=(${extraAfter[@]} $NIX_CFLAGS_LINK)
9696-9797- # Add the flags that should be passed to the linker (and prevent
9898- # `ld-wrapper' from adding NIX_LDFLAGS again).
9999- for i in $NIX_LDFLAGS_BEFORE; do
100100- extraBefore=(${extraBefore[@]} "-Wl,$i")
101101- done
102102- for i in $NIX_LDFLAGS; do
103103- if test "${i:0:3}" = "-L/"; then
104104- extraAfter=(${extraAfter[@]} "$i")
105105- else
106106- extraAfter=(${extraAfter[@]} "-Wl,$i")
107107- fi
108108- done
109109- export NIX_LDFLAGS_SET=1
110110-fi
111111-112112-# As a very special hack, if the arguments are just `-v', then don't
113113-# add anything. This is to prevent `clang -v' (which normally prints
114114-# out the version number and returns exit code 0) from printing out
115115-# `No input files specified' and returning exit code 1.
116116-if test "$*" = "-v"; then
117117- extraAfter=()
118118- extraBefore=()
119119-fi
120120-121121-# Optionally print debug info.
122122-if test "$NIX_DEBUG" = "1"; then
123123- echo "original flags to @clangProg@:" >&2
124124- for i in "${params[@]}"; do
125125- echo " $i" >&2
126126- done
127127- echo "extraBefore flags to @clangProg@:" >&2
128128- for i in ${extraBefore[@]}; do
129129- echo " $i" >&2
130130- done
131131- echo "extraAfter flags to @clangProg@:" >&2
132132- for i in ${extraAfter[@]}; do
133133- echo " $i" >&2
134134- done
135135-fi
136136-137137-if test -n "$NIX_CLANG_WRAPPER_EXEC_HOOK"; then
138138- source "$NIX_CLANG_WRAPPER_EXEC_HOOK"
139139-fi
140140-141141-# Call the real `clang'. Filter out warnings from stderr about unused
142142-# `-B' flags, since they confuse some programs. Deep bash magic to
143143-# apply grep to stderr (by swapping stdin/stderr twice).
144144-if test -z "$NIX_CLANG_NEEDS_GREP"; then
145145- @clangProg@ ${extraBefore[@]} "${params[@]}" ${extraAfter[@]}
146146-else
147147- (@clangProg@ ${extraBefore[@]} "${params[@]}" ${extraAfter[@]} 3>&2 2>&1 1>&3- \
148148- | (grep -v 'file path prefix' || true); exit ${PIPESTATUS[0]}) 3>&2 2>&1 1>&3-
149149- exit $?
150150-fi
-89
pkgs/build-support/clang-wrapper/default.nix
···11-# The Nix `clang' stdenv.mkDerivation is not directly usable, since it doesn't
22-# know where the C library and standard header files are. Therefore
33-# the compiler produced by that package cannot be installed directly
44-# in a user environment and used from the command line. This
55-# stdenv.mkDerivation provides a wrapper that sets up the right environment
66-# variables so that the compiler and the linker just "work".
77-88-{ name ? "", stdenv, nativeTools, nativeLibc, nativePrefix ? ""
99-, clang ? null, libc ? null, binutils ? null, coreutils ? null, shell ? ""
1010-, zlib ? null, libcxx ? null
1111-}:
1212-1313-assert nativeTools -> nativePrefix != "";
1414-assert !nativeTools -> clang != null && binutils != null && coreutils != null;
1515-assert !nativeLibc -> libc != null;
1616-1717-let
1818-1919- clangVersion = (builtins.parseDrvName clang.name).version;
2020- clangName = (builtins.parseDrvName clang.name).name;
2121-2222-in
2323-2424-stdenv.mkDerivation {
2525- name =
2626- (if name != "" then name else clangName + "-wrapper") +
2727- (if clang != null && clangVersion != "" then "-" + clangVersion else "");
2828-2929- builder = ./builder.sh;
3030- setupHook = ./setup-hook.sh;
3131- clangWrapper = ./clang-wrapper.sh;
3232- ldWrapper = ../gcc-wrapper/ld-wrapper.sh;
3333- utils = ../gcc-wrapper/utils.sh;
3434- addFlags = ./add-flags;
3535-3636- inherit nativeTools nativeLibc nativePrefix clang clangVersion libcxx;
3737-3838- libcxxabi = libcxx.abi or null;
3939-4040- gcc = clang.gcc;
4141- libc = if nativeLibc then null else libc;
4242- binutils = if nativeTools then null else binutils;
4343- # The wrapper scripts use 'cat', so we may need coreutils
4444- coreutils = if nativeTools then null else coreutils;
4545-4646- langC = true;
4747- langCC = true;
4848- shell = if shell == "" then stdenv.shell else
4949- if builtins.isAttrs shell then (shell + shell.shellPath)
5050- else shell;
5151-5252- crossAttrs = {
5353- shell = shell.crossDrv + shell.crossDrv.shellPath;
5454- libc = libc.crossDrv;
5555- coreutils = coreutils.crossDrv;
5656- binutils = binutils.crossDrv;
5757- clang = clang.crossDrv;
5858- #
5959- # This is not the best way to do this. I think the reference should be
6060- # the style in the gcc-cross-wrapper, but to keep a stable stdenv now I
6161- # do this sufficient if/else.
6262- dynamicLinker =
6363- (if stdenv.cross.arch == "arm" then "ld-linux.so.3" else
6464- if stdenv.cross.arch == "mips" then "ld.so.1" else
6565- if stdenv.lib.hasSuffix "pc-gnu" stdenv.cross.config then "ld.so.1" else
6666- abort "don't know the name of the dynamic linker for this platform");
6767- };
6868-6969- meta =
7070- let clang_ = if clang != null then clang else {}; in
7171- (if clang_ ? meta then removeAttrs clang.meta ["priority"] else {}) //
7272- { description =
7373- stdenv.lib.attrByPath ["meta" "description"] "System C compiler" clang_
7474- + " (wrapper script)";
7575- };
7676-7777- # The dynamic linker has different names on different Linux platforms.
7878- dynamicLinker =
7979- if !nativeLibc then
8080- (if stdenv.system == "i686-linux" then "ld-linux.so.2" else
8181- if stdenv.system == "x86_64-linux" then "ld-linux-x86-64.so.2" else
8282- if stdenv.isArm then "ld-linux.so.3" else
8383- if stdenv.system == "powerpc-linux" then "ld.so.1" else
8484- if stdenv.system == "mips64el-linux" then "ld.so.1" else
8585- abort "don't know the name of the dynamic linker for this platform")
8686- else "";
8787-8888- preferLocalBuild = true;
8989-}
-38
pkgs/build-support/clang-wrapper/setup-hook.sh
···11-export NIX_GCC=@out@
22-33-addCVars () {
44- if test -d $1/include; then
55- export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -isystem $1/include"
66- fi
77-88- if test -d $1/lib64; then
99- export NIX_LDFLAGS="$NIX_LDFLAGS -L$1/lib64"
1010- fi
1111-1212- if test -d $1/lib; then
1313- export NIX_LDFLAGS="$NIX_LDFLAGS -L$1/lib"
1414- fi
1515-}
1616-1717-envHooks+=(addCVars)
1818-1919-# Note: these come *after* $out in the PATH (see setup.sh).
2020-2121-if test -n "@clang@"; then
2222- addToSearchPath PATH @clang@/bin
2323-fi
2424-2525-if test -n "@binutils@"; then
2626- addToSearchPath PATH @binutils@/bin
2727-fi
2828-2929-if test -n "@libc@"; then
3030- addToSearchPath PATH @libc@/bin
3131-fi
3232-3333-if test -n "@coreutils@"; then
3434- addToSearchPath PATH @coreutils@/bin
3535-fi
3636-3737-: ${CXX:=clang++}
3838-export CXX
···114114# We want gcc to call the wrapper linker, not that of binutils.
115115export PATH="@ldPath@:$PATH"
116116117117-# Call the real `gcc'. Filter out warnings from stderr about unused
118118-# `-B' flags, since they confuse some programs. Deep bash magic to
119119-# apply grep to stderr (by swapping stdin/stderr twice).
120120-if test -z "$NIX_GCC_NEEDS_GREP"; then
121121- @gccProg@ ${extraBefore[@]} "${params[@]}" ${extraAfter[@]}
122122-else
123123- (@gccProg@ ${extraBefore[@]} "${params[@]}" ${extraAfter[@]} 3>&2 2>&1 1>&3- \
124124- | (grep -v 'file path prefix' || true); exit ${PIPESTATUS[0]}) 3>&2 2>&1 1>&3-
125125- exit $?
126126-fi
117117+exec @gccProg@ ${extraBefore[@]} "${params[@]}" ${extraAfter[@]}
+8-8
pkgs/build-support/gcc-wrapper/add-flags
···11# `-B@out@/bin' forces gcc to use ld-wrapper.sh when calling ld.
22export NIX_CFLAGS_COMPILE="-B@out@/bin/ $NIX_CFLAGS_COMPILE"
3344-if test -e @out@/nix-support/libc-cflags; then
44+if [ -e @out@/nix-support/libc-cflags ]; then
55 export NIX_CFLAGS_COMPILE="$(cat @out@/nix-support/libc-cflags) $NIX_CFLAGS_COMPILE"
66fi
7788-if test -e @out@/nix-support/gcc-cflags; then
88+if [ -e @out@/nix-support/gcc-cflags ]; then
99 export NIX_CFLAGS_COMPILE="$(cat @out@/nix-support/gcc-cflags) $NIX_CFLAGS_COMPILE"
1010fi
11111212-if test -e @out@/nix-support/gnat-cflags; then
1212+if [ -e @out@/nix-support/gnat-cflags ]; then
1313 export NIX_GNATFLAGS_COMPILE="$(cat @out@/nix-support/gnat-cflags) $NIX_GNATFLAGS_COMPILE"
1414fi
15151616-if test -e @out@/nix-support/libc-ldflags; then
1717- export NIX_LDFLAGS="$NIX_LDFLAGS $(cat @out@/nix-support/libc-ldflags)"
1616+if [ -e @out@/nix-support/libc-ldflags ]; then
1717+ export NIX_LDFLAGS+=" $(cat @out@/nix-support/libc-ldflags)"
1818fi
19192020-if test -e @out@/nix-support/gcc-ldflags; then
2121- export NIX_LDFLAGS="$NIX_LDFLAGS $(cat @out@/nix-support/gcc-ldflags)"
2020+if [ -e @out@/nix-support/gcc-ldflags ]; then
2121+ export NIX_LDFLAGS+=" $(cat @out@/nix-support/gcc-ldflags)"
2222fi
23232424-if test -e @out@/nix-support/libc-ldflags-before; then
2424+if [ -e @out@/nix-support/libc-ldflags-before ]; then
2525 export NIX_LDFLAGS_BEFORE="$(cat @out@/nix-support/libc-ldflags-before) $NIX_LDFLAGS_BEFORE"
2626fi
2727
-214
pkgs/build-support/gcc-wrapper/builder.sh
···11-source $stdenv/setup
22-33-44-mkdir -p $out/bin
55-mkdir -p $out/nix-support
66-77-88-if test -z "$nativeLibc"; then
99- dynamicLinker="$libc/lib/$dynamicLinker"
1010- echo $dynamicLinker > $out/nix-support/dynamic-linker
1111-1212- if test -e $libc/lib/32/ld-linux.so.2; then
1313- echo $libc/lib/32/ld-linux.so.2 > $out/nix-support/dynamic-linker-m32
1414- fi
1515-1616- # The "-B$libc/lib/" flag is a quick hack to force gcc to link
1717- # against the crt1.o from our own glibc, rather than the one in
1818- # /usr/lib. (This is only an issue when using an `impure'
1919- # compiler/linker, i.e., one that searches /usr/lib and so on.)
2020- #
2121- # Unfortunately, setting -B appears to override the default search
2222- # path. Thus, the gcc-specific "../includes-fixed" directory is
2323- # now longer searched and glibc's <limits.h> header fails to
2424- # compile, because it uses "#include_next <limits.h>" to find the
2525- # limits.h file in ../includes-fixed. To remedy the problem,
2626- # another -idirafter is necessary to add that directory again.
2727- echo "-B$libc/lib/ -idirafter $libc/include -idirafter $gcc/lib/gcc/*/*/include-fixed" > $out/nix-support/libc-cflags
2828-2929- echo "-L$libc/lib" > $out/nix-support/libc-ldflags
3030-3131- # The dynamic linker is passed in `ldflagsBefore' to allow
3232- # explicit overrides of the dynamic linker by callers to gcc/ld
3333- # (the *last* value counts, so ours should come first).
3434- echo "-dynamic-linker" $dynamicLinker > $out/nix-support/libc-ldflags-before
3535-fi
3636-3737-if test -n "$nativeTools"; then
3838- gccPath="$nativePrefix/bin"
3939- ldPath="$nativePrefix/bin"
4040-else
4141- if test -e "$gcc/lib64"; then
4242- gccLDFlags="$gccLDFlags -L$gcc/lib64"
4343- fi
4444- gccLDFlags="$gccLDFlags -L$gcc/lib"
4545- if [ -n "$langVhdl" ]; then
4646- gccLDFlags="$gccLDFlags -L$zlib/lib"
4747- fi
4848- echo "$gccLDFlags" > $out/nix-support/gcc-ldflags
4949-5050- # GCC shows $gcc/lib in `gcc -print-search-dirs', but not
5151- # $gcc/lib64 (even though it does actually search there...)..
5252- # This confuses libtool. So add it to the compiler tool search
5353- # path explicitly.
5454- if test -e "$gcc/lib64"; then
5555- gccCFlags="$gccCFlags -B$gcc/lib64"
5656- fi
5757-5858- # Find the gcc libraries path (may work only without multilib)
5959- if [ -n "$langAda" ]; then
6060- basePath=`echo $gcc/lib/*/*/*`
6161- gccCFlags="$gccCFlags -B$basePath -I$basePath/adainclude"
6262-6363- gnatCFlags="-aI$basePath/adainclude -aO$basePath/adalib"
6464- echo "$gnatCFlags" > $out/nix-support/gnat-cflags
6565- fi
6666- echo "$gccCFlags" > $out/nix-support/gcc-cflags
6767-6868- gccPath="$gcc/bin"
6969- # On Illumos/Solaris we might prefer native ld
7070- if test -n "$nativePrefix"; then
7171- ldPath="$nativePrefix/bin"
7272- else
7373- ldPath="$binutils/bin"
7474- fi;
7575-fi
7676-7777-7878-doSubstitute() {
7979- local src=$1
8080- local dst=$2
8181- local ld="$ldPath/ld"
8282- if $ld -V 2>&1 |grep Solaris; then
8383- # Use Solaris specific linker wrapper
8484- ld="$out/bin/ld-solaris"
8585- fi
8686- # Can't use substitute() here, because replace may not have been
8787- # built yet (in the bootstrap).
8888- sed \
8989- -e "s^@out@^$out^g" \
9090- -e "s^@shell@^$shell^g" \
9191- -e "s^@gcc@^$gcc^g" \
9292- -e "s^@gccProg@^$gccProg^g" \
9393- -e "s^@gnatProg@^$gnatProg^g" \
9494- -e "s^@gnatlinkProg@^$gnatlinkProg^g" \
9595- -e "s^@binutils@^$binutils^g" \
9696- -e "s^@coreutils@^$coreutils^g" \
9797- -e "s^@libc@^$libc^g" \
9898- -e "s^@ld@^$ld^g" \
9999- < "$src" > "$dst"
100100-}
101101-102102-103103-# Make wrapper scripts around gcc, g++, and gfortran. Also make symlinks
104104-# cc, c++, and f77.
105105-mkGccWrapper() {
106106- local dst=$1
107107- local src=$2
108108-109109- if ! test -f "$src"; then
110110- echo "$src does not exist (skipping)"
111111- return 1
112112- fi
113113-114114- gccProg="$src"
115115- doSubstitute "$gccWrapper" "$dst"
116116- chmod +x "$dst"
117117-}
118118-119119-mkGnatWrapper() {
120120- local dst=$1
121121- local src=$2
122122-123123- if ! test -f "$src"; then
124124- echo "$src does not exist (skipping)"
125125- return 1
126126- fi
127127-128128- gnatProg="$src"
129129- doSubstitute "$gnatWrapper" "$dst"
130130- chmod +x "$dst"
131131-}
132132-133133-mkGnatLinkWrapper() {
134134- local dst=$1
135135- local src=$2
136136-137137- if ! test -f "$src"; then
138138- echo "$src does not exist (skipping)"
139139- return 1
140140- fi
141141-142142- gnatlinkProg="$src"
143143- doSubstitute "$gnatlinkWrapper" "$dst"
144144- chmod +x "$dst"
145145-}
146146-147147-if mkGccWrapper $out/bin/gcc $gccPath/gcc
148148-then
149149- ln -sv gcc $out/bin/cc
150150-fi
151151-152152-if mkGccWrapper $out/bin/g++ $gccPath/g++
153153-then
154154- ln -sv g++ $out/bin/c++
155155-fi
156156-157157-mkGccWrapper $out/bin/cpp $gccPath/cpp || true
158158-159159-if mkGccWrapper $out/bin/gfortran $gccPath/gfortran
160160-then
161161- ln -sv gfortran $out/bin/g77
162162- ln -sv gfortran $out/bin/f77
163163-fi
164164-165165-mkGccWrapper $out/bin/gcj $gccPath/gcj || true
166166-167167-mkGccWrapper $out/bin/gccgo $gccPath/gccgo || true
168168-169169-mkGccWrapper $out/bin/gnatgcc $gccPath/gnatgcc || true
170170-mkGnatWrapper $out/bin/gnatmake $gccPath/gnatmake || true
171171-mkGnatWrapper $out/bin/gnatbind $gccPath/gnatbind || true
172172-mkGnatLinkWrapper $out/bin/gnatlink $gccPath/gnatlink || true
173173-174174-if [ -f $gccPath/ghdl ]; then
175175- ln -sf $gccPath/ghdl $out/bin/ghdl
176176-fi
177177-178178-179179-# Create a symlink to as (the assembler). This is useful when a
180180-# gcc-wrapper is installed in a user environment, as it ensures that
181181-# the right assembler is called.
182182-ln -s $ldPath/as $out/bin/as
183183-184184-185185-# Make a wrapper around the linker.
186186-doSubstitute "$ldWrapper" "$out/bin/ld"
187187-chmod +x "$out/bin/ld"
188188-189189-# Copy solaris ld wrapper if needed
190190-if $ldPath/ld -V 2>&1 |grep Solaris; then
191191- # Use Solaris specific linker wrapper
192192- sed -e "s^@ld@^$ldPath/ld^g" < "$ldSolarisWrapper" > "$out/bin/ld-solaris"
193193- chmod +x "$out/bin/ld-solaris"
194194-fi
195195-196196-197197-# Emit a setup hook. Also store the path to the original GCC and
198198-# Glibc.
199199-test -n "$gcc" && echo $gcc > $out/nix-support/orig-gcc
200200-test -n "$libc" && echo $libc > $out/nix-support/orig-libc
201201-202202-doSubstitute "$addFlags" "$out/nix-support/add-flags.sh"
203203-204204-doSubstitute "$setupHook" "$out/nix-support/setup-hook"
205205-206206-cp -p $utils $out/nix-support/utils.sh
207207-208208-209209-# Propagate the wrapped gcc so that if you install the wrapper, you get
210210-# tools like gcov, the manpages, etc. as well (including for binutils
211211-# and Glibc).
212212-if test -z "$nativeTools"; then
213213- echo $gcc $binutils $libc > $out/nix-support/propagated-user-env-packages
214214-fi
+199-45
pkgs/build-support/gcc-wrapper/default.nix
···11-# The Nix `gcc' stdenv.mkDerivation is not directly usable, since it doesn't
22-# know where the C library and standard header files are. Therefore
33-# the compiler produced by that package cannot be installed directly
44-# in a user environment and used from the command line. This
55-# stdenv.mkDerivation provides a wrapper that sets up the right environment
66-# variables so that the compiler and the linker just "work".
11+# The Nixpkgs GCC is not directly usable, since it doesn't know where
22+# the C library and standard header files are. Therefore the compiler
33+# produced by that package cannot be installed directly in a user
44+# environment and used from the command line. So we use a wrapper
55+# script that sets up the right environment variables so that the
66+# compiler and the linker just "work".
7788{ name ? "", stdenv, nativeTools, nativeLibc, nativePrefix ? ""
99-, gcc ? null, libc ? null, binutils ? null, coreutils ? null, shell ? ""
1010-, zlib ? null
99+, gcc ? null, libc ? null, binutils ? null, coreutils ? null, shell ? stdenv.shell
1010+, zlib ? null, extraPackages ? []
1111}:
12121313+with stdenv.lib;
1414+1315assert nativeTools -> nativePrefix != "";
1416assert !nativeTools -> gcc != null && binutils != null && coreutils != null;
1517assert !nativeLibc -> libc != null;
16181717-# For ghdl (the vhdl language provider to gcc) we need zlib in the wrapper
1818-assert (gcc != null && gcc ? langVhdl && gcc.langVhdl) -> zlib != null;
1919+# For ghdl (the vhdl language provider to gcc) we need zlib in the wrapper.
2020+assert gcc.langVhdl or false -> zlib != null;
19212022let
21232224 gccVersion = (builtins.parseDrvName gcc.name).version;
2325 gccName = (builtins.parseDrvName gcc.name).name;
24262525- langGo = if nativeTools then false else gcc ? langGo && gcc.langGo;
2627in
27282829stdenv.mkDerivation {
···3031 (if name != "" then name else gccName + "-wrapper") +
3132 (if gcc != null && gccVersion != "" then "-" + gccVersion else "");
32333333- builder = ./builder.sh;
3434- setupHook = ./setup-hook.sh;
3535- gccWrapper = ./gcc-wrapper.sh;
3636- gnatWrapper = ./gnat-wrapper.sh;
3737- gnatlinkWrapper = ./gnatlink-wrapper.sh;
3838- ldWrapper = ./ld-wrapper.sh;
3939- ldSolarisWrapper = ./ld-solaris-wrapper.sh;
4040- utils = ./utils.sh;
4141- addFlags = ./add-flags;
3434+ preferLocalBuild = true;
42354343- inherit nativeTools nativeLibc nativePrefix gcc;
3636+ inherit gcc shell;
4437 libc = if nativeLibc then null else libc;
4538 binutils = if nativeTools then null else binutils;
4646- # The wrapper scripts use 'cat', so we may need coreutils
3939+ # The wrapper scripts use 'cat', so we may need coreutils.
4740 coreutils = if nativeTools then null else coreutils;
48414949- langC = if nativeTools then true else gcc.langC;
5050- langCC = if nativeTools then true else gcc.langCC;
5151- langFortran = if nativeTools then false else gcc ? langFortran;
5252- langAda = if nativeTools then false else gcc ? langAda && gcc.langAda;
5353- langVhdl = if nativeTools then false else gcc ? langVhdl && gcc.langVhdl;
5454- zlib = if gcc != null && gcc ? langVhdl then zlib else null;
5555- shell = if shell == "" then stdenv.shell else
5656- if builtins.isAttrs shell then (shell + shell.shellPath)
5757- else shell;
4242+ passthru = { inherit nativeTools nativeLibc nativePrefix; };
4343+4444+ buildCommand =
4545+ ''
4646+ mkdir -p $out/bin $out/nix-support
4747+4848+ wrap() {
4949+ local dst="$1"
5050+ local wrapper="$2"
5151+ export prog="$3"
5252+ substituteAll "$wrapper" "$out/bin/$dst"
5353+ chmod +x "$out/bin/$dst"
5454+ }
5555+ ''
5656+5757+ + optionalString (!nativeLibc) ''
5858+ dynamicLinker="$libc/lib/$dynamicLinker"
5959+ echo $dynamicLinker > $out/nix-support/dynamic-linker
6060+6161+ if [ -e $libc/lib/32/ld-linux.so.2 ]; then
6262+ echo $libc/lib/32/ld-linux.so.2 > $out/nix-support/dynamic-linker-m32
6363+ fi
6464+6565+ # The "-B$libc/lib/" flag is a quick hack to force gcc to link
6666+ # against the crt1.o from our own glibc, rather than the one in
6767+ # /usr/lib. (This is only an issue when using an `impure'
6868+ # compiler/linker, i.e., one that searches /usr/lib and so on.)
6969+ #
7070+ # Unfortunately, setting -B appears to override the default search
7171+ # path. Thus, the gcc-specific "../includes-fixed" directory is
7272+ # now longer searched and glibc's <limits.h> header fails to
7373+ # compile, because it uses "#include_next <limits.h>" to find the
7474+ # limits.h file in ../includes-fixed. To remedy the problem,
7575+ # another -idirafter is necessary to add that directory again.
7676+ echo "-B$libc/lib/ -idirafter $libc/include -idirafter $gcc/lib/gcc/*/*/include-fixed" > $out/nix-support/libc-cflags
7777+7878+ echo "-L$libc/lib" > $out/nix-support/libc-ldflags
7979+8080+ # The dynamic linker is passed in `ldflagsBefore' to allow
8181+ # explicit overrides of the dynamic linker by callers to gcc/ld
8282+ # (the *last* value counts, so ours should come first).
8383+ echo "-dynamic-linker" $dynamicLinker > $out/nix-support/libc-ldflags-before
8484+8585+ echo $libc > $out/nix-support/orig-libc
8686+ ''
8787+8888+ + (if nativeTools then ''
8989+ gccPath="${nativePrefix}/bin"
9090+ ldPath="${nativePrefix}/bin"
9191+ '' else ''
9292+ echo $gcc > $out/nix-support/orig-gcc
9393+9494+ # GCC shows $gcc/lib in `gcc -print-search-dirs', but not
9595+ # $gcc/lib64 (even though it does actually search there...)..
9696+ # This confuses libtool. So add it to the compiler tool search
9797+ # path explicitly.
9898+ if [ -e "$gcc/lib64" -a ! -L "$gcc/lib64" ]; then
9999+ gccLDFlags+=" -L$gcc/lib64"
100100+ gccCFlags+=" -B$gcc/lib64"
101101+ fi
102102+ gccLDFlags+=" -L$gcc/lib"
103103+104104+ ${optionalString gcc.langVhdl or false ''
105105+ gccLDFlags+=" -L${zlib}/lib"
106106+ ''}
107107+108108+ # Find the gcc libraries path (may work only without multilib).
109109+ ${optionalString gcc.langAda or false ''
110110+ basePath=`echo $gcc/lib/*/*/*`
111111+ gccCFlags+=" -B$basePath -I$basePath/adainclude"
112112+ gnatCFlags="-aI$basePath/adainclude -aO$basePath/adalib"
113113+ echo "$gnatCFlags" > $out/nix-support/gnat-cflags
114114+ ''}
115115+116116+ echo "$gccLDFlags" > $out/nix-support/gcc-ldflags
117117+ echo "$gccCFlags" > $out/nix-support/gcc-cflags
118118+119119+ gccPath="$gcc/bin"
120120+ ldPath="$binutils/bin"
121121+122122+ # Propagate the wrapped gcc so that if you install the wrapper,
123123+ # you get tools like gcov, the manpages, etc. as well (including
124124+ # for binutils and Glibc).
125125+ echo $gcc $binutils $libc > $out/nix-support/propagated-user-env-packages
126126+127127+ echo ${toString extraPackages} > $out/nix-support/propagated-native-build-inputs
128128+ ''
129129+130130+ + optionalString (stdenv.isSunOS && nativePrefix != "") ''
131131+ # Solaris needs an additional ld wrapper.
132132+ ldPath="${nativePrefix}/bin"
133133+ ld="$out/bin/ld-solaris"
134134+ wrap ld-solaris ${./ld-solaris-wrapper.sh}
135135+ '')
136136+137137+ + ''
138138+ # Create a symlink to as (the assembler). This is useful when a
139139+ # gcc-wrapper is installed in a user environment, as it ensures that
140140+ # the right assembler is called.
141141+ if [ -e $ldPath/as ]; then
142142+ ln -s $ldPath/as $out/bin/as
143143+ fi
144144+145145+ wrap ld ${./ld-wrapper.sh} ''${ld:-$ldPath/ld}
146146+147147+ if [ -e $binutils/bin/ld.gold ]; then
148148+ wrap ld.gold ${./ld-wrapper.sh} $binutils/bin/ld.gold
149149+ fi
150150+151151+ if [ -e $binutils/bin/ld.bfd ]; then
152152+ wrap ld.bfd ${./ld-wrapper.sh} $binutils/bin/ld.bfd
153153+ fi
154154+155155+ if [ -e $gccPath/gcc ]; then
156156+ wrap gcc ${./gcc-wrapper.sh} $gccPath/gcc
157157+ ln -s gcc $out/bin/cc
158158+ elif [ -e $gccPath/clang ]; then
159159+ wrap clang ${./gcc-wrapper.sh} $gccPath/clang
160160+ ln -s clang $out/bin/cc
161161+ fi
162162+163163+ if [ -e $gccPath/g++ ]; then
164164+ wrap g++ ${./gcc-wrapper.sh} $gccPath/g++
165165+ ln -s g++ $out/bin/c++
166166+ elif [ -e $gccPath/clang++ ]; then
167167+ wrap clang++ ${./gcc-wrapper.sh} $gccPath/clang++
168168+ ln -s clang++ $out/bin/c++
169169+ fi
170170+171171+ if [ -e $gccPath/cpp ]; then
172172+ wrap cpp ${./gcc-wrapper.sh} $gccPath/cpp
173173+ fi
174174+ ''
175175+176176+ + optionalString gcc.langFortran or false ''
177177+ wrap gfortran ${./gcc-wrapper.sh} $gccPath/gfortran
178178+ ln -sv gfortran $out/bin/g77
179179+ ln -sv gfortran $out/bin/f77
180180+ ''
181181+182182+ + optionalString gcc.langJava or false ''
183183+ wrap gcj ${./gcc-wrapper.sh} $gccPath/gcj
184184+ ''
185185+186186+ + optionalString gcc.langGo or false ''
187187+ wrap gccgo ${./gcc-wrapper.sh} $gccPath/gccgo
188188+ ''
189189+190190+ + optionalString gcc.langAda or false ''
191191+ wrap gnatgcc ${./gcc-wrapper.sh} $gccPath/gnatgcc
192192+ wrap gnatmake ${./gnat-wrapper.sh} $gccPath/gnatmake
193193+ wrap gnatbind ${./gnat-wrapper.sh} $gccPath/gnatbind
194194+ wrap gnatlink ${./gnatlink-wrapper.sh} $gccPath/gnatlink
195195+ ''
196196+197197+ + optionalString gcc.langVhdl or false ''
198198+ ln -s $gccPath/ghdl $out/bin/ghdl
199199+ ''
200200+201201+ + ''
202202+ substituteAll ${./setup-hook.sh} $out/nix-support/setup-hook
203203+ substituteAll ${./add-flags} $out/nix-support/add-flags.sh
204204+ cp -p ${./utils.sh} $out/nix-support/utils.sh
205205+206206+ if [ -e $out/bin/clang ]; then
207207+ echo 'export CC; : ''${CC:=clang}' >> $out/nix-support/setup-hook
208208+ fi
209209+210210+ if [ -e $out/bin/clang++ ]; then
211211+ echo 'export CXX; : ''${CXX:=clang++}' >> $out/nix-support/setup-hook
212212+ fi
213213+ '';
214214+215215+ # The dynamic linker has different names on different Linux platforms.
216216+ dynamicLinker =
217217+ if !nativeLibc then
218218+ (if stdenv.system == "i686-linux" then "ld-linux.so.2" else
219219+ if stdenv.system == "x86_64-linux" then "ld-linux-x86-64.so.2" else
220220+ # ARM with a wildcard, which can be "" or "-armhf".
221221+ if stdenv.isArm then "ld-linux*.so.3" else
222222+ if stdenv.system == "powerpc-linux" then "ld.so.1" else
223223+ if stdenv.system == "mips64el-linux" then "ld.so.1" else
224224+ abort "Don't know the name of the dynamic linker for this platform.")
225225+ else "";
5822659227 crossAttrs = {
60228 shell = shell.crossDrv + shell.crossDrv.shellPath;
···73241 abort "don't know the name of the dynamic linker for this platform");
74242 };
752437676- preferLocalBuild = true;
7777-78244 meta =
79245 let gcc_ = if gcc != null then gcc else {}; in
80246 (if gcc_ ? meta then removeAttrs gcc.meta ["priority"] else {}) //
···82248 stdenv.lib.attrByPath ["meta" "description"] "System C compiler" gcc_
83249 + " (wrapper script)";
84250 };
8585-8686- # The dynamic linker has different names on different Linux platforms.
8787- dynamicLinker =
8888- if !nativeLibc then
8989- (if stdenv.system == "i686-linux" then "ld-linux.so.2" else
9090- if stdenv.system == "x86_64-linux" then "ld-linux-x86-64.so.2" else
9191- # ARM with a wildcard, which can be "" or "-armhf".
9292- if stdenv.isArm then "ld-linux*.so.3" else
9393- if stdenv.system == "powerpc-linux" then "ld.so.1" else
9494- if stdenv.system == "mips64el-linux" then "ld.so.1" else
9595- abort "don't know the name of the dynamic linker for this platform")
9696- else "";
97251}
+35-45
pkgs/build-support/gcc-wrapper/gcc-wrapper.sh
···11#! @shell@ -e
2233-if test -n "$NIX_GCC_WRAPPER_START_HOOK"; then
33+if [ -n "$NIX_GCC_WRAPPER_START_HOOK" ]; then
44 source "$NIX_GCC_WRAPPER_START_HOOK"
55fi
6677-if test -z "$NIX_GCC_WRAPPER_FLAGS_SET"; then
77+if [ -z "$NIX_GCC_WRAPPER_FLAGS_SET" ]; then
88 source @out@/nix-support/add-flags.sh
99fi
1010···1818nonFlagArgs=0
19192020for i in "$@"; do
2121- if test "$i" = "-c"; then
2121+ if [ "$i" = -c ]; then
2222 dontLink=1
2323- elif test "$i" = "-S"; then
2323+ elif [ "$i" = -S ]; then
2424 dontLink=1
2525- elif test "$i" = "-E"; then
2525+ elif [ "$i" = -E ]; then
2626 dontLink=1
2727- elif test "$i" = "-E"; then
2727+ elif [ "$i" = -E ]; then
2828 dontLink=1
2929- elif test "$i" = "-M"; then
2929+ elif [ "$i" = -M ]; then
3030 dontLink=1
3131- elif test "$i" = "-MM"; then
3131+ elif [ "$i" = -MM ]; then
3232 dontLink=1
3333- elif test "$i" = "-x"; then
3333+ elif [ "$i" = -x ]; then
3434 # At least for the cases c-header or c++-header we should set dontLink.
3535 # I expect no one use -x other than making precompiled headers.
3636 dontLink=1
3737- elif test "${i:0:1}" != "-"; then
3737+ elif [ "${i:0:1}" != - ]; then
3838 nonFlagArgs=1
3939- elif test "$i" = "-m32"; then
4040- if test -e @out@/nix-support/dynamic-linker-m32; then
3939+ elif [ "$i" = -m32 ]; then
4040+ if [ -e @out@/nix-support/dynamic-linker-m32 ]; then
4141 NIX_LDFLAGS="$NIX_LDFLAGS -dynamic-linker $(cat @out@/nix-support/dynamic-linker-m32)"
4242 fi
4343 fi
···4848# "-c" flag). So if no non-flag arguments are given, don't pass any
4949# linker flags. This catches cases like "gcc" (should just print
5050# "gcc: no input files") and "gcc -v" (should print the version).
5151-if test "$nonFlagArgs" = "0"; then
5151+if [ "$nonFlagArgs" = 0 ]; then
5252 dontLink=1
5353fi
545455555656# Optionally filter out paths not refering to the store.
5757params=("$@")
5858-if test "$NIX_ENFORCE_PURITY" = "1" -a -n "$NIX_STORE"; then
5858+if [ "$NIX_ENFORCE_PURITY" = 1 -a -n "$NIX_STORE" ]; then
5959 rest=()
6060 n=0
6161- while test $n -lt ${#params[*]}; do
6161+ while [ $n -lt ${#params[*]} ]; do
6262 p=${params[n]}
6363 p2=${params[$((n+1))]}
6464- if test "${p:0:3}" = "-L/" && badPath "${p:2}"; then
6464+ if [ "${p:0:3}" = -L/ ] && badPath "${p:2}"; then
6565 skip $p
6666- elif test "$p" = "-L" && badPath "$p2"; then
6666+ elif [ "$p" = -L ] && badPath "$p2"; then
6767 n=$((n + 1)); skip $p2
6868- elif test "${p:0:3}" = "-I/" && badPath "${p:2}"; then
6868+ elif [ "${p:0:3}" = -I/ ] && badPath "${p:2}"; then
6969 skip $p
7070- elif test "$p" = "-I" && badPath "$p2"; then
7070+ elif [ "$p" = -I ] && badPath "$p2"; then
7171 n=$((n + 1)); skip $p2
7272- elif test "$p" = "-isystem" && badPath "$p2"; then
7272+ elif [ "$p" = -isystem ] && badPath "$p2"; then
7373 n=$((n + 1)); skip $p2
7474 else
7575 rest=("${rest[@]}" "$p")
···86868787# When enforcing purity, pretend gcc can't find the current date and
8888# time
8989-if test "$NIX_ENFORCE_PURITY" = "1"; then
8989+if [ "$NIX_ENFORCE_PURITY" = 1 ]; then
9090 extraAfter+=('-D__DATE__="Jan 01 1970"'
9191 '-D__TIME__="00:00:01"'
9292 -Wno-builtin-macro-redefined)
9393fi
949495959696-if test "$dontLink" != "1"; then
9696+if [ "$dontLink" != 1 ]; then
97979898 # Add the flags that should only be passed to the compiler when
9999 # linking.
···105105 extraBefore=(${extraBefore[@]} "-Wl,$i")
106106 done
107107 for i in $NIX_LDFLAGS; do
108108- if test "${i:0:3}" = "-L/"; then
109109- extraAfter+=("$i")
110110- else
111111- extraAfter+=("-Wl,$i")
112112- fi
108108+ if [ "${i:0:3}" = -L/ ]; then
109109+ extraAfter+=("$i")
110110+ else
111111+ extraAfter+=("-Wl,$i")
112112+ fi
113113 done
114114 export NIX_LDFLAGS_SET=1
115115fi
···118118# add anything. This is to prevent `gcc -v' (which normally prints
119119# out the version number and returns exit code 0) from printing out
120120# `No input files specified' and returning exit code 1.
121121-if test "$*" = "-v"; then
121121+if [ "$*" = -v ]; then
122122 extraAfter=()
123123 extraBefore=()
124124-fi
124124+fi
125125126126# Optionally print debug info.
127127-if test "$NIX_DEBUG" = "1"; then
128128- echo "original flags to @gccProg@:" >&2
127127+if [ -n "$NIX_DEBUG" ]; then
128128+ echo "original flags to @prog@:" >&2
129129 for i in "${params[@]}"; do
130130 echo " $i" >&2
131131 done
132132- echo "extraBefore flags to @gccProg@:" >&2
132132+ echo "extraBefore flags to @prog@:" >&2
133133 for i in ${extraBefore[@]}; do
134134 echo " $i" >&2
135135 done
136136- echo "extraAfter flags to @gccProg@:" >&2
136136+ echo "extraAfter flags to @prog@:" >&2
137137 for i in ${extraAfter[@]}; do
138138 echo " $i" >&2
139139 done
140140fi
141141142142-if test -n "$NIX_GCC_WRAPPER_EXEC_HOOK"; then
142142+if [ -n "$NIX_GCC_WRAPPER_EXEC_HOOK" ]; then
143143 source "$NIX_GCC_WRAPPER_EXEC_HOOK"
144144fi
145145146146-147147-# Call the real `gcc'. Filter out warnings from stderr about unused
148148-# `-B' flags, since they confuse some programs. Deep bash magic to
149149-# apply grep to stderr (by swapping stdin/stderr twice).
150150-if test -z "$NIX_GCC_NEEDS_GREP"; then
151151- @gccProg@ ${extraBefore[@]} "${params[@]}" "${extraAfter[@]}"
152152-else
153153- (@gccProg@ ${extraBefore[@]} "${params[@]}" "${extraAfter[@]}" 3>&2 2>&1 1>&3- \
154154- | (grep -v 'file path prefix' || true); exit ${PIPESTATUS[0]}) 3>&2 2>&1 1>&3-
155155- exit $?
156156-fi
146146+exec @prog@ ${extraBefore[@]} "${params[@]}" "${extraAfter[@]}"
+20-30
pkgs/build-support/gcc-wrapper/gnat-wrapper.sh
···11#! @shell@ -e
2233-if test -n "$NIX_GNAT_WRAPPER_START_HOOK"; then
33+if [ -n "$NIX_GNAT_WRAPPER_START_HOOK" ]; then
44 source "$NIX_GNAT_WRAPPER_START_HOOK"
55fi
6677-if test -z "$NIX_GNAT_WRAPPER_FLAGS_SET"; then
77+if [ -z "$NIX_GNAT_WRAPPER_FLAGS_SET" ]; then
88 source @out@/nix-support/add-flags.sh
99fi
1010···1818nonFlagArgs=0
19192020for i in "$@"; do
2121- if test "$i" = "-c"; then
2121+ if [ "$i" = -c ]; then
2222 dontLink=1
2323- elif test "$i" = "-M"; then
2323+ elif [ "$i" = -M ]; then
2424 dontLink=1
2525- elif test "${i:0:1}" != "-"; then
2525+ elif [ "${i:0:1}" != - ]; then
2626 nonFlagArgs=1
2727- elif test "$i" = "-m32"; then
2828- if test -e @out@/nix-support/dynamic-linker-m32; then
2727+ elif [ "$i" = -m32 ]; then
2828+ if [ -e @out@/nix-support/dynamic-linker-m32 ]; then
2929 NIX_LDFLAGS="$NIX_LDFLAGS -dynamic-linker $(cat @out@/nix-support/dynamic-linker-m32)"
3030 fi
3131 fi
···3636# "-c" flag). So if no non-flag arguments are given, don't pass any
3737# linker flags. This catches cases like "gcc" (should just print
3838# "gcc: no input files") and "gcc -v" (should print the version).
3939-if test "$nonFlagArgs" = "0"; then
3939+if [ "$nonFlagArgs" = 0 ]; then
4040 dontLink=1
4141fi
424243434444# Optionally filter out paths not refering to the store.
4545params=("$@")
4646-if test "$NIX_ENFORCE_PURITY" = "1" -a -n "$NIX_STORE"; then
4646+if [ "$NIX_ENFORCE_PURITY" = 1 -a -n "$NIX_STORE" ]; then
4747 rest=()
4848 n=0
4949- while test $n -lt ${#params[*]}; do
4949+ while [ $n -lt ${#params[*]} ]; do
5050 p=${params[n]}
5151 p2=${params[$((n+1))]}
5252- if test "${p:0:3}" = "-L/" && badPath "${p:2}"; then
5252+ if [ "${p:0:3}" = -L/ ] && badPath "${p:2}"; then
5353 skip $p
5454- elif test "${p:0:3}" = "-I/" && badPath "${p:2}"; then
5454+ elif [ "${p:0:3}" = -I/ ] && badPath "${p:2}"; then
5555 skip $p
5656- elif test "${p:0:4}" = "-aI/" && badPath "${p:3}"; then
5656+ elif [ "${p:0:4}" = -aI/ ] && badPath "${p:3}"; then
5757 skip $p
5858- elif test "${p:0:4}" = "-aO/" && badPath "${p:3}"; then
5858+ elif [ "${p:0:4}" = -aO/ ] && badPath "${p:3}"; then
5959 skip $p
6060 else
6161 rest=("${rest[@]}" "$p")
···8181#done
82828383# Optionally print debug info.
8484-if test "$NIX_DEBUG" = "1"; then
8585- echo "original flags to @gnatProg@:" >&2
8484+if [ -n "$NIX_DEBUG" ]; then
8585+ echo "original flags to @prog@:" >&2
8686 for i in "${params[@]}"; do
8787 echo " $i" >&2
8888 done
8989- echo "extraBefore flags to @gnatProg@:" >&2
8989+ echo "extraBefore flags to @prog@:" >&2
9090 for i in ${extraBefore[@]}; do
9191 echo " $i" >&2
9292 done
9393- echo "extraAfter flags to @gnatProg@:" >&2
9393+ echo "extraAfter flags to @prog@:" >&2
9494 for i in ${extraAfter[@]}; do
9595 echo " $i" >&2
9696 done
9797fi
98989999-if test -n "$NIX_GNAT_WRAPPER_EXEC_HOOK"; then
9999+if [ -n "$NIX_GNAT_WRAPPER_EXEC_HOOK" ]; then
100100 source "$NIX_GNAT_WRAPPER_EXEC_HOOK"
101101fi
102102103103-104104-# Call the real `gcc'. Filter out warnings from stderr about unused
105105-# `-B' flags, since they confuse some programs. Deep bash magic to
106106-# apply grep to stderr (by swapping stdin/stderr twice).
107107-if test -z "$NIX_GNAT_NEEDS_GREP"; then
108108- @gnatProg@ ${extraBefore[@]} "${params[@]}" ${extraAfter[@]}
109109-else
110110- (@gnatProg@ ${extraBefore[@]} "${params[@]}" ${extraAfter[@]} 3>&2 2>&1 1>&3- \
111111- | (grep -v 'file path prefix' || true); exit ${PIPESTATUS[0]}) 3>&2 2>&1 1>&3-
112112- exit $?
113113-fi
103103+exec @prog@ ${extraBefore[@]} "${params[@]}" ${extraAfter[@]}
···66# I've also tried adding -z direct and -z lazyload, but it gave too many problems with C++ exceptions :'(
77# Also made sure libgcc would not be lazy-loaded, as suggested here: https://www.illumos.org/issues/2534#note-3
88# but still no success.
99-cmd="@ld@ -z ignore"
99+cmd="@prog@ -z ignore"
10101111args=("$@");
1212
+31-31
pkgs/build-support/gcc-wrapper/ld-wrapper.sh
···11#! @shell@ -e
2233-if test -n "$NIX_LD_WRAPPER_START_HOOK"; then
33+if [ -n "$NIX_LD_WRAPPER_START_HOOK" ]; then
44 source "$NIX_LD_WRAPPER_START_HOOK"
55fi
6677-if test -z "$NIX_GCC_WRAPPER_FLAGS_SET"; then
77+if [ -z "$NIX_GCC_WRAPPER_FLAGS_SET" ]; then
88 source @out@/nix-support/add-flags.sh
99fi
1010···13131414# Optionally filter out paths not refering to the store.
1515params=("$@")
1616-if test "$NIX_ENFORCE_PURITY" = "1" -a -n "$NIX_STORE" \
1717- -a \( -z "$NIX_IGNORE_LD_THROUGH_GCC" -o -z "$NIX_LDFLAGS_SET" \); then
1616+if [ "$NIX_ENFORCE_PURITY" = 1 -a -n "$NIX_STORE" \
1717+ -a \( -z "$NIX_IGNORE_LD_THROUGH_GCC" -o -z "$NIX_LDFLAGS_SET" \) ]; then
1818 rest=()
1919 n=0
2020- while test $n -lt ${#params[*]}; do
2020+ while [ $n -lt ${#params[*]} ]; do
2121 p=${params[n]}
2222 p2=${params[$((n+1))]}
2323- if test "${p:0:3}" = "-L/" && badPath "${p:2}"; then
2323+ if [ "${p:0:3}" = -L/ ] && badPath "${p:2}"; then
2424 skip $p
2525- elif test "$p" = "-L" && badPath "$p2"; then
2525+ elif [ "$p" = -L ] && badPath "$p2"; then
2626 n=$((n + 1)); skip $p2
2727- elif test "$p" = "-rpath" && badPath "$p2"; then
2727+ elif [ "$p" = -rpath ] && badPath "$p2"; then
2828 n=$((n + 1)); skip $p2
2929- elif test "$p" = "-dynamic-linker" && badPath "$p2"; then
2929+ elif [ "$p" = -dynamic-linker ] && badPath "$p2"; then
3030 n=$((n + 1)); skip $p2
3131- elif test "${p:0:1}" = "/" && badPath "$p"; then
3131+ elif [ "${p:0:1}" = / ] && badPath "$p"; then
3232 # We cannot skip this; barf.
3333 echo "impure path \`$p' used in link" >&2
3434 exit 1
3535- elif test "${p:0:9}" = "--sysroot"; then
3535+ elif [ "${p:0:9}" = --sysroot ]; then
3636 # Our ld is not built with sysroot support (Can we fix that?)
3737 :
3838 else
···4747extra=()
4848extraBefore=()
49495050-if test -z "$NIX_LDFLAGS_SET"; then
5050+if [ -z "$NIX_LDFLAGS_SET" ]; then
5151 extra+=($NIX_LDFLAGS)
5252 extraBefore+=($NIX_LDFLAGS_BEFORE)
5353fi
···565657575858# Add all used dynamic libraries to the rpath.
5959-if test "$NIX_DONT_SET_RPATH" != "1"; then
5959+if [ "$NIX_DONT_SET_RPATH" != 1 ]; then
60606161 libPath=""
6262 addToLibPath() {
6363 local path="$1"
6464- if test "${path:0:1}" != "/"; then return 0; fi
6464+ if [ "${path:0:1}" != / ]; then return 0; fi
6565 case "$path" in
6666 *..*|*./*|*/.*|*//*)
6767 local path2
···7575 esac
7676 libPath="$libPath $path "
7777 }
7878-7878+7979 addToRPath() {
8080 # If the path is not in the store, don't add it to the rpath.
8181 # This typically happens for libraries in /tmp that are later
8282 # copied to $out/lib. If not, we're screwed.
8383- if test "${1:0:${#NIX_STORE}}" != "$NIX_STORE"; then return 0; fi
8383+ if [ "${1:0:${#NIX_STORE}}" != "$NIX_STORE" ]; then return 0; fi
8484 case $rpath in
8585 *\ $1\ *) return 0 ;;
8686 esac
···9797 # First, find all -L... switches.
9898 allParams=("${params[@]}" ${extra[@]})
9999 n=0
100100- while test $n -lt ${#allParams[*]}; do
100100+ while [ $n -lt ${#allParams[*]} ]; do
101101 p=${allParams[n]}
102102 p2=${allParams[$((n+1))]}
103103- if test "${p:0:3}" = "-L/"; then
103103+ if [ "${p:0:3}" = -L/ ]; then
104104 addToLibPath ${p:2}
105105- elif test "$p" = "-L"; then
105105+ elif [ "$p" = -L ]; then
106106 addToLibPath ${p2}
107107 n=$((n + 1))
108108- elif test "$p" = "-l"; then
108108+ elif [ "$p" = -l ]; then
109109 addToLibs ${p2}
110110 n=$((n + 1))
111111- elif test "${p:0:2}" = "-l"; then
111111+ elif [ "${p:0:2}" = -l ]; then
112112 addToLibs ${p:2}
113113- elif test "$p" = "-dynamic-linker"; then
114114- # Ignore the dynamic linker argument, or it
113113+ elif [ "$p" = -dynamic-linker ]; then
114114+ # Ignore the dynamic linker argument, or it
115115 # will get into the next 'elif'. We don't want
116116 # the dynamic linker path rpath to go always first.
117117 n=$((n + 1))
···129129 # so, add the directory to the rpath.
130130 # It's important to add the rpath in the order of -L..., so
131131 # the link time chosen objects will be those of runtime linking.
132132-132132+133133 for i in $libPath; do
134134 for j in $libs; do
135135- if test -f "$i/lib$j.so"; then
135135+ if [ -f "$i/lib$j.so" ]; then
136136 addToRPath $i
137137 break
138138 fi
139139 done
140140 done
141141-141141+142142143143 # Finally, add `-rpath' switches.
144144 for i in $rpath; do
···148148149149150150# Optionally print debug info.
151151-if test "$NIX_DEBUG" = "1"; then
152152- echo "original flags to @ld@:" >&2
151151+if [ -n "$NIX_DEBUG" ]; then
152152+ echo "original flags to @prog@:" >&2
153153 for i in "${params[@]}"; do
154154 echo " $i" >&2
155155 done
156156- echo "extra flags to @ld@:" >&2
156156+ echo "extra flags to @prog@:" >&2
157157 for i in ${extra[@]}; do
158158 echo " $i" >&2
159159 done
160160fi
161161162162-if test -n "$NIX_LD_WRAPPER_EXEC_HOOK"; then
162162+if [ -n "$NIX_LD_WRAPPER_EXEC_HOOK" ]; then
163163 source "$NIX_LD_WRAPPER_EXEC_HOOK"
164164fi
165165166166-exec @ld@ ${extraBefore[@]} "${params[@]}" ${extra[@]}
166166+exec @prog@ ${extraBefore[@]} "${params[@]}" ${extra[@]}
+10-10
pkgs/build-support/gcc-wrapper/setup-hook.sh
···11export NIX_GCC=@out@
2233addCVars () {
44- if test -d $1/include; then
55- export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -isystem $1/include"
44+ if [ -d $1/include ]; then
55+ export NIX_CFLAGS_COMPILE+=" -isystem $1/include"
66 fi
7788- if test -d $1/lib64; then
99- export NIX_LDFLAGS="$NIX_LDFLAGS -L$1/lib64"
88+ if [ -d $1/lib64 -a ! -L $1/lib64 ]; then
99+ export NIX_LDFLAGS+=" -L$1/lib64"
1010 fi
11111212- if test -d $1/lib; then
1313- export NIX_LDFLAGS="$NIX_LDFLAGS -L$1/lib"
1212+ if [ -d $1/lib ]; then
1313+ export NIX_LDFLAGS+=" -L$1/lib"
1414 fi
1515}
1616···18181919# Note: these come *after* $out in the PATH (see setup.sh).
20202121-if test -n "@gcc@"; then
2121+if [ -n "@gcc@" ]; then
2222 addToSearchPath PATH @gcc@/bin
2323fi
24242525-if test -n "@binutils@"; then
2525+if [ -n "@binutils@" ]; then
2626 addToSearchPath PATH @binutils@/bin
2727fi
28282929-if test -n "@libc@"; then
2929+if [ -n "@libc@" ]; then
3030 addToSearchPath PATH @libc@/bin
3131fi
32323333-if test -n "@coreutils@"; then
3333+if [ -n "@coreutils@" ]; then
3434 addToSearchPath PATH @coreutils@/bin
3535fi
+4-4
pkgs/build-support/gcc-wrapper/utils.sh
···11skip () {
22- if test "$NIX_DEBUG" = "1"; then
22+ if [ -n "$NIX_DEBUG" ]; then
33 echo "skipping impure path $1" >&2
44 fi
55}
···99# `/nix/store/.../lib/foo.so' isn't.
1010badPath() {
1111 local p=$1
1212-1212+1313 # Relative paths are okay (since they're presumably relative to
1414 # the temporary build directory).
1515- if test "${p:0:1}" != "/"; then return 1; fi
1616-1515+ if [ "${p:0:1}" != / ]; then return 1; fi
1616+1717 # Otherwise, the path should refer to the store or some temporary
1818 # directory (including the build directory).
1919 test \
···1010# their absolute path (using "install_name_tool -id"). It also
1111# rewrites references in other dylibs to absolute paths.
12121313+postFixupHooks+=('fixDarwinDylibNamesIn $prefix')
1414+1315fixDarwinDylibNames() {
1416 local flags=()
1517 local old_id
···2931 local dir="$1"
3032 fixDarwinDylibNames $(find "$dir" -name "*.dylib")
3133}
3232-3333-postFixup() {
3434- fixDarwinDylibNamesIn "$prefix"
3535-}
···11+{stdenv, fetchurl, perl, ncurses, gmp}:
22+33+stdenv.mkDerivation rec {
44+ version = "7.8.3";
55+66+ name = "ghc-${version}-binary";
77+88+ src =
99+ if stdenv.system == "i686-linux" then
1010+ fetchurl {
1111+ url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-i386-unknown-linux.tar.bz2";
1212+ sha256 = "0gny7knhss0w0d9r6jm1gghrcb8kqjvj94bb7hxf9syrk4fxlcxi";
1313+ }
1414+ else if stdenv.system == "x86_64-linux" then
1515+ fetchurl {
1616+ url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-x86_64-unknown-linux.tar.bz2";
1717+ sha256 = "043jabd0lh6n1zlqhysngbpvlsdznsa2mmsj08jyqgahw9sjb5ns";
1818+ }
1919+ else if stdenv.system == "i686-darwin" then
2020+ fetchurl {
2121+ url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-i386-apple-darwin.tar.bz2";
2222+ sha256 = "1vrbs3pzki37hzym1f1nh07lrqh066z3ypvm81fwlikfsvk4djc0";
2323+ }
2424+ else if stdenv.system == "x86_64-darwin" then
2525+ fetchurl {
2626+ url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-x86_64-apple-darwin.tar.bz2";
2727+ sha256 = "1ja0cq5xyjcvjpvjmm4nzhkpmwfs2kjlldbc48lxcs9rmqi7rnay";
2828+ }
2929+ else throw "cannot bootstrap GHC on this platform";
3030+3131+ buildInputs = [perl];
3232+3333+ postUnpack =
3434+ # Strip is harmful, see also below. It's important that this happens
3535+ # first. The GHC Cabal build system makes use of strip by default and
3636+ # has hardcoded paths to /usr/bin/strip in many places. We replace
3737+ # those below, making them point to our dummy script.
3838+ ''
3939+ mkdir "$TMP/bin"
4040+ for i in strip; do
4141+ echo '#! ${stdenv.shell}' > "$TMP/bin/$i"
4242+ chmod +x "$TMP/bin/$i"
4343+ done
4444+ PATH="$TMP/bin:$PATH"
4545+ '' +
4646+ # We have to patch the GMP paths for the integer-gmp package.
4747+ ''
4848+ find . -name integer-gmp.buildinfo \
4949+ -exec sed -i "s@extra-lib-dirs: @extra-lib-dirs: ${gmp}/lib@" {} \;
5050+ '' +
5151+ # On Linux, use patchelf to modify the executables so that they can
5252+ # find editline/gmp.
5353+ (if stdenv.isLinux then ''
5454+ find . -type f -perm +100 \
5555+ -exec patchelf --interpreter "$(cat $NIX_GCC/nix-support/dynamic-linker)" \
5656+ --set-rpath "${ncurses}/lib:${gmp}/lib" {} \;
5757+ sed -i "s|/usr/bin/perl|perl\x00 |" ghc-${version}/ghc/stage2/build/tmp/ghc-stage2
5858+ sed -i "s|/usr/bin/gcc|gcc\x00 |" ghc-${version}/ghc/stage2/build/tmp/ghc-stage2
5959+ for prog in ld ar gcc strip ranlib; do
6060+ find . -name "setup-config" -exec sed -i "s@/usr/bin/$prog@$(type -p $prog)@g" {} \;
6161+ done
6262+ '' else "");
6363+6464+ configurePhase = ''
6565+ ./configure --prefix=$out --with-gmp-libraries=${gmp}/lib \
6666+ --with-gmp-includes=${gmp}/include
6767+ '';
6868+6969+ # Stripping combined with patchelf breaks the executables (they die
7070+ # with a segfault or the kernel even refuses the execve). (NIXPKGS-85)
7171+ dontStrip = true;
7272+7373+ # No building is necessary, but calling make without flags ironically
7474+ # calls install-strip ...
7575+ buildPhase = "true";
7676+7777+ postInstall =
7878+ ''
7979+ # Sanity check, can ghc create executables?
8080+ cd $TMP
8181+ mkdir test-ghc; cd test-ghc
8282+ cat > main.hs << EOF
8383+ module Main where
8484+ main = putStrLn "yes"
8585+ EOF
8686+ $out/bin/ghc --make main.hs
8787+ echo compilation ok
8888+ [ $(./main) == "yes" ]
8989+ '';
9090+9191+ meta.license = stdenv.lib.licenses.bsd3;
9292+ meta.platforms = ["x86_64-linux" "i686-linux" "i686-darwin" "x86_64-darwin"];
9393+}
-2
pkgs/development/compilers/ghc/7.8.3.nix
···2626 export NIX_LDFLAGS="$NIX_LDFLAGS -rpath $out/lib/ghc-${version}"
2727 '';
28282929- configureFlags = "--with-gcc=${stdenv.gcc}/bin/gcc";
3030-3129 # required, because otherwise all symbols from HSffi.o are stripped, and
3230 # that in turn causes GHCi to abort
3331 stripDebugFlags = [ "-S" "--keep-file-symbols" ];
+4
pkgs/development/compilers/llvm/3.4/clang.nix
···11{ stdenv, fetch, cmake, libxml2, libedit, llvm, version, clang-tools-extra_src }:
2233+# be sure not to rebuild clang on darwin; some packages request it specifically
44+# we need to fix those
55+assert stdenv.isDarwin -> stdenv.gcc.nativeTools;
66+37stdenv.mkDerivation {
48 name = "clang-${version}";
59
···11+diff --git a/configure b/configure
22+index d45e88f..25d872b 100755
33+--- a/configure
44++++ b/configure
55+@@ -322,7 +322,14 @@ case "$bytecc,$target" in
66+ bytecccompopts="-fno-defer-pop $gcc_warnings -DSHRINKED_GNUC"
77+ mathlib="";;
88+ *,*-*-darwin*)
99+- bytecccompopts="-fno-defer-pop $gcc_warnings"
1010++ # On recent version of OSX, gcc is a symlink to clang
1111++ if $bytecc --version | grep -q clang; then
1212++ # -fno-defer-pop is not supported by clang, and make recent
1313++ # versions of clang to fail
1414++ bytecccompopts="$gcc_warnings"
1515++ else
1616++ bytecccompopts="-fno-defer-pop $gcc_warnings"
1717++ fi
1818+ mathlib=""
1919+ mkexe="$mkexe -Wl,-no_compact_unwind"
2020+ # Tell gcc that we can use 32-bit code addresses for threaded code
+14
pkgs/development/interpreters/guile/clang.patch
···11+diff --git a/lib/stdint.in.h b/lib/stdint.in.h
22+index 889bca7..15d39b0 100644
33+--- a/lib/stdint.in.h
44++++ b/lib/stdint.in.h
55+@@ -74,7 +74,8 @@
66+ in <inttypes.h> would reinclude us, skipping our contents because
77+ _@GUARD_PREFIX@_STDINT_H is defined.
88+ The include_next requires a split double-inclusion guard. */
99+-# @INCLUDE_NEXT@ @NEXT_STDINT_H@
1010++# include <inttypes.h>
1111++// # @INCLUDE_NEXT@ @NEXT_STDINT_H@
1212+ #endif
1313+1414+ #if ! defined _@GUARD_PREFIX@_STDINT_H && ! defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H
+3-3
pkgs/development/interpreters/guile/default.nix
···77 else stdenv.mkDerivation)
8899(rec {
1010- name = "guile-2.0.9";
1010+ name = "guile-2.0.11";
11111212 src = fetchurl {
1313 url = "mirror://gnu/guile/${name}.tar.xz";
1414- sha256 = "0nw9y8vjyz4r61v06p9msks5lm58pd91irmzg4k487vmv743h2pp";
1414+ sha256 = "1qh3j7308qvsjgwf7h94yqgckpbgz2k3yqdkzsyhqcafvfka9l5f";
1515 };
16161717 nativeBuildInputs = [ makeWrapper gawk pkgconfig ];
···29293030 enableParallelBuilding = true;
31313232- patches = [ ./disable-gc-sensitive-tests.patch ./eai_system.patch ] ++
3232+ patches = [ ./disable-gc-sensitive-tests.patch ./eai_system.patch ./clang.patch ] ++
3333 (stdenv.lib.optional (coverageAnalysis != null) ./gcov-file-name.patch);
34343535 # Explicitly link against libgcc_s, to work around the infamous
···11+--- src/dbinc/atomic.h 2013-03-12 14:07:22.000000000 -0400
22++++ src/dbinc/atomic.h.change 2013-03-12 14:06:35.000000000 -0400
33+@@ -144,7 +144,7 @@
44+ #define atomic_inc(env, p) __atomic_inc(p)
55+ #define atomic_dec(env, p) __atomic_dec(p)
66+ #define atomic_compare_exchange(env, p, o, n) \
77+- __atomic_compare_exchange((p), (o), (n))
88++ __atomic_compare_exchange_db((p), (o), (n))
99+ static inline int __atomic_inc(db_atomic_t *p)
1010+ {
1111+ int temp;
1212+@@ -176,7 +176,7 @@
1313+ * http://gcc.gnu.org/onlinedocs/gcc-4.1.0/gcc/Atomic-Builtins.html
1414+ * which configure could be changed to use.
1515+ */
1616+-static inline int __atomic_compare_exchange(
1717++static inline int __atomic_compare_exchange_db(
1818+ db_atomic_t *p, atomic_value_t oldval, atomic_value_t newval)
1919+ {
2020+ atomic_value_t was;
+3
pkgs/development/libraries/gmp/5.1.x.nix
···1616 # Build a "fat binary", with routines for several sub-architectures
1717 # (x86), except on Solaris where some tests crash with "Memory fault".
1818 # See <http://hydra.nixos.org/build/2760931>, for instance.
1919+ #
2020+ # no darwin because gmp uses ASM that clang doesn't like
1921 optional (!stdenv.isSunOS) "--enable-fat"
2022 ++ (if cxx then [ "--enable-cxx" ]
2123 else [ "--disable-cxx" ])
2224 ++ optional (cxx && stdenv.isDarwin) "CPPFLAGS=-fexceptions"
2525+ ++ optional stdenv.isDarwin "ABI=64"
2326 ++ optional stdenv.is64bit "--with-pic"
2427 ;
2528
···1616 "--with-gcc-arch=generic" # no detection of -march= or -mtune=
1717 ] ++ stdenv.lib.optional (stdenv.needsPax) "--enable-pax_emutramp";
18181919- doCheck = stdenv.isLinux; # until we solve dejagnu problems on darwin and expect on BSD
1919+ #doCheck = stdenv.isLinux; # until we solve dejagnu problems on darwin and expect on BSD
2020+ doCheck = false;
20212122 dontStrip = stdenv ? cross; # Don't run the native `strip' when cross-compiling.
22232324 postInstall =
2425 # Install headers in the right place.
2525- '' ln -s${if stdenv.isFreeBSD then "" else "r"}v "$out/lib/"libffi*/include "$out/include"
2626+ '' ln -s${if stdenv.isBSD then "" else "r"}v "$out/lib/"libffi*/include "$out/include"
2627 '';
27282829 meta = {
+2
pkgs/development/libraries/libgcrypt/default.nix
···10101111 propagatedBuildInputs = [ libgpgerror ];
12121313+ configureFlags = stdenv.lib.optional stdenv.isDarwin "--disable-asm";
1414+1315 doCheck = stdenv.system != "i686-linux"; # "basic" test fails after stdenv+glibc-2.18
14161517 # For some reason the tests don't find `libgpg-error.so'.
···10101111 buildInputs = [ gmp ];
12121313+ CFLAGS = "-I${gmp}/include";
1414+1315 configureFlags =
1416 /* Work around a FreeBSD bug that otherwise leads to segfaults in the test suite:
1517 http://hydra.bordeaux.inria.fr/build/34862
···6666 enableParallelBuilding = true;
67676868 meta = {
6969+ # due to builder args bug; see
7070+ # https://github.com/NixOS/nix/commit/b224ac15201c57b40ea855f5a98b1bd166c1c7f6
7171+ broken = stdenv.isDarwin;
6972 description = "Powerful package manager that makes package management reliable and reproducible";
7073 longDescription = ''
7174 Nix is a powerful package manager for Linux and other Unix systems that