mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-12-26 21:33:03 +03:00
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"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xml:id="chap-stdenv">
|
||||
@ -188,11 +187,13 @@ genericBuild
|
||||
|
||||
<varlistentry>
|
||||
<term><varname>NIX_DEBUG</varname></term>
|
||||
<listitem><para>If set, <literal>stdenv</literal> will print some
|
||||
debug information during the build. In particular, the
|
||||
<command>gcc</command> and <command>ld</command> wrapper scripts
|
||||
will print out the complete command line passed to the wrapped
|
||||
tools.</para></listitem>
|
||||
<listitem><para>
|
||||
A natural number indicating how much information to log.
|
||||
If set to 1 or higher, <literal>stdenv</literal> will print moderate debug information during the build.
|
||||
In particular, the <command>gcc</command> and <command>ld</command> wrapper scripts will print out the complete command line passed to the wrapped tools.
|
||||
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>
|
||||
|
||||
</variablelist>
|
||||
|
@ -16,14 +16,14 @@ do
|
||||
hardeningDisableMap[$flag]=1
|
||||
done
|
||||
|
||||
if [[ -n "${NIX_DEBUG:-}" ]]; then
|
||||
if (( "${NIX_DEBUG:-0}" >= 1 )); then
|
||||
printf 'HARDENING: disabled flags:' >&2
|
||||
(( "${#hardeningDisableMap[@]}" )) && printf ' %q' "${!hardeningDisableMap[@]}" >&2
|
||||
echo >&2
|
||||
fi
|
||||
|
||||
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;
|
||||
fi
|
||||
for flag in "${hardeningFlags[@]}"
|
||||
@ -31,40 +31,40 @@ if [[ -z "${hardeningDisableMap[all]:-}" ]]; then
|
||||
if [[ -z "${hardeningDisableMap[$flag]:-}" ]]; then
|
||||
case $flag in
|
||||
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')
|
||||
;;
|
||||
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')
|
||||
;;
|
||||
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')
|
||||
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')
|
||||
hardeningLDFlags+=('-pie')
|
||||
fi
|
||||
;;
|
||||
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')
|
||||
;;
|
||||
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')
|
||||
;;
|
||||
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')
|
||||
;;
|
||||
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')
|
||||
;;
|
||||
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')
|
||||
;;
|
||||
*)
|
||||
|
@ -2,6 +2,10 @@
|
||||
set -eu -o pipefail
|
||||
shopt -s nullglob
|
||||
|
||||
if (( "${NIX_DEBUG:-0}" >= 7 )); then
|
||||
set -x
|
||||
fi
|
||||
|
||||
path_backup="$PATH"
|
||||
|
||||
# That @-vars are substituted separately from bash evaluation makes
|
||||
@ -161,7 +165,7 @@ if [ "$*" = -v ]; then
|
||||
fi
|
||||
|
||||
# Optionally print debug info.
|
||||
if [ -n "${NIX_DEBUG:-}" ]; then
|
||||
if (( "${NIX_DEBUG:-0}" >= 1 )); then
|
||||
# Old bash workaround, see ld-wrapper for explanation.
|
||||
echo "extra flags before to @prog@:" >&2
|
||||
printf " %q\n" ${extraBefore+"${extraBefore[@]}"} >&2
|
||||
|
@ -5,15 +5,15 @@
|
||||
# script that sets up the right environment variables so that the
|
||||
# compiler and the linker just "work".
|
||||
|
||||
{ name ? "", stdenv, nativeTools, noLibc ? false, nativeLibc, nativePrefix ? ""
|
||||
, cc ? null, libc ? null, binutils ? null, coreutils ? null, shell ? stdenv.shell
|
||||
{ name ? "", stdenvNoCC, nativeTools, noLibc ? false, nativeLibc, nativePrefix ? ""
|
||||
, cc ? null, libc ? null, binutils ? null, coreutils ? null, shell ? stdenvNoCC.shell
|
||||
, zlib ? null, extraPackages ? [], extraBuildCommands ? ""
|
||||
, isGNU ? false, isClang ? cc.isClang or false, gnugrep ? null
|
||||
, buildPackages ? {}
|
||||
, useMacosReexportHack ? false
|
||||
}:
|
||||
|
||||
with stdenv.lib;
|
||||
with stdenvNoCC.lib;
|
||||
|
||||
assert nativeTools -> nativePrefix != "";
|
||||
assert !nativeTools ->
|
||||
@ -25,6 +25,7 @@ assert (noLibc || nativeLibc) == (libc == null);
|
||||
assert cc.langVhdl or false -> zlib != null;
|
||||
|
||||
let
|
||||
stdenv = stdenvNoCC;
|
||||
inherit (stdenv) hostPlatform targetPlatform;
|
||||
|
||||
# Prefix for binaries. Customarily ends with a dash separator.
|
||||
|
@ -2,6 +2,10 @@
|
||||
set -eu -o pipefail
|
||||
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
|
||||
# worry about the old bash empty array `set -u` workarounds.
|
||||
|
||||
@ -109,7 +113,7 @@ fi
|
||||
#fi
|
||||
|
||||
# Optionally print debug info.
|
||||
if [ -n "${NIX_DEBUG:-}" ]; then
|
||||
if (( "${NIX_DEBUG:-0}" >= 1 )); then
|
||||
echo "extra flags before to @prog@:" >&2
|
||||
printf " %q\n" "${extraBefore[@]}" >&2
|
||||
echo "original flags to @prog@:" >&2
|
||||
|
@ -2,6 +2,10 @@
|
||||
set -eu -o pipefail
|
||||
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
|
||||
# worry about the old bash empty array `set -u` workarounds.
|
||||
|
||||
@ -24,7 +28,7 @@ extraBefore=()
|
||||
#export NIX_@infixSalt@_LDFLAGS_SET=1
|
||||
|
||||
# Optionally print debug info.
|
||||
if [ -n "${NIX_DEBUG:-}" ]; then
|
||||
if (( "${NIX_DEBUG:-0}" >= 1 )); then
|
||||
echo "extra flags before to @prog@:" >&2
|
||||
printf " %q\n" "${extraBefore[@]}" >&2
|
||||
echo "original flags to @prog@:" >&2
|
||||
|
@ -2,6 +2,10 @@
|
||||
set -eu -o pipefail
|
||||
shopt -s nullglob
|
||||
|
||||
if (( "${NIX_DEBUG:-0}" >= 7 )); then
|
||||
set -x
|
||||
fi
|
||||
|
||||
declare -a args=("$@")
|
||||
# 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
|
||||
|
@ -2,6 +2,10 @@
|
||||
set -eu -o pipefail
|
||||
shopt -s nullglob
|
||||
|
||||
if (( "${NIX_DEBUG:-0}" >= 7 )); then
|
||||
set -x
|
||||
fi
|
||||
|
||||
path_backup="$PATH"
|
||||
|
||||
# phase separation makes this look useless
|
||||
@ -156,7 +160,7 @@ fi
|
||||
|
||||
|
||||
# Optionally print debug info.
|
||||
if [ -n "${NIX_DEBUG:-}" ]; then
|
||||
if (( "${NIX_DEBUG:-0}" >= 1 )); then
|
||||
# Old bash workaround, see above.
|
||||
echo "extra flags before to @prog@:" >&2
|
||||
printf " %q\n" ${extraBefore+"${extraBefore[@]}"} >&2
|
||||
|
@ -1,5 +1,5 @@
|
||||
skip () {
|
||||
if [ -n "${NIX_DEBUG:-}" ]; then
|
||||
if (( "${NIX_DEBUG:-0}" >= 1 )); then
|
||||
echo "skipping impure path $1" >&2
|
||||
fi
|
||||
}
|
||||
|
@ -1,24 +1,26 @@
|
||||
{stdenv, lib, fetchurl, perl, libedit, ncurses5, gmp}:
|
||||
{ stdenv
|
||||
, fetchurl, perl
|
||||
, libedit, ncurses5, gmp
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
version = "6.10.2";
|
||||
|
||||
name = "ghc-${version}-binary";
|
||||
|
||||
src =
|
||||
if stdenv.system == "i686-linux" then
|
||||
fetchurl {
|
||||
# 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";
|
||||
sha256 = "1fw0zr2qshlpk8s0d16k27zcv5263nqdg2xds5ymw8ff6qz9rz9b";
|
||||
}
|
||||
else if stdenv.system == "x86_64-linux" then
|
||||
fetchurl {
|
||||
# Idem.
|
||||
url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-x86_64-unknown-linux.tar.bz2";
|
||||
sha256 = "1rd2j7lmcfsm2rdfb5g6q0l8dz3sxadk5m3d2f69d4a6g4p4h7jj";
|
||||
}
|
||||
else throw "cannot bootstrap GHC on this platform";
|
||||
src = fetchurl ({
|
||||
"i686-linux" = {
|
||||
# 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";
|
||||
sha256 = "1fw0zr2qshlpk8s0d16k27zcv5263nqdg2xds5ymw8ff6qz9rz9b";
|
||||
};
|
||||
"x86_64-linux" = {
|
||||
# Idem.
|
||||
url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-x86_64-unknown-linux.tar.bz2";
|
||||
sha256 = "1rd2j7lmcfsm2rdfb5g6q0l8dz3sxadk5m3d2f69d4a6g4p4h7jj";
|
||||
};
|
||||
}.${stdenv.hostPlatform.system}
|
||||
or (throw "cannot bootstrap GHC on this platform"));
|
||||
|
||||
buildInputs = [perl];
|
||||
|
||||
@ -27,27 +29,27 @@ stdenv.mkDerivation rec {
|
||||
# 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"
|
||||
'' +
|
||||
'' +
|
||||
# On Linux, use patchelf to modify the executables so that they can
|
||||
# find editline/gmp.
|
||||
(if stdenv.isLinux then ''
|
||||
stdenv.lib.optionalString stdenv.hostPlatform.isLinux ''
|
||||
find . -type f -perm -0100 \
|
||||
-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
|
||||
find . -name "setup-config" -exec sed -i "s@/usr/bin/$prog@$(type -p $prog)@g" {} \;
|
||||
done
|
||||
'' else "");
|
||||
'';
|
||||
|
||||
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
|
||||
@ -58,44 +60,21 @@ stdenv.mkDerivation rec {
|
||||
# calls install-strip ...
|
||||
dontBuild = true;
|
||||
|
||||
# The binaries for Darwin use frameworks, so fake those frameworks,
|
||||
# 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
|
||||
postInstall = ''
|
||||
# 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
|
||||
|
||||
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
|
||||
sed -i "s@^\(.*pkgName = PackageName \"rts\".*\libraryDirs = \\[\)\(.*\)@\\1\"${gmp.out}/lib\",\2@" $out/lib/ghc-${version}/package.conf
|
||||
|
||||
# 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" ]
|
||||
'';
|
||||
# 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 = {
|
||||
homepage = http://haskell.org/ghc;
|
||||
|
@ -1,32 +1,32 @@
|
||||
{stdenv, fetchurl, perl, ncurses5, gmp, libiconv}:
|
||||
{ stdenv
|
||||
, fetchurl, perl
|
||||
, ncurses5, gmp, libiconv
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
version = "7.0.4";
|
||||
|
||||
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 = "0mfnihiyjl06f5w1yrjp36sw9g67g2ymg5sdl0g23h1pab99jx63";
|
||||
}
|
||||
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 = "0mc4rhqcxz427wq4zgffmnn0d2yjqvy6af4x9mha283p1gdj5q99";
|
||||
}
|
||||
else if stdenv.system == "i686-darwin" then
|
||||
fetchurl {
|
||||
url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-i386-apple-darwin.tar.bz2";
|
||||
sha256 = "0qj45hslrrr8zfks8m1jcb3awwx9rh35ndnpfmb0gwb6j7azq5n3";
|
||||
}
|
||||
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 = "1m2ml88p1swf4dnv2vq8hz4drcp46n3ahpfi05wh01ajkf8hnn3l";
|
||||
}
|
||||
else throw "cannot bootstrap GHC on this platform";
|
||||
src = fetchurl ({
|
||||
"i686-linux" = {
|
||||
url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-i386-unknown-linux.tar.bz2";
|
||||
sha256 = "0mfnihiyjl06f5w1yrjp36sw9g67g2ymg5sdl0g23h1pab99jx63";
|
||||
};
|
||||
"x86_64-linux" = {
|
||||
url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-x86_64-unknown-linux.tar.bz2";
|
||||
sha256 = "0mc4rhqcxz427wq4zgffmnn0d2yjqvy6af4x9mha283p1gdj5q99";
|
||||
};
|
||||
"i686-darwin" = {
|
||||
url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-i386-apple-darwin.tar.bz2";
|
||||
sha256 = "0qj45hslrrr8zfks8m1jcb3awwx9rh35ndnpfmb0gwb6j7azq5n3";
|
||||
};
|
||||
"x86_64-darwin" = {
|
||||
url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-x86_64-apple-darwin.tar.bz2";
|
||||
sha256 = "1m2ml88p1swf4dnv2vq8hz4drcp46n3ahpfi05wh01ajkf8hnn3l";
|
||||
};
|
||||
}.${stdenv.hostPlatform.system}
|
||||
or (throw "cannot bootstrap GHC on this platform"));
|
||||
|
||||
buildInputs = [perl];
|
||||
|
||||
@ -41,22 +41,22 @@ stdenv.mkDerivation rec {
|
||||
# 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.out}/lib@" {} \;
|
||||
'' + stdenv.lib.optionalString stdenv.isDarwin ''
|
||||
'' + stdenv.lib.optionalString stdenv.isDarwin ''
|
||||
find . -name base.buildinfo \
|
||||
-exec sed -i "s@extra-lib-dirs: @extra-lib-dirs: ${libiconv}/lib@" {} \;
|
||||
'' +
|
||||
'' +
|
||||
# On Linux, use patchelf to modify the executables so that they can
|
||||
# find editline/gmp.
|
||||
stdenv.lib.optionalString stdenv.isLinux ''
|
||||
@ -68,24 +68,24 @@ stdenv.mkDerivation rec {
|
||||
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
|
||||
'' + stdenv.lib.optionalString stdenv.isDarwin ''
|
||||
# not enough room in the object files for the full path to libiconv :(
|
||||
fix () {
|
||||
install_name_tool -change /usr/lib/libiconv.2.dylib @executable_path/libiconv.dylib $1
|
||||
}
|
||||
'' + stdenv.lib.optionalString stdenv.isDarwin ''
|
||||
# not enough room in the object files for the full path to libiconv :(
|
||||
fix () {
|
||||
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-7.0.4/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}/utils/ghc-pwd/dist/build/tmp
|
||||
ln -s ${libiconv}/lib/libiconv.dylib ghc-${version}/utils/hpc/dist/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
|
||||
fix $(find . -type f -name $file)
|
||||
done
|
||||
for file in ghc-cabal ghc-pwd ghc-stage2 ghc-pkg haddock hsc2hs hpc; do
|
||||
fix $(find . -type f -name $file)
|
||||
done
|
||||
|
||||
for file in $(find . -name setup-config); do
|
||||
substituteInPlace $file --replace /usr/bin/ranlib "$(type -P ranlib)"
|
||||
done
|
||||
'';
|
||||
for file in $(find . -name setup-config); do
|
||||
substituteInPlace $file --replace /usr/bin/ranlib "$(type -P ranlib)"
|
||||
done
|
||||
'';
|
||||
|
||||
configurePhase = ''
|
||||
./configure --prefix=$out \
|
||||
@ -101,19 +101,18 @@ stdenv.mkDerivation rec {
|
||||
# calls install-strip ...
|
||||
dontBuild = 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" ]
|
||||
'';
|
||||
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" "x86_64-darwin"];
|
||||
|
@ -1,32 +1,32 @@
|
||||
{stdenv, fetchurl, perl, ncurses5, gmp, libiconv, makeWrapper}:
|
||||
{ stdenv
|
||||
, fetchurl, perl, makeWrapper
|
||||
, ncurses5, gmp, libiconv
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
version = "7.4.2";
|
||||
|
||||
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 = "1imzqc0slpg0r6p40n5a9m18cbcm0m86z8dgyhfxcckksw54mzwf";
|
||||
}
|
||||
else throw "cannot bootstrap GHC on this platform";
|
||||
src = fetchurl ({
|
||||
"i686-linux" = {
|
||||
url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-i386-unknown-linux.tar.bz2";
|
||||
sha256 = "0gny7knhss0w0d9r6jm1gghrcb8kqjvj94bb7hxf9syrk4fxlcxi";
|
||||
};
|
||||
"x86_64-linux" = {
|
||||
url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-x86_64-unknown-linux.tar.bz2";
|
||||
sha256 = "043jabd0lh6n1zlqhysngbpvlsdznsa2mmsj08jyqgahw9sjb5ns";
|
||||
};
|
||||
"i686-darwin" = {
|
||||
url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-i386-apple-darwin.tar.bz2";
|
||||
sha256 = "1vrbs3pzki37hzym1f1nh07lrqh066z3ypvm81fwlikfsvk4djc0";
|
||||
};
|
||||
"x86_64-darwin" = {
|
||||
url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-x86_64-apple-darwin.tar.bz2";
|
||||
sha256 = "1imzqc0slpg0r6p40n5a9m18cbcm0m86z8dgyhfxcckksw54mzwf";
|
||||
};
|
||||
}.${stdenv.hostPlatform.system}
|
||||
or (throw "cannot bootstrap GHC on this platform"));
|
||||
|
||||
buildInputs = [perl];
|
||||
|
||||
@ -41,22 +41,22 @@ stdenv.mkDerivation rec {
|
||||
# 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.out}/lib@" {} \;
|
||||
'' + stdenv.lib.optionalString stdenv.isDarwin ''
|
||||
'' + stdenv.lib.optionalString stdenv.isDarwin ''
|
||||
find . -name base.buildinfo \
|
||||
-exec sed -i "s@extra-lib-dirs: @extra-lib-dirs: ${libiconv}/lib@" {} \;
|
||||
'' +
|
||||
'' +
|
||||
# On Linux, use patchelf to modify the executables so that they can
|
||||
# find editline/gmp.
|
||||
stdenv.lib.optionalString stdenv.isLinux ''
|
||||
@ -73,24 +73,24 @@ stdenv.mkDerivation rec {
|
||||
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
|
||||
'' + stdenv.lib.optionalString stdenv.isDarwin ''
|
||||
# not enough room in the object files for the full path to libiconv :(
|
||||
fix () {
|
||||
install_name_tool -change /usr/lib/libiconv.2.dylib @executable_path/libiconv.dylib $1
|
||||
}
|
||||
'' + stdenv.lib.optionalString stdenv.isDarwin ''
|
||||
# not enough room in the object files for the full path to libiconv :(
|
||||
fix () {
|
||||
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-7.4.2/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}/utils/ghc-pwd/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-${version}/ghc/stage2/build/tmp
|
||||
|
||||
for file in ghc-cabal ghc-pwd ghc-stage2 ghc-pkg haddock hsc2hs hpc; do
|
||||
fix $(find . -type f -name $file)
|
||||
done
|
||||
for file in ghc-cabal ghc-pwd ghc-stage2 ghc-pkg haddock hsc2hs hpc; do
|
||||
fix $(find . -type f -name $file)
|
||||
done
|
||||
|
||||
for file in $(find . -name setup-config); do
|
||||
substituteInPlace $file --replace /usr/bin/ranlib "$(type -P ranlib)"
|
||||
done
|
||||
'';
|
||||
for file in $(find . -name setup-config); do
|
||||
substituteInPlace $file --replace /usr/bin/ranlib "$(type -P ranlib)"
|
||||
done
|
||||
'';
|
||||
|
||||
configurePhase = ''
|
||||
./configure --prefix=$out \
|
||||
@ -107,10 +107,10 @@ stdenv.mkDerivation rec {
|
||||
dontBuild = true;
|
||||
|
||||
preInstall = stdenv.lib.optionalString stdenv.isDarwin ''
|
||||
mkdir -p $out/lib/ghc-7.4.2
|
||||
mkdir -p $out/lib/ghc-${version}
|
||||
mkdir -p $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
|
||||
'';
|
||||
|
||||
|
@ -77,7 +77,7 @@ in rec {
|
||||
|
||||
cc = if isNull last then "/dev/null" else import ../../build-support/cc-wrapper {
|
||||
inherit shell;
|
||||
inherit (last) stdenv;
|
||||
inherit (last) stdenvNoCC;
|
||||
|
||||
nativeTools = false;
|
||||
nativeLibc = false;
|
||||
@ -324,7 +324,7 @@ in rec {
|
||||
shell = "${pkgs.bash}/bin/bash";
|
||||
|
||||
cc = lib.callPackageWith {} ../../build-support/cc-wrapper {
|
||||
inherit (pkgs) stdenv;
|
||||
inherit (pkgs) stdenvNoCC;
|
||||
inherit shell;
|
||||
nativeTools = false;
|
||||
nativeLibc = false;
|
||||
|
@ -77,7 +77,7 @@ let inherit (localSystem) system; in
|
||||
nativeTools = true;
|
||||
nativePrefix = "/usr";
|
||||
nativeLibc = true;
|
||||
inherit (prevStage) stdenv;
|
||||
stdenvNoCC = prevStage.stdenv;
|
||||
cc = {
|
||||
name = "clang-9.9.9";
|
||||
cc = "/usr";
|
||||
|
@ -1,6 +1,10 @@
|
||||
set -eu
|
||||
set -o pipefail
|
||||
|
||||
if (( "${NIX_DEBUG:-0}" >= 6 )); then
|
||||
set -x
|
||||
fi
|
||||
|
||||
: ${outputs:=out}
|
||||
|
||||
|
||||
@ -269,7 +273,7 @@ for i in $initialPath; do
|
||||
addToSearchPath PATH "$i/bin"
|
||||
done
|
||||
|
||||
if [ "${NIX_DEBUG:-}" = 1 ]; then
|
||||
if (( "${NIX_DEBUG:-0}" >= 1 )); then
|
||||
echo "initial path: $PATH"
|
||||
fi
|
||||
|
||||
@ -429,7 +433,7 @@ fi
|
||||
|
||||
|
||||
PATH="${_PATH-}${_PATH:+${PATH:+:}}$PATH"
|
||||
if [ "${NIX_DEBUG:-}" = 1 ]; then
|
||||
if (( "${NIX_DEBUG:-0}" >= 1 )); then
|
||||
echo "final path: $PATH"
|
||||
fi
|
||||
|
||||
@ -539,7 +543,7 @@ substituteAll() {
|
||||
local -a args=()
|
||||
|
||||
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}"
|
||||
fi
|
||||
args+=("--subst-var" "$varName")
|
||||
|
@ -84,7 +84,7 @@ let
|
||||
libc = prevStage.glibc;
|
||||
inherit (prevStage) binutils coreutils gnugrep;
|
||||
name = name;
|
||||
stdenv = prevStage.ccWrapperStdenv;
|
||||
stdenvNoCC = prevStage.ccWrapperStdenv;
|
||||
};
|
||||
|
||||
extraAttrs = {
|
||||
@ -244,7 +244,7 @@ in
|
||||
};
|
||||
cc = prevStage.gcc-unwrapped;
|
||||
libc = self.glibc;
|
||||
inherit (self) stdenv binutils coreutils gnugrep;
|
||||
inherit (self) stdenvNoCC binutils coreutils gnugrep;
|
||||
name = "";
|
||||
shell = self.bash + "/bin/bash";
|
||||
};
|
||||
|
@ -117,6 +117,7 @@ in
|
||||
cc = null;
|
||||
fetchurl = null;
|
||||
};
|
||||
stdenvNoCC = stdenv;
|
||||
|
||||
cc = import ../../build-support/cc-wrapper {
|
||||
name = "cc-native";
|
||||
@ -126,7 +127,7 @@ in
|
||||
"i686-solaris" = "/usr/gnu";
|
||||
"x86_64-solaris" = "/opt/local/gcc47";
|
||||
}.${system} or "/usr";
|
||||
inherit stdenv;
|
||||
inherit stdenvNoCC;
|
||||
};
|
||||
|
||||
fetchurl = import ../../build-support/fetchurl {
|
||||
|
@ -1,5 +1,5 @@
|
||||
{ lib
|
||||
, crossSystem, config
|
||||
, crossSystem, config, overlays
|
||||
, bootStages
|
||||
, ...
|
||||
}:
|
||||
@ -7,9 +7,7 @@
|
||||
assert crossSystem == null;
|
||||
|
||||
bootStages ++ [
|
||||
(prevStage: let
|
||||
inherit (prevStage) stdenv;
|
||||
in {
|
||||
(prevStage: {
|
||||
inherit config overlays;
|
||||
|
||||
stdenv = import ../generic rec {
|
||||
@ -27,10 +25,9 @@ bootStages ++ [
|
||||
|
||||
cc = import ../../build-support/cc-wrapper {
|
||||
nativeTools = false;
|
||||
nativePrefix = stdenv.lib.optionalString hostPlatform.isSunOS "/usr";
|
||||
nativePrefix = lib.optionalString hostPlatform.isSunOS "/usr";
|
||||
nativeLibc = true;
|
||||
inherit stdenv;
|
||||
inherit (prevStage) binutils coreutils gnugrep;
|
||||
inherit (prevStage) stdenvNoCC binutils coreutils gnugrep;
|
||||
cc = prevStage.gcc.cc;
|
||||
isGNU = true;
|
||||
shell = prevStage.bash + "/bin/sh";
|
||||
@ -38,7 +35,7 @@ bootStages ++ [
|
||||
|
||||
shell = prevStage.bash + "/bin/sh";
|
||||
|
||||
fetchurlBoot = stdenv.fetchurlBoot;
|
||||
fetchurlBoot = prevStage.stdenv.fetchurlBoot;
|
||||
|
||||
overrides = self: super: {
|
||||
inherit cc;
|
||||
|
@ -6207,11 +6207,11 @@ with pkgs;
|
||||
|
||||
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;
|
||||
nativeLibc = targetPlatform == hostPlatform && stdenv.cc.nativeLibc or false;
|
||||
nativePrefix = stdenv.cc.nativePrefix or "";
|
||||
noLibc = (libc == null);
|
||||
noLibc = !nativeLibc && (libc == null);
|
||||
|
||||
isGNU = cc.isGNU or false;
|
||||
isClang = cc.isClang or false;
|
||||
|
Loading…
Reference in New Issue
Block a user