pkgs/development/compilers: stdenv.lib -> lib
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
{ stdenv
|
||||
{ lib, stdenv
|
||||
, fetchurl, perl, gcc
|
||||
, ncurses5, ncurses6, gmp, glibc, libiconv
|
||||
, llvmPackages
|
||||
@@ -14,11 +14,11 @@ let
|
||||
|
||||
ourNcurses = if useNcurses6 then ncurses6 else ncurses5;
|
||||
|
||||
libPath = stdenv.lib.makeLibraryPath ([
|
||||
libPath = lib.makeLibraryPath ([
|
||||
ourNcurses gmp
|
||||
] ++ stdenv.lib.optional (stdenv.hostPlatform.isDarwin) libiconv);
|
||||
] ++ lib.optional (stdenv.hostPlatform.isDarwin) libiconv);
|
||||
|
||||
libEnvVar = stdenv.lib.optionalString stdenv.hostPlatform.isDarwin "DY"
|
||||
libEnvVar = lib.optionalString stdenv.hostPlatform.isDarwin "DY"
|
||||
+ "LD_LIBRARY_PATH";
|
||||
|
||||
glibcDynLinker = assert stdenv.isLinux;
|
||||
@@ -26,7 +26,7 @@ let
|
||||
# Could be stdenv.cc.bintools.dynamicLinker, keeping as-is to avoid rebuild.
|
||||
''"$(cat $NIX_CC/nix-support/dynamic-linker)"''
|
||||
else
|
||||
"${stdenv.lib.getLib glibc}/lib/ld-linux*";
|
||||
"${lib.getLib glibc}/lib/ld-linux*";
|
||||
|
||||
in
|
||||
|
||||
@@ -61,7 +61,7 @@ stdenv.mkDerivation rec {
|
||||
or (throw "cannot bootstrap GHC on this platform"));
|
||||
|
||||
nativeBuildInputs = [ perl ];
|
||||
propagatedBuildInputs = stdenv.lib.optionals useLLVM [ llvmPackages.llvm ];
|
||||
propagatedBuildInputs = lib.optionals useLLVM [ llvmPackages.llvm ];
|
||||
|
||||
# Cannot patchelf beforehand due to relative RPATHs that anticipate
|
||||
# the final install location/
|
||||
@@ -70,7 +70,7 @@ stdenv.mkDerivation rec {
|
||||
postUnpack =
|
||||
# GHC has dtrace probes, which causes ld to try to open /usr/lib/libdtrace.dylib
|
||||
# during linking
|
||||
stdenv.lib.optionalString stdenv.isDarwin ''
|
||||
lib.optionalString stdenv.isDarwin ''
|
||||
export NIX_LDFLAGS+=" -no_dtrace_dof"
|
||||
# not enough room in the object files for the full path to libiconv :(
|
||||
for exe in $(find . -type f -executable); do
|
||||
@@ -90,17 +90,17 @@ stdenv.mkDerivation rec {
|
||||
''
|
||||
find . -name integer-gmp.buildinfo \
|
||||
-exec sed -i "s@extra-lib-dirs: @extra-lib-dirs: ${gmp.out}/lib@" {} \;
|
||||
'' + stdenv.lib.optionalString stdenv.isDarwin ''
|
||||
'' + lib.optionalString stdenv.isDarwin ''
|
||||
find . -name base.buildinfo \
|
||||
-exec sed -i "s@extra-lib-dirs: @extra-lib-dirs: ${libiconv}/lib@" {} \;
|
||||
'' +
|
||||
# Rename needed libraries and binaries, fix interpreter
|
||||
stdenv.lib.optionalString stdenv.isLinux ''
|
||||
lib.optionalString stdenv.isLinux ''
|
||||
find . -type f -perm -0100 \
|
||||
-exec patchelf \
|
||||
--replace-needed libncurses${stdenv.lib.optionalString stdenv.is64bit "w"}.so.5 libncurses.so \
|
||||
--replace-needed libncurses${lib.optionalString stdenv.is64bit "w"}.so.5 libncurses.so \
|
||||
${ # This isn't required for x86_64-linux where we use ncurses6
|
||||
stdenv.lib.optionalString (!useNcurses6) "--replace-needed libtinfo.so libtinfo.so.5"
|
||||
lib.optionalString (!useNcurses6) "--replace-needed libtinfo.so libtinfo.so.5"
|
||||
} \
|
||||
--interpreter ${glibcDynLinker} {} \;
|
||||
|
||||
@@ -113,16 +113,16 @@ stdenv.mkDerivation rec {
|
||||
# (`__strdup` is defined to be an alias of `strdup` anyway[1]).
|
||||
# [1] http://refspecs.linuxbase.org/LSB_4.0.0/LSB-Core-generic/LSB-Core-generic/baselib---strdup-1.html
|
||||
# Use objcopy magic to make the change:
|
||||
stdenv.lib.optionalString stdenv.hostPlatform.isMusl ''
|
||||
lib.optionalString stdenv.hostPlatform.isMusl ''
|
||||
find ./ghc-${version}/rts -name "libHSrts*.a" -exec ''${OBJCOPY:-objcopy} --redefine-sym __strdup=strdup {} \;
|
||||
'';
|
||||
|
||||
configurePlatforms = [ ];
|
||||
configureFlags = [
|
||||
"--with-gmp-libraries=${stdenv.lib.getLib gmp}/lib"
|
||||
"--with-gmp-includes=${stdenv.lib.getDev gmp}/include"
|
||||
] ++ stdenv.lib.optional stdenv.isDarwin "--with-gcc=${./gcc-clang-wrapper.sh}"
|
||||
++ stdenv.lib.optional stdenv.hostPlatform.isMusl "--disable-ld-override";
|
||||
"--with-gmp-libraries=${lib.getLib gmp}/lib"
|
||||
"--with-gmp-includes=${lib.getDev gmp}/include"
|
||||
] ++ lib.optional stdenv.isDarwin "--with-gcc=${./gcc-clang-wrapper.sh}"
|
||||
++ lib.optional stdenv.hostPlatform.isMusl "--disable-ld-override";
|
||||
|
||||
# No building is necessary, but calling make without flags ironically
|
||||
# calls install-strip ...
|
||||
@@ -130,14 +130,14 @@ stdenv.mkDerivation rec {
|
||||
|
||||
# On Linux, use patchelf to modify the executables so that they can
|
||||
# find editline/gmp.
|
||||
postFixup = stdenv.lib.optionalString stdenv.isLinux ''
|
||||
postFixup = lib.optionalString stdenv.isLinux ''
|
||||
for p in $(find "$out" -type f -executable); do
|
||||
if isELF "$p"; then
|
||||
echo "Patchelfing $p"
|
||||
patchelf --set-rpath "${libPath}:$(patchelf --print-rpath $p)" $p
|
||||
fi
|
||||
done
|
||||
'' + stdenv.lib.optionalString stdenv.isDarwin ''
|
||||
'' + lib.optionalString stdenv.isDarwin ''
|
||||
# not enough room in the object files for the full path to libiconv :(
|
||||
for exe in $(find "$out" -type f -executable); do
|
||||
isScript $exe && continue
|
||||
@@ -171,6 +171,6 @@ stdenv.mkDerivation rec {
|
||||
enableShared = true;
|
||||
};
|
||||
|
||||
meta.license = stdenv.lib.licenses.bsd3;
|
||||
meta.license = lib.licenses.bsd3;
|
||||
meta.platforms = ["x86_64-linux" "aarch64-linux" "i686-linux" "x86_64-darwin"];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user