2019-02-14 15:29:42 +08:00
|
|
|
{ stdenv
|
2019-04-13 16:49:49 +08:00
|
|
|
, fetchFromGitHub, runCommand
|
|
|
|
, perl, groff, cmake, libxml2, python, libffi, valgrind
|
2019-02-14 15:29:42 +08:00
|
|
|
}:
|
|
|
|
|
2019-04-13 16:49:49 +08:00
|
|
|
let
|
|
|
|
llvm-src = fetchFromGitHub {
|
2020-06-23 21:18:37 +08:00
|
|
|
rev = "7746fe85489e92e1caffda18b9d7b2ae9e5da1a8";
|
2019-04-13 16:49:49 +08:00
|
|
|
owner = "m-labs";
|
|
|
|
repo = "llvm-or1k";
|
2020-06-23 21:18:37 +08:00
|
|
|
sha256 = "0jqbb3k9r91swsyrdak8fzvs1qi451zy8dqmpqriaxk5g83ny5b7";
|
2019-04-13 16:49:49 +08:00
|
|
|
};
|
|
|
|
clang-src = fetchFromGitHub {
|
|
|
|
rev = "9e996136d52ed506ed8f57ef8b13b0f0f735e6a3";
|
|
|
|
owner = "m-labs";
|
|
|
|
repo = "clang-or1k";
|
|
|
|
sha256 = "0w5f450i76y162aswi2c7jip8x3arzljaxhbqp8qfdffm0rdbjp4";
|
|
|
|
};
|
|
|
|
llvm-clang-src = runCommand "llvm-clang-src" {}
|
|
|
|
''
|
|
|
|
mkdir -p $out
|
|
|
|
mkdir -p $out/tools/clang
|
|
|
|
cp -r ${llvm-src}/* $out/
|
|
|
|
cp -r ${clang-src}/* $out/tools/clang
|
|
|
|
'';
|
|
|
|
in
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
name = "llvm-or1k";
|
2020-06-09 18:21:54 +08:00
|
|
|
passthru.llvm-src = llvm-src;
|
2019-04-13 16:49:49 +08:00
|
|
|
src = llvm-clang-src;
|
2020-06-09 18:21:54 +08:00
|
|
|
version = "6.0.0";
|
2019-02-14 15:29:42 +08:00
|
|
|
|
2020-06-09 18:21:54 +08:00
|
|
|
buildInputs = [ perl groff cmake libxml2 python libffi ] ++ stdenv.lib.optional stdenv.isLinux valgrind;
|
2019-02-14 15:29:42 +08:00
|
|
|
|
2019-04-13 16:49:49 +08:00
|
|
|
preBuild = ''
|
|
|
|
NIX_BUILD_CORES=4
|
|
|
|
makeFlagsArray=(-j''$NIX_BUILD_CORES)
|
|
|
|
mkdir -p $out/
|
|
|
|
'';
|
2019-02-14 15:29:42 +08:00
|
|
|
|
2019-04-13 16:49:49 +08:00
|
|
|
cmakeFlags = with stdenv; [
|
|
|
|
"-DCMAKE_BUILD_TYPE=Release"
|
|
|
|
"-DLLVM_BUILD_LLVM_DYLIB=ON"
|
|
|
|
"-DLLVM_LINK_LLVM_DYLIB=ON"
|
2019-08-26 09:29:49 +08:00
|
|
|
"-DLLVM_TARGETS_TO_BUILD=X86;ARM"
|
2019-04-13 16:49:49 +08:00
|
|
|
"-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=OR1K"
|
|
|
|
"-DLLVM_ENABLE_ASSERTIONS=OFF"
|
|
|
|
"-DLLVM_INSTALL_UTILS=ON"
|
|
|
|
"-DLLVM_INCLUDE_TESTS=OFF"
|
|
|
|
"-DLLVM_INCLUDE_DOCS=OFF"
|
|
|
|
"-DLLVM_INCLUDE_EXAMPLES=OFF"
|
|
|
|
"-DCLANG_ENABLE_ARCMT=OFF"
|
|
|
|
"-DCLANG_ENABLE_STATIC_ANALYZER=OFF"
|
|
|
|
"-DCLANG_INCLUDE_TESTS=OFF"
|
|
|
|
"-DCLANG_INCLUDE_DOCS=OFF"
|
|
|
|
];
|
2019-02-14 15:29:42 +08:00
|
|
|
|
2019-04-13 16:49:49 +08:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
meta = {
|
|
|
|
description = "Collection of modular and reusable compiler and toolchain technologies";
|
|
|
|
homepage = http://llvm.org/;
|
|
|
|
license = stdenv.lib.licenses.bsd3;
|
|
|
|
maintainers = with stdenv.lib.maintainers; [ sb0 ];
|
|
|
|
platforms = stdenv.lib.platforms.all;
|
|
|
|
};
|
|
|
|
}
|