pkgs/development/compilers: stdenv.lib -> lib
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
{ stdenv, fetch, cmake, libxml2, llvm, version, clang-tools-extra_src, python3
|
||||
{ lib, stdenv, fetch, cmake, libxml2, llvm, version, clang-tools-extra_src, python3
|
||||
, fixDarwinDylibNames
|
||||
, enableManpages ? false
|
||||
}:
|
||||
@@ -19,15 +19,15 @@ let
|
||||
'';
|
||||
|
||||
nativeBuildInputs = [ cmake python3 ]
|
||||
++ stdenv.lib.optional enableManpages python3.pkgs.sphinx
|
||||
++ stdenv.lib.optional stdenv.hostPlatform.isDarwin fixDarwinDylibNames;
|
||||
++ lib.optional enableManpages python3.pkgs.sphinx
|
||||
++ lib.optional stdenv.hostPlatform.isDarwin fixDarwinDylibNames;
|
||||
|
||||
buildInputs = [ libxml2 llvm ];
|
||||
|
||||
cmakeFlags = [
|
||||
"-DCMAKE_CXX_FLAGS=-std=c++11"
|
||||
"-DLLVM_ENABLE_RTTI=ON"
|
||||
] ++ stdenv.lib.optionals enableManpages [
|
||||
] ++ lib.optionals enableManpages [
|
||||
"-DCLANG_INCLUDE_DOCS=ON"
|
||||
"-DLLVM_ENABLE_SPHINX=ON"
|
||||
"-DSPHINX_OUTPUT_MAN=ON"
|
||||
@@ -44,7 +44,7 @@ let
|
||||
|
||||
# Patch for standalone doc building
|
||||
sed -i '1s,^,find_package(Sphinx REQUIRED)\n,' docs/CMakeLists.txt
|
||||
'' + stdenv.lib.optionalString stdenv.hostPlatform.isMusl ''
|
||||
'' + lib.optionalString stdenv.hostPlatform.isMusl ''
|
||||
sed -i -e 's/lgcc_s/lgcc_eh/' lib/Driver/ToolChains/*.cpp
|
||||
'';
|
||||
|
||||
@@ -80,10 +80,10 @@ let
|
||||
meta = {
|
||||
description = "A c, c++, objective-c, and objective-c++ frontend for the llvm compiler";
|
||||
homepage = "https://llvm.org/";
|
||||
license = stdenv.lib.licenses.ncsa;
|
||||
platforms = stdenv.lib.platforms.all;
|
||||
license = lib.licenses.ncsa;
|
||||
platforms = lib.platforms.all;
|
||||
};
|
||||
} // stdenv.lib.optionalAttrs enableManpages {
|
||||
} // lib.optionalAttrs enableManpages {
|
||||
pname = "clang-manpages";
|
||||
|
||||
buildPhase = ''
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{ stdenv, version, fetch, cmake, python3, llvm, libcxxabi }:
|
||||
{ lib, stdenv, version, fetch, cmake, python3, llvm, libcxxabi }:
|
||||
|
||||
let
|
||||
|
||||
@@ -14,7 +14,7 @@ stdenv.mkDerivation {
|
||||
src = fetch "compiler-rt" "1fcr3jn24yr8lh36nc0c4ikli4744i2q9m1ik67p1jymwwaixkgl";
|
||||
|
||||
nativeBuildInputs = [ cmake python3 llvm ];
|
||||
buildInputs = stdenv.lib.optional stdenv.hostPlatform.isDarwin libcxxabi;
|
||||
buildInputs = lib.optional stdenv.hostPlatform.isDarwin libcxxabi;
|
||||
|
||||
NIX_CFLAGS_COMPILE = [
|
||||
"-DSCUDO_DEFAULT_OPTIONS=DeleteSizeMismatch=0:DeallocationTypeMismatch=0"
|
||||
@@ -24,24 +24,24 @@ stdenv.mkDerivation {
|
||||
"-DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON"
|
||||
"-DCMAKE_C_COMPILER_TARGET=${stdenv.hostPlatform.config}"
|
||||
"-DCMAKE_ASM_COMPILER_TARGET=${stdenv.hostPlatform.config}"
|
||||
] ++ stdenv.lib.optionals (useLLVM || bareMetal || isMusl) [
|
||||
] ++ lib.optionals (useLLVM || bareMetal || isMusl) [
|
||||
"-DCOMPILER_RT_BUILD_SANITIZERS=OFF"
|
||||
"-DCOMPILER_RT_BUILD_XRAY=OFF"
|
||||
"-DCOMPILER_RT_BUILD_LIBFUZZER=OFF"
|
||||
"-DCOMPILER_RT_BUILD_PROFILE=OFF"
|
||||
] ++ stdenv.lib.optionals (useLLVM || bareMetal) [
|
||||
] ++ lib.optionals (useLLVM || bareMetal) [
|
||||
"-DCMAKE_C_COMPILER_WORKS=ON"
|
||||
"-DCMAKE_CXX_COMPILER_WORKS=ON"
|
||||
"-DCOMPILER_RT_BAREMETAL_BUILD=ON"
|
||||
"-DCMAKE_SIZEOF_VOID_P=${toString (stdenv.hostPlatform.parsed.cpu.bits / 8)}"
|
||||
] ++ stdenv.lib.optionals (useLLVM) [
|
||||
] ++ lib.optionals (useLLVM) [
|
||||
"-DCOMPILER_RT_BUILD_BUILTINS=ON"
|
||||
"-DCMAKE_C_FLAGS=-nodefaultlibs"
|
||||
#https://stackoverflow.com/questions/53633705/cmake-the-c-compiler-is-not-able-to-compile-a-simple-test-program
|
||||
"-DCMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY"
|
||||
] ++ stdenv.lib.optionals (bareMetal) [
|
||||
] ++ lib.optionals (bareMetal) [
|
||||
"-DCOMPILER_RT_OS_DIR=baremetal"
|
||||
] ++ stdenv.lib.optionals (stdenv.hostPlatform.isDarwin) [
|
||||
] ++ lib.optionals (stdenv.hostPlatform.isDarwin) [
|
||||
# The compiler-rt build infrastructure sniffs supported platforms on Darwin
|
||||
# and finds i386;x86_64;x86_64h. We only build for x86_64, so linking fails
|
||||
# when it tries to use libc++ and libc++api for i386.
|
||||
@@ -53,21 +53,21 @@ stdenv.mkDerivation {
|
||||
patches = [
|
||||
./compiler-rt-codesign.patch # Revert compiler-rt commit that makes codesign mandatory
|
||||
../7/compiler-rt-glibc.patch
|
||||
] ++ stdenv.lib.optional stdenv.hostPlatform.isMusl ./sanitizers-nongnu.patch
|
||||
++ stdenv.lib.optional stdenv.hostPlatform.isAarch32 ./compiler-rt-armv7l.patch;
|
||||
] ++ lib.optional stdenv.hostPlatform.isMusl ./sanitizers-nongnu.patch
|
||||
++ lib.optional stdenv.hostPlatform.isAarch32 ./compiler-rt-armv7l.patch;
|
||||
|
||||
# TSAN requires XPC on Darwin, which we have no public/free source files for. We can depend on the Apple frameworks
|
||||
# to get it, but they're unfree. Since LLVM is rather central to the stdenv, we patch out TSAN support so that Hydra
|
||||
# can build this. If we didn't do it, basically the entire nixpkgs on Darwin would have an unfree dependency and we'd
|
||||
# get no binary cache for the entire platform. If you really find yourself wanting the TSAN, make this controllable by
|
||||
# a flag and turn the flag off during the stdenv build.
|
||||
postPatch = stdenv.lib.optionalString (!stdenv.isDarwin) ''
|
||||
postPatch = lib.optionalString (!stdenv.isDarwin) ''
|
||||
substituteInPlace cmake/builtin-config-ix.cmake \
|
||||
--replace 'set(X86 i386)' 'set(X86 i386 i486 i586 i686)'
|
||||
'' + stdenv.lib.optionalString stdenv.isDarwin ''
|
||||
'' + lib.optionalString stdenv.isDarwin ''
|
||||
substituteInPlace cmake/config-ix.cmake \
|
||||
--replace 'set(COMPILER_RT_HAS_TSAN TRUE)' 'set(COMPILER_RT_HAS_TSAN FALSE)'
|
||||
'' + stdenv.lib.optionalString (useLLVM) ''
|
||||
'' + lib.optionalString (useLLVM) ''
|
||||
substituteInPlace lib/builtins/int_util.c \
|
||||
--replace "#include <stdlib.h>" ""
|
||||
substituteInPlace lib/builtins/clear_cache.c \
|
||||
@@ -77,9 +77,9 @@ stdenv.mkDerivation {
|
||||
'';
|
||||
|
||||
# Hack around weird upsream RPATH bug
|
||||
postInstall = stdenv.lib.optionalString (stdenv.hostPlatform.isDarwin || stdenv.hostPlatform.isWasm) ''
|
||||
postInstall = lib.optionalString (stdenv.hostPlatform.isDarwin || stdenv.hostPlatform.isWasm) ''
|
||||
ln -s "$out/lib"/*/* "$out/lib"
|
||||
'' + stdenv.lib.optionalString (useLLVM) ''
|
||||
'' + lib.optionalString (useLLVM) ''
|
||||
ln -s $out/lib/*/clang_rt.crtbegin-*.o $out/lib/linux/crtbegin.o
|
||||
ln -s $out/lib/*/clang_rt.crtend-*.o $out/lib/linux/crtend.o
|
||||
ln -s $out/lib/*/clang_rt.crtbegin_shared-*.o $out/lib/linux/crtbeginS.o
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{ lowPrio, newScope, pkgs, stdenv, cmake, gccForLibs
|
||||
{ lowPrio, newScope, pkgs, lib, stdenv, cmake, gccForLibs
|
||||
, libxml2, python3, isl, fetchurl, overrideCC, wrapCCWith
|
||||
, buildPackages
|
||||
, buildLlvmTools # tools, but from the previous stage, for cross
|
||||
@@ -17,7 +17,7 @@ let
|
||||
|
||||
clang-tools-extra_src = fetch "clang-tools-extra" "1w8ml7fyn4vyxmy59n2qm4r1k1kgwgwkaldp6m45fdv4g0kkfbhd";
|
||||
|
||||
tools = stdenv.lib.makeExtensible (tools: let
|
||||
tools = lib.makeExtensible (tools: let
|
||||
callPackage = newScope (tools // { inherit stdenv cmake libxml2 python3 isl release_version version fetch; });
|
||||
mkExtraBuildCommands = cc: ''
|
||||
rsrc="$out/resource-root"
|
||||
@@ -25,7 +25,7 @@ let
|
||||
ln -s "${cc}/lib/clang/${release_version}/include" "$rsrc"
|
||||
ln -s "${targetLlvmLibraries.compiler-rt.out}/lib" "$rsrc/lib"
|
||||
echo "-resource-dir=$rsrc" >> $out/nix-support/cc-cflags
|
||||
'' + stdenv.lib.optionalString (stdenv.targetPlatform.isLinux && !(stdenv.targetPlatform.useLLVM or false)) ''
|
||||
'' + lib.optionalString (stdenv.targetPlatform.isLinux && !(stdenv.targetPlatform.useLLVM or false)) ''
|
||||
echo "--gcc-toolchain=${gccForLibs}" >> $out/nix-support/cc-cflags
|
||||
'';
|
||||
in {
|
||||
@@ -75,7 +75,7 @@ let
|
||||
lldb = callPackage ./lldb.nix {};
|
||||
});
|
||||
|
||||
libraries = stdenv.lib.makeExtensible (libraries: let
|
||||
libraries = lib.makeExtensible (libraries: let
|
||||
callPackage = newScope (libraries // buildLlvmTools // { inherit stdenv cmake libxml2 python3 isl release_version version fetch; });
|
||||
in {
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ stdenv.mkDerivation {
|
||||
export LIBCXXABI_INCLUDE_DIR="$PWD/$(ls -d libcxxabi-${version}*)/include"
|
||||
'';
|
||||
|
||||
patches = stdenv.lib.optionals stdenv.hostPlatform.isMusl [
|
||||
patches = lib.optionals stdenv.hostPlatform.isMusl [
|
||||
../../libcxx-0001-musl-hacks.patch
|
||||
];
|
||||
|
||||
@@ -26,8 +26,8 @@ stdenv.mkDerivation {
|
||||
patchShebangs utils/cat_files.py
|
||||
'';
|
||||
nativeBuildInputs = [ cmake ]
|
||||
++ stdenv.lib.optional stdenv.hostPlatform.isMusl python3
|
||||
++ stdenv.lib.optional stdenv.hostPlatform.isDarwin fixDarwinDylibNames;
|
||||
++ lib.optional stdenv.hostPlatform.isMusl python3
|
||||
++ lib.optional stdenv.hostPlatform.isDarwin fixDarwinDylibNames;
|
||||
|
||||
buildInputs = [ libcxxabi ];
|
||||
|
||||
@@ -35,7 +35,7 @@ stdenv.mkDerivation {
|
||||
"-DLIBCXX_LIBCXXABI_LIB_PATH=${libcxxabi}/lib"
|
||||
"-DLIBCXX_LIBCPPABI_VERSION=2"
|
||||
"-DLIBCXX_CXX_ABI=libcxxabi"
|
||||
] ++ stdenv.lib.optional stdenv.hostPlatform.isMusl "-DLIBCXX_HAS_MUSL_LIBC=1";
|
||||
] ++ lib.optional stdenv.hostPlatform.isMusl "-DLIBCXX_HAS_MUSL_LIBC=1";
|
||||
|
||||
passthru = {
|
||||
isLLVM = true;
|
||||
@@ -44,7 +44,7 @@ stdenv.mkDerivation {
|
||||
meta = {
|
||||
homepage = "https://libcxx.llvm.org/";
|
||||
description = "A new implementation of the C++ standard library, targeting C++11";
|
||||
license = with stdenv.lib.licenses; [ ncsa mit ];
|
||||
platforms = stdenv.lib.platforms.unix;
|
||||
license = with lib.licenses; [ ncsa mit ];
|
||||
platforms = lib.platforms.unix;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{ stdenv, cmake, fetch, libcxx, libunwind, llvm, version }:
|
||||
{ lib, stdenv, cmake, fetch, libcxx, libunwind, llvm, version }:
|
||||
|
||||
stdenv.mkDerivation {
|
||||
pname = "libc++abi";
|
||||
@@ -7,15 +7,15 @@ stdenv.mkDerivation {
|
||||
src = fetch "libcxxabi" "0prqvdj317qrc8nddaq1hh2ag9algkd9wbkj3y4mr5588k12x7r0";
|
||||
|
||||
nativeBuildInputs = [ cmake ];
|
||||
buildInputs = stdenv.lib.optional (!stdenv.isDarwin && !stdenv.isFreeBSD) libunwind;
|
||||
buildInputs = lib.optional (!stdenv.isDarwin && !stdenv.isFreeBSD) libunwind;
|
||||
|
||||
postUnpack = ''
|
||||
unpackFile ${libcxx.src}
|
||||
unpackFile ${llvm.src}
|
||||
export cmakeFlags="-DLLVM_PATH=$PWD/$(ls -d llvm-*) -DLIBCXXABI_LIBCXX_PATH=$PWD/$(ls -d libcxx-*)"
|
||||
'' + stdenv.lib.optionalString stdenv.isDarwin ''
|
||||
'' + lib.optionalString stdenv.isDarwin ''
|
||||
export TRIPLE=x86_64-apple-darwin
|
||||
'' + stdenv.lib.optionalString stdenv.hostPlatform.isMusl ''
|
||||
'' + lib.optionalString stdenv.hostPlatform.isMusl ''
|
||||
patch -p1 -d $(ls -d libcxx-*) -i ${../libcxx-0001-musl-hacks.patch}
|
||||
'';
|
||||
|
||||
@@ -44,8 +44,8 @@ stdenv.mkDerivation {
|
||||
meta = {
|
||||
homepage = "https://libcxxabi.llvm.org/";
|
||||
description = "A new implementation of low level support for a standard C++ library";
|
||||
license = with stdenv.lib.licenses; [ ncsa mit ];
|
||||
maintainers = with stdenv.lib.maintainers; [ vlstill ];
|
||||
platforms = stdenv.lib.platforms.unix;
|
||||
license = with lib.licenses; [ ncsa mit ];
|
||||
maintainers = with lib.maintainers; [ vlstill ];
|
||||
platforms = lib.platforms.unix;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{ stdenv
|
||||
{ lib, stdenv
|
||||
, fetch
|
||||
, cmake
|
||||
, libxml2
|
||||
@@ -25,7 +25,7 @@ stdenv.mkDerivation {
|
||||
meta = {
|
||||
description = "The LLVM Linker";
|
||||
homepage = "https://lld.llvm.org/";
|
||||
license = stdenv.lib.licenses.ncsa;
|
||||
platforms = stdenv.lib.platforms.all;
|
||||
license = lib.licenses.ncsa;
|
||||
platforms = lib.platforms.all;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{ stdenv
|
||||
{ lib, stdenv
|
||||
, fetch
|
||||
, fetchpatch
|
||||
, cmake
|
||||
@@ -42,7 +42,7 @@ stdenv.mkDerivation {
|
||||
|
||||
nativeBuildInputs = [ cmake python3 which swig ];
|
||||
buildInputs = [ ncurses zlib libedit libxml2 llvm ]
|
||||
++ stdenv.lib.optionals stdenv.isDarwin [ darwin.libobjc darwin.apple_sdk.libs.xpc darwin.apple_sdk.frameworks.Foundation darwin.bootstrap_cmds darwin.apple_sdk.frameworks.Carbon darwin.apple_sdk.frameworks.Cocoa ];
|
||||
++ lib.optionals stdenv.isDarwin [ darwin.libobjc darwin.apple_sdk.libs.xpc darwin.apple_sdk.frameworks.Foundation darwin.bootstrap_cmds darwin.apple_sdk.frameworks.Carbon darwin.apple_sdk.frameworks.Cocoa ];
|
||||
|
||||
CXXFLAGS = "-fno-rtti";
|
||||
hardeningDisable = [ "format" ];
|
||||
@@ -56,7 +56,7 @@ stdenv.mkDerivation {
|
||||
cp ../docs/lldb.1 $out/share/man/man1/
|
||||
'';
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
meta = with lib; {
|
||||
description = "A next-generation high-performance debugger";
|
||||
homepage = "https://llvm.org/";
|
||||
license = licenses.ncsa;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{ stdenv
|
||||
{ lib, stdenv
|
||||
, fetch
|
||||
, cmake
|
||||
, python3
|
||||
@@ -17,10 +17,10 @@
|
||||
}:
|
||||
|
||||
let
|
||||
inherit (stdenv.lib) optional optionals optionalString;
|
||||
inherit (lib) optional optionals optionalString;
|
||||
|
||||
# Used when creating a versioned symlinks of libLLVM.dylib
|
||||
versionSuffixes = with stdenv.lib;
|
||||
versionSuffixes = with lib;
|
||||
let parts = splitVersion release_version; in
|
||||
imap (i: _: concatStringsSep "." (take i parts)) parts;
|
||||
in
|
||||
@@ -136,7 +136,7 @@ stdenv.mkDerivation ({
|
||||
+ optionalString (stdenv.isDarwin && enableSharedLibraries) ''
|
||||
substituteInPlace "$out/lib/cmake/llvm/LLVMExports-${if debugVersion then "debug" else "release"}.cmake" \
|
||||
--replace "\''${_IMPORT_PREFIX}/lib/libLLVM.dylib" "$lib/lib/libLLVM.dylib"
|
||||
${stdenv.lib.concatMapStringsSep "\n" (v: ''
|
||||
${lib.concatMapStringsSep "\n" (v: ''
|
||||
ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${v}.dylib
|
||||
'') versionSuffixes}
|
||||
'';
|
||||
@@ -149,11 +149,11 @@ stdenv.mkDerivation ({
|
||||
meta = {
|
||||
description = "Collection of modular and reusable compiler and toolchain technologies";
|
||||
homepage = "https://llvm.org/";
|
||||
license = stdenv.lib.licenses.ncsa;
|
||||
maintainers = with stdenv.lib.maintainers; [ lovek323 raskin dtzWill ];
|
||||
platforms = stdenv.lib.platforms.all;
|
||||
license = lib.licenses.ncsa;
|
||||
maintainers = with lib.maintainers; [ lovek323 raskin dtzWill ];
|
||||
platforms = lib.platforms.all;
|
||||
};
|
||||
} // stdenv.lib.optionalAttrs enableManpages {
|
||||
} // lib.optionalAttrs enableManpages {
|
||||
pname = "llvm-manpages";
|
||||
|
||||
buildPhase = ''
|
||||
|
||||
@@ -18,7 +18,7 @@ stdenv.mkDerivation {
|
||||
meta = {
|
||||
description = "Components required to build an executable OpenMP program";
|
||||
homepage = "https://openmp.llvm.org/";
|
||||
license = stdenv.lib.licenses.mit;
|
||||
platforms = stdenv.lib.platforms.all;
|
||||
license = lib.licenses.mit;
|
||||
platforms = lib.platforms.all;
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user