nix: Clean up the flake file
This commit is contained in:
parent
675dced870
commit
3f87aecff9
229
flake.nix
229
flake.nix
|
@ -119,202 +119,53 @@
|
|||
})
|
||||
];
|
||||
|
||||
get_pkgs = system:
|
||||
if system == "x86_64-linux"
|
||||
then import nixpkgs {
|
||||
inherit system overlays;
|
||||
linker = "lld";
|
||||
crossSystem = nixpkgs.lib.systems.examples.musl64 // { useLLVM = true; };
|
||||
# config.replaceCrossStdenv = { buildPackages, baseStdenv }:
|
||||
# buildPackages.stdenvAdapters.overrideCC baseStdenv buildPackages.llvmPackages_17.clangUseLLVM;
|
||||
}
|
||||
else import nixpkgs {
|
||||
inherit system overlays;
|
||||
};
|
||||
|
||||
pkgs = get_pkgs system;
|
||||
utils = import ./nix/utils.nix { inherit nixpkgs; };
|
||||
|
||||
# # sereneLLVM = (pkgs.callPackage ./nix/llvm.nix {
|
||||
# # inherit (pkgs) lib stdenv cmake ninja ccache zlib libxml2 fetchgit;
|
||||
# Create a package set based on the build system
|
||||
pkgs = utils.get_pkgs system overlays;
|
||||
|
||||
# # }).llvm;
|
||||
|
||||
# # stdenv = pkgs.stdenvAdapters.overrideCC pkgs.stdenv sereneLLVM;
|
||||
# stdenv = pkgs.stdenv;
|
||||
# Create a stdenv based on LLVM 17
|
||||
stdenv = pkgs.stdenvAdapters.overrideCC pkgs.stdenv pkgs.llvmPackages_17.clangUseLLVM;
|
||||
sereneLLVM = pkgs.llvmPackages_17.override { inherit stdenv; };
|
||||
|
||||
gc = pkgs.callPackage ./nix/boehmgc.nix { inherit stdenv; };
|
||||
|
||||
zlib' = pkgs.zlib-ng.overrideAttrs (old: {
|
||||
cmakeFlags = [
|
||||
"-DCMAKE_INSTALL_PREFIX=/"
|
||||
"-DBUILD_SHARED_LIBS=OFF"
|
||||
"-DINSTALL_UTILS=ON"
|
||||
"-DZLIB_COMPAT=ON"
|
||||
];
|
||||
});
|
||||
|
||||
# By default llvm adds zlib to `propagatedBuildInputs` which means any
|
||||
# package that uses llvm will indirectly depends on zlib. And since
|
||||
# by default that zlib is built as a shared lib (since our packageset
|
||||
# is not static), We can't statically link to it. So, we just replace
|
||||
# that zlib with our override of zlib-ng
|
||||
clang' = stdenv.cc.overrideAttrs (old: {
|
||||
propagatedBuildInputs = [ stdenv.cc.bintools ] ++ [ pkgs.zlib-ng ];
|
||||
propagatedBuildInputs = [ stdenv.cc.bintools ] ++ [ zlib' ];
|
||||
});
|
||||
|
||||
stdenv' = pkgs.stdenvAdapters.overrideCC pkgs.stdenv clang';
|
||||
# utils = (pkgs.callPackage ./nix/utils.nix {});
|
||||
|
||||
# llvm_source = pkgs.callPackage ./nix/llvm_source.nix {};
|
||||
|
||||
# libunwind = (pkgs.callPackage ./nix/libunwind {
|
||||
# stdenv = stdenv';
|
||||
# inherit llvm_source utils;
|
||||
# });
|
||||
|
||||
# cxx-headers = (pkgs.callPackage ./nix/libcxx {
|
||||
# inherit llvm_source utils;
|
||||
# llvm_libunwind = libunwind;
|
||||
# llvm_libcxxabi = null;
|
||||
# headersOnly = true;
|
||||
# stdenv = stdenv';
|
||||
# });
|
||||
|
||||
# libcxxabi = (pkgs.callPackage ./nix/libcxxabi {
|
||||
# inherit llvm_source utils cxx-headers;
|
||||
# llvm_libunwind = libunwind;
|
||||
# stdenv = stdenv';
|
||||
# });
|
||||
|
||||
# libcxx = (pkgs.callPackage ./nix/libcxx {
|
||||
# inherit llvm_source utils;
|
||||
# llvm_libcxxabi = libcxxabi;
|
||||
# llvm_libunwind = libunwind;
|
||||
# stdenv = stdenv';
|
||||
# });
|
||||
|
||||
# compiler-rt = (pkgs.callPackage ./nix/compiler-rt {
|
||||
# inherit llvm_source utils;
|
||||
# llvm_libcxxabi = libcxxabi;
|
||||
# stdenv = stdenv';
|
||||
# });
|
||||
|
||||
# ullvm = pkgs.stellvmPackages_17;
|
||||
# clang' = pkgs.wrapCCWith rec {
|
||||
# libcxx = ullvm.libcxx;
|
||||
# cc = ullvm.clang;
|
||||
# libc = ullvm.musl;
|
||||
# bintools = ullvm.bintools;
|
||||
# extraPackages = [
|
||||
# libcxxabi
|
||||
# compiler-rt
|
||||
# ] ++ pkgs.lib.optionals (!pkgs.stdenv.targetPlatform.isWasm) [
|
||||
# ullvm.libunwind
|
||||
# ];
|
||||
# extraBuildCommands = mkExtraBuildCommands cc llvm_source.major compiler-rt;
|
||||
# nixSupport.cc-cflags =
|
||||
# [ "-rtlib=compiler-rt"
|
||||
# "-Wno-unused-command-line-argument"
|
||||
# "-B${compiler-rt}/lib"
|
||||
# ]
|
||||
# ++ pkgs.lib.optional (!pkgs.stdenv.targetPlatform.isWasm) "--unwindlib=libunwind"
|
||||
# ++ pkgs.lib.optional
|
||||
# (!stdenv'.targetPlatform.isWasm)
|
||||
# "-lunwind"
|
||||
# ++ pkgs.lib.optional pkgs.stdenv.targetPlatform.isWasm "-fno-exceptions";
|
||||
# };
|
||||
# stdenv'' = pkgs.stdenvAdapters.overrideCC pkgs.stdenv clang';
|
||||
|
||||
|
||||
# llvm = (pkgs.callPackage ./nix/llvm {
|
||||
# inherit llvm_source utils;
|
||||
# buildLlvmTools = pkgs.llvmPackages_17;
|
||||
# stdenv = stdenv'';
|
||||
# });
|
||||
# llvm = (pkgs.callPackage ./nix/llvm.nix {
|
||||
# inherit llvm_source utils;
|
||||
|
||||
# # llvm_libcxx = libcxx;
|
||||
# # llvm_libcxxabi = libcxxabi;
|
||||
# # llvm_compiler-rt = compiler-rt;
|
||||
# # llvm_libunwind = libunwind;
|
||||
# stdenv = pkgs.stdenv;
|
||||
# });
|
||||
|
||||
|
||||
# clang' = pkgs.wrapCCWith rec {
|
||||
# libcxx = llvm;
|
||||
# cc = llvm;
|
||||
# libc = pkgs.llvmPackages_17.bintools.libc;
|
||||
# bintools = pkgs.llvmPackages_17.bintools;
|
||||
# extraPackages = [
|
||||
# llvm
|
||||
# ];
|
||||
# # extraPackages = [
|
||||
# # libcxxabi
|
||||
# # compiler-rt
|
||||
# # ] ++ pkgs.lib.optionals (!pkgs.stdenv.targetPlatform.isWasm) [
|
||||
# # ullvm.libunwind
|
||||
# # ];
|
||||
# extraBuildCommands = mkExtraBuildCommands cc llvm_source.major;
|
||||
# nixSupport.cc-cflags =
|
||||
# [ "-rtlib=compiler-rt"
|
||||
# "-Wno-unused-command-line-argument"
|
||||
# "-B${llvm}/lib/"
|
||||
# ]
|
||||
# ++ pkgs.lib.optional (!pkgs.stdenv.targetPlatform.isWasm) "--unwindlib=libunwind"
|
||||
# ++ pkgs.lib.optional
|
||||
# (!stdenv'.targetPlatform.isWasm)
|
||||
# "-lunwind"
|
||||
# ++ pkgs.lib.optional pkgs.stdenv.targetPlatform.isWasm "-fno-exceptions";
|
||||
# };
|
||||
# stdenv'' = pkgs.stdenvAdapters.overrideCC pkgs.stdenv clang';
|
||||
llvm = pkgs.llvmPackages_17.llvm.overrideAttrs (old: {
|
||||
propagatedBuildInputs = [];
|
||||
propagatedBuildInputs = [ zlib' ];
|
||||
});
|
||||
|
||||
z = pkgs.zlib-ng.overrideAttrs (old: {
|
||||
cmakeFlags = [
|
||||
"-DCMAKE_INSTALL_PREFIX=/"
|
||||
"-DBUILD_SHARED_LIBS=OFF"
|
||||
"-DINSTALL_UTILS=ON"
|
||||
"-DZLIB_COMPAT=ON"
|
||||
];
|
||||
});
|
||||
#with pkgs;
|
||||
native_build_inputs =
|
||||
let
|
||||
# filterCmakeFlags = xs: builtins.filter
|
||||
# (x: !(x == "-DCMAKE_CROSSCOMPILING=True" || pkgs.lib.hasPrefix "-DLLVM_TABLEGEN=" x))
|
||||
# xs;
|
||||
# This is the actual stdenv that we need to use anywhere else
|
||||
stdenv' = pkgs.stdenvAdapters.overrideCC pkgs.stdenv clang';
|
||||
|
||||
git' = pkgs.git.overrideAttrs (old: {
|
||||
preInstallCheck =
|
||||
pkgs.lib.replaceStrings [ ''disable_test t0201-gettext-fallbacks'' ]
|
||||
[ ''
|
||||
# Just disabling the tests that fails under musl
|
||||
git' = pkgs.git.overrideAttrs (old: {
|
||||
preInstallCheck =
|
||||
pkgs.lib.replaceStrings [ ''disable_test t0201-gettext-fallbacks'' ]
|
||||
[ ''
|
||||
disable_test t0201-gettext-fallbacks
|
||||
disable_test t2082-parallel-checkout-attributes
|
||||
'' ]
|
||||
old.preInstallCheck;
|
||||
});
|
||||
|
||||
# iwyu = (pkgs.include-what-you-use.overrideAttrs (old:
|
||||
# let
|
||||
# version = "0.22";
|
||||
# in {
|
||||
# inherit version;
|
||||
|
||||
# src = pkgs.fetchurl {
|
||||
# url = "${old.meta.homepage}/downloads/${old.pname}-${version}.src.tar.gz";
|
||||
# hash = "sha256-ajUZGf+JvafJXIlUcmAYaNs9qrlqlYs44DYokNWHYLY=";
|
||||
# };
|
||||
# }))
|
||||
# .override {
|
||||
# llvmPackages = pkgs.__splicedPackages.llvmPackages_17;# .overrideAttrs (oldLLVM: {
|
||||
# # cmakeFlags = builtins.trace ">> ${toString(filterCmakeFlags oldLLVM.cmakeFlags)}" filterCmakeFlags oldLLVM.cmakeFlags;
|
||||
# # });
|
||||
# };
|
||||
# mlir_16' = pkgs.mlir_16.overrideAttrs (old: {
|
||||
|
||||
# });
|
||||
# builtins.trace ">> ${sereneLLVM}"
|
||||
in (with pkgs; [
|
||||
# sereneLLVM.llvm
|
||||
# sereneLLVM.mlir
|
||||
# sereneLLVM.clang
|
||||
# sereneLLVM.compiler-rt
|
||||
# sereneLLVM.lld
|
||||
# sereneLLVM.libcxx
|
||||
# sereneLLVM.libcxxabi
|
||||
old.preInstallCheck;
|
||||
});
|
||||
|
||||
native_build_inputs = (with pkgs; [
|
||||
cmake
|
||||
ninja
|
||||
ccache
|
||||
|
@ -325,38 +176,20 @@
|
|||
zsh-syntax-highlighting
|
||||
python3
|
||||
iwyu
|
||||
# mlir17
|
||||
# llvm17
|
||||
# cr17
|
||||
# cc17
|
||||
# libcxx17
|
||||
# libcxxabi17
|
||||
# lld17
|
||||
# libunwind17
|
||||
gc
|
||||
#musl
|
||||
llvm
|
||||
|
||||
#llvmPackages_17.llvm
|
||||
llvmPackages_17.mlir
|
||||
llvmPackages_17.clang
|
||||
]);
|
||||
|
||||
build_inputs = with pkgs; [
|
||||
gc
|
||||
#musl
|
||||
gtest
|
||||
gmock
|
||||
#llvmPackages_17.llvm
|
||||
z
|
||||
zlib'
|
||||
llvm
|
||||
llvmPackages_17.mlir
|
||||
llvmPackages_17.clang
|
||||
|
||||
# llvmPackages_17.libcxx
|
||||
# llvmPackages_17.libcxxabi
|
||||
# llvmPackages_17.compiler-rt
|
||||
# zstd
|
||||
];
|
||||
|
||||
in {
|
||||
|
|
200
nix/utils.nix
200
nix/utils.nix
|
@ -13,194 +13,18 @@
|
|||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
{ lib }:
|
||||
{ nixpkgs }:
|
||||
{
|
||||
cmakeFlags = stdenv: [
|
||||
"-DLLVM_BUILD_EXAMPLES=ON"
|
||||
"-DLLVM_TARGETS_TO_BUILD='X86'"
|
||||
"-DCMAKE_BUILD_TYPE=Release"
|
||||
"-DLLVM_ENABLE_ASSERTIONS=ON"
|
||||
"-DLLVM_CCACHE_BUILD=OFF"
|
||||
"-DCMAKE_EXPORT_COMPILE_COMMANDS=ON"
|
||||
|
||||
"-DLLVM_EXTERNAL_PROJECTS=iwyu"
|
||||
#"-DLLVM_EXTERNAL_IWYU_SOURCE_DIR=${iwyu.src}"
|
||||
#"-DCMAKE_INSTALL_PREFIX=${placeholder "out"}"
|
||||
|
||||
|
||||
# No lldb? Yes, lldb links against liblldb.so and since we use
|
||||
# -static with our executables that wouldn't be easy to handle
|
||||
# and I'm lazy. We can just compile the lldb or any other debugger
|
||||
# on the host
|
||||
"-DLLVM_ENABLE_PROJECTS='clang;lld;mlir;clang-tools-extra'"
|
||||
"-DLLVM_RUNTIME_TARGETS=${stdenv.hostPlatform.config}"
|
||||
"-DLLVM_ENABLE_RUNTIMES='compiler-rt;libcxx;libcxxabi;libunwind'"
|
||||
"-DLLVM_HOST_TRIPLE=${stdenv.hostPlatform.config}"
|
||||
"-DLLVM_RUNTIME_TARGET=${stdenv.hostPlatform.config}"
|
||||
"-DLLVM_BUILTIN_TARGETS=${stdenv.hostPlatform.config}"
|
||||
|
||||
# Serene uses static libs, so no shared lib
|
||||
"-DLLVM_ENABLE_PIC=OFF"
|
||||
# "-DLLVM_BUILD_STATIC=ON"
|
||||
"-DLLVM_LINK_LLVM_DYLIB=off"
|
||||
|
||||
"-DLLVM_ENABLE_LIBXML2=OFF"
|
||||
"-DLLVM_BUILD_DOCS=OFF"
|
||||
"-DLLVM_ENABLE_SPHINX=OFF"
|
||||
"-DSPHINX_OUTPUT_MAN=OFF"
|
||||
"-DSPHINX_OUTPUT_HTML=OFF"
|
||||
|
||||
"-DCMAKE_POSITION_INDEPENDENT_CODE=ON"
|
||||
"-DCLANG_DEFAULT_CXX_STDLIB=libc++"
|
||||
"-DCLANG_DEFAULT_LINKER=lld"
|
||||
"-DCLANG_DEFAULT_OBJCOPY=llvm-objcopy"
|
||||
"-DCLANG_DEFAULT_RTLIB=compiler-rt"
|
||||
"-DCLANG_VENDOR_UTI=serene.toolchain"
|
||||
"-DLLVM_ENABLE_LIBCXX=ON"
|
||||
|
||||
"-DLLVM_ENABLE_NEW_PASS_MANAGER=ON"
|
||||
"-DLLVM_BUILD_TESTS=OFF"
|
||||
"-DLLVM_ENABLE_ASSERTIONS=ON"
|
||||
"-DLLVM_ENABLE_LIBXML2=OFF"
|
||||
"-DLLVM_ENABLE_TERMINFO=OFF"
|
||||
#"-DLLVM_ENABLE_ZLIB=FORCE_ON"
|
||||
"-DLLVM_INCLUDE_BENCHMARKS=OFF"
|
||||
"-DLLVM_INCLUDE_EXAMPLES=OFF"
|
||||
"-DLLVM_INCLUDE_TESTS=OFF"
|
||||
"-DLLVM_INCLUDE_GO_TESTS=OFF"
|
||||
"-DLLVM_ENABLE_BINDINGS=OFF"
|
||||
#"-DLLVM_TARGETS_TO_BUILD": "X86;AArch64;AMDGPU;ARM;RISCV;WebAssembly"
|
||||
"-DLLVM_STATIC_LINK_CXX_STDLIB=ON"
|
||||
"-DPACKAGE_VENDOR=Serene"
|
||||
"-DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON"
|
||||
"-DENABLE_X86_RELAX_RELOCATIONS=ON"
|
||||
"-DBUILD_SHARED_LIBS=OFF"
|
||||
"-DCLANG_ENABLE_BOOTSTRAP=ON"
|
||||
"-DLIBCXX_ENABLE_STATIC_ABI_LIBRARY=ON"
|
||||
"-DLIBCXXABI_ENABLE_SHARED=OFF"
|
||||
"-DLIBCXX_ABI_VERSION=2"
|
||||
|
||||
"-DLLVM_HAVE_LIBXAR=0"
|
||||
"-DLIBCLANG_BUILD_STATIC=ON"
|
||||
|
||||
"-DCOMPILER_RT_BUILD_BUILTINS=ON"
|
||||
"-DCOMPILER_RT_USE_LIBCXX=ON"
|
||||
"-DCMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY"
|
||||
"-DLIBCLANG_BUILD_STATIC=ON"
|
||||
|
||||
|
||||
] ++ lib.optional (stdenv.hostPlatform.isMusl) [
|
||||
"-DDLIBCXX_HAS_MUSL_LIBC=ON"
|
||||
# ] ++ lib.optional (stdenv.hostPlatform.isStatic) [
|
||||
# "-DLIBCLANG_BUILD_STATIC=ON"
|
||||
];
|
||||
|
||||
builtinFlags = stdenv:
|
||||
let
|
||||
target = stdenv.targetPlatform.config;
|
||||
in [
|
||||
"-DBUILTINS_${target}_CMAKE_C_COMPILER_TARGET=${target}"
|
||||
"-DBUILTINS_${target}_CMAKE_CXX_COMPILER_TARGET=${target}"
|
||||
"-DBUILTINS_${target}_CMAKE_ASM_COMPILER_TARGET=${target}"
|
||||
"-DBUILTINS_${target}_CMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY"
|
||||
# "CMAKE_EXE_LINKER_FLAGS=--target=${target} {self.buildenv.get('LDFLAGS', '')}"
|
||||
# "CMAKE_SHARED_LINKER_FLAGS=--target=${target} {self.buildenv.get('LDFLAGS', '')}"
|
||||
"-DBUILTINS_${target}_CMAKE_INSTALL_RPATH=\$ORIGIN/../lib"
|
||||
"-DBUILTINS_${target}_CMAKE_BUILD_WITH_INSTALL_RPATH=ON"
|
||||
"-DBUILTINS_${target}_COMPILER_RT_BAREMETAL_BUILD=ON"
|
||||
"-DBUILTINS_${target}_COMPILER_RT_DEFAULT_TARGET_ONLY=ON"
|
||||
] ++ lib.optional (stdenv.hostPlatform.useLLVM) [
|
||||
"-DBUILTINS_${target}_LLVM_USE_LINKER=lld"
|
||||
];
|
||||
|
||||
runtimeFlags = stdenv:
|
||||
let
|
||||
target = stdenv.targetPlatform.config;
|
||||
in [
|
||||
"-DRUNTIMES_${target}_CMAKE_C_COMPILER_TARGET=${target}"
|
||||
"-DRUNTIMES_${target}_CMAKE_CXX_COMPILER_TARGET=${target}"
|
||||
"-DRUNTIMES_${target}_CMAKE_ASM_COMPILER_TARGET=${target}"
|
||||
"-DRUNTIMES_${target}_CMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY"
|
||||
"-DRUNTIMES_${target}_CMAKE_INSTALL_RPATH=\$ORIGIN/../lib"
|
||||
"-DRUNTIMES_${target}_CMAKE_BUILD_WITH_INSTALL_RPATH=ON"
|
||||
"-DRUNTIMES_${target}_CMAKE_POSITION_INDEPENDENT_CODE=ON"
|
||||
"-DRUNTIMES_${target}_LLVM_USE_LTO=ON"
|
||||
|
||||
# Make sure we use libc++ from the tree instead from the system.
|
||||
"-DRUNTIMES_${target}_SANITIZER_CXX_ABI=libc++"
|
||||
"-DRUNTIMES_${target}_SANITIZER_CXX_ABI_INTREE=ON"
|
||||
"-DRUNTIMES_${target}_LIBCXX_CXX_ABI=libcxxabi"
|
||||
"-DRUNTIMES_${target}_LIBCXX_USE_COMPILER_RT=ON"
|
||||
"-DRUNTIMES_${target}_LIBCXX_ENABLE_STATIC_ABI_LIBRARY=ON"
|
||||
"-DRUNTIMES_${target}_LIBCXX_ABI_UNSTABLE=ON"
|
||||
"-DRUNTIMES_${target}_LIBCXX_STATICALLY_LINK_ABI_IN_SHARED_LIBRARY=ON"
|
||||
"-DRUNTIMES_${target}_LIBCXX_STATICALLY_LINK_ABI_IN_STATIC_LIBRARY=ON"
|
||||
"-DRUNTIMES_${target}_LIBCXX_ABI_VERSION=2"
|
||||
"-DRUNTIMES_${target}_LIBCXXABI_ENABLE_THREADS=ON"
|
||||
"-DRUNTIMES_${target}_LIBCXXABI_HAS_CXA_THREAD_ATEXIT_IMPL=OFF"
|
||||
"-DRUNTIMES_${target}_LIBCXXABI_USE_COMPILER_RT=ON"
|
||||
"-DRUNTIMES_${target}_LIBCXXABI_USE_LLVM_UNWINDER=ON"
|
||||
"-DRUNTIMES_${target}_LIBCXXABI_ENABLE_STATIC_UNWINDER=ON"
|
||||
"-DRUNTIMES_${target}_LIBCXXABI_STATICALLY_LINK_UNWINDER_IN_SHARED_LIBRARY=ON"
|
||||
"-DRUNTIMES_${target}_LIBCXXABI_STATICALLY_LINK_UNWINDER_IN_STATIC_LIBRARY=ON"
|
||||
"-DRUNTIMES_${target}_LIBCXXABI_ENABLE_SHARED=OFF"
|
||||
"-DRUNTIMES_${target}_LIBUNWIND_USE_COMPILER_RT=ON"
|
||||
] ++ (lib.optional (stdenv.hostPlatform.useLLVM) [
|
||||
"-DRUNTIMES_${target}_LLVM_USE_LINKER=lld"
|
||||
]) ++ (lib.optional (stdenv.hostPlatform.isMusl) [
|
||||
# TODO: Check for more sanitizers that work with musl
|
||||
"-DRUNTIMES_${target}_COMPILER_RT_SANITIZERS_TO_BUILD='asan;msan;tsan'"
|
||||
"-DRUNTIMES_${target}_COMPILER_RT_USE_BUILTINS_LIBRARY=ON"
|
||||
"-DRUNTIMES_${target}_COMPILER_RT_USE_LIBCXX=ON"
|
||||
"-DRUNTIMES_${target}_COMPILER_RT_BUILD_SANITIZERS=ON"
|
||||
# musl doesn't have -latomic
|
||||
"-DRUNTIMES_${target}_LIBCXX_HAS_ATOMIC_LIB=OFF"
|
||||
|
||||
"-DRUNTIMES_${target}_LIBCXX_HAS_MUSL_LIBC=ON"
|
||||
# For some reason this flag is not correctly set if we don't
|
||||
# manually set it and some strange gnu only LDFLAGS are injected.
|
||||
"-DRUNTIMES_${target}_COMPILER_RT_HAS_GNU_VERSION_SCRIPT_COMPAT=OFF"
|
||||
# X-Ray doesn't seem to compiler with musl
|
||||
"-DRUNTIMES_${target}_COMPILER_RT_BUILD_XRAY=OFF"
|
||||
# Only build these if we enable sanitizers since they depend
|
||||
# on the sanitizer common runtime
|
||||
"-DRUNTIMES_${target}_COMPILER_RT_BUILD_MEMPROF=ON"
|
||||
"-DRUNTIMES_${target}_COMPILER_RT_BUILD_LIBFUZZER=ON"
|
||||
"-DRUNTIMES_${target}_COMPILER_RT_BUILD_ORC=ON"
|
||||
]);
|
||||
|
||||
meta = {
|
||||
homepage = "https://llvm.org/";
|
||||
description = "A collection of modular and reusable compiler and toolchain technologies";
|
||||
longDescription = ''
|
||||
The LLVM Project is a collection of modular and reusable compiler and
|
||||
toolchain technologies. Despite its name, LLVM has little to do with
|
||||
traditional virtual machines. The name "LLVM" itself is not an acronym; it
|
||||
is the full name of the project.
|
||||
LLVM began as a research project at the University of Illinois, with the
|
||||
goal of providing a modern, SSA-based compilation strategy capable of
|
||||
supporting both static and dynamic compilation of arbitrary programming
|
||||
languages. Since then, LLVM has grown to be an umbrella project consisting
|
||||
of a number of subprojects, many of which are being used in production by
|
||||
a wide variety of commercial and open source projects as well as being
|
||||
widely used in academic research. Code in the LLVM project is licensed
|
||||
under the "Apache 2.0 License with LLVM exceptions".
|
||||
'';
|
||||
license = lib.licenses.ncsa;
|
||||
|
||||
# TODO: Add the maintainer
|
||||
# maintainers = "Sameer Rahmani []";
|
||||
|
||||
# See llvm/cmake/config-ix.cmake.
|
||||
platforms =
|
||||
lib.platforms.aarch64 ++
|
||||
lib.platforms.arm ++
|
||||
lib.platforms.mips ++
|
||||
lib.platforms.power ++
|
||||
lib.platforms.s390x ++
|
||||
lib.platforms.wasi ++
|
||||
lib.platforms.x86 ++
|
||||
lib.platforms.riscv ++
|
||||
lib.platforms.m68k;
|
||||
get_pkgs = system: overlays:
|
||||
if system == "x86_64-linux"
|
||||
then import nixpkgs {
|
||||
inherit system overlays;
|
||||
linker = "lld";
|
||||
crossSystem = nixpkgs.lib.systems.examples.musl64 // { useLLVM = true; };
|
||||
# config.replaceCrossStdenv = { buildPackages, baseStdenv }:
|
||||
# buildPackages.stdenvAdapters.overrideCC baseStdenv buildPackages.llvmPackages_17.clangUseLLVM;
|
||||
}
|
||||
else import nixpkgs {
|
||||
inherit system overlays;
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue