Merge branch 'staging'

This commit is contained in:
Eelco Dolstra 2014-11-14 16:00:23 +01:00
commit ca441636f1
251 changed files with 2695 additions and 4747 deletions

View file

@ -27,9 +27,11 @@ with lib;
config = mkIf config.fonts.enableFontConfig {
# Bring in the default (upstream) fontconfig configuration.
# Fontconfig 2.10 backward compatibility
# Bring in the default (upstream) fontconfig configuration, only for fontconfig 2.10
environment.etc."fonts/fonts.conf".source =
pkgs.makeFontsConf { fontDirectories = config.fonts.fonts; };
pkgs.makeFontsConf { fontconfig = pkgs.fontconfig_210; fontDirectories = config.fonts.fonts; };
environment.etc."fonts/conf.d/00-nixos.conf".text =
''
@ -47,6 +49,29 @@ with lib;
</fontconfig>
'';
# Versioned fontconfig > 2.10. Take shared fonts.conf from fontconfig.
# Otherwise specify only font directories.
environment.etc."fonts/${pkgs.fontconfig.configVersion}/fonts.conf".source =
"${pkgs.fontconfig}/etc/fonts/fonts.conf";
environment.etc."fonts/${pkgs.fontconfig.configVersion}/conf.d/00-nixos.conf".text =
''
<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<fontconfig>
<!-- Set the default hinting style to "slight". -->
<match target="font">
<edit mode="assign" name="hintstyle">
<const>hintslight</const>
</edit>
</match>
<!-- Font directories -->
${concatStringsSep "\n" (map (font: "<dir>${font}</dir>") config.fonts.fonts)}
</fontconfig>
'';
environment.systemPackages = [ pkgs.fontconfig ];
};

View file

@ -13,14 +13,6 @@ with lib;
type = types.listOf types.path;
example = literalExample "[ pkgs.dejavu_fonts ]";
description = "List of primary font paths.";
apply = list: list ++
[ # - the user's current profile
"~/.nix-profile/lib/X11/fonts"
"~/.nix-profile/share/fonts"
# - the default profile
"/nix/var/nix/profiles/default/lib/X11/fonts"
"/nix/var/nix/profiles/default/share/fonts"
];
};
};

View file

@ -35,29 +35,27 @@ in
config = {
environment.etc =
[ # Name Service Switch configuration file. Required by the C library.
# !!! Factor out the mdns stuff. The avahi module should define
# an option used by this module.
{ source = pkgs.writeText "nsswitch.conf"
''
passwd: files ldap
group: files ldap
shadow: files ldap
hosts: files ${optionalString nssmdns "mdns_minimal [NOTFOUND=return]"} dns ${optionalString nssmdns "mdns"} ${optionalString nsswins "wins"} myhostname
networks: files dns
ethers: files
services: files
protocols: files
'';
target = "nsswitch.conf";
}
];
# Name Service Switch configuration file. Required by the C
# library. !!! Factor out the mdns stuff. The avahi module
# should define an option used by this module.
environment.etc."nsswitch.conf".text =
''
passwd: files ldap
group: files ldap
shadow: files ldap
hosts: files ${optionalString nssmdns "mdns_minimal [NOTFOUND=return]"} dns ${optionalString nssmdns "mdns"} ${optionalString nsswins "wins"} myhostname mymachines
networks: files dns
ethers: files
services: files
protocols: files
'';
# Use nss-myhostname to ensure that our hostname always resolves to
# a valid IP address. It returns all locally configured IP
# addresses, or ::1 and 127.0.0.2 as fallbacks.
system.nssModules = [ pkgs.systemd ];
# Systemd provides nss-myhostname to ensure that our hostname
# always resolves to a valid IP address. It returns all locally
# configured IP addresses, or ::1 and 127.0.0.2 as
# fallbacks. Systemd also provides nss-mymachines to return IP
# addresses of local containers.
system.nssModules = [ config.systemd.package ];
};
}

View file

@ -31,6 +31,7 @@ let
buildCommand = ''
mkdir -p $out
shopt -s nullglob
set +o pipefail
# Set a reasonable $PATH for programs called by udev rules.
echo 'ENV{PATH}="${udevPath}/bin:${udevPath}/sbin"' > $out/00-path.rules

View file

@ -62,7 +62,7 @@ in
mkdir -m 0755 -p /var/db/nscd
'';
restartTriggers = [ config.environment.etc.hosts.source ];
restartTriggers = [ config.environment.etc.hosts.source config.environment.etc."nsswitch.conf".source ];
serviceConfig =
{ ExecStart = "@${pkgs.glibc}/sbin/nscd nscd -f ${cfgFile}";

View file

@ -44,9 +44,10 @@ in {
};
environment.gnome3.packageSet = mkOption {
default = pkgs.gnome3;
example = literalExample "pkgs.gnome3_12";
default = null;
example = literalExample "pkgs.gnome3_10";
description = "Which Gnome 3 package set to use.";
apply = p: if p == null then pkgs.gnome3 else p;
};
environment.gnome3.excludePackages = mkOption {

View file

@ -5,8 +5,8 @@ with lib;
let
cfg = config.services.xserver.displayManager;
gdm = pkgs.gnome3_12.gdm; # gdm 3.10 not supported
gnome3 = config.environment.gnome3.packageSet;
gdm = gnome3.gdm;
in

View file

@ -372,7 +372,11 @@ exec 3>&-
# Emit a udev rule for /dev/root to prevent systemd from complaining.
eval $(udevadm info --export --export-prefix=ROOT_ --device-id-of-file=$targetRoot || true)
if [ -e /mnt-root/iso ]; then
eval $(udevadm info --export --export-prefix=ROOT_ --device-id-of-file=/mnt-root/iso || true)
else
eval $(udevadm info --export --export-prefix=ROOT_ --device-id-of-file=$targetRoot || true)
fi
if [ "$ROOT_MAJOR" -a "$ROOT_MINOR" -a "$ROOT_MAJOR" != 0 ]; then
mkdir -p /run/udev/rules.d
echo 'ACTION=="add|change", SUBSYSTEM=="block", ENV{MAJOR}=="'$ROOT_MAJOR'", ENV{MINOR}=="'$ROOT_MINOR'", SYMLINK+="root"' > /run/udev/rules.d/61-dev-root-link.rules

View file

@ -34,6 +34,8 @@ let
doublePatchelf = pkgs.stdenv.isArm;
}
''
set +o pipefail
mkdir -p $out/bin $out/lib
ln -s $out/bin $out/sbin

View file

@ -85,6 +85,7 @@ let
"systemd-journal-flush.service"
"systemd-journal-gatewayd.socket"
"systemd-journal-gatewayd.service"
"systemd-journald-dev-log.socket"
"syslog.socket"
# SysV init compatibility.

View file

@ -271,9 +271,12 @@ in
NotifyAccess = "all";
# Note that on reboot, systemd-nspawn returns 10, so this
# Note that on reboot, systemd-nspawn returns 133, so this
# unit will be restarted. On poweroff, it returns 0, so the
# unit won't be restarted.
RestartForceExitStatus = "133";
SuccessExitStatus = "133";
Restart = "on-failure";
# Hack: we don't want to kill systemd-nspawn, since we call

View file

@ -1,5 +1,5 @@
import ./make-test.nix {
name = "gnome3_12";
name = "gnome3";
machine =
{ config, pkgs, ... }:
@ -11,7 +11,7 @@ import ./make-test.nix {
services.xserver.displayManager.auto.enable = true;
services.xserver.displayManager.auto.user = "alice";
services.xserver.desktopManager.gnome3.enable = true;
environment.gnome3.packageSet = pkgs.gnome3_12;
environment.gnome3.packageSet = pkgs.gnome3_10;
virtualisation.memorySize = 512;
};

View file

@ -1,11 +1,8 @@
{ stdenv, fetchurl, pkgconfig, makeWrapper, intltool, libgpod, curl, flac,
gnome3_12, gtk3, glib, gettext, perl, perlXMLParser , libglade, flex, libid3tag,
gnome, gtk3, glib, gettext, perl, perlXMLParser, flex, libglade, libid3tag,
libvorbis, hicolor_icon_theme, gdk_pixbuf }:
let
gnome = gnome3_12;
in stdenv.mkDerivation rec {
stdenv.mkDerivation rec {
version = "2.1.4";
name = "gtkpod-${version}";

View file

@ -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;

View file

@ -1,5 +1,5 @@
{ stdenv, fetchurl, python, pkgconfig, cmake, bluez, libusb1, curl
, libiconv, gettext, sqlite }:
, libiconvOrEmpty, gettext, sqlite }:
with stdenv.lib;
@ -14,8 +14,8 @@ stdenv.mkDerivation rec {
patches = [ ./bashcomp-dir.patch ];
buildInputs = [ python pkgconfig cmake bluez libusb1 curl libiconv
gettext sqlite ];
buildInputs = [ python pkgconfig cmake bluez libusb1 curl gettext sqlite ]
++ libiconvOrEmpty;
enableParallelBuilding = true;

View file

@ -1,5 +1,5 @@
{ stdenv, fetchurl, autoconf, automake, libtool, pkgconfig, python
, boost, db, openssl, geoip, libiconv, miniupnpc
, boost, db, openssl, geoip, libiconvOrEmpty, miniupnpc
, srcOnly, fetchgit
}:
@ -33,8 +33,8 @@ in stdenv.mkDerivation rec {
buildInputs = [
autoconf automake libtool pkgconfig python
boost db openssl geoip libiconv miniupnpc
];
boost db openssl geoip miniupnpc
] ++ libiconvOrEmpty;
postPatch = ''
sed -i -e '/-htmldir/s|(default: [^)]*)|(default: ${twisterHTML})|' \

View file

@ -1,4 +1,5 @@
{ stdenv, fetchurl, cmake, freetype, libpng, mesa, gettext, openssl, qt4, perl, libiconv }:
{ stdenv, fetchurl, cmake, freetype, libpng, mesa, gettext, openssl, qt4, perl
, libiconvOrEmpty }:
stdenv.mkDerivation rec {
name = "stellarium-0.12.4";
@ -8,7 +9,8 @@ stdenv.mkDerivation rec {
sha256 = "11367hv9niyz9v47lf31vjsqkgc8da0vy2nhiyxgmk1i49p1pbhg";
};
buildInputs = [ cmake freetype libpng mesa gettext openssl qt4 perl libiconv ];
buildInputs = [ cmake freetype libpng mesa gettext openssl qt4 perl ]
++ libiconvOrEmpty;
enableParallelBuilding = true;

View file

@ -2,4 +2,4 @@ addRLibPath () {
addToSearchPath R_LIBS_SITE $1/library
}
envHooks=(${envHooks[@]} addRLibPath)
envHooks+=(addRLibPath)

View file

@ -38,16 +38,14 @@ stdenv.mkDerivation rec {
${if pythonBindings || perlBindings then "--with-swig=${swig}" else "--without-swig"}
${if javahlBindings then "--enable-javahl --with-jdk=${jdk}" else ""}
${if stdenv.isDarwin then "--enable-keychain" else "--disable-keychain"}
${if saslSupport then "--enable-sasl --with-sasl=${sasl}" else "--disable-sasl"}
${if httpSupport then "--enable-serf --with-serf=${serf}" else "--disable-serf"}
${if saslSupport then "--with-sasl=${sasl}" else "--without-sasl"}
${if httpSupport then "--with-serf=${serf}" else "--without-serf"}
--with-zlib=${zlib}
--with-sqlite=${sqlite}
'';
preBuild = ''
makeFlagsArray=(APACHE_LIBEXECDIR=$out/modules)
'' + stdenv.lib.optionalString stdenv.isDarwin ''
substituteInPlace configure --replace "-no-cpp-precomp" ""
'';
postInstall = ''
@ -73,10 +71,6 @@ 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/;

View file

@ -1,6 +1,6 @@
{ stdenv, fetchurl
, libX11, gettext, wxGTK
, libiconv, fontconfig, freetype
, libX11, wxGTK
, libiconvOrEmpty, fontconfig, freetype
, mesa
, libass, fftw, ffms
, ffmpeg, pkgconfig, zlib # Undocumented (?) dependencies
@ -29,16 +29,20 @@ stdenv.mkDerivation rec {
};
buildInputs = with stdenv.lib;
[ intltool libX11 gettext wxGTK libiconv fontconfig freetype mesa libass fftw ffms ffmpeg pkgconfig zlib icu boost ]
++ optional spellChecking hunspell
++ optional automationSupport lua
++ optional openalSupport openal
++ optional alsaSupport alsaLib
++ optional pulseaudioSupport pulseaudio
++ optional portaudioSupport portaudio
;
[ pkgconfig intltool libX11 wxGTK fontconfig freetype mesa
libass fftw ffms ffmpeg zlib icu boost boost.lib
]
++ libiconvOrEmpty
++ optional spellChecking hunspell
++ optional automationSupport lua
++ optional openalSupport openal
++ optional alsaSupport alsaLib
++ optional pulseaudioSupport pulseaudio
++ optional portaudioSupport portaudio
;
NIX_LDFLAGS = "-liconv -lavutil -lavformat -lavcodec -lswscale -lz -lm -lGL";
enableParallelBuilding = true;
postInstall = "ln -s $out/bin/aegisub-* $out/bin/aegisub";

View file

@ -221,6 +221,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 \
@ -243,6 +247,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"

View file

@ -1,24 +0,0 @@
# `-B@out@/bin' forces clang to use ld-wrapper.sh when calling ld.
export NIX_CFLAGS_COMPILE="-B@out@/bin/ $NIX_CFLAGS_COMPILE"
if test -e @out@/nix-support/libc-cflags; then
export NIX_CFLAGS_COMPILE="$(cat @out@/nix-support/libc-cflags) $NIX_CFLAGS_COMPILE"
fi
if test -e @out@/nix-support/clang-cflags; then
export NIX_CFLAGS_COMPILE="$(cat @out@/nix-support/clang-cflags) $NIX_CFLAGS_COMPILE"
fi
if test -e @out@/nix-support/libc-ldflags; then
export NIX_LDFLAGS="$NIX_LDFLAGS $(cat @out@/nix-support/libc-ldflags)"
fi
if test -e @out@/nix-support/clang-ldflags; then
export NIX_LDFLAGS="$NIX_LDFLAGS $(cat @out@/nix-support/clang-ldflags)"
fi
if test -e @out@/nix-support/libc-ldflags-before; then
export NIX_LDFLAGS_BEFORE="$(cat @out@/nix-support/libc-ldflags-before) $NIX_LDFLAGS_BEFORE"
fi
export NIX_GCC_WRAPPER_FLAGS_SET=1

View file

@ -1,137 +0,0 @@
source $stdenv/setup
mkdir -p $out/bin
mkdir -p $out/nix-support
if test -z "$nativeLibc"; then
dynamicLinker="$libc/lib/$dynamicLinker"
echo $dynamicLinker > $out/nix-support/dynamic-linker
if test -e $libc/lib/32/ld-linux.so.2; then
echo $libc/lib/32/ld-linux.so.2 > $out/nix-support/dynamic-linker-m32
fi
# The "-B$libc/lib/" flag is a quick hack to force clang to link
# against the crt1.o from our own glibc, rather than the one in
# /usr/lib. (This is only an issue when using an `impure'
# compiler/linker, i.e., one that searches /usr/lib and so on.)
echo "-B$libc/lib/ -idirafter $libc/include" > $out/nix-support/libc-cflags
echo "-L$libc/lib" > $out/nix-support/libc-ldflags
# The dynamic linker is passed in `ldflagsBefore' to allow
# explicit overrides of the dynamic linker by callers to clang/ld
# (the *last* value counts, so ours should come first).
echo "-dynamic-linker $dynamicLinker" > $out/nix-support/libc-ldflags-before
fi
if test -n "$nativeTools"; then
clangPath="$nativePrefix/bin"
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"
fi
clangLDFlags="$clangLDFlags -L$clang/lib"
echo "$clangLDFlags" > $out/nix-support/clang-ldflags
# Need files like crtbegin.o from gcc
# It's unclear if these will ever be provided by an LLVM project
clangCFlags="$clangCFlags -B$basePath"
clangCFlags="$clangCFlags -isystem$clang/lib/clang/$clangVersion/include"
echo "$clangCFlags" > $out/nix-support/clang-cflags
clangPath="$clang/bin"
ldPath="$binutils/bin"
fi
doSubstitute() {
local src=$1
local dst=$2
local uselibcxx=
local uselibcxxabi=
if test -n "$libcxx" && echo $dst | fgrep ++; then uselibcxx=$libcxx; fi
if test -n "$libcxxabi" && echo $dst | fgrep ++; then uselibcxxabi=$libcxxabi; fi
# Can't use substitute() here, because replace may not have been
# built yet (in the bootstrap).
sed \
-e "s^@out@^$out^g" \
-e "s^@shell@^$shell^g" \
-e "s^@libcxx@^$uselibcxx^g" \
-e "s^@libcxxabi@^$uselibcxxabi^g" \
-e "s^@clang@^$clang^g" \
-e "s^@clangProg@^$clangProg^g" \
-e "s^@binutils@^$binutils^g" \
-e "s^@coreutils@^$coreutils^g" \
-e "s^@libc@^$libc^g" \
-e "s^@ld@^$ldPath/ld^g" \
< "$src" > "$dst"
}
# Make wrapper scripts around clang and clang++. Also make symlinks
# cc and c++
mkClangWrapper() {
local dst=$1
local src=$2
if ! test -f "$src"; then
echo "$src does not exist (skipping)"
return 1
fi
clangProg="$src"
doSubstitute "$clangWrapper" "$dst"
chmod +x "$dst"
}
if mkClangWrapper $out/bin/clang $clangPath/clang
then
ln -sv clang $out/bin/cc
fi
if mkClangWrapper $out/bin/clang++ $clangPath/clang++
then
ln -sv clang++ $out/bin/c++
fi
# Create a symlink to as (the assembler). This is useful when a
# clang-wrapper is installed in a user environment, as it ensures that
# the right assembler is called.
ln -s $ldPath/as $out/bin/as
# Make a wrapper around the linker.
doSubstitute "$ldWrapper" "$out/bin/ld"
chmod +x "$out/bin/ld"
# Emit a setup hook. Also store the path to the original Clang and
# libc.
test -n "$clang" && echo $clang > $out/nix-support/orig-clang
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"
cp -p $utils $out/nix-support/utils.sh
# Propagate the wrapped clang so that if you install the wrapper, you get
# llvm tools, the manpages, etc. as well (including for binutils
# and Glibc).
if test -z "$nativeTools"; then
echo $clang $binutils $libc > $out/nix-support/propagated-user-env-packages
fi

View file

@ -1,150 +0,0 @@
#! @shell@ -e
if test -n "$NIX_GCC_WRAPPER_START_HOOK"; then
source "$NIX_GCC_WRAPPER_START_HOOK"
fi
if test -z "$NIX_GCC_WRAPPER_FLAGS_SET"; then
source @out@/nix-support/add-flags.sh
fi
source @out@/nix-support/utils.sh
# Figure out if linker flags should be passed. Clang prints annoying
# warnings when they are not needed. (does it really? Copied from gcc-wrapper)
dontLink=0
getVersion=0
nonFlagArgs=0
for i in "$@"; do
if test "$i" = "-c"; then
dontLink=1
elif test "$i" = "-S"; then
dontLink=1
elif test "$i" = "-E"; then
dontLink=1
elif test "$i" = "-E"; then
dontLink=1
elif test "$i" = "-M"; then
dontLink=1
elif test "$i" = "-MM"; then
dontLink=1
elif test "$i" = "-x"; then
# At least for the cases c-header or c++-header we should set dontLink.
# I expect no one use -x other than making precompiled headers.
dontLink=1
elif test "${i:0:1}" != "-"; then
nonFlagArgs=1
elif test "$i" = "-m32"; then
if test -e @out@/nix-support/dynamic-linker-m32; then
NIX_LDFLAGS="$NIX_LDFLAGS -dynamic-linker $(cat @out@/nix-support/dynamic-linker-m32)"
fi
fi
done
# If we pass a flag like -Wl, then clang will call the linker unless it
# can figure out that it has to do something else (e.g., because of a
# "-c" flag). So if no non-flag arguments are given, don't pass any
# linker flags. This catches cases like "clang" (should just print
# "clang: no input files") and "clang -v" (should print the version).
if test "$nonFlagArgs" = "0"; then
dontLink=1
fi
# Optionally filter out paths not refering to the store.
params=("$@")
if test "$NIX_ENFORCE_PURITY" = "1" -a -n "$NIX_STORE"; then
rest=()
n=0
while test $n -lt ${#params[*]}; do
p=${params[n]}
p2=${params[$((n+1))]}
if test "${p:0:3}" = "-L/" && badPath "${p:2}"; then
skip $p
elif test "$p" = "-L" && badPath "$p2"; then
n=$((n + 1)); skip $p2
elif test "${p:0:3}" = "-I/" && badPath "${p:2}"; then
skip $p
elif test "$p" = "-I" && badPath "$p2"; then
n=$((n + 1)); skip $p2
elif test "$p" = "-isystem" && badPath "$p2"; then
n=$((n + 1)); skip $p2
else
rest=("${rest[@]}" "$p")
fi
n=$((n + 1))
done
params=("${rest[@]}")
NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE --sysroot=/var/empty"
fi
if test -n "@libcxx@"; then
NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -isystem@libcxx@/include/c++/v1 -stdlib=libc++"
NIX_CFLAGS_LINK="$NIX_CFLAGS_LINK -L@libcxx@/lib -stdlib=libc++ -L@libcxxabi@/lib -lc++abi"
fi
# Add the flags for the C compiler proper.
extraAfter=($NIX_CFLAGS_COMPILE)
extraBefore=()
if test "$dontLink" != "1"; then
# Add the flags that should only be passed to the compiler when
# linking.
extraAfter=(${extraAfter[@]} $NIX_CFLAGS_LINK)
# Add the flags that should be passed to the linker (and prevent
# `ld-wrapper' from adding NIX_LDFLAGS again).
for i in $NIX_LDFLAGS_BEFORE; do
extraBefore=(${extraBefore[@]} "-Wl,$i")
done
for i in $NIX_LDFLAGS; do
if test "${i:0:3}" = "-L/"; then
extraAfter=(${extraAfter[@]} "$i")
else
extraAfter=(${extraAfter[@]} "-Wl,$i")
fi
done
export NIX_LDFLAGS_SET=1
fi
# As a very special hack, if the arguments are just `-v', then don't
# add anything. This is to prevent `clang -v' (which normally prints
# out the version number and returns exit code 0) from printing out
# `No input files specified' and returning exit code 1.
if test "$*" = "-v"; then
extraAfter=()
extraBefore=()
fi
# Optionally print debug info.
if test "$NIX_DEBUG" = "1"; then
echo "original flags to @clangProg@:" >&2
for i in "${params[@]}"; do
echo " $i" >&2
done
echo "extraBefore flags to @clangProg@:" >&2
for i in ${extraBefore[@]}; do
echo " $i" >&2
done
echo "extraAfter flags to @clangProg@:" >&2
for i in ${extraAfter[@]}; do
echo " $i" >&2
done
fi
if test -n "$NIX_CLANG_WRAPPER_EXEC_HOOK"; then
source "$NIX_CLANG_WRAPPER_EXEC_HOOK"
fi
# Call the real `clang'. Filter out warnings from stderr about unused
# `-B' flags, since they confuse some programs. Deep bash magic to
# apply grep to stderr (by swapping stdin/stderr twice).
if test -z "$NIX_CLANG_NEEDS_GREP"; then
@clangProg@ ${extraBefore[@]} "${params[@]}" ${extraAfter[@]}
else
(@clangProg@ ${extraBefore[@]} "${params[@]}" ${extraAfter[@]} 3>&2 2>&1 1>&3- \
| (grep -v 'file path prefix' || true); exit ${PIPESTATUS[0]}) 3>&2 2>&1 1>&3-
exit $?
fi

View file

@ -1,89 +0,0 @@
# The Nix `clang' stdenv.mkDerivation is not directly usable, since it doesn't
# know where the C library and standard header files are. Therefore
# the compiler produced by that package cannot be installed directly
# in a user environment and used from the command line. This
# stdenv.mkDerivation provides a wrapper that sets up the right environment
# variables so that the compiler and the linker just "work".
{ name ? "", stdenv, nativeTools, nativeLibc, nativePrefix ? ""
, clang ? null, libc ? null, binutils ? null, coreutils ? null, shell ? ""
, zlib ? null, libcxx ? null
}:
assert nativeTools -> nativePrefix != "";
assert !nativeTools -> clang != null && binutils != null && coreutils != null;
assert !nativeLibc -> libc != null;
let
clangVersion = (builtins.parseDrvName clang.name).version;
clangName = (builtins.parseDrvName clang.name).name;
in
stdenv.mkDerivation {
name =
(if name != "" then name else clangName + "-wrapper") +
(if clang != null && clangVersion != "" then "-" + clangVersion else "");
builder = ./builder.sh;
setupHook = ./setup-hook.sh;
clangWrapper = ./clang-wrapper.sh;
ldWrapper = ../gcc-wrapper/ld-wrapper.sh;
utils = ../gcc-wrapper/utils.sh;
addFlags = ./add-flags;
inherit nativeTools nativeLibc nativePrefix clang clangVersion libcxx;
libcxxabi = libcxx.abi or null;
gcc = clang.gcc;
libc = if nativeLibc then null else libc;
binutils = if nativeTools then null else binutils;
# The wrapper scripts use 'cat', so we may need coreutils
coreutils = if nativeTools then null else coreutils;
langC = true;
langCC = true;
shell = if shell == "" then stdenv.shell else
if builtins.isAttrs shell then (shell + shell.shellPath)
else shell;
crossAttrs = {
shell = shell.crossDrv + shell.crossDrv.shellPath;
libc = libc.crossDrv;
coreutils = coreutils.crossDrv;
binutils = binutils.crossDrv;
clang = clang.crossDrv;
#
# This is not the best way to do this. I think the reference should be
# the style in the gcc-cross-wrapper, but to keep a stable stdenv now I
# do this sufficient if/else.
dynamicLinker =
(if stdenv.cross.arch == "arm" then "ld-linux.so.3" else
if stdenv.cross.arch == "mips" then "ld.so.1" else
if stdenv.lib.hasSuffix "pc-gnu" stdenv.cross.config then "ld.so.1" else
abort "don't know the name of the dynamic linker for this platform");
};
meta =
let clang_ = if clang != null then clang else {}; in
(if clang_ ? meta then removeAttrs clang.meta ["priority"] else {}) //
{ description =
stdenv.lib.attrByPath ["meta" "description"] "System C compiler" clang_
+ " (wrapper script)";
};
# The dynamic linker has different names on different Linux platforms.
dynamicLinker =
if !nativeLibc then
(if stdenv.system == "i686-linux" then "ld-linux.so.2" else
if stdenv.system == "x86_64-linux" then "ld-linux-x86-64.so.2" else
if stdenv.isArm then "ld-linux.so.3" else
if stdenv.system == "powerpc-linux" then "ld.so.1" else
if stdenv.system == "mips64el-linux" then "ld.so.1" else
abort "don't know the name of the dynamic linker for this platform")
else "";
preferLocalBuild = true;
}

View file

@ -1,36 +0,0 @@
addCVars () {
if test -d $1/include; then
export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -isystem $1/include"
fi
if test -d $1/lib64; then
export NIX_LDFLAGS="$NIX_LDFLAGS -L$1/lib64"
fi
if test -d $1/lib; then
export NIX_LDFLAGS="$NIX_LDFLAGS -L$1/lib"
fi
}
envHooks=(${envHooks[@]} addCVars)
# Note: these come *after* $out in the PATH (see setup.sh).
if test -n "@clang@"; then
addToSearchPath PATH @clang@/bin
fi
if test -n "@binutils@"; then
addToSearchPath PATH @binutils@/bin
fi
if test -n "@libc@"; then
addToSearchPath PATH @libc@/bin
fi
if test -n "@coreutils@"; then
addToSearchPath PATH @coreutils@/bin
fi
: ${CXX:=clang++}
export CXX

View file

@ -83,6 +83,7 @@ init_remote(){
local url=$1
git init
git remote add origin $url
( [ -n "$http_proxy" ] && git config http.proxy $http_proxy ) || true
}
# Return the reference of an hash if it exists on the remote repository.

View file

@ -13,9 +13,7 @@
, ... } @ args:
fetchurl ({
# Remove the extension, because otherwise unpackPhase will get
# confused. FIXME: fix unpackPhase.
name = args.name or lib.removeSuffix ".zip" (lib.removeSuffix ".tar.gz" (baseNameOf url));
name = args.name or (baseNameOf url);
recursiveHash = true;

View file

@ -114,13 +114,4 @@ fi
# We want gcc to call the wrapper linker, not that of binutils.
export PATH="@ldPath@:$PATH"
# Call the real `gcc'. Filter out warnings from stderr about unused
# `-B' flags, since they confuse some programs. Deep bash magic to
# apply grep to stderr (by swapping stdin/stderr twice).
if test -z "$NIX_GCC_NEEDS_GREP"; then
@gccProg@ ${extraBefore[@]} "${params[@]}" ${extraAfter[@]}
else
(@gccProg@ ${extraBefore[@]} "${params[@]}" ${extraAfter[@]} 3>&2 2>&1 1>&3- \
| (grep -v 'file path prefix' || true); exit ${PIPESTATUS[0]}) 3>&2 2>&1 1>&3-
exit $?
fi
exec @gccProg@ ${extraBefore[@]} "${params[@]}" ${extraAfter[@]}

View file

@ -11,7 +11,7 @@ crossAddCVars () {
fi
}
crossEnvHooks=(${crossEnvHooks[@]} crossAddCVars)
crossEnvHooks+=(crossAddCVars)
crossStripDirs() {
local dirs="$1"

View file

@ -1,27 +1,27 @@
# `-B@out@/bin' forces gcc to use ld-wrapper.sh when calling ld.
export NIX_CFLAGS_COMPILE="-B@out@/bin/ $NIX_CFLAGS_COMPILE"
if test -e @out@/nix-support/libc-cflags; then
if [ -e @out@/nix-support/libc-cflags ]; then
export NIX_CFLAGS_COMPILE="$(cat @out@/nix-support/libc-cflags) $NIX_CFLAGS_COMPILE"
fi
if test -e @out@/nix-support/gcc-cflags; then
if [ -e @out@/nix-support/gcc-cflags ]; then
export NIX_CFLAGS_COMPILE="$(cat @out@/nix-support/gcc-cflags) $NIX_CFLAGS_COMPILE"
fi
if test -e @out@/nix-support/gnat-cflags; then
if [ -e @out@/nix-support/gnat-cflags ]; then
export NIX_GNATFLAGS_COMPILE="$(cat @out@/nix-support/gnat-cflags) $NIX_GNATFLAGS_COMPILE"
fi
if test -e @out@/nix-support/libc-ldflags; then
export NIX_LDFLAGS="$NIX_LDFLAGS $(cat @out@/nix-support/libc-ldflags)"
if [ -e @out@/nix-support/libc-ldflags ]; then
export NIX_LDFLAGS+=" $(cat @out@/nix-support/libc-ldflags)"
fi
if test -e @out@/nix-support/gcc-ldflags; then
export NIX_LDFLAGS="$NIX_LDFLAGS $(cat @out@/nix-support/gcc-ldflags)"
if [ -e @out@/nix-support/gcc-ldflags ]; then
export NIX_LDFLAGS+=" $(cat @out@/nix-support/gcc-ldflags)"
fi
if test -e @out@/nix-support/libc-ldflags-before; then
if [ -e @out@/nix-support/libc-ldflags-before ]; then
export NIX_LDFLAGS_BEFORE="$(cat @out@/nix-support/libc-ldflags-before) $NIX_LDFLAGS_BEFORE"
fi

View file

@ -1,214 +0,0 @@
source $stdenv/setup
mkdir -p $out/bin
mkdir -p $out/nix-support
if test -z "$nativeLibc"; then
dynamicLinker="$libc/lib/$dynamicLinker"
echo $dynamicLinker > $out/nix-support/dynamic-linker
if test -e $libc/lib/32/ld-linux.so.2; then
echo $libc/lib/32/ld-linux.so.2 > $out/nix-support/dynamic-linker-m32
fi
# The "-B$libc/lib/" flag is a quick hack to force gcc to link
# against the crt1.o from our own glibc, rather than the one in
# /usr/lib. (This is only an issue when using an `impure'
# compiler/linker, i.e., one that searches /usr/lib and so on.)
#
# Unfortunately, setting -B appears to override the default search
# path. Thus, the gcc-specific "../includes-fixed" directory is
# now longer searched and glibc's <limits.h> header fails to
# compile, because it uses "#include_next <limits.h>" to find the
# limits.h file in ../includes-fixed. To remedy the problem,
# another -idirafter is necessary to add that directory again.
echo "-B$libc/lib/ -idirafter $libc/include -idirafter $gcc/lib/gcc/*/*/include-fixed" > $out/nix-support/libc-cflags
echo "-L$libc/lib" > $out/nix-support/libc-ldflags
# The dynamic linker is passed in `ldflagsBefore' to allow
# explicit overrides of the dynamic linker by callers to gcc/ld
# (the *last* value counts, so ours should come first).
echo "-dynamic-linker" $dynamicLinker > $out/nix-support/libc-ldflags-before
fi
if test -n "$nativeTools"; then
gccPath="$nativePrefix/bin"
ldPath="$nativePrefix/bin"
else
if test -e "$gcc/lib64"; then
gccLDFlags="$gccLDFlags -L$gcc/lib64"
fi
gccLDFlags="$gccLDFlags -L$gcc/lib"
if [ -n "$langVhdl" ]; then
gccLDFlags="$gccLDFlags -L$zlib/lib"
fi
echo "$gccLDFlags" > $out/nix-support/gcc-ldflags
# GCC shows $gcc/lib in `gcc -print-search-dirs', but not
# $gcc/lib64 (even though it does actually search there...)..
# This confuses libtool. So add it to the compiler tool search
# path explicitly.
if test -e "$gcc/lib64"; then
gccCFlags="$gccCFlags -B$gcc/lib64"
fi
# Find the gcc libraries path (may work only without multilib)
if [ -n "$langAda" ]; then
basePath=`echo $gcc/lib/*/*/*`
gccCFlags="$gccCFlags -B$basePath -I$basePath/adainclude"
gnatCFlags="-aI$basePath/adainclude -aO$basePath/adalib"
echo "$gnatCFlags" > $out/nix-support/gnat-cflags
fi
echo "$gccCFlags" > $out/nix-support/gcc-cflags
gccPath="$gcc/bin"
# On Illumos/Solaris we might prefer native ld
if test -n "$nativePrefix"; then
ldPath="$nativePrefix/bin"
else
ldPath="$binutils/bin"
fi;
fi
doSubstitute() {
local src=$1
local dst=$2
local ld="$ldPath/ld"
if $ld -V 2>&1 |grep Solaris; then
# Use Solaris specific linker wrapper
ld="$out/bin/ld-solaris"
fi
# Can't use substitute() here, because replace may not have been
# built yet (in the bootstrap).
sed \
-e "s^@out@^$out^g" \
-e "s^@shell@^$shell^g" \
-e "s^@gcc@^$gcc^g" \
-e "s^@gccProg@^$gccProg^g" \
-e "s^@gnatProg@^$gnatProg^g" \
-e "s^@gnatlinkProg@^$gnatlinkProg^g" \
-e "s^@binutils@^$binutils^g" \
-e "s^@coreutils@^$coreutils^g" \
-e "s^@libc@^$libc^g" \
-e "s^@ld@^$ld^g" \
< "$src" > "$dst"
}
# Make wrapper scripts around gcc, g++, and gfortran. Also make symlinks
# cc, c++, and f77.
mkGccWrapper() {
local dst=$1
local src=$2
if ! test -f "$src"; then
echo "$src does not exist (skipping)"
return 1
fi
gccProg="$src"
doSubstitute "$gccWrapper" "$dst"
chmod +x "$dst"
}
mkGnatWrapper() {
local dst=$1
local src=$2
if ! test -f "$src"; then
echo "$src does not exist (skipping)"
return 1
fi
gnatProg="$src"
doSubstitute "$gnatWrapper" "$dst"
chmod +x "$dst"
}
mkGnatLinkWrapper() {
local dst=$1
local src=$2
if ! test -f "$src"; then
echo "$src does not exist (skipping)"
return 1
fi
gnatlinkProg="$src"
doSubstitute "$gnatlinkWrapper" "$dst"
chmod +x "$dst"
}
if mkGccWrapper $out/bin/gcc $gccPath/gcc
then
ln -sv gcc $out/bin/cc
fi
if mkGccWrapper $out/bin/g++ $gccPath/g++
then
ln -sv g++ $out/bin/c++
fi
mkGccWrapper $out/bin/cpp $gccPath/cpp || true
if mkGccWrapper $out/bin/gfortran $gccPath/gfortran
then
ln -sv gfortran $out/bin/g77
ln -sv gfortran $out/bin/f77
fi
mkGccWrapper $out/bin/gcj $gccPath/gcj || true
mkGccWrapper $out/bin/gccgo $gccPath/gccgo || true
mkGccWrapper $out/bin/gnatgcc $gccPath/gnatgcc || true
mkGnatWrapper $out/bin/gnatmake $gccPath/gnatmake || true
mkGnatWrapper $out/bin/gnatbind $gccPath/gnatbind || true
mkGnatLinkWrapper $out/bin/gnatlink $gccPath/gnatlink || true
if [ -f $gccPath/ghdl ]; then
ln -sf $gccPath/ghdl $out/bin/ghdl
fi
# Create a symlink to as (the assembler). This is useful when a
# gcc-wrapper is installed in a user environment, as it ensures that
# the right assembler is called.
ln -s $ldPath/as $out/bin/as
# Make a wrapper around the linker.
doSubstitute "$ldWrapper" "$out/bin/ld"
chmod +x "$out/bin/ld"
# Copy solaris ld wrapper if needed
if $ldPath/ld -V 2>&1 |grep Solaris; then
# Use Solaris specific linker wrapper
sed -e "s^@ld@^$ldPath/ld^g" < "$ldSolarisWrapper" > "$out/bin/ld-solaris"
chmod +x "$out/bin/ld-solaris"
fi
# Emit a setup hook. Also store the path to the original GCC and
# Glibc.
test -n "$gcc" && echo $gcc > $out/nix-support/orig-gcc
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"
cp -p $utils $out/nix-support/utils.sh
# Propagate the wrapped gcc so that if you install the wrapper, you get
# tools like gcov, the manpages, etc. as well (including for binutils
# and Glibc).
if test -z "$nativeTools"; then
echo $gcc $binutils $libc > $out/nix-support/propagated-user-env-packages
fi

View file

@ -1,28 +1,29 @@
# The Nix `gcc' stdenv.mkDerivation is not directly usable, since it doesn't
# know where the C library and standard header files are. Therefore
# the compiler produced by that package cannot be installed directly
# in a user environment and used from the command line. This
# stdenv.mkDerivation provides a wrapper that sets up the right environment
# variables so that the compiler and the linker just "work".
# The Nixpkgs GCC is not directly usable, since it doesn't know where
# the C library and standard header files are. Therefore the compiler
# produced by that package cannot be installed directly in a user
# environment and used from the command line. So we use a wrapper
# script that sets up the right environment variables so that the
# compiler and the linker just "work".
{ name ? "", stdenv, nativeTools, nativeLibc, nativePrefix ? ""
, gcc ? null, libc ? null, binutils ? null, coreutils ? null, shell ? ""
, zlib ? null
, gcc ? null, libc ? null, binutils ? null, coreutils ? null, shell ? stdenv.shell
, zlib ? null, extraPackages ? []
}:
with stdenv.lib;
assert nativeTools -> nativePrefix != "";
assert !nativeTools -> gcc != null && binutils != null && coreutils != null;
assert !nativeLibc -> libc != null;
# For ghdl (the vhdl language provider to gcc) we need zlib in the wrapper
assert (gcc != null && gcc ? langVhdl && gcc.langVhdl) -> zlib != null;
# For ghdl (the vhdl language provider to gcc) we need zlib in the wrapper.
assert gcc.langVhdl or false -> zlib != null;
let
gccVersion = (builtins.parseDrvName gcc.name).version;
gccName = (builtins.parseDrvName gcc.name).name;
langGo = if nativeTools then false else gcc ? langGo && gcc.langGo;
in
stdenv.mkDerivation {
@ -30,31 +31,198 @@ stdenv.mkDerivation {
(if name != "" then name else gccName + "-wrapper") +
(if gcc != null && gccVersion != "" then "-" + gccVersion else "");
builder = ./builder.sh;
setupHook = ./setup-hook.sh;
gccWrapper = ./gcc-wrapper.sh;
gnatWrapper = ./gnat-wrapper.sh;
gnatlinkWrapper = ./gnatlink-wrapper.sh;
ldWrapper = ./ld-wrapper.sh;
ldSolarisWrapper = ./ld-solaris-wrapper.sh;
utils = ./utils.sh;
addFlags = ./add-flags;
preferLocalBuild = true;
inherit nativeTools nativeLibc nativePrefix gcc;
inherit gcc shell;
libc = if nativeLibc then null else libc;
binutils = if nativeTools then null else binutils;
# The wrapper scripts use 'cat', so we may need coreutils
# The wrapper scripts use 'cat', so we may need coreutils.
coreutils = if nativeTools then null else coreutils;
langC = if nativeTools then true else gcc.langC;
langCC = if nativeTools then true else gcc.langCC;
langFortran = if nativeTools then false else gcc ? langFortran;
langAda = if nativeTools then false else gcc ? langAda && gcc.langAda;
langVhdl = if nativeTools then false else gcc ? langVhdl && gcc.langVhdl;
zlib = if gcc != null && gcc ? langVhdl then zlib else null;
shell = if shell == "" then stdenv.shell else
if builtins.isAttrs shell then (shell + shell.shellPath)
else shell;
passthru = { inherit nativeTools nativeLibc nativePrefix; };
buildCommand =
''
mkdir -p $out/bin $out/nix-support
wrap() {
local dst="$1"
local wrapper="$2"
export prog="$3"
substituteAll "$wrapper" "$out/bin/$dst"
chmod +x "$out/bin/$dst"
}
''
+ optionalString (!nativeLibc) ''
dynamicLinker="$libc/lib/$dynamicLinker"
echo $dynamicLinker > $out/nix-support/dynamic-linker
if [ -e $libc/lib/32/ld-linux.so.2 ]; then
echo $libc/lib/32/ld-linux.so.2 > $out/nix-support/dynamic-linker-m32
fi
# The "-B$libc/lib/" flag is a quick hack to force gcc to link
# against the crt1.o from our own glibc, rather than the one in
# /usr/lib. (This is only an issue when using an `impure'
# compiler/linker, i.e., one that searches /usr/lib and so on.)
#
# Unfortunately, setting -B appears to override the default search
# path. Thus, the gcc-specific "../includes-fixed" directory is
# now longer searched and glibc's <limits.h> header fails to
# compile, because it uses "#include_next <limits.h>" to find the
# limits.h file in ../includes-fixed. To remedy the problem,
# another -idirafter is necessary to add that directory again.
echo "-B$libc/lib/ -idirafter $libc/include -idirafter $gcc/lib/gcc/*/*/include-fixed" > $out/nix-support/libc-cflags
echo "-L$libc/lib" > $out/nix-support/libc-ldflags
# The dynamic linker is passed in `ldflagsBefore' to allow
# explicit overrides of the dynamic linker by callers to gcc/ld
# (the *last* value counts, so ours should come first).
echo "-dynamic-linker" $dynamicLinker > $out/nix-support/libc-ldflags-before
echo $libc > $out/nix-support/orig-libc
''
+ (if nativeTools then ''
gccPath="${nativePrefix}/bin"
ldPath="${nativePrefix}/bin"
'' else ''
echo $gcc > $out/nix-support/orig-gcc
# GCC shows $gcc/lib in `gcc -print-search-dirs', but not
# $gcc/lib64 (even though it does actually search there...)..
# This confuses libtool. So add it to the compiler tool search
# path explicitly.
if [ -e "$gcc/lib64" -a ! -L "$gcc/lib64" ]; then
gccLDFlags+=" -L$gcc/lib64"
gccCFlags+=" -B$gcc/lib64"
fi
gccLDFlags+=" -L$gcc/lib"
${optionalString gcc.langVhdl or false ''
gccLDFlags+=" -L${zlib}/lib"
''}
# Find the gcc libraries path (may work only without multilib).
${optionalString gcc.langAda or false ''
basePath=`echo $gcc/lib/*/*/*`
gccCFlags+=" -B$basePath -I$basePath/adainclude"
gnatCFlags="-aI$basePath/adainclude -aO$basePath/adalib"
echo "$gnatCFlags" > $out/nix-support/gnat-cflags
''}
echo "$gccLDFlags" > $out/nix-support/gcc-ldflags
echo "$gccCFlags" > $out/nix-support/gcc-cflags
gccPath="$gcc/bin"
ldPath="$binutils/bin"
# Propagate the wrapped gcc so that if you install the wrapper,
# you get tools like gcov, the manpages, etc. as well (including
# for binutils and Glibc).
echo $gcc $binutils $libc > $out/nix-support/propagated-user-env-packages
echo ${toString extraPackages} > $out/nix-support/propagated-native-build-inputs
''
+ optionalString (stdenv.isSunOS && nativePrefix != "") ''
# Solaris needs an additional ld wrapper.
ldPath="${nativePrefix}/bin"
ld="$out/bin/ld-solaris"
wrap ld-solaris ${./ld-solaris-wrapper.sh}
'')
+ ''
# Create a symlink to as (the assembler). This is useful when a
# gcc-wrapper is installed in a user environment, as it ensures that
# the right assembler is called.
if [ -e $ldPath/as ]; then
ln -s $ldPath/as $out/bin/as
fi
wrap ld ${./ld-wrapper.sh} ''${ld:-$ldPath/ld}
if [ -e $binutils/bin/ld.gold ]; then
wrap ld.gold ${./ld-wrapper.sh} $binutils/bin/ld.gold
fi
if [ -e $binutils/bin/ld.bfd ]; then
wrap ld.bfd ${./ld-wrapper.sh} $binutils/bin/ld.bfd
fi
if [ -e $gccPath/gcc ]; then
wrap gcc ${./gcc-wrapper.sh} $gccPath/gcc
ln -s gcc $out/bin/cc
elif [ -e $gccPath/clang ]; then
wrap clang ${./gcc-wrapper.sh} $gccPath/clang
ln -s clang $out/bin/cc
fi
if [ -e $gccPath/g++ ]; then
wrap g++ ${./gcc-wrapper.sh} $gccPath/g++
ln -s g++ $out/bin/c++
elif [ -e $gccPath/clang++ ]; then
wrap clang++ ${./gcc-wrapper.sh} $gccPath/clang++
ln -s clang++ $out/bin/c++
fi
if [ -e $gccPath/cpp ]; then
wrap cpp ${./gcc-wrapper.sh} $gccPath/cpp
fi
''
+ optionalString gcc.langFortran or false ''
wrap gfortran ${./gcc-wrapper.sh} $gccPath/gfortran
ln -sv gfortran $out/bin/g77
ln -sv gfortran $out/bin/f77
''
+ optionalString gcc.langJava or false ''
wrap gcj ${./gcc-wrapper.sh} $gccPath/gcj
''
+ optionalString gcc.langGo or false ''
wrap gccgo ${./gcc-wrapper.sh} $gccPath/gccgo
''
+ optionalString gcc.langAda or false ''
wrap gnatgcc ${./gcc-wrapper.sh} $gccPath/gnatgcc
wrap gnatmake ${./gnat-wrapper.sh} $gccPath/gnatmake
wrap gnatbind ${./gnat-wrapper.sh} $gccPath/gnatbind
wrap gnatlink ${./gnatlink-wrapper.sh} $gccPath/gnatlink
''
+ optionalString gcc.langVhdl or false ''
ln -s $gccPath/ghdl $out/bin/ghdl
''
+ ''
substituteAll ${./setup-hook.sh} $out/nix-support/setup-hook
substituteAll ${./add-flags} $out/nix-support/add-flags.sh
cp -p ${./utils.sh} $out/nix-support/utils.sh
if [ -e $out/bin/clang ]; then
echo 'export CC; : ''${CC:=clang}' >> $out/nix-support/setup-hook
fi
if [ -e $out/bin/clang++ ]; then
echo 'export CXX; : ''${CXX:=clang++}' >> $out/nix-support/setup-hook
fi
'';
# The dynamic linker has different names on different Linux platforms.
dynamicLinker =
if !nativeLibc then
(if stdenv.system == "i686-linux" then "ld-linux.so.2" else
if stdenv.system == "x86_64-linux" then "ld-linux-x86-64.so.2" else
# ARM with a wildcard, which can be "" or "-armhf".
if stdenv.isArm then "ld-linux*.so.3" else
if stdenv.system == "powerpc-linux" then "ld.so.1" else
if stdenv.system == "mips64el-linux" then "ld.so.1" else
abort "Don't know the name of the dynamic linker for this platform.")
else "";
crossAttrs = {
shell = shell.crossDrv + shell.crossDrv.shellPath;
@ -73,8 +241,6 @@ stdenv.mkDerivation {
abort "don't know the name of the dynamic linker for this platform");
};
preferLocalBuild = true;
meta =
let gcc_ = if gcc != null then gcc else {}; in
(if gcc_ ? meta then removeAttrs gcc.meta ["priority"] else {}) //
@ -82,16 +248,4 @@ stdenv.mkDerivation {
stdenv.lib.attrByPath ["meta" "description"] "System C compiler" gcc_
+ " (wrapper script)";
};
# The dynamic linker has different names on different Linux platforms.
dynamicLinker =
if !nativeLibc then
(if stdenv.system == "i686-linux" then "ld-linux.so.2" else
if stdenv.system == "x86_64-linux" then "ld-linux-x86-64.so.2" else
# ARM with a wildcard, which can be "" or "-armhf".
if stdenv.isArm then "ld-linux*.so.3" else
if stdenv.system == "powerpc-linux" then "ld.so.1" else
if stdenv.system == "mips64el-linux" then "ld.so.1" else
abort "don't know the name of the dynamic linker for this platform")
else "";
}

View file

@ -1,10 +1,10 @@
#! @shell@ -e
if test -n "$NIX_GCC_WRAPPER_START_HOOK"; then
if [ -n "$NIX_GCC_WRAPPER_START_HOOK" ]; then
source "$NIX_GCC_WRAPPER_START_HOOK"
fi
if test -z "$NIX_GCC_WRAPPER_FLAGS_SET"; then
if [ -z "$NIX_GCC_WRAPPER_FLAGS_SET" ]; then
source @out@/nix-support/add-flags.sh
fi
@ -18,26 +18,26 @@ getVersion=0
nonFlagArgs=0
for i in "$@"; do
if test "$i" = "-c"; then
if [ "$i" = -c ]; then
dontLink=1
elif test "$i" = "-S"; then
elif [ "$i" = -S ]; then
dontLink=1
elif test "$i" = "-E"; then
elif [ "$i" = -E ]; then
dontLink=1
elif test "$i" = "-E"; then
elif [ "$i" = -E ]; then
dontLink=1
elif test "$i" = "-M"; then
elif [ "$i" = -M ]; then
dontLink=1
elif test "$i" = "-MM"; then
elif [ "$i" = -MM ]; then
dontLink=1
elif test "$i" = "-x"; then
elif [ "$i" = -x ]; then
# At least for the cases c-header or c++-header we should set dontLink.
# I expect no one use -x other than making precompiled headers.
dontLink=1
elif test "${i:0:1}" != "-"; then
elif [ "${i:0:1}" != - ]; then
nonFlagArgs=1
elif test "$i" = "-m32"; then
if test -e @out@/nix-support/dynamic-linker-m32; then
elif [ "$i" = -m32 ]; then
if [ -e @out@/nix-support/dynamic-linker-m32 ]; then
NIX_LDFLAGS="$NIX_LDFLAGS -dynamic-linker $(cat @out@/nix-support/dynamic-linker-m32)"
fi
fi
@ -48,28 +48,28 @@ done
# "-c" flag). So if no non-flag arguments are given, don't pass any
# linker flags. This catches cases like "gcc" (should just print
# "gcc: no input files") and "gcc -v" (should print the version).
if test "$nonFlagArgs" = "0"; then
if [ "$nonFlagArgs" = 0 ]; then
dontLink=1
fi
# Optionally filter out paths not refering to the store.
params=("$@")
if test "$NIX_ENFORCE_PURITY" = "1" -a -n "$NIX_STORE"; then
if [ "$NIX_ENFORCE_PURITY" = 1 -a -n "$NIX_STORE" ]; then
rest=()
n=0
while test $n -lt ${#params[*]}; do
while [ $n -lt ${#params[*]} ]; do
p=${params[n]}
p2=${params[$((n+1))]}
if test "${p:0:3}" = "-L/" && badPath "${p:2}"; then
if [ "${p:0:3}" = -L/ ] && badPath "${p:2}"; then
skip $p
elif test "$p" = "-L" && badPath "$p2"; then
elif [ "$p" = -L ] && badPath "$p2"; then
n=$((n + 1)); skip $p2
elif test "${p:0:3}" = "-I/" && badPath "${p:2}"; then
elif [ "${p:0:3}" = -I/ ] && badPath "${p:2}"; then
skip $p
elif test "$p" = "-I" && badPath "$p2"; then
elif [ "$p" = -I ] && badPath "$p2"; then
n=$((n + 1)); skip $p2
elif test "$p" = "-isystem" && badPath "$p2"; then
elif [ "$p" = -isystem ] && badPath "$p2"; then
n=$((n + 1)); skip $p2
else
rest=("${rest[@]}" "$p")
@ -84,11 +84,20 @@ fi
extraAfter=($NIX_CFLAGS_COMPILE)
extraBefore=()
if test "$dontLink" != "1"; then
# When enforcing purity, pretend gcc can't find the current date and
# time
if [ "$NIX_ENFORCE_PURITY" = 1 ]; then
extraAfter+=('-D__DATE__="Jan 01 1970"'
'-D__TIME__="00:00:01"'
-Wno-builtin-macro-redefined)
fi
if [ "$dontLink" != 1 ]; then
# Add the flags that should only be passed to the compiler when
# linking.
extraAfter=(${extraAfter[@]} $NIX_CFLAGS_LINK)
extraAfter+=($NIX_CFLAGS_LINK)
# Add the flags that should be passed to the linker (and prevent
# `ld-wrapper' from adding NIX_LDFLAGS again).
@ -96,11 +105,11 @@ if test "$dontLink" != "1"; then
extraBefore=(${extraBefore[@]} "-Wl,$i")
done
for i in $NIX_LDFLAGS; do
if test "${i:0:3}" = "-L/"; then
extraAfter=(${extraAfter[@]} "$i")
else
extraAfter=(${extraAfter[@]} "-Wl,$i")
fi
if [ "${i:0:3}" = -L/ ]; then
extraAfter+=("$i")
else
extraAfter+=("-Wl,$i")
fi
done
export NIX_LDFLAGS_SET=1
fi
@ -109,39 +118,29 @@ fi
# add anything. This is to prevent `gcc -v' (which normally prints
# out the version number and returns exit code 0) from printing out
# `No input files specified' and returning exit code 1.
if test "$*" = "-v"; then
if [ "$*" = -v ]; then
extraAfter=()
extraBefore=()
fi
fi
# Optionally print debug info.
if test "$NIX_DEBUG" = "1"; then
echo "original flags to @gccProg@:" >&2
if [ -n "$NIX_DEBUG" ]; then
echo "original flags to @prog@:" >&2
for i in "${params[@]}"; do
echo " $i" >&2
done
echo "extraBefore flags to @gccProg@:" >&2
echo "extraBefore flags to @prog@:" >&2
for i in ${extraBefore[@]}; do
echo " $i" >&2
done
echo "extraAfter flags to @gccProg@:" >&2
echo "extraAfter flags to @prog@:" >&2
for i in ${extraAfter[@]}; do
echo " $i" >&2
done
fi
if test -n "$NIX_GCC_WRAPPER_EXEC_HOOK"; then
if [ -n "$NIX_GCC_WRAPPER_EXEC_HOOK" ]; then
source "$NIX_GCC_WRAPPER_EXEC_HOOK"
fi
# Call the real `gcc'. Filter out warnings from stderr about unused
# `-B' flags, since they confuse some programs. Deep bash magic to
# apply grep to stderr (by swapping stdin/stderr twice).
if test -z "$NIX_GCC_NEEDS_GREP"; then
@gccProg@ ${extraBefore[@]} "${params[@]}" ${extraAfter[@]}
else
(@gccProg@ ${extraBefore[@]} "${params[@]}" ${extraAfter[@]} 3>&2 2>&1 1>&3- \
| (grep -v 'file path prefix' || true); exit ${PIPESTATUS[0]}) 3>&2 2>&1 1>&3-
exit $?
fi
exec @prog@ ${extraBefore[@]} "${params[@]}" "${extraAfter[@]}"

View file

@ -1,10 +1,10 @@
#! @shell@ -e
if test -n "$NIX_GNAT_WRAPPER_START_HOOK"; then
if [ -n "$NIX_GNAT_WRAPPER_START_HOOK" ]; then
source "$NIX_GNAT_WRAPPER_START_HOOK"
fi
if test -z "$NIX_GNAT_WRAPPER_FLAGS_SET"; then
if [ -z "$NIX_GNAT_WRAPPER_FLAGS_SET" ]; then
source @out@/nix-support/add-flags.sh
fi
@ -18,14 +18,14 @@ getVersion=0
nonFlagArgs=0
for i in "$@"; do
if test "$i" = "-c"; then
if [ "$i" = -c ]; then
dontLink=1
elif test "$i" = "-M"; then
elif [ "$i" = -M ]; then
dontLink=1
elif test "${i:0:1}" != "-"; then
elif [ "${i:0:1}" != - ]; then
nonFlagArgs=1
elif test "$i" = "-m32"; then
if test -e @out@/nix-support/dynamic-linker-m32; then
elif [ "$i" = -m32 ]; then
if [ -e @out@/nix-support/dynamic-linker-m32 ]; then
NIX_LDFLAGS="$NIX_LDFLAGS -dynamic-linker $(cat @out@/nix-support/dynamic-linker-m32)"
fi
fi
@ -36,26 +36,26 @@ done
# "-c" flag). So if no non-flag arguments are given, don't pass any
# linker flags. This catches cases like "gcc" (should just print
# "gcc: no input files") and "gcc -v" (should print the version).
if test "$nonFlagArgs" = "0"; then
if [ "$nonFlagArgs" = 0 ]; then
dontLink=1
fi
# Optionally filter out paths not refering to the store.
params=("$@")
if test "$NIX_ENFORCE_PURITY" = "1" -a -n "$NIX_STORE"; then
if [ "$NIX_ENFORCE_PURITY" = 1 -a -n "$NIX_STORE" ]; then
rest=()
n=0
while test $n -lt ${#params[*]}; do
while [ $n -lt ${#params[*]} ]; do
p=${params[n]}
p2=${params[$((n+1))]}
if test "${p:0:3}" = "-L/" && badPath "${p:2}"; then
if [ "${p:0:3}" = -L/ ] && badPath "${p:2}"; then
skip $p
elif test "${p:0:3}" = "-I/" && badPath "${p:2}"; then
elif [ "${p:0:3}" = -I/ ] && badPath "${p:2}"; then
skip $p
elif test "${p:0:4}" = "-aI/" && badPath "${p:3}"; then
elif [ "${p:0:4}" = -aI/ ] && badPath "${p:3}"; then
skip $p
elif test "${p:0:4}" = "-aO/" && badPath "${p:3}"; then
elif [ "${p:0:4}" = -aO/ ] && badPath "${p:3}"; then
skip $p
else
rest=("${rest[@]}" "$p")
@ -81,33 +81,23 @@ fi
#done
# Optionally print debug info.
if test "$NIX_DEBUG" = "1"; then
echo "original flags to @gnatProg@:" >&2
if [ -n "$NIX_DEBUG" ]; then
echo "original flags to @prog@:" >&2
for i in "${params[@]}"; do
echo " $i" >&2
done
echo "extraBefore flags to @gnatProg@:" >&2
echo "extraBefore flags to @prog@:" >&2
for i in ${extraBefore[@]}; do
echo " $i" >&2
done
echo "extraAfter flags to @gnatProg@:" >&2
echo "extraAfter flags to @prog@:" >&2
for i in ${extraAfter[@]}; do
echo " $i" >&2
done
fi
if test -n "$NIX_GNAT_WRAPPER_EXEC_HOOK"; then
if [ -n "$NIX_GNAT_WRAPPER_EXEC_HOOK" ]; then
source "$NIX_GNAT_WRAPPER_EXEC_HOOK"
fi
# Call the real `gcc'. Filter out warnings from stderr about unused
# `-B' flags, since they confuse some programs. Deep bash magic to
# apply grep to stderr (by swapping stdin/stderr twice).
if test -z "$NIX_GNAT_NEEDS_GREP"; then
@gnatProg@ ${extraBefore[@]} "${params[@]}" ${extraAfter[@]}
else
(@gnatProg@ ${extraBefore[@]} "${params[@]}" ${extraAfter[@]} 3>&2 2>&1 1>&3- \
| (grep -v 'file path prefix' || true); exit ${PIPESTATUS[0]}) 3>&2 2>&1 1>&3-
exit $?
fi
exec @prog@ ${extraBefore[@]} "${params[@]}" ${extraAfter[@]}

View file

@ -11,33 +11,23 @@ extraBefore=()
#done
# Optionally print debug info.
if test "$NIX_DEBUG" = "1"; then
echo "original flags to @gnatlinkProg@:" >&2
if [ -n "$NIX_DEBUG" ]; then
echo "original flags to @prog@:" >&2
for i in "$@"; do
echo " $i" >&2
done
echo "extraBefore flags to @gnatlinkProg@:" >&2
echo "extraBefore flags to @prog@:" >&2
for i in ${extraBefore[@]}; do
echo " $i" >&2
done
echo "extraAfter flags to @gnatlinkProg@:" >&2
echo "extraAfter flags to @prog@:" >&2
for i in ${extraAfter[@]}; do
echo " $i" >&2
done
fi
if test -n "$NIX_GNAT_WRAPPER_EXEC_HOOK"; then
if [ -n "$NIX_GNAT_WRAPPER_EXEC_HOOK" ]; then
source "$NIX_GNAT_WRAPPER_EXEC_HOOK"
fi
# Call the real `gcc'. Filter out warnings from stderr about unused
# `-B' flags, since they confuse some programs. Deep bash magic to
# apply grep to stderr (by swapping stdin/stderr twice).
if test -z "$NIX_GNAT_NEEDS_GREP"; then
@gnatlinkProg@ ${extraBefore[@]} "$@" ${extraAfter[@]}
else
(@gnatlinkProg@ ${extraBefore[@]} "$@" ${extraAfter[@]} 3>&2 2>&1 1>&3- \
| (grep -v 'file path prefix' || true); exit ${PIPESTATUS[0]}) 3>&2 2>&1 1>&3-
exit $?
fi
exec @prog@ ${extraBefore[@]} "$@" ${extraAfter[@]}

View file

@ -6,7 +6,7 @@ set -u
# I've also tried adding -z direct and -z lazyload, but it gave too many problems with C++ exceptions :'(
# Also made sure libgcc would not be lazy-loaded, as suggested here: https://www.illumos.org/issues/2534#note-3
# but still no success.
cmd="@ld@ -z ignore"
cmd="@prog@ -z ignore"
args=("$@");

View file

@ -1,10 +1,10 @@
#! @shell@ -e
if test -n "$NIX_LD_WRAPPER_START_HOOK"; then
if [ -n "$NIX_LD_WRAPPER_START_HOOK" ]; then
source "$NIX_LD_WRAPPER_START_HOOK"
fi
if test -z "$NIX_GCC_WRAPPER_FLAGS_SET"; then
if [ -z "$NIX_GCC_WRAPPER_FLAGS_SET" ]; then
source @out@/nix-support/add-flags.sh
fi
@ -13,26 +13,26 @@ source @out@/nix-support/utils.sh
# Optionally filter out paths not refering to the store.
params=("$@")
if test "$NIX_ENFORCE_PURITY" = "1" -a -n "$NIX_STORE" \
-a \( -z "$NIX_IGNORE_LD_THROUGH_GCC" -o -z "$NIX_LDFLAGS_SET" \); then
if [ "$NIX_ENFORCE_PURITY" = 1 -a -n "$NIX_STORE" \
-a \( -z "$NIX_IGNORE_LD_THROUGH_GCC" -o -z "$NIX_LDFLAGS_SET" \) ]; then
rest=()
n=0
while test $n -lt ${#params[*]}; do
while [ $n -lt ${#params[*]} ]; do
p=${params[n]}
p2=${params[$((n+1))]}
if test "${p:0:3}" = "-L/" && badPath "${p:2}"; then
if [ "${p:0:3}" = -L/ ] && badPath "${p:2}"; then
skip $p
elif test "$p" = "-L" && badPath "$p2"; then
elif [ "$p" = -L ] && badPath "$p2"; then
n=$((n + 1)); skip $p2
elif test "$p" = "-rpath" && badPath "$p2"; then
elif [ "$p" = -rpath ] && badPath "$p2"; then
n=$((n + 1)); skip $p2
elif test "$p" = "-dynamic-linker" && badPath "$p2"; then
elif [ "$p" = -dynamic-linker ] && badPath "$p2"; then
n=$((n + 1)); skip $p2
elif test "${p:0:1}" = "/" && badPath "$p"; then
elif [ "${p:0:1}" = / ] && badPath "$p"; then
# We cannot skip this; barf.
echo "impure path \`$p' used in link" >&2
exit 1
elif test "${p:0:9}" = "--sysroot"; then
elif [ "${p:0:9}" = --sysroot ]; then
# Our ld is not built with sysroot support (Can we fix that?)
:
else
@ -47,7 +47,7 @@ fi
extra=()
extraBefore=()
if test -z "$NIX_LDFLAGS_SET"; then
if [ -z "$NIX_LDFLAGS_SET" ]; then
extra+=($NIX_LDFLAGS)
extraBefore+=($NIX_LDFLAGS_BEFORE)
fi
@ -56,12 +56,12 @@ extra+=($NIX_LDFLAGS_AFTER)
# Add all used dynamic libraries to the rpath.
if test "$NIX_DONT_SET_RPATH" != "1"; then
if [ "$NIX_DONT_SET_RPATH" != 1 ]; then
libPath=""
addToLibPath() {
local path="$1"
if test "${path:0:1}" != "/"; then return 0; fi
if [ "${path:0:1}" != / ]; then return 0; fi
case "$path" in
*..*|*./*|*/.*|*//*)
local path2
@ -75,12 +75,12 @@ if test "$NIX_DONT_SET_RPATH" != "1"; then
esac
libPath="$libPath $path "
}
addToRPath() {
# If the path is not in the store, don't add it to the rpath.
# This typically happens for libraries in /tmp that are later
# copied to $out/lib. If not, we're screwed.
if test "${1:0:${#NIX_STORE}}" != "$NIX_STORE"; then return 0; fi
if [ "${1:0:${#NIX_STORE}}" != "$NIX_STORE" ]; then return 0; fi
case $rpath in
*\ $1\ *) return 0 ;;
esac
@ -97,21 +97,21 @@ if test "$NIX_DONT_SET_RPATH" != "1"; then
# First, find all -L... switches.
allParams=("${params[@]}" ${extra[@]})
n=0
while test $n -lt ${#allParams[*]}; do
while [ $n -lt ${#allParams[*]} ]; do
p=${allParams[n]}
p2=${allParams[$((n+1))]}
if test "${p:0:3}" = "-L/"; then
if [ "${p:0:3}" = -L/ ]; then
addToLibPath ${p:2}
elif test "$p" = "-L"; then
elif [ "$p" = -L ]; then
addToLibPath ${p2}
n=$((n + 1))
elif test "$p" = "-l"; then
elif [ "$p" = -l ]; then
addToLibs ${p2}
n=$((n + 1))
elif test "${p:0:2}" = "-l"; then
elif [ "${p:0:2}" = -l ]; then
addToLibs ${p:2}
elif test "$p" = "-dynamic-linker"; then
# Ignore the dynamic linker argument, or it
elif [ "$p" = -dynamic-linker ]; then
# Ignore the dynamic linker argument, or it
# will get into the next 'elif'. We don't want
# the dynamic linker path rpath to go always first.
n=$((n + 1))
@ -129,16 +129,16 @@ if test "$NIX_DONT_SET_RPATH" != "1"; then
# so, add the directory to the rpath.
# It's important to add the rpath in the order of -L..., so
# the link time chosen objects will be those of runtime linking.
for i in $libPath; do
for j in $libs; do
if test -f "$i/lib$j.so"; then
if [ -f "$i/lib$j.so" ]; then
addToRPath $i
break
fi
done
done
# Finally, add `-rpath' switches.
for i in $rpath; do
@ -148,19 +148,19 @@ fi
# Optionally print debug info.
if test "$NIX_DEBUG" = "1"; then
echo "original flags to @ld@:" >&2
if [ -n "$NIX_DEBUG" ]; then
echo "original flags to @prog@:" >&2
for i in "${params[@]}"; do
echo " $i" >&2
done
echo "extra flags to @ld@:" >&2
echo "extra flags to @prog@:" >&2
for i in ${extra[@]}; do
echo " $i" >&2
done
fi
if test -n "$NIX_LD_WRAPPER_EXEC_HOOK"; then
if [ -n "$NIX_LD_WRAPPER_EXEC_HOOK" ]; then
source "$NIX_LD_WRAPPER_EXEC_HOOK"
fi
exec @ld@ ${extraBefore[@]} "${params[@]}" ${extra[@]}
exec @prog@ ${extraBefore[@]} "${params[@]}" ${extra[@]}

View file

@ -1,33 +1,35 @@
export NIX_GCC=@out@
addCVars () {
if test -d $1/include; then
export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -isystem $1/include"
if [ -d $1/include ]; then
export NIX_CFLAGS_COMPILE+=" -isystem $1/include"
fi
if test -d $1/lib64; then
export NIX_LDFLAGS="$NIX_LDFLAGS -L$1/lib64"
if [ -d $1/lib64 -a ! -L $1/lib64 ]; then
export NIX_LDFLAGS+=" -L$1/lib64"
fi
if test -d $1/lib; then
export NIX_LDFLAGS="$NIX_LDFLAGS -L$1/lib"
if [ -d $1/lib ]; then
export NIX_LDFLAGS+=" -L$1/lib"
fi
}
envHooks=(${envHooks[@]} addCVars)
envHooks+=(addCVars)
# Note: these come *after* $out in the PATH (see setup.sh).
if test -n "@gcc@"; then
if [ -n "@gcc@" ]; then
addToSearchPath PATH @gcc@/bin
fi
if test -n "@binutils@"; then
if [ -n "@binutils@" ]; then
addToSearchPath PATH @binutils@/bin
fi
if test -n "@libc@"; then
if [ -n "@libc@" ]; then
addToSearchPath PATH @libc@/bin
fi
if test -n "@coreutils@"; then
if [ -n "@coreutils@" ]; then
addToSearchPath PATH @coreutils@/bin
fi

View file

@ -1,5 +1,5 @@
skip () {
if test "$NIX_DEBUG" = "1"; then
if [ -n "$NIX_DEBUG" ]; then
echo "skipping impure path $1" >&2
fi
}
@ -9,11 +9,11 @@ skip () {
# `/nix/store/.../lib/foo.so' isn't.
badPath() {
local p=$1
# Relative paths are okay (since they're presumably relative to
# the temporary build directory).
if test "${p:0:1}" != "/"; then return 1; fi
if [ "${p:0:1}" != / ]; then return 1; fi
# Otherwise, the path should refer to the store or some temporary
# directory (including the build directory).
test \

View file

@ -108,7 +108,7 @@ stdenv.mkDerivation (
. ${./functions.sh}
origSrc=$src
src=$(findTarballs $src | head -1)
src=$(findTarball $src)
'';
}
)

View file

@ -38,7 +38,7 @@ stdenv.mkDerivation (
. ${./functions.sh}
origSrc=$src
src=$(findTarballs $src | head -1)
src=$(findTarball $src)
if test -e $origSrc/nix-support/hydra-release-name; then
releaseName=$(cat $origSrc/nix-support/hydra-release-name)

View file

@ -32,7 +32,7 @@ vmTools.runInLinuxImage (stdenv.mkDerivation (
postHook = ''
. ${./functions.sh}
propagateImageName
src=$(findTarballs $src | head -1) # Find a tarball.
src=$(findTarball $src)
'';
installExtraDebsPhase = ''

View file

@ -1,34 +1,37 @@
findTarballs() {
local suffix
test -d "$1/tarballs/" && {
findTarball() {
local suffix i
if [ -d "$1/tarballs/" ]; then
for suffix in tar.gz tgz tar.bz2 tbz2 tar.xz tar.lzma; do
ls $1/tarballs/*.$suffix 2> /dev/null
done | sort
}
echo "$1"
for i in $1/tarballs/*.$suffix; do echo $i; return; done
done | sort | head -1
return
else
echo "$1"
return
fi
}
canonicalizeJarManifest() {
local input=$1
# http://docs.oracle.com/javase/7/docs/technotes/guides/jar/jar.html#Notes_on_Manifest_and_Signature_Files
(head -n 1 $input && tail -n +2 $input | sort | grep -v '^\s*$') > $input-tmp
mv $input-tmp $input
local input=$1
# http://docs.oracle.com/javase/7/docs/technotes/guides/jar/jar.html#Notes_on_Manifest_and_Signature_Files
(head -n 1 $input && tail -n +2 $input | sort | grep -v '^\s*$') > $input-tmp
mv $input-tmp $input
}
# Post-process a jar file to contain canonical timestamps and metadata ordering
canonicalizeJar() {
local input=$1
local outer=$(pwd)
unzip -qq $input -d $input-tmp
canonicalizeJarManifest $input-tmp/META-INF/MANIFEST.MF
# Set all timestamps to Jan 1 1980, which is the earliest date the zip format supports...
find $input-tmp -exec touch -t 198001010000.00 {} +
rm $input
pushd $input-tmp
zip -q -r -o -X $outer/tmp-out.jar . 2> /dev/null
popd
rm -rf $input-tmp
mv $outer/tmp-out.jar $input
local input=$1
local outer=$(pwd)
unzip -qq $input -d $input-tmp
canonicalizeJarManifest $input-tmp/META-INF/MANIFEST.MF
# Set all timestamps to Jan 1 1980, which is the earliest date the zip format supports...
find $input-tmp -exec touch -t 198001010000.00 {} +
rm $input
pushd $input-tmp
zip -q -r -o -X $outer/tmp-out.jar . 2> /dev/null
popd
rm -rf $input-tmp
mv $outer/tmp-out.jar $input
}
propagateImageName() {

View file

@ -18,6 +18,8 @@
, prePhases ? []
, postPhases ? []
, buildInputs ? []
, preHook ? ""
, postHook ? ""
, ... } @ args:
let
@ -89,7 +91,8 @@ stdenv.mkDerivation (
postHook = ''
. ${./functions.sh}
origSrc=$src
src=$(findTarballs $src | head -1)
src=$(findTarball $src)
${postHook}
'';
preHook = ''
@ -105,6 +108,8 @@ stdenv.mkDerivation (
shopt -s expand_aliases
alias make="scan-build -o _clang_analyze_$name --html-title='Scan results for $name' make"
fi
${preHook}
'';
# Clean up after analysis

View file

@ -16,7 +16,7 @@ vmTools.buildRPM (
preBuild = ''
. ${./functions.sh}
propagateImageName
src=$(findTarballs $src | head -1) # Pick the first tarball.
src=$(findTarball $src)
'';
postInstall = ''

View file

@ -0,0 +1,27 @@
fixupOutputHooks+=('if [ -z "$dontGzipMan" ]; then compressManPages "$prefix"; fi')
compressManPages() {
local dir="$1"
echo "gzipping man pages in $dir"
GLOBIGNORE=.:..:*.gz:*.bz2
for f in "$dir"/share/man/*/* "$dir"/share/man/*/*/*; do
if [ -f "$f" -a ! -L "$f" ]; then
if gzip -c -n "$f" > "$f".gz; then
rm "$f"
else
rm "$f".gz
fi
fi
done
for f in "$dir"/share/man/*/* "$dir"/share/man/*/*/*; do
if [ -L "$f" -a -f `readlink -f "$f"`.gz ]; then
ln -sf `readlink "$f"`.gz "$f".gz && rm "$f"
fi
done
unset GLOBIGNORE
}

View file

@ -10,6 +10,8 @@
# their absolute path (using "install_name_tool -id"). It also
# rewrites references in other dylibs to absolute paths.
postFixupHooks+=('fixDarwinDylibNamesIn $prefix')
fixDarwinDylibNames() {
local flags=()
local old_id
@ -29,7 +31,3 @@ fixDarwinDylibNamesIn() {
local dir="$1"
fixDarwinDylibNames $(find "$dir" -name "*.dylib")
}
postFixup() {
fixDarwinDylibNamesIn "$prefix"
}

View file

@ -0,0 +1,50 @@
# This setup hook moves $out/{man,doc,info} to $out/share; moves
# $out/share/man to $man/share/man; and moves $out/share/doc to
# $man/share/doc.
preFixupHooks+=(_moveDocs)
_moveToShare() {
forceShare=${forceShare:=man doc info}
if [ -z "$forceShare" -o -z "$out" ]; then return; fi
for d in $forceShare; do
if [ -d "$out/$d" ]; then
if [ -d "$out/share/$d" ]; then
echo "both $d/ and share/$d/ exist!"
else
echo "moving $out/$d to $out/share/$d"
mkdir -p $out/share
mv $out/$d $out/share/
fi
fi
done
}
_moveToOutput() {
local d="$1"
local dst="$2"
if [ -z "$dst" -a ! -e $dst/$d ]; then return; fi
local output
for output in $outputs; do
if [ "${!output}" = "$dst" ]; then continue; fi
if [ -d "${!output}/$d" ]; then
echo "moving ${!output}/$d to $dst/$d"
mkdir -p $dst/share
mv ${!output}/$d $dst/$d
break
fi
done
}
_moveDocs() {
_moveToShare
_moveToOutput share/man "$man"
_moveToOutput share/info "$info"
_moveToOutput share/doc "$doc"
# Remove empty share directory.
if [ -d "$out/share" ]; then
rmdir $out/share 2> /dev/null || true
fi
}

View file

@ -0,0 +1,21 @@
# This setup hook, for each output, moves everything in $output/lib64
# to $output/lib, and replaces $output/lib64 with a symlink to
# $output/lib. The rationale is that lib64 directories are unnecessary
# in Nix (since 32-bit and 64-bit builds of a package are in different
# store paths anyway).
fixupOutputHooks+=(_moveLib64)
_moveLib64() {
if [ "$dontMoveLib64" = 1 ]; then return; fi
if [ ! -e "$prefix/lib64" -o -L "$prefix/lib64" ]; then return; fi
echo "moving $prefix/lib64/* to $prefix/lib"
mkdir -p $prefix/lib
shopt -s dotglob
for i in $prefix/lib64/*; do
mv "$i" $prefix/lib
done
shopt -u dotglob
rmdir $prefix/lib64
ln -s lib $prefix/lib64
}

View file

@ -0,0 +1,19 @@
# This setup hook, for each output, moves everything in $output/sbin
# to $output/bin, and replaces $output/sbin with a symlink to
# $output/bin.
fixupOutputHooks+=(_moveSbin)
_moveSbin() {
if [ "$dontMoveSbin" = 1 ]; then return; fi
if [ ! -e "$prefix/sbin" -o -L "$prefix/sbin" ]; then return; fi
echo "moving $prefix/sbin/* to $prefix/bin"
mkdir -p $prefix/bin
shopt -s dotglob
for i in $prefix/sbin/*; do
mv "$i" $prefix/bin
done
shopt -u dotglob
rmdir $prefix/sbin
ln -s bin $prefix/sbin
}

View file

@ -0,0 +1,62 @@
# This setup hook causes the fixup phase to rewrite all script
# interpreter file names (`#! /path') to paths found in $PATH. E.g.,
# /bin/sh will be rewritten to /nix/store/<hash>-some-bash/bin/sh.
# /usr/bin/env gets special treatment so that ".../bin/env python" is
# rewritten to /nix/store/<hash>/bin/python. Interpreters that are
# already in the store are left untouched.
fixupOutputHooks+=('if [ -z "$dontPatchShebangs" ]; then patchShebangs "$prefix"; fi')
patchShebangs() {
local dir="$1"
header "patching script interpreter paths in $dir"
local f
local oldPath
local newPath
local arg0
local args
local oldInterpreterLine
local newInterpreterLine
find "$dir" -type f -perm +0100 | while read f; do
if [ "$(head -1 "$f" | head -c +2)" != '#!' ]; then
# missing shebang => not a script
continue
fi
oldInterpreterLine=$(head -1 "$f" | tail -c +3)
read -r oldPath arg0 args <<< "$oldInterpreterLine"
if $(echo "$oldPath" | grep -q "/bin/env$"); then
# Check for unsupported 'env' functionality:
# - options: something starting with a '-'
# - environment variables: foo=bar
if $(echo "$arg0" | grep -q -- "^-.*\|.*=.*"); then
echo "unsupported interpreter directive \"$oldInterpreterLine\" (set dontPatchShebangs=1 and handle shebang patching yourself)"
exit 1
fi
newPath="$(command -v "$arg0" || true)"
else
if [ "$oldPath" = "" ]; then
# If no interpreter is specified linux will use /bin/sh. Set
# oldpath="/bin/sh" so that we get /nix/store/.../sh.
oldPath="/bin/sh"
fi
newPath="$(command -v "$(basename "$oldPath")" || true)"
args="$arg0 $args"
fi
newInterpreterLine="$newPath $args"
if [ -n "$oldPath" -a "${oldPath:0:${#NIX_STORE}}" != "$NIX_STORE" ]; then
if [ -n "$newPath" -a "$newPath" != "$oldPath" ]; then
echo "$f: interpreter directive changed from \"$oldInterpreterLine\" to \"$newInterpreterLine\""
# escape the escape chars so that sed doesn't interpret them
escapedInterpreterLine=$(echo "$newInterpreterLine" | sed 's|\\|\\\\|g')
sed -i -e "1 s|.*|#\!$escapedInterpreterLine|" "$f"
fi
fi
done
stopNest
}

View file

@ -10,4 +10,4 @@ addPkgToClassPath () {
done
}
envHooks=(''${envHooks[@]} addPkgToClassPath)
envHooks+=(addPkgToClassPath)

View file

@ -0,0 +1,36 @@
# This setup hook strips libraries and executables in the fixup phase.
fixupOutputHooks+=(_doStrip)
_doStrip() {
if [ -z "$dontStrip" ]; then
stripDebugList=${stripDebugList:-lib lib32 lib64 libexec bin sbin}
if [ -n "$stripDebugList" ]; then
stripDirs "$stripDebugList" "${stripDebugFlags:--S}"
fi
stripAllList=${stripAllList:-}
if [ -n "$stripAllList" ]; then
stripDirs "$stripAllList" "${stripAllFlags:--s}"
fi
fi
}
stripDirs() {
local dirs="$1"
local stripFlags="$2"
local dirsNew=
for d in ${dirs}; do
if [ -d "$prefix/$d" ]; then
dirsNew="${dirsNew} $prefix/$d "
fi
done
dirs=${dirsNew}
if [ -n "${dirs}" ]; then
header "stripping (with flags $stripFlags) in$dirs"
find $dirs -type f -print0 | xargs -0 ${xargsFlags:--r} strip $commonStripFlags $stripFlags || true
stopNest
fi
}

View file

@ -1,4 +1,4 @@
{ stdenv, lndir }:
{ lib, stdenv, lndir }:
rec {
@ -30,7 +30,7 @@ rec {
(test -n "$executable" && chmod +x "$n") || true
'';
# Shorthands for `writeTextFile'.
writeText = name: text: writeTextFile {inherit name text;};
writeTextDir = name: text: writeTextFile {inherit name text; destination = "/${name}";};
@ -55,9 +55,9 @@ rec {
(''
mkdir -p $out/nix-support
cp ${script} $out/nix-support/setup-hook
'' + stdenv.lib.optionalString (deps != []) ''
'' + lib.optionalString (deps != []) ''
echo ${toString deps} > $out/nix-support/propagated-native-build-inputs
'' + stdenv.lib.optionalString (substitutions != {}) ''
'' + lib.optionalString (substitutions != {}) ''
substituteAll ${script} $out/nix-support/setup-hook
'');
@ -80,7 +80,7 @@ rec {
# Quickly create a set of symlinks to derivations.
# entries is a list of attribute sets like { name = "name" ; path = "/nix/store/..."; }
linkFarm = name: entries: runCommand name {} ("mkdir -p $out; cd $out; \n" +
(stdenv.lib.concatMapStrings (x: "ln -s '${x.path}' '${x.name}';\n") entries));
(lib.concatMapStrings (x: "ln -s '${x.path}' '${x.name}';\n") entries));
# Require file
requireFile = {name, sha256, url ? null, message ? null} :

View file

@ -5,4 +5,4 @@ addDbusIncludePath () {
fi
}
envHooks=(${envHooks[@]} addDbusIncludePath)
envHooks+=(addDbusIncludePath)

View file

@ -1,7 +1,8 @@
{ callPackage, self, pkgs }:
{ callPackage, pkgs }:
rec {
inherit (pkgs) glib gtk2 gtk3 gnome2 upower glib_networking;
gnome3 = pkgs.gnome3_10 // { recurseForDerivations = false; };
gtk = gtk3; # just to be sure
libcanberra = pkgs.libcanberra_gtk3; # just to be sure
inherit (pkgs.gnome2) ORBit2;
@ -16,9 +17,13 @@ rec {
dconf = callPackage ./core/dconf { };
empathy = callPackage ./core/empathy { };
empathy = callPackage ./core/empathy {
webkitgtk = pkgs.webkitgtk24x;
};
epiphany = callPackage ./core/epiphany { };
epiphany = callPackage ./core/epiphany {
webkitgtk = pkgs.webkitgtk24x;
};
evince = callPackage ./core/evince { }; # ToDo: dbus would prevent compilation, enable tests
@ -66,7 +71,9 @@ rec {
folks = callPackage ./core/folks { };
gnome_online_accounts = callPackage ./core/gnome-online-accounts { };
gnome_online_accounts = callPackage ./core/gnome-online-accounts {
webkitgtk = pkgs.webkitgtk24x;
};
gnome-online-miners = callPackage ./core/gnome-online-miners { };
@ -126,7 +133,9 @@ rec {
rest = callPackage ./core/rest { };
sushi = callPackage ./core/sushi { };
sushi = callPackage ./core/sushi {
webkitgtk = pkgs.webkitgtk24x;
};
totem = callPackage ./core/totem { };
@ -138,7 +147,9 @@ rec {
vino = callPackage ./core/vino { };
yelp = callPackage ./core/yelp { };
yelp = callPackage ./core/yelp {
webkitgtk = pkgs.webkitgtk24x;
};
yelp_xsl = callPackage ./core/yelp-xsl { };
@ -149,9 +160,13 @@ rec {
#### Apps (http://ftp.acc.umu.se/pub/GNOME/apps/)
bijiben = callPackage ./apps/bijiben { };
bijiben = callPackage ./apps/bijiben {
webkitgtk = pkgs.webkitgtk24x;
};
evolution = callPackage ./apps/evolution { };
evolution = callPackage ./apps/evolution {
webkitgtk = pkgs.webkitgtk24x;
};
file-roller = callPackage ./apps/file-roller { };
@ -161,7 +176,9 @@ rec {
gnome-clocks = callPackage ./apps/gnome-clocks { };
gnome-documents = callPackage ./apps/gnome-documents { };
gnome-documents = callPackage ./apps/gnome-documents {
webkitgtk = pkgs.webkitgtk24x;
};
gnome-music = callPackage ./apps/gnome-music { };
@ -181,14 +198,16 @@ rec {
goffice = callPackage ./misc/goffice { };
gitg = callPackage ./misc/gitg { };
gitg = callPackage ./misc/gitg {
webkitgtk = pkgs.webkitgtk24x;
};
libgit2-glib = callPackage ./misc/libgit2-glib {
libgit2 = pkgs.libgit2.override { libssh2 = null; };
};
libmediaart = callPackage ./misc/libmediaart { };
gexiv2 = callPackage ./misc/gexiv2 { };
gnome-tweak-tool = callPackage ./misc/gnome-tweak-tool { };

View file

@ -22,9 +22,13 @@ rec {
dconf = callPackage ./core/dconf { };
empathy = callPackage ./core/empathy { };
empathy = callPackage ./core/empathy {
webkitgtk = pkgs.webkitgtk24x;
};
epiphany = callPackage ./core/epiphany { };
epiphany = callPackage ./core/epiphany {
webkitgtk = pkgs.webkitgtk24x;
};
evince = callPackage ./core/evince { }; # ToDo: dbus would prevent compilation, enable tests
@ -76,7 +80,9 @@ rec {
folks = callPackage ./core/folks { };
gnome_online_accounts = callPackage ./core/gnome-online-accounts { };
gnome_online_accounts = callPackage ./core/gnome-online-accounts {
webkitgtk = pkgs.webkitgtk24x;
};
gnome-online-miners = callPackage ./core/gnome-online-miners { };
@ -158,7 +164,9 @@ rec {
rest = callPackage ./core/rest { };
sushi = callPackage ./core/sushi { };
sushi = callPackage ./core/sushi {
webkitgtk = pkgs.webkitgtk24x;
};
totem = callPackage ./core/totem { };
@ -174,7 +182,9 @@ rec {
vino = callPackage ./core/vino { };
yelp = callPackage ./core/yelp { };
yelp = callPackage ./core/yelp {
webkitgtk = pkgs.webkitgtk24x;
};
yelp_xsl = callPackage ./core/yelp-xsl { };
@ -185,9 +195,13 @@ rec {
#### Apps (http://ftp.acc.umu.se/pub/GNOME/apps/)
bijiben = callPackage ./apps/bijiben { };
bijiben = callPackage ./apps/bijiben {
webkitgtk = pkgs.webkitgtk24x;
};
evolution = callPackage ./apps/evolution { };
evolution = callPackage ./apps/evolution {
webkitgtk = pkgs.webkitgtk24x;
};
file-roller = callPackage ./apps/file-roller { };
@ -202,7 +216,9 @@ rec {
gnome-clocks = callPackage ./apps/gnome-clocks { };
gnome-documents = callPackage ./apps/gnome-documents { };
gnome-documents = callPackage ./apps/gnome-documents {
webkitgtk = pkgs.webkitgtk24x;
};
gnome-music = callPackage ./apps/gnome-music { };
@ -225,13 +241,17 @@ rec {
#### Misc -- other packages on http://ftp.gnome.org/pub/GNOME/sources/
geary = callPackage ./misc/geary { };
geary = callPackage ./misc/geary {
webkitgtk = pkgs.webkitgtk24x;
};
gfbgraph = callPackage ./misc/gfbgraph { };
goffice = callPackage ./misc/goffice { };
gitg = callPackage ./misc/gitg { };
gitg = callPackage ./misc/gitg {
webkitgtk = pkgs.webkitgtk24x;
};
libgda = callPackage ./misc/libgda { };

View file

@ -4,6 +4,7 @@
, gmp ? null, mpfr ? null, bison ? null, flex ? null
}:
assert false;
assert stdenv.isDarwin;
assert langF77 -> gmp != null;

View file

@ -474,6 +474,8 @@ stdenv.mkDerivation ({
# Strip kills static libs of other archs (hence cross != null)
// optionalAttrs (!stripped || cross != null) { dontStrip = true; NIX_STRIP_DEBUG = 0; }
// optionalAttrs (enableMultilib) { dontMoveLib64 = true; }
// optionalAttrs langVhdl rec {
name = "ghdl-0.29";

View file

@ -526,4 +526,6 @@ stdenv.mkDerivation ({
# Strip kills static libs of other archs (hence cross != null)
// optionalAttrs (!stripped || cross != null) { dontStrip = true; NIX_STRIP_DEBUG = 0; }
// optionalAttrs (enableMultilib) { dontMoveLib64 = true; }
)

View file

@ -153,7 +153,6 @@ let version = "4.9.1";
" --disable-libssp --disable-nls" +
" --without-headers" +
" --disable-threads " +
" --disable-libmudflap " +
" --disable-libgomp " +
" --disable-libquadmath" +
" --disable-shared" +
@ -513,4 +512,6 @@ stdenv.mkDerivation ({
# Strip kills static libs of other archs (hence cross != null)
// optionalAttrs (!stripped || cross != null) { dontStrip = true; NIX_STRIP_DEBUG = 0; }
// optionalAttrs (enableMultilib) { dontMoveLib64 = true; }
)

View file

@ -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

View file

@ -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"];
}

View file

@ -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" ];

View file

@ -1,5 +1,9 @@
{ stdenv, fetch, cmake, libxml2, libedit, llvm, version, clang-tools-extra_src }:
# be sure not to rebuild clang on darwin; some packages request it specifically
# we need to fix those
assert stdenv.isDarwin -> stdenv.gcc.nativeTools;
stdenv.mkDerivation {
name = "clang-${version}";

View file

@ -27,7 +27,10 @@ in stdenv.mkDerivation rec {
mv compiler-rt-* $sourceRoot/projects/compiler-rt
'';
buildInputs = [ perl groff cmake libxml2 python libffi ] ++ stdenv.lib.optional stdenv.isLinux valgrind;
buildInputs =
[ perl groff cmake libxml2 libffi ]
++ stdenv.lib.optional (!stdenv.isDarwin) python /*
++ stdenv.lib.optional stdenv.isLinux valgrind */;
propagatedBuildInputs = [ ncurses zlib ];
@ -65,6 +68,5 @@ in stdenv.mkDerivation rec {
license = stdenv.lib.licenses.bsd3;
maintainers = with stdenv.lib.maintainers; [ shlevy lovek323 raskin viric ];
platforms = stdenv.lib.platforms.all;
broken = stdenv.isDarwin;
};
}

View file

@ -26,6 +26,8 @@ stdenv.mkDerivation rec {
sha256 = "b1ca708994180236917ae79e17606da5bd334ca6acd6873a550027e1c0ec874a";
};
patches = [ ./fix-clang-build-on-osx.diff ];
prefixKey = "-prefix ";
configureFlags = ["-no-tk"] ++ optionals useX11 [ "-x11lib" x11lib
"-x11include" x11inc ];

View file

@ -0,0 +1,20 @@
diff --git a/configure b/configure
index d45e88f..25d872b 100755
--- a/configure
+++ b/configure
@@ -322,7 +322,14 @@ case "$bytecc,$target" in
bytecccompopts="-fno-defer-pop $gcc_warnings -DSHRINKED_GNUC"
mathlib="";;
*,*-*-darwin*)
- bytecccompopts="-fno-defer-pop $gcc_warnings"
+ # On recent version of OSX, gcc is a symlink to clang
+ if $bytecc --version | grep -q clang; then
+ # -fno-defer-pop is not supported by clang, and make recent
+ # versions of clang to fail
+ bytecccompopts="$gcc_warnings"
+ else
+ bytecccompopts="-fno-defer-pop $gcc_warnings"
+ fi
mathlib=""
mkexe="$mkexe -Wl,-no_compact_unwind"
# Tell gcc that we can use 32-bit code addresses for threaded code

View file

@ -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 <inttypes.h> 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 <inttypes.h>
+// # @INCLUDE_NEXT@ @NEXT_STDINT_H@
#endif
#if ! defined _@GUARD_PREFIX@_STDINT_H && ! defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H

View file

@ -31,7 +31,7 @@
# libguile/vm-i-system.i is not created in time
enableParallelBuilding = false;
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

View file

@ -10,4 +10,4 @@ addGuileLibPath () {
fi
}
envHooks=(${envHooks[@]} addGuileLibPath)
envHooks+=(addGuileLibPath)

View file

@ -5,4 +5,4 @@ addGuileLibPath () {
fi
}
envHooks=(${envHooks[@]} addGuileLibPath)
envHooks+=(addGuileLibPath)

View file

@ -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="$CC" )
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" )

View file

@ -2,4 +2,4 @@ addPerlLibPath () {
addToSearchPath PERL5LIB $1/lib/perl5/site_perl
}
envHooks=(${envHooks[@]} addPerlLibPath)
envHooks+=(addPerlLibPath)

View file

@ -1,4 +1,4 @@
{ stdenv, fetchurl }:
{ lib, stdenv, fetchurl, enableThreading ? true }:
let
@ -6,10 +6,6 @@ let
in
with {
inherit (stdenv.lib) optional optionalString;
};
stdenv.mkDerivation rec {
name = "perl-5.16.3";
@ -21,9 +17,12 @@ stdenv.mkDerivation rec {
patches =
[ # Do not look in /usr etc. for dependencies.
./no-sys-dirs.patch
./no-impure-config-time.patch
./fixed-man-page-date.patch
./no-date-in-perl-binary.patch
]
++ optional stdenv.isSunOS ./ld-shared.patch
++ stdenv.lib.optional stdenv.isDarwin [ ./cpp-precomp.patch ./no-libutil.patch ] ;
++ lib.optional stdenv.isSunOS ./ld-shared.patch
++ lib.optional stdenv.isDarwin [ ./cpp-precomp.patch ./no-libutil.patch ] ;
# Build a thread-safe Perl with a dynamic libperls.o. We need the
# "installstyle" option to ensure that modules are put under
@ -32,14 +31,13 @@ stdenv.mkDerivation rec {
# Miniperl needs -lm. perl needs -lrt.
configureFlags =
[ "-de"
"-Dcc=gcc"
"-Uinstallusrbinperl"
"-Dinstallstyle=lib/perl5"
"-Duseshrplib"
"-Dlocincpth=${libc}/include"
"-Dloclibpth=${libc}/lib"
]
++ optional (stdenv ? glibc) "-Dusethreads";
++ lib.optional enableThreading "-Dusethreads";
configureScript = "${stdenv.shell} ./Configure";
@ -51,18 +49,18 @@ stdenv.mkDerivation rec {
''
configureFlags="$configureFlags -Dprefix=$out -Dman1dir=$out/share/man/man1 -Dman3dir=$out/share/man/man3"
${optionalString stdenv.isArm ''
${lib.optionalString stdenv.isArm ''
configureFlagsArray=(-Dldflags="-lm -lrt")
''}
${optionalString stdenv.isCygwin ''
${lib.optionalString stdenv.isCygwin ''
cp cygwin/cygwin.c{,.bak}
echo "#define PERLIO_NOT_STDIO 0" > tmp
cat tmp cygwin/cygwin.c.bak > cygwin/cygwin.c
''}
'';
preBuild = optionalString (!(stdenv ? gcc && stdenv.gcc.nativeTools))
preBuild = lib.optionalString (!(stdenv ? gcc && stdenv.gcc.nativeTools))
''
# Make Cwd work on NixOS (where we don't have a /bin/pwd).
substituteInPlace dist/Cwd/Cwd.pm --replace "'/bin/pwd'" "'$(type -tP pwd)'"

View file

@ -0,0 +1,11 @@
--- a/cpan/podlators/lib/Pod/Man.pm 2014-04-07 06:25:23.730505243 +0200
+++ b/cpan/podlators/lib/Pod/Man.pm 2014-04-07 06:26:40.816552603 +0200
@@ -768,7 +768,7 @@
} else {
($name, $section) = $self->devise_title;
}
- my $date = $$self{date} || $self->devise_date;
+ my $date = "1970-01-01"; # Fixed date for NixOS, orig: $$self{date} || $self->devise_date;
$self->preamble ($name, $section, $date)
unless $self->bare_output or DEBUG > 9;

View file

@ -0,0 +1,11 @@
--- a/perl.c 2014-04-07 07:58:01.402831615 +0200
+++ b/perl.c 2014-04-07 07:59:38.556945298 +0200
@@ -1754,7 +1754,7 @@
PUSHs(Perl_newSVpvn_flags(aTHX_ non_bincompat_options,
sizeof(non_bincompat_options) - 1, SVs_TEMP));
-#ifdef __DATE__
+#if 0
# ifdef __TIME__
PUSHs(Perl_newSVpvn_flags(aTHX_
STR_WITH_LEN("Compiled at " __DATE__ " " __TIME__),

View file

@ -0,0 +1,11 @@
--- a/Configure 2014-04-05 20:21:33.714635700 +0200
+++ b/Configure 2014-04-05 20:23:23.377441026 +0200
@@ -3609,6 +3609,8 @@
: who configured the system
cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
+cf_time='Thu Jan 1 00:00:00 UTC 1970'
+
case "$cf_by" in
"")
cf_by=`(logname) 2>/dev/null`

View file

@ -2,4 +2,4 @@ addPerlLibPath () {
addToSearchPath PERL5LIB $1/lib/perl5/site_perl
}
envHooks=(${envHooks[@]} addPerlLibPath)
envHooks+=(addPerlLibPath)

View file

@ -1,4 +1,16 @@
{ stdenv, fetchurl }:
{ stdenv, fetchurl, enableThreading ? true }:
# We can only compile perl with threading on platforms where we have a
# real glibc in the stdenv.
#
# Instead of silently building an unthreaded perl if this is not the
# case, we force callers to disableThreading explicitly, therefore
# documenting the platforms where the perl is not threaded.
#
# In the case of stdenv linux boot stage1 it's not possible to use
# threading because of the simpleness of the bootstrap glibc, so we
# use enableThreading = false there.
assert enableThreading -> (stdenv ? glibc);
let
@ -39,7 +51,7 @@ stdenv.mkDerivation rec {
"-Dlocincpth=${libc}/include"
"-Dloclibpth=${libc}/lib"
]
++ optional (stdenv ? glibc) "-Dusethreads";
++ optional enableThreading "-Dusethreads";
configureScript = "${stdenv.shell} ./Configure";

View file

@ -2,4 +2,4 @@ addPerlLibPath () {
addToSearchPath PERL5LIB $1/lib/perl5/site_perl
}
envHooks=(${envHooks[@]} addPerlLibPath)
envHooks+=(addPerlLibPath)

View file

@ -2,4 +2,4 @@ addPerlLibPath () {
addToSearchPath PERL5LIB $1/@libPrefix@
}
envHooks=(${envHooks[@]} addPerlLibPath)
envHooks+=(addPerlLibPath)

View file

@ -12,4 +12,4 @@ toPythonPath() {
echo $result
}
envHooks=(${envHooks[@]} addPythonPath)
envHooks+=(addPythonPath)

View file

@ -12,4 +12,4 @@ toPythonPath() {
echo $result
}
envHooks=(${envHooks[@]} addPythonPath)
envHooks+=(addPythonPath)

View file

@ -68,6 +68,7 @@ let
configureFlags = "--enable-shared --with-threads --enable-unicode";
NIX_CFLAGS_COMPILE = optionalString stdenv.isDarwin "-msse2";
DETERMINISTIC_BUILD = 1;
setupHook = ./setup-hook.sh;

View file

@ -12,4 +12,4 @@ toPythonPath() {
echo $result
}
envHooks=(${envHooks[@]} addPythonPath)
envHooks+=(addPythonPath)

View file

@ -12,4 +12,4 @@ toPythonPath() {
echo $result
}
envHooks=(${envHooks[@]} addPythonPath)
envHooks+=(addPythonPath)

View file

@ -12,4 +12,4 @@ toPythonPath() {
echo $result
}
envHooks=(${envHooks[@]} addPythonPath)
envHooks+=(addPythonPath)

View file

@ -12,4 +12,4 @@ toPythonPath() {
echo $result
}
envHooks=(${envHooks[@]} addPythonPath)
envHooks+=(addPythonPath)

View file

@ -48,12 +48,6 @@ stdenv.mkDerivation rec {
enableParallelBuilding = true;
# Fix a build failure on systems with nix store optimisation.
# (The build process attempted to copy file a overwriting file b, where a and
# b are hard-linked, which results in cp returning a non-zero exit code.)
# https://github.com/NixOS/nixpkgs/issues/4266
postUnpack = ''rm "$sourceRoot/enc/unicode/name2ctype.h"'';
patches = [
./ruby19-parallel-install.patch
./bitperfect-rdoc.patch
@ -86,6 +80,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}

View file

@ -50,12 +50,6 @@ stdenv.mkDerivation rec {
enableParallelBuilding = true;
# Fix a build failure on systems with nix store optimisation.
# (The build process attempted to copy file a overwriting file b, where a and
# b are hard-linked, which results in cp returning a non-zero exit code.)
# https://github.com/NixOS/nixpkgs/issues/4266
postUnpack = ''rm "$sourceRoot/enc/unicode/name2ctype.h"'';
patches = ops useRailsExpress [
"${patchSet}/patches/ruby/2.0.0/p481/01-zero-broken-tests.patch"
"${patchSet}/patches/ruby/2.0.0/p481/02-railsexpress-gc.patch"

View file

@ -51,12 +51,6 @@ stdenv.mkDerivation rec {
enableParallelBuilding = true;
# Fix a build failure on systems with nix store optimisation.
# (The build process attempted to copy file a overwriting file b, where a and
# b are hard-linked, which results in cp returning a non-zero exit code.)
# https://github.com/NixOS/nixpkgs/issues/4266
postUnpack = ''rm "$sourceRoot/enc/unicode/name2ctype.h"'';
patches = ops useRailsExpress [
"${patchSet}/patches/ruby/2.1.0/railsexpress/01-current-2.1.1-fixes.patch"
"${patchSet}/patches/ruby/2.1.0/railsexpress/02-zero-broken-tests.patch"

View file

@ -51,12 +51,6 @@ stdenv.mkDerivation rec {
enableParallelBuilding = true;
# Fix a build failure on systems with nix store optimisation.
# (The build process attempted to copy file a overwriting file b, where a and
# b are hard-linked, which results in cp returning a non-zero exit code.)
# https://github.com/NixOS/nixpkgs/issues/4266
postUnpack = ''rm "$sourceRoot/enc/unicode/name2ctype.h"'';
patches = ops useRailsExpress [
"${patchSet}/patches/ruby/2.1.0/railsexpress/01-zero-broken-tests.patch"
"${patchSet}/patches/ruby/2.1.0/railsexpress/02-improve-gc-stats.patch"

View file

@ -51,12 +51,6 @@ stdenv.mkDerivation rec {
enableParallelBuilding = true;
# Fix a build failure on systems with nix store optimisation.
# (The build process attempted to copy file a overwriting file b, where a and
# b are hard-linked, which results in cp returning a non-zero exit code.)
# https://github.com/NixOS/nixpkgs/issues/4266
postUnpack = ''rm "$sourceRoot/enc/unicode/name2ctype.h"'';
patches = ops useRailsExpress [
"${patchSet}/patches/ruby/2.1.2/railsexpress/01-zero-broken-tests.patch"
"${patchSet}/patches/ruby/2.1.2/railsexpress/02-improve-gc-stats.patch"

View file

@ -2,6 +2,7 @@
, sslSupport ? true, openssl
, bdbSupport ? false, db
, ldapSupport ? true, openldap
, libiconvOrNull
}:
assert sslSupport -> openssl != null;
@ -28,7 +29,7 @@ stdenv.mkDerivation rec {
${stdenv.lib.optionalString ldapSupport "--with-ldap"}
'';
propagatedBuildInputs = [ makeWrapper apr expat ]
propagatedBuildInputs = [ makeWrapper apr expat libiconvOrNull ]
++ optional sslSupport openssl
++ optional bdbSupport db
++ optional ldapSupport openldap;

View file

@ -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 *******************************/

View file

@ -8,6 +8,10 @@ stdenv.mkDerivation rec {
sha256 = "1qgn5psfyhbrnap275xjfrzppf5a83fb67gpql0kfqv37al869gm";
};
patchPhase = ''
patch interfaces/cc/aspell.h < ${./clang.patch}
'';
buildInputs = [ perl ];
doCheck = true;

View file

@ -2,14 +2,14 @@
, intltool, dbus_glib, at_spi2_core, libSM }:
stdenv.mkDerivation rec {
versionMajor = "2.12";
versionMajor = "2.14";
versionMinor = "1";
moduleName = "at-spi2-atk";
name = "${moduleName}-${versionMajor}.${versionMinor}";
src = fetchurl {
url = "mirror://gnome/sources/${moduleName}/${versionMajor}/${name}.tar.xz";
sha256 = "5fa9c527bdec028e06797563cd52d49bcf06f638549df983424d88db89bb1336";
sha256 = "1jvvs5bb63xa8ip4cvmpmyyc35gyh39bvwn967wabw7dc3m393q5";
};
buildInputs = [ python pkgconfig popt atk libX11 libICE xlibs.libXtst libXi

View file

@ -1,15 +1,15 @@
{ stdenv, fetchurl, python, pkgconfig, popt, intltool, dbus_glib
, libX11, xextproto, libSM, libICE, libXtst, libXi, gobjectIntrospection }:
stdenv.mkDerivation (rec {
versionMajor = "2.12";
stdenv.mkDerivation rec {
versionMajor = "2.14";
versionMinor = "0";
moduleName = "at-spi2-core";
name = "${moduleName}-${versionMajor}.${versionMinor}";
src = fetchurl {
url = "mirror://gnome/sources/${moduleName}/${versionMajor}/${name}.tar.xz";
sha256 = "12gvsgdaxnxskndlhlmdkc50cfqgmzfc4n8la9944fz5k3fhwmfv";
sha256 = "1j0l4l4qx0i4s9zzwhiwvw3hfjnrbmknvwkzvqpvb5gndqpb01sq";
};
buildInputs = [
@ -21,12 +21,10 @@ stdenv.mkDerivation (rec {
# ToDo: on non-NixOS we create a symlink from there?
configureFlags = "--with-dbus-daemondir=/run/current-system/sw/bin/";
NIX_LDFLAGS = with stdenv; lib.optionalString isDarwin "-lintl";
meta = with stdenv.lib; {
platforms = platforms.linux;
};
}
// stdenv.lib.optionalAttrs stdenv.isDarwin {
NIX_LDFLAGS = "-lintl";
}
)

Some files were not shown because too many files have changed in this diff Show more