<commit_before>{ stdenv, fetchurl, perl, groff, cmake, python, libffi, binutils }:
let
  version = "3.3";
in stdenv.mkDerivation rec {
  name = "llvm-${version}";

  src = fetchurl {
    url = "http://llvm.org/releases/${version}/llvm-${version}.src.tar.gz";
    sha256 = "0y3mfbb5qzcpw3v5qncn69x1hdrrrfirgs82ypi2annhf0g6nxk8";
  };

  patches = [
    ./more-memory-for-bugpoint.patch # The default rlimits in 3.3 are too low for shared libraries.
    ./no-rule-aarch64.patch          # http://llvm.org/bugs/show_bug.cgi?id=16625
  ];

  buildInputs = [ perl groff cmake python libffi ];

  # hacky fix: created binaries need to be run before installation
  preBuild = let LD = if stdenv.isDarwin then "DYLD" else "LD";
    in "export ${LD}_LIBRARY_PATH='$$${LD}_LIBRARY_PATH:'`pwd`/lib";

  cmakeFlags = with stdenv; [
    "-DCMAKE_BUILD_TYPE=Release"
    "-DLLVM_BUILD_TESTS=ON"
    "-DLLVM_ENABLE_FFI=ON"
    "-DLLVM_BINUTILS_INCDIR=${binutils}/include"
    "-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=R600" # for mesa
  ] ++ stdenv.lib.optional (!isDarwin) "-DBUILD_SHARED_LIBS=ON";

  postBuild = ''
    paxmark m bin/{lli,llvm-rtdyld}

    paxmark m unittests/ExecutionEngine/JIT/JITTests
    paxmark m unittests/ExecutionEngine/MCJIT/MCJITTests
    paxmark m unittests/Support/SupportTests
  '';
<commit_msg>llvm_33: backport patch from LLVM 3.5<commit_after>{ stdenv, fetchurl, perl, groff, cmake, python, libffi, binutils }:
let
  version = "3.3";
in stdenv.mkDerivation rec {
  name = "llvm-${version}";

  src = fetchurl {
    url = "http://llvm.org/releases/${version}/llvm-${version}.src.tar.gz";
    sha256 = "0y3mfbb5qzcpw3v5qncn69x1hdrrrfirgs82ypi2annhf0g6nxk8";
  };

  patches = [
    ./more-memory-for-bugpoint.patch # The default rlimits in 3.3 are too low for shared libraries.
    ./no-rule-aarch64.patch          # http://llvm.org/bugs/show_bug.cgi?id=16625
    # Patch needed for Julia, backports fixes from LLVM 3.5
    (fetchurl {
      url = "https://raw.githubusercontent.com/JuliaLang/julia/3bdda3750efc4ebf8ce7eda8a0888ffef3851605/deps/llvm-3.3.patch";
      sha256 = "0j6chyx4k8zr1qha5dks8lqlcraqrj4q1hwnk2kj3qi6cajsd8k3";
    })
  ];

  buildInputs = [ perl groff cmake python libffi ];

  # hacky fix: created binaries need to be run before installation
  preBuild = let LD = if stdenv.isDarwin then "DYLD" else "LD";
    in "export ${LD}_LIBRARY_PATH='$$${LD}_LIBRARY_PATH:'`pwd`/lib";

  cmakeFlags = with stdenv; [
    "-DCMAKE_BUILD_TYPE=Release"
    "-DLLVM_BUILD_TESTS=ON"
    "-DLLVM_ENABLE_FFI=ON"
    "-DLLVM_BINUTILS_INCDIR=${binutils}/include"
    "-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=R600" # for mesa
  ] ++ stdenv.lib.optional (!isDarwin) "-DBUILD_SHARED_LIBS=ON";

  postBuild = ''
    paxmark m bin/{lli,llvm-rtdyld}

    paxmark m unittests/ExecutionEngine/JIT/JITTests
    paxmark m unittests/ExecutionEngine/MCJIT/MCJITTests
    paxmark m unittests/Support/SupportTests
  '';

{'fraction_non_alphanumeric': 0.13141683778234087, 'fraction_numerical': 0.03661875427789185, 'mean_word_length': 3.831404958677686, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2225415', 'n_tokens_mistral': 1249, 'n_tokens_neox': 1161, 'n_words': 203}