;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2014, 2016 Eric Bavier ;;; Copyright © 2015 Mark H Weaver ;;; Copyright © 2015, 2017 Ludovic Courtès ;;; Copyright © 2016 Dennis Mungai ;;; Copyright © 2016 Ricardo Wurmus ;;; Copyright © 2017 Roel Janssen ;;; ;;; This file is part of GNU Guix. ;;; ;;; GNU Guix is free software; you can redistribute it and/or modify it ;;; under the terms of the GNU General Public License as published by ;;; the Free Software Foundation; either version 3 of the License, or (at ;;; your option) any later version. ;;; ;;; GNU Guix is distributed in the hope that it will be useful, but ;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;;; GNU General Public License for more details. ;;; ;;; You should have received a copy of the GNU General Public License ;;; along with GNU Guix. If not, see . (define-module (gnu packages llvm) #:use-module (guix packages) #:use-module ((guix licenses) #:prefix license:) #:use-module (guix download) #:use-module (guix utils) #:use-module (guix build-system gnu) #:use-module (guix build-system cmake) #:use-module (gnu packages) #:use-module (gnu packages gcc) #:use-module (gnu packages bootstrap) ;glibc-dynamic-linker #:use-module (gnu packages compression) #:use-module (gnu packages libffi) #:use-module (gnu packages perl) #:use-module (gnu packages python) #:use-module (gnu packages xml)) (define-public llvm (package (name "llvm") (version "3.8.1") (source (origin (method url-fetch) (uri (string-append "http://llvm.org/releases/" version "/llvm-" version ".src.tar.xz")) (sha256 (base32 "1ybmnid4pw2hxn12ax5qa5kl1ldfns0njg8533y3mzslvd5cx0kf")))) (build-system cmake-build-system) (native-inputs `(("python" ,python-2) ;bytes->str conversion in clang>=3.7 needs python-2 ("perl" ,perl))) (inputs `(("libffi" ,libffi))) (propagated-inputs `(("zlib" ,zlib))) ;to use output from llvm-config (arguments `(#:configure-flags '("-DCMAKE_SKIP_BUILD_RPATH=FALSE" "-DCMAKE_BUILD_WITH_INSTALL_RPATH=FALSE" "-DBUILD_SHARED_LIBS:BOOL=TRUE" "-DLLVM_ENABLE_FFI:BOOL=TRUE" "-DLLVM_INSTALL_UTILS=ON") ; Needed for rustc. ;; Don't use '-g' during the build, to save space. #:build-type "Release" #:phases (modify-phases %standard-phases (add-before 'build 'shared-lib-workaround ;; Even with CMAKE_SKIP_BUILD_RPATH=FALSE, llvm-tblgen ;; doesn't seem to get the correct rpath to be able to run ;; from the build directory. Set LD_LIBRARY_PATH as a ;; workaround. (lambda _ (setenv "LD_LIBRARY_PATH" (string-append (getcwd) "/lib")) #t))))) (home-page "http://www.llvm.org") (synopsis "Optimizing compiler infrastructure") (description "LLVM is a compiler infrastructure designed for compile-time, link-time, runtime, and idle-time optimization of programs from arbitrary programming languages. It currently supports compilation of C and C++ programs, using front-ends derived from GCC 4.0.1. A new front-end for the C family of languages is in development. The compiler infrastructure includes mirror sets of programming tools as well as libraries with equivalent functionality.") (license license:ncsa))) (define-public llvm-with-rtti (package (inherit llvm) (name "llvm-with-rtti") (arguments (substitute-keyword-arguments (package-arguments llvm) ((#:configure-flags flags) `(append '("-DCMAKE_SKIP_BUILD_RPATH=FALSE" "-DCMAKE_BUILD_WITH_INSTALL_RPATH=FALSE" "-DLLVM_REQUIRES_RTTI=1") ,flags)))))) (define (clang-runtime-from-llvm llvm hash) (package (name "clang-runtime") (version (package-version llvm)) (source (origin (method url-fetch) (uri (string-append "http://llvm.org/releases/" ve