Merge branch 'cc-wrapper-stdenvNoCC' into ericson2314-cross-base
This commit is contained in:
commit
2cb098b7b4
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
<chapter xmlns="http://docbook.org/ns/docbook"
|
<chapter xmlns="http://docbook.org/ns/docbook"
|
||||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||||
xml:id="chap-stdenv">
|
xml:id="chap-stdenv">
|
||||||
@ -188,11 +187,13 @@ genericBuild
|
|||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><varname>NIX_DEBUG</varname></term>
|
<term><varname>NIX_DEBUG</varname></term>
|
||||||
<listitem><para>If set, <literal>stdenv</literal> will print some
|
<listitem><para>
|
||||||
debug information during the build. In particular, the
|
A natural number indicating how much information to log.
|
||||||
<command>gcc</command> and <command>ld</command> wrapper scripts
|
If set to 1 or higher, <literal>stdenv</literal> will print moderate debug information during the build.
|
||||||
will print out the complete command line passed to the wrapped
|
In particular, the <command>gcc</command> and <command>ld</command> wrapper scripts will print out the complete command line passed to the wrapped tools.
|
||||||
tools.</para></listitem>
|
If set to 6 or higher, the <literal>stdenv</literal> setup script will be run with <literal>set -x</literal> tracing.
|
||||||
|
If set to 7 or higher, the <command>gcc</command> and <command>ld</command> wrapper scripts will also be run with <literal>set -x</literal> tracing.
|
||||||
|
</para></listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
</variablelist>
|
</variablelist>
|
||||||
|
@ -16,14 +16,14 @@ do
|
|||||||
hardeningDisableMap[$flag]=1
|
hardeningDisableMap[$flag]=1
|
||||||
done
|
done
|
||||||
|
|
||||||
if [[ -n "${NIX_DEBUG:-}" ]]; then
|
if (( "${NIX_DEBUG:-0}" >= 1 )); then
|
||||||
printf 'HARDENING: disabled flags:' >&2
|
printf 'HARDENING: disabled flags:' >&2
|
||||||
(( "${#hardeningDisableMap[@]}" )) && printf ' %q' "${!hardeningDisableMap[@]}" >&2
|
(( "${#hardeningDisableMap[@]}" )) && printf ' %q' "${!hardeningDisableMap[@]}" >&2
|
||||||
echo >&2
|
echo >&2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -z "${hardeningDisableMap[all]:-}" ]]; then
|
if [[ -z "${hardeningDisableMap[all]:-}" ]]; then
|
||||||
if [[ -n "${NIX_DEBUG:-}" ]]; then
|
if (( "${NIX_DEBUG:-0}" >= 1 )); then
|
||||||
echo 'HARDENING: Is active (not completely disabled with "all" flag)' >&2;
|
echo 'HARDENING: Is active (not completely disabled with "all" flag)' >&2;
|
||||||
fi
|
fi
|
||||||
for flag in "${hardeningFlags[@]}"
|
for flag in "${hardeningFlags[@]}"
|
||||||
@ -31,40 +31,40 @@ if [[ -z "${hardeningDisableMap[all]:-}" ]]; then
|
|||||||
if [[ -z "${hardeningDisableMap[$flag]:-}" ]]; then
|
if [[ -z "${hardeningDisableMap[$flag]:-}" ]]; then
|
||||||
case $flag in
|
case $flag in
|
||||||
fortify)
|
fortify)
|
||||||
if [[ -n "${NIX_DEBUG:-}" ]]; then echo HARDENING: enabling fortify >&2; fi
|
if (( "${NIX_DEBUG:-0}" >= 1 )); then echo HARDENING: enabling fortify >&2; fi
|
||||||
hardeningCFlags+=('-O2' '-D_FORTIFY_SOURCE=2')
|
hardeningCFlags+=('-O2' '-D_FORTIFY_SOURCE=2')
|
||||||
;;
|
;;
|
||||||
stackprotector)
|
stackprotector)
|
||||||
if [[ -n "${NIX_DEBUG:-}" ]]; then echo HARDENING: enabling stackprotector >&2; fi
|
if (( "${NIX_DEBUG:-0}" >= 1 )); then echo HARDENING: enabling stackprotector >&2; fi
|
||||||
hardeningCFlags+=('-fstack-protector-strong' '--param' 'ssp-buffer-size=4')
|
hardeningCFlags+=('-fstack-protector-strong' '--param' 'ssp-buffer-size=4')
|
||||||
;;
|
;;
|
||||||
pie)
|
pie)
|
||||||
if [[ -n "${NIX_DEBUG:-}" ]]; then echo HARDENING: enabling CFlags -fPIE >&2; fi
|
if (( "${NIX_DEBUG:-0}" >= 1 )); then echo HARDENING: enabling CFlags -fPIE >&2; fi
|
||||||
hardeningCFlags+=('-fPIE')
|
hardeningCFlags+=('-fPIE')
|
||||||
if [[ ! ("$*" =~ " -shared " || "$*" =~ " -static ") ]]; then
|
if [[ ! ("$*" =~ " -shared " || "$*" =~ " -static ") ]]; then
|
||||||
if [[ -n "${NIX_DEBUG:-}" ]]; then echo HARDENING: enabling LDFlags -pie >&2; fi
|
if (( "${NIX_DEBUG:-0}" >= 1 )); then echo HARDENING: enabling LDFlags -pie >&2; fi
|
||||||
hardeningCFlags+=('-pie')
|
hardeningCFlags+=('-pie')
|
||||||
hardeningLDFlags+=('-pie')
|
hardeningLDFlags+=('-pie')
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
pic)
|
pic)
|
||||||
if [[ -n "${NIX_DEBUG:-}" ]]; then echo HARDENING: enabling pic >&2; fi
|
if (( "${NIX_DEBUG:-0}" >= 1 )); then echo HARDENING: enabling pic >&2; fi
|
||||||
hardeningCFlags+=('-fPIC')
|
hardeningCFlags+=('-fPIC')
|
||||||
;;
|
;;
|
||||||
strictoverflow)
|
strictoverflow)
|
||||||
if [[ -n "${NIX_DEBUG:-}" ]]; then echo HARDENING: enabling strictoverflow >&2; fi
|
if (( "${NIX_DEBUG:-0}" >= 1 )); then echo HARDENING: enabling strictoverflow >&2; fi
|
||||||
hardeningCFlags+=('-fno-strict-overflow')
|
hardeningCFlags+=('-fno-strict-overflow')
|
||||||
;;
|
;;
|
||||||
format)
|
format)
|
||||||
if [[ -n "${NIX_DEBUG:-}" ]]; then echo HARDENING: enabling format >&2; fi
|
if (( "${NIX_DEBUG:-0}" >= 1 )); then echo HARDENING: enabling format >&2; fi
|
||||||
hardeningCFlags+=('-Wformat' '-Wformat-security' '-Werror=format-security')
|
hardeningCFlags+=('-Wformat' '-Wformat-security' '-Werror=format-security')
|
||||||
;;
|
;;
|
||||||
relro)
|
relro)
|
||||||
if [[ -n "${NIX_DEBUG:-}" ]]; then echo HARDENING: enabling relro >&2; fi
|
if (( "${NIX_DEBUG:-0}" >= 1 )); then echo HARDENING: enabling relro >&2; fi
|
||||||
hardeningLDFlags+=('-z' 'relro')
|
hardeningLDFlags+=('-z' 'relro')
|
||||||
;;
|
;;
|
||||||
bindnow)
|
bindnow)
|
||||||
if [[ -n "${NIX_DEBUG:-}" ]]; then echo HARDENING: enabling bindnow >&2; fi
|
if (( "${NIX_DEBUG:-0}" >= 1 )); then echo HARDENING: enabling bindnow >&2; fi
|
||||||
hardeningLDFlags+=('-z' 'now')
|
hardeningLDFlags+=('-z' 'now')
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
|
@ -2,6 +2,10 @@
|
|||||||
set -eu -o pipefail
|
set -eu -o pipefail
|
||||||
shopt -s nullglob
|
shopt -s nullglob
|
||||||
|
|
||||||
|
if (( "${NIX_DEBUG:-0}" >= 7 )); then
|
||||||
|
set -x
|
||||||
|
fi
|
||||||
|
|
||||||
path_backup="$PATH"
|
path_backup="$PATH"
|
||||||
|
|
||||||
# That @-vars are substituted separately from bash evaluation makes
|
# That @-vars are substituted separately from bash evaluation makes
|
||||||
@ -161,7 +165,7 @@ if [ "$*" = -v ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Optionally print debug info.
|
# Optionally print debug info.
|
||||||
if [ -n "${NIX_DEBUG:-}" ]; then
|
if (( "${NIX_DEBUG:-0}" >= 1 )); then
|
||||||
# Old bash workaround, see ld-wrapper for explanation.
|
# Old bash workaround, see ld-wrapper for explanation.
|
||||||
echo "extra flags before to @prog@:" >&2
|
echo "extra flags before to @prog@:" >&2
|
||||||
printf " %q\n" ${extraBefore+"${extraBefore[@]}"} >&2
|
printf " %q\n" ${extraBefore+"${extraBefore[@]}"} >&2
|
||||||
|
@ -5,15 +5,15 @@
|
|||||||
# script that sets up the right environment variables so that the
|
# script that sets up the right environment variables so that the
|
||||||
# compiler and the linker just "work".
|
# compiler and the linker just "work".
|
||||||
|
|
||||||
{ name ? "", stdenv, nativeTools, noLibc ? false, nativeLibc, nativePrefix ? ""
|
{ name ? "", stdenvNoCC, nativeTools, noLibc ? false, nativeLibc, nativePrefix ? ""
|
||||||
, cc ? null, libc ? null, binutils ? null, coreutils ? null, shell ? stdenv.shell
|
, cc ? null, libc ? null, binutils ? null, coreutils ? null, shell ? stdenvNoCC.shell
|
||||||
, zlib ? null, extraPackages ? [], extraBuildCommands ? ""
|
, zlib ? null, extraPackages ? [], extraBuildCommands ? ""
|
||||||
, isGNU ? false, isClang ? cc.isClang or false, gnugrep ? null
|
, isGNU ? false, isClang ? cc.isClang or false, gnugrep ? null
|
||||||
, buildPackages ? {}
|
, buildPackages ? {}
|
||||||
, useMacosReexportHack ? false
|
, useMacosReexportHack ? false
|
||||||
}:
|
}:
|
||||||
|
|
||||||
with stdenv.lib;
|
with stdenvNoCC.lib;
|
||||||
|
|
||||||
assert nativeTools -> nativePrefix != "";
|
assert nativeTools -> nativePrefix != "";
|
||||||
assert !nativeTools ->
|
assert !nativeTools ->
|
||||||
@ -25,6 +25,7 @@ assert (noLibc || nativeLibc) == (libc == null);
|
|||||||
assert cc.langVhdl or false -> zlib != null;
|
assert cc.langVhdl or false -> zlib != null;
|
||||||
|
|
||||||
let
|
let
|
||||||
|
stdenv = stdenvNoCC;
|
||||||
inherit (stdenv) hostPlatform targetPlatform;
|
inherit (stdenv) hostPlatform targetPlatform;
|
||||||
|
|
||||||
# Prefix for binaries. Customarily ends with a dash separator.
|
# Prefix for binaries. Customarily ends with a dash separator.
|
||||||
|
@ -2,6 +2,10 @@
|
|||||||
set -eu -o pipefail
|
set -eu -o pipefail
|
||||||
shopt -s nullglob
|
shopt -s nullglob
|
||||||
|
|
||||||
|
if (( "${NIX_DEBUG:-0}" >= 7 )); then
|
||||||
|
set -x
|
||||||
|
fi
|
||||||
|
|
||||||
# N.B. Gnat is not used during bootstrapping, so we don't need to
|
# N.B. Gnat is not used during bootstrapping, so we don't need to
|
||||||
# worry about the old bash empty array `set -u` workarounds.
|
# worry about the old bash empty array `set -u` workarounds.
|
||||||
|
|
||||||
@ -109,7 +113,7 @@ fi
|
|||||||
#fi
|
#fi
|
||||||
|
|
||||||
# Optionally print debug info.
|
# Optionally print debug info.
|
||||||
if [ -n "${NIX_DEBUG:-}" ]; then
|
if (( "${NIX_DEBUG:-0}" >= 1 )); then
|
||||||
echo "extra flags before to @prog@:" >&2
|
echo "extra flags before to @prog@:" >&2
|
||||||
printf " %q\n" "${extraBefore[@]}" >&2
|
printf " %q\n" "${extraBefore[@]}" >&2
|
||||||
echo "original flags to @prog@:" >&2
|
echo "original flags to @prog@:" >&2
|
||||||
|
@ -2,6 +2,10 @@
|
|||||||
set -eu -o pipefail
|
set -eu -o pipefail
|
||||||
shopt -s nullglob
|
shopt -s nullglob
|
||||||
|
|
||||||
|
if (( "${NIX_DEBUG:-0}" >= 7 )); then
|
||||||
|
set -x
|
||||||
|
fi
|
||||||
|
|
||||||
# N.B. Gnat is not used during bootstrapping, so we don't need to
|
# N.B. Gnat is not used during bootstrapping, so we don't need to
|
||||||
# worry about the old bash empty array `set -u` workarounds.
|
# worry about the old bash empty array `set -u` workarounds.
|
||||||
|
|
||||||
@ -24,7 +28,7 @@ extraBefore=()
|
|||||||
#export NIX_@infixSalt@_LDFLAGS_SET=1
|
#export NIX_@infixSalt@_LDFLAGS_SET=1
|
||||||
|
|
||||||
# Optionally print debug info.
|
# Optionally print debug info.
|
||||||
if [ -n "${NIX_DEBUG:-}" ]; then
|
if (( "${NIX_DEBUG:-0}" >= 1 )); then
|
||||||
echo "extra flags before to @prog@:" >&2
|
echo "extra flags before to @prog@:" >&2
|
||||||
printf " %q\n" "${extraBefore[@]}" >&2
|
printf " %q\n" "${extraBefore[@]}" >&2
|
||||||
echo "original flags to @prog@:" >&2
|
echo "original flags to @prog@:" >&2
|
||||||
|
@ -2,6 +2,10 @@
|
|||||||
set -eu -o pipefail
|
set -eu -o pipefail
|
||||||
shopt -s nullglob
|
shopt -s nullglob
|
||||||
|
|
||||||
|
if (( "${NIX_DEBUG:-0}" >= 7 )); then
|
||||||
|
set -x
|
||||||
|
fi
|
||||||
|
|
||||||
declare -a args=("$@")
|
declare -a args=("$@")
|
||||||
# I've also tried adding -z direct and -z lazyload, but it gave too many problems with C++ exceptions :'(
|
# 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
|
# Also made sure libgcc would not be lazy-loaded, as suggested here: https://www.illumos.org/issues/2534#note-3
|
||||||
|
@ -2,6 +2,10 @@
|
|||||||
set -eu -o pipefail
|
set -eu -o pipefail
|
||||||
shopt -s nullglob
|
shopt -s nullglob
|
||||||
|
|
||||||
|
if (( "${NIX_DEBUG:-0}" >= 7 )); then
|
||||||
|
set -x
|
||||||
|
fi
|
||||||
|
|
||||||
path_backup="$PATH"
|
path_backup="$PATH"
|
||||||
|
|
||||||
# phase separation makes this look useless
|
# phase separation makes this look useless
|
||||||
@ -156,7 +160,7 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
# Optionally print debug info.
|
# Optionally print debug info.
|
||||||
if [ -n "${NIX_DEBUG:-}" ]; then
|
if (( "${NIX_DEBUG:-0}" >= 1 )); then
|
||||||
# Old bash workaround, see above.
|
# Old bash workaround, see above.
|
||||||
echo "extra flags before to @prog@:" >&2
|
echo "extra flags before to @prog@:" >&2
|
||||||
printf " %q\n" ${extraBefore+"${extraBefore[@]}"} >&2
|
printf " %q\n" ${extraBefore+"${extraBefore[@]}"} >&2
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
skip () {
|
skip () {
|
||||||
if [ -n "${NIX_DEBUG:-}" ]; then
|
if (( "${NIX_DEBUG:-0}" >= 1 )); then
|
||||||
echo "skipping impure path $1" >&2
|
echo "skipping impure path $1" >&2
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -1,24 +1,26 @@
|
|||||||
{stdenv, lib, fetchurl, perl, libedit, ncurses5, gmp}:
|
{ stdenv
|
||||||
|
, fetchurl, perl
|
||||||
|
, libedit, ncurses5, gmp
|
||||||
|
}:
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
version = "6.10.2";
|
version = "6.10.2";
|
||||||
|
|
||||||
name = "ghc-${version}-binary";
|
name = "ghc-${version}-binary";
|
||||||
|
|
||||||
src =
|
src = fetchurl ({
|
||||||
if stdenv.system == "i686-linux" then
|
"i686-linux" = {
|
||||||
fetchurl {
|
|
||||||
# This binary requires libedit.so.0 (rather than libedit.so.2).
|
# This binary requires libedit.so.0 (rather than libedit.so.2).
|
||||||
url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-i386-unknown-linux.tar.bz2";
|
url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-i386-unknown-linux.tar.bz2";
|
||||||
sha256 = "1fw0zr2qshlpk8s0d16k27zcv5263nqdg2xds5ymw8ff6qz9rz9b";
|
sha256 = "1fw0zr2qshlpk8s0d16k27zcv5263nqdg2xds5ymw8ff6qz9rz9b";
|
||||||
}
|
};
|
||||||
else if stdenv.system == "x86_64-linux" then
|
"x86_64-linux" = {
|
||||||
fetchurl {
|
|
||||||
# Idem.
|
# Idem.
|
||||||
url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-x86_64-unknown-linux.tar.bz2";
|
url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-x86_64-unknown-linux.tar.bz2";
|
||||||
sha256 = "1rd2j7lmcfsm2rdfb5g6q0l8dz3sxadk5m3d2f69d4a6g4p4h7jj";
|
sha256 = "1rd2j7lmcfsm2rdfb5g6q0l8dz3sxadk5m3d2f69d4a6g4p4h7jj";
|
||||||
}
|
};
|
||||||
else throw "cannot bootstrap GHC on this platform";
|
}.${stdenv.hostPlatform.system}
|
||||||
|
or (throw "cannot bootstrap GHC on this platform"));
|
||||||
|
|
||||||
buildInputs = [perl];
|
buildInputs = [perl];
|
||||||
|
|
||||||
@ -37,17 +39,17 @@ stdenv.mkDerivation rec {
|
|||||||
'' +
|
'' +
|
||||||
# On Linux, use patchelf to modify the executables so that they can
|
# On Linux, use patchelf to modify the executables so that they can
|
||||||
# find editline/gmp.
|
# find editline/gmp.
|
||||||
(if stdenv.isLinux then ''
|
stdenv.lib.optionalString stdenv.hostPlatform.isLinux ''
|
||||||
find . -type f -perm -0100 \
|
find . -type f -perm -0100 \
|
||||||
-exec patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
|
-exec patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
|
||||||
--set-rpath "${lib.makeLibraryPath [ libedit ncurses5 gmp ]}" {} \;
|
--set-rpath "${stdenv.lib.makeLibraryPath [ libedit ncurses5 gmp ]}" {} \;
|
||||||
for prog in ld ar gcc strip ranlib; do
|
for prog in ld ar gcc strip ranlib; do
|
||||||
find . -name "setup-config" -exec sed -i "s@/usr/bin/$prog@$(type -p $prog)@g" {} \;
|
find . -name "setup-config" -exec sed -i "s@/usr/bin/$prog@$(type -p $prog)@g" {} \;
|
||||||
done
|
done
|
||||||
'' else "");
|
'';
|
||||||
|
|
||||||
configurePhase = ''
|
configurePhase = ''
|
||||||
./configure --prefix=$out --with-gmp-libraries=${lib.getLib gmp}/lib --with-gmp-includes=${lib.getDev gmp}/include
|
./configure --prefix=$out --with-gmp-libraries=${stdenv.lib.getLib gmp}/lib --with-gmp-includes=${stdenv.lib.getDev gmp}/include
|
||||||
'';
|
'';
|
||||||
|
|
||||||
# Stripping combined with patchelf breaks the executables (they die
|
# Stripping combined with patchelf breaks the executables (they die
|
||||||
@ -58,30 +60,7 @@ stdenv.mkDerivation rec {
|
|||||||
# calls install-strip ...
|
# calls install-strip ...
|
||||||
dontBuild = true;
|
dontBuild = true;
|
||||||
|
|
||||||
# The binaries for Darwin use frameworks, so fake those frameworks,
|
postInstall = ''
|
||||||
# and create some wrapper scripts that set DYLD_FRAMEWORK_PATH so
|
|
||||||
# that the executables work with no special setup.
|
|
||||||
postInstall =
|
|
||||||
(if stdenv.isDarwin then
|
|
||||||
''
|
|
||||||
mkdir -p $out/frameworks/GMP.framework/Versions/A
|
|
||||||
ln -s ${gmp.out}/lib/libgmp.dylib $out/frameworks/GMP.framework/GMP
|
|
||||||
ln -s ${gmp.out}/lib/libgmp.dylib $out/frameworks/GMP.framework/Versions/A/GMP
|
|
||||||
# !!! fix this
|
|
||||||
mkdir -p $out/frameworks/GNUeditline.framework/Versions/A
|
|
||||||
ln -s ${libedit}/lib/libeditline.dylib $out/frameworks/GNUeditline.framework/GNUeditline
|
|
||||||
ln -s ${libedit}/lib/libeditline.dylib $out/frameworks/GNUeditline.framework/Versions/A/GNUeditline
|
|
||||||
|
|
||||||
mv $out/bin $out/bin-orig
|
|
||||||
mkdir $out/bin
|
|
||||||
for i in $(cd $out/bin-orig && ls); do
|
|
||||||
echo \"#! $SHELL -e\" >> $out/bin/$i
|
|
||||||
echo \"DYLD_FRAMEWORK_PATH=$out/frameworks exec $out/bin-orig/$i -framework-path $out/frameworks \\\"\\$@\\\"\" >> $out/bin/$i
|
|
||||||
chmod +x $out/bin/$i
|
|
||||||
done
|
|
||||||
'' else "")
|
|
||||||
+
|
|
||||||
''
|
|
||||||
# bah, the passing gmp doesn't work, so let's add it to the final package.conf in a quick but dirty way
|
# bah, the passing gmp doesn't work, so let's add it to the final package.conf in a quick but dirty way
|
||||||
sed -i "s@^\(.*pkgName = PackageName \"rts\".*\libraryDirs = \\[\)\(.*\)@\\1\"${gmp.out}/lib\",\2@" $out/lib/ghc-${version}/package.conf
|
sed -i "s@^\(.*pkgName = PackageName \"rts\".*\libraryDirs = \\[\)\(.*\)@\\1\"${gmp.out}/lib\",\2@" $out/lib/ghc-${version}/package.conf
|
||||||
|
|
||||||
|
@ -1,32 +1,32 @@
|
|||||||
{stdenv, fetchurl, perl, ncurses5, gmp, libiconv}:
|
{ stdenv
|
||||||
|
, fetchurl, perl
|
||||||
|
, ncurses5, gmp, libiconv
|
||||||
|
}:
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
version = "7.0.4";
|
version = "7.0.4";
|
||||||
|
|
||||||
name = "ghc-${version}-binary";
|
name = "ghc-${version}-binary";
|
||||||
|
|
||||||
src =
|
src = fetchurl ({
|
||||||
if stdenv.system == "i686-linux" then
|
"i686-linux" = {
|
||||||
fetchurl {
|
|
||||||
url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-i386-unknown-linux.tar.bz2";
|
url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-i386-unknown-linux.tar.bz2";
|
||||||
sha256 = "0mfnihiyjl06f5w1yrjp36sw9g67g2ymg5sdl0g23h1pab99jx63";
|
sha256 = "0mfnihiyjl06f5w1yrjp36sw9g67g2ymg5sdl0g23h1pab99jx63";
|
||||||
}
|
};
|
||||||
else if stdenv.system == "x86_64-linux" then
|
"x86_64-linux" = {
|
||||||
fetchurl {
|
|
||||||
url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-x86_64-unknown-linux.tar.bz2";
|
url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-x86_64-unknown-linux.tar.bz2";
|
||||||
sha256 = "0mc4rhqcxz427wq4zgffmnn0d2yjqvy6af4x9mha283p1gdj5q99";
|
sha256 = "0mc4rhqcxz427wq4zgffmnn0d2yjqvy6af4x9mha283p1gdj5q99";
|
||||||
}
|
};
|
||||||
else if stdenv.system == "i686-darwin" then
|
"i686-darwin" = {
|
||||||
fetchurl {
|
|
||||||
url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-i386-apple-darwin.tar.bz2";
|
url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-i386-apple-darwin.tar.bz2";
|
||||||
sha256 = "0qj45hslrrr8zfks8m1jcb3awwx9rh35ndnpfmb0gwb6j7azq5n3";
|
sha256 = "0qj45hslrrr8zfks8m1jcb3awwx9rh35ndnpfmb0gwb6j7azq5n3";
|
||||||
}
|
};
|
||||||
else if stdenv.system == "x86_64-darwin" then
|
"x86_64-darwin" = {
|
||||||
fetchurl {
|
|
||||||
url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-x86_64-apple-darwin.tar.bz2";
|
url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-x86_64-apple-darwin.tar.bz2";
|
||||||
sha256 = "1m2ml88p1swf4dnv2vq8hz4drcp46n3ahpfi05wh01ajkf8hnn3l";
|
sha256 = "1m2ml88p1swf4dnv2vq8hz4drcp46n3ahpfi05wh01ajkf8hnn3l";
|
||||||
}
|
};
|
||||||
else throw "cannot bootstrap GHC on this platform";
|
}.${stdenv.hostPlatform.system}
|
||||||
|
or (throw "cannot bootstrap GHC on this platform"));
|
||||||
|
|
||||||
buildInputs = [perl];
|
buildInputs = [perl];
|
||||||
|
|
||||||
@ -74,9 +74,9 @@ stdenv.mkDerivation rec {
|
|||||||
install_name_tool -change /usr/lib/libiconv.2.dylib @executable_path/libiconv.dylib $1
|
install_name_tool -change /usr/lib/libiconv.2.dylib @executable_path/libiconv.dylib $1
|
||||||
}
|
}
|
||||||
|
|
||||||
ln -s ${libiconv}/lib/libiconv.dylib ghc-7.0.4/utils/ghc-pwd/dist/build/tmp
|
ln -s ${libiconv}/lib/libiconv.dylib ghc-${version}/utils/ghc-pwd/dist/build/tmp
|
||||||
ln -s ${libiconv}/lib/libiconv.dylib ghc-7.0.4/utils/hpc/dist/build/tmp
|
ln -s ${libiconv}/lib/libiconv.dylib ghc-${version}/utils/hpc/dist/build/tmp
|
||||||
ln -s ${libiconv}/lib/libiconv.dylib ghc-7.0.4/ghc/stage2/build/tmp
|
ln -s ${libiconv}/lib/libiconv.dylib ghc-${version}/ghc/stage2/build/tmp
|
||||||
|
|
||||||
for file in ghc-cabal ghc-pwd ghc-stage2 ghc-pkg haddock hsc2hs hpc; do
|
for file in ghc-cabal ghc-pwd ghc-stage2 ghc-pkg haddock hsc2hs hpc; do
|
||||||
fix $(find . -type f -name $file)
|
fix $(find . -type f -name $file)
|
||||||
@ -101,8 +101,7 @@ stdenv.mkDerivation rec {
|
|||||||
# calls install-strip ...
|
# calls install-strip ...
|
||||||
dontBuild = true;
|
dontBuild = true;
|
||||||
|
|
||||||
postInstall =
|
postInstall = ''
|
||||||
''
|
|
||||||
# Sanity check, can ghc create executables?
|
# Sanity check, can ghc create executables?
|
||||||
cd $TMP
|
cd $TMP
|
||||||
mkdir test-ghc; cd test-ghc
|
mkdir test-ghc; cd test-ghc
|
||||||
|
@ -1,32 +1,32 @@
|
|||||||
{stdenv, fetchurl, perl, ncurses5, gmp, libiconv, makeWrapper}:
|
{ stdenv
|
||||||
|
, fetchurl, perl, makeWrapper
|
||||||
|
, ncurses5, gmp, libiconv
|
||||||
|
}:
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
version = "7.4.2";
|
version = "7.4.2";
|
||||||
|
|
||||||
name = "ghc-${version}-binary";
|
name = "ghc-${version}-binary";
|
||||||
|
|
||||||
src =
|
src = fetchurl ({
|
||||||
if stdenv.system == "i686-linux" then
|
"i686-linux" = {
|
||||||
fetchurl {
|
|
||||||
url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-i386-unknown-linux.tar.bz2";
|
url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-i386-unknown-linux.tar.bz2";
|
||||||
sha256 = "0gny7knhss0w0d9r6jm1gghrcb8kqjvj94bb7hxf9syrk4fxlcxi";
|
sha256 = "0gny7knhss0w0d9r6jm1gghrcb8kqjvj94bb7hxf9syrk4fxlcxi";
|
||||||
}
|
};
|
||||||
else if stdenv.system == "x86_64-linux" then
|
"x86_64-linux" = {
|
||||||
fetchurl {
|
|
||||||
url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-x86_64-unknown-linux.tar.bz2";
|
url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-x86_64-unknown-linux.tar.bz2";
|
||||||
sha256 = "043jabd0lh6n1zlqhysngbpvlsdznsa2mmsj08jyqgahw9sjb5ns";
|
sha256 = "043jabd0lh6n1zlqhysngbpvlsdznsa2mmsj08jyqgahw9sjb5ns";
|
||||||
}
|
};
|
||||||
else if stdenv.system == "i686-darwin" then
|
"i686-darwin" = {
|
||||||
fetchurl {
|
|
||||||
url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-i386-apple-darwin.tar.bz2";
|
url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-i386-apple-darwin.tar.bz2";
|
||||||
sha256 = "1vrbs3pzki37hzym1f1nh07lrqh066z3ypvm81fwlikfsvk4djc0";
|
sha256 = "1vrbs3pzki37hzym1f1nh07lrqh066z3ypvm81fwlikfsvk4djc0";
|
||||||
}
|
};
|
||||||
else if stdenv.system == "x86_64-darwin" then
|
"x86_64-darwin" = {
|
||||||
fetchurl {
|
|
||||||
url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-x86_64-apple-darwin.tar.bz2";
|
url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-x86_64-apple-darwin.tar.bz2";
|
||||||
sha256 = "1imzqc0slpg0r6p40n5a9m18cbcm0m86z8dgyhfxcckksw54mzwf";
|
sha256 = "1imzqc0slpg0r6p40n5a9m18cbcm0m86z8dgyhfxcckksw54mzwf";
|
||||||
}
|
};
|
||||||
else throw "cannot bootstrap GHC on this platform";
|
}.${stdenv.hostPlatform.system}
|
||||||
|
or (throw "cannot bootstrap GHC on this platform"));
|
||||||
|
|
||||||
buildInputs = [perl];
|
buildInputs = [perl];
|
||||||
|
|
||||||
@ -79,9 +79,9 @@ stdenv.mkDerivation rec {
|
|||||||
install_name_tool -change /usr/lib/libiconv.2.dylib @executable_path/libiconv.dylib $1
|
install_name_tool -change /usr/lib/libiconv.2.dylib @executable_path/libiconv.dylib $1
|
||||||
}
|
}
|
||||||
|
|
||||||
ln -s ${libiconv}/lib/libiconv.dylib ghc-7.4.2/utils/ghc-pwd/dist-install/build/tmp
|
ln -s ${libiconv}/lib/libiconv.dylib ghc-${version}/utils/ghc-pwd/dist-install/build/tmp
|
||||||
ln -s ${libiconv}/lib/libiconv.dylib ghc-7.4.2/utils/hpc/dist-install/build/tmp
|
ln -s ${libiconv}/lib/libiconv.dylib ghc-${version}/utils/hpc/dist-install/build/tmp
|
||||||
ln -s ${libiconv}/lib/libiconv.dylib ghc-7.4.2/ghc/stage2/build/tmp
|
ln -s ${libiconv}/lib/libiconv.dylib ghc-${version}/ghc/stage2/build/tmp
|
||||||
|
|
||||||
for file in ghc-cabal ghc-pwd ghc-stage2 ghc-pkg haddock hsc2hs hpc; do
|
for file in ghc-cabal ghc-pwd ghc-stage2 ghc-pkg haddock hsc2hs hpc; do
|
||||||
fix $(find . -type f -name $file)
|
fix $(find . -type f -name $file)
|
||||||
@ -107,10 +107,10 @@ stdenv.mkDerivation rec {
|
|||||||
dontBuild = true;
|
dontBuild = true;
|
||||||
|
|
||||||
preInstall = stdenv.lib.optionalString stdenv.isDarwin ''
|
preInstall = stdenv.lib.optionalString stdenv.isDarwin ''
|
||||||
mkdir -p $out/lib/ghc-7.4.2
|
mkdir -p $out/lib/ghc-${version}
|
||||||
mkdir -p $out/bin
|
mkdir -p $out/bin
|
||||||
ln -s ${libiconv}/lib/libiconv.dylib $out/bin
|
ln -s ${libiconv}/lib/libiconv.dylib $out/bin
|
||||||
ln -s ${libiconv}/lib/libiconv.dylib $out/lib/ghc-7.4.2/libiconv.dylib
|
ln -s ${libiconv}/lib/libiconv.dylib $out/lib/ghc-${version}/libiconv.dylib
|
||||||
ln -s ${libiconv}/lib/libiconv.dylib utils/ghc-cabal/dist-install/build/tmp
|
ln -s ${libiconv}/lib/libiconv.dylib utils/ghc-cabal/dist-install/build/tmp
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ in rec {
|
|||||||
|
|
||||||
cc = if isNull last then "/dev/null" else import ../../build-support/cc-wrapper {
|
cc = if isNull last then "/dev/null" else import ../../build-support/cc-wrapper {
|
||||||
inherit shell;
|
inherit shell;
|
||||||
inherit (last) stdenv;
|
inherit (last) stdenvNoCC;
|
||||||
|
|
||||||
nativeTools = false;
|
nativeTools = false;
|
||||||
nativeLibc = false;
|
nativeLibc = false;
|
||||||
@ -324,7 +324,7 @@ in rec {
|
|||||||
shell = "${pkgs.bash}/bin/bash";
|
shell = "${pkgs.bash}/bin/bash";
|
||||||
|
|
||||||
cc = lib.callPackageWith {} ../../build-support/cc-wrapper {
|
cc = lib.callPackageWith {} ../../build-support/cc-wrapper {
|
||||||
inherit (pkgs) stdenv;
|
inherit (pkgs) stdenvNoCC;
|
||||||
inherit shell;
|
inherit shell;
|
||||||
nativeTools = false;
|
nativeTools = false;
|
||||||
nativeLibc = false;
|
nativeLibc = false;
|
||||||
|
@ -77,7 +77,7 @@ let inherit (localSystem) system; in
|
|||||||
nativeTools = true;
|
nativeTools = true;
|
||||||
nativePrefix = "/usr";
|
nativePrefix = "/usr";
|
||||||
nativeLibc = true;
|
nativeLibc = true;
|
||||||
inherit (prevStage) stdenv;
|
stdenvNoCC = prevStage.stdenv;
|
||||||
cc = {
|
cc = {
|
||||||
name = "clang-9.9.9";
|
name = "clang-9.9.9";
|
||||||
cc = "/usr";
|
cc = "/usr";
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
set -eu
|
set -eu
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
|
||||||
|
if (( "${NIX_DEBUG:-0}" >= 6 )); then
|
||||||
|
set -x
|
||||||
|
fi
|
||||||
|
|
||||||
: ${outputs:=out}
|
: ${outputs:=out}
|
||||||
|
|
||||||
|
|
||||||
@ -269,7 +273,7 @@ for i in $initialPath; do
|
|||||||
addToSearchPath PATH "$i/bin"
|
addToSearchPath PATH "$i/bin"
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ "${NIX_DEBUG:-}" = 1 ]; then
|
if (( "${NIX_DEBUG:-0}" >= 1 )); then
|
||||||
echo "initial path: $PATH"
|
echo "initial path: $PATH"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -429,7 +433,7 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
PATH="${_PATH-}${_PATH:+${PATH:+:}}$PATH"
|
PATH="${_PATH-}${_PATH:+${PATH:+:}}$PATH"
|
||||||
if [ "${NIX_DEBUG:-}" = 1 ]; then
|
if (( "${NIX_DEBUG:-0}" >= 1 )); then
|
||||||
echo "final path: $PATH"
|
echo "final path: $PATH"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -539,7 +543,7 @@ substituteAll() {
|
|||||||
local -a args=()
|
local -a args=()
|
||||||
|
|
||||||
for varName in $(awk 'BEGIN { for (v in ENVIRON) if (v ~ /^[a-z][a-zA-Z0-9_]*$/) print v }'); do
|
for varName in $(awk 'BEGIN { for (v in ENVIRON) if (v ~ /^[a-z][a-zA-Z0-9_]*$/) print v }'); do
|
||||||
if [ "${NIX_DEBUG:-}" = "1" ]; then
|
if (( "${NIX_DEBUG:-0}" >= 1 )); then
|
||||||
printf "@%s@ -> %q\n" "${varName}" "${!varName}"
|
printf "@%s@ -> %q\n" "${varName}" "${!varName}"
|
||||||
fi
|
fi
|
||||||
args+=("--subst-var" "$varName")
|
args+=("--subst-var" "$varName")
|
||||||
|
@ -84,7 +84,7 @@ let
|
|||||||
libc = prevStage.glibc;
|
libc = prevStage.glibc;
|
||||||
inherit (prevStage) binutils coreutils gnugrep;
|
inherit (prevStage) binutils coreutils gnugrep;
|
||||||
name = name;
|
name = name;
|
||||||
stdenv = prevStage.ccWrapperStdenv;
|
stdenvNoCC = prevStage.ccWrapperStdenv;
|
||||||
};
|
};
|
||||||
|
|
||||||
extraAttrs = {
|
extraAttrs = {
|
||||||
@ -244,7 +244,7 @@ in
|
|||||||
};
|
};
|
||||||
cc = prevStage.gcc-unwrapped;
|
cc = prevStage.gcc-unwrapped;
|
||||||
libc = self.glibc;
|
libc = self.glibc;
|
||||||
inherit (self) stdenv binutils coreutils gnugrep;
|
inherit (self) stdenvNoCC binutils coreutils gnugrep;
|
||||||
name = "";
|
name = "";
|
||||||
shell = self.bash + "/bin/bash";
|
shell = self.bash + "/bin/bash";
|
||||||
};
|
};
|
||||||
|
@ -117,6 +117,7 @@ in
|
|||||||
cc = null;
|
cc = null;
|
||||||
fetchurl = null;
|
fetchurl = null;
|
||||||
};
|
};
|
||||||
|
stdenvNoCC = stdenv;
|
||||||
|
|
||||||
cc = import ../../build-support/cc-wrapper {
|
cc = import ../../build-support/cc-wrapper {
|
||||||
name = "cc-native";
|
name = "cc-native";
|
||||||
@ -126,7 +127,7 @@ in
|
|||||||
"i686-solaris" = "/usr/gnu";
|
"i686-solaris" = "/usr/gnu";
|
||||||
"x86_64-solaris" = "/opt/local/gcc47";
|
"x86_64-solaris" = "/opt/local/gcc47";
|
||||||
}.${system} or "/usr";
|
}.${system} or "/usr";
|
||||||
inherit stdenv;
|
inherit stdenvNoCC;
|
||||||
};
|
};
|
||||||
|
|
||||||
fetchurl = import ../../build-support/fetchurl {
|
fetchurl = import ../../build-support/fetchurl {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{ lib
|
{ lib
|
||||||
, crossSystem, config
|
, crossSystem, config, overlays
|
||||||
, bootStages
|
, bootStages
|
||||||
, ...
|
, ...
|
||||||
}:
|
}:
|
||||||
@ -7,9 +7,7 @@
|
|||||||
assert crossSystem == null;
|
assert crossSystem == null;
|
||||||
|
|
||||||
bootStages ++ [
|
bootStages ++ [
|
||||||
(prevStage: let
|
(prevStage: {
|
||||||
inherit (prevStage) stdenv;
|
|
||||||
in {
|
|
||||||
inherit config overlays;
|
inherit config overlays;
|
||||||
|
|
||||||
stdenv = import ../generic rec {
|
stdenv = import ../generic rec {
|
||||||
@ -27,10 +25,9 @@ bootStages ++ [
|
|||||||
|
|
||||||
cc = import ../../build-support/cc-wrapper {
|
cc = import ../../build-support/cc-wrapper {
|
||||||
nativeTools = false;
|
nativeTools = false;
|
||||||
nativePrefix = stdenv.lib.optionalString hostPlatform.isSunOS "/usr";
|
nativePrefix = lib.optionalString hostPlatform.isSunOS "/usr";
|
||||||
nativeLibc = true;
|
nativeLibc = true;
|
||||||
inherit stdenv;
|
inherit (prevStage) stdenvNoCC binutils coreutils gnugrep;
|
||||||
inherit (prevStage) binutils coreutils gnugrep;
|
|
||||||
cc = prevStage.gcc.cc;
|
cc = prevStage.gcc.cc;
|
||||||
isGNU = true;
|
isGNU = true;
|
||||||
shell = prevStage.bash + "/bin/sh";
|
shell = prevStage.bash + "/bin/sh";
|
||||||
@ -38,7 +35,7 @@ bootStages ++ [
|
|||||||
|
|
||||||
shell = prevStage.bash + "/bin/sh";
|
shell = prevStage.bash + "/bin/sh";
|
||||||
|
|
||||||
fetchurlBoot = stdenv.fetchurlBoot;
|
fetchurlBoot = prevStage.stdenv.fetchurlBoot;
|
||||||
|
|
||||||
overrides = self: super: {
|
overrides = self: super: {
|
||||||
inherit cc;
|
inherit cc;
|
||||||
|
@ -6207,11 +6207,11 @@ with pkgs;
|
|||||||
|
|
||||||
wla-dx = callPackage ../development/compilers/wla-dx { };
|
wla-dx = callPackage ../development/compilers/wla-dx { };
|
||||||
|
|
||||||
wrapCCWith = { name ? "", cc, libc, extraBuildCommands ? "" }: ccWrapperFun {
|
wrapCCWith = { name ? "", cc, libc, extraBuildCommands ? "" }: ccWrapperFun rec {
|
||||||
nativeTools = targetPlatform == hostPlatform && stdenv.cc.nativeTools or false;
|
nativeTools = targetPlatform == hostPlatform && stdenv.cc.nativeTools or false;
|
||||||
nativeLibc = targetPlatform == hostPlatform && stdenv.cc.nativeLibc or false;
|
nativeLibc = targetPlatform == hostPlatform && stdenv.cc.nativeLibc or false;
|
||||||
nativePrefix = stdenv.cc.nativePrefix or "";
|
nativePrefix = stdenv.cc.nativePrefix or "";
|
||||||
noLibc = (libc == null);
|
noLibc = !nativeLibc && (libc == null);
|
||||||
|
|
||||||
isGNU = cc.isGNU or false;
|
isGNU = cc.isGNU or false;
|
||||||
isClang = cc.isClang or false;
|
isClang = cc.isClang or false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user