guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: clang-tidy


From: fis trivial
Subject: Re: clang-tidy
Date: Fri, 21 Dec 2018 04:48:56 +0000

Hi Brett,

Clang-tidy comes from clang-extra-tools, which is not bundled in guix package.
I have my own clang packaging based on clang-7.  But I don't have time to test
upgrading LLVM on core-update.  Here is my clang package which includes clang
extra tools, anyone interested in packaging LLVM-7 for and friends for GUIX can
copy it without any constrain:

(define-public clang
  (package
    (name "clang")
    (version (package-version llvm))
    (source
     (origin (method url-fetch)
             (uri (string-append "http://releases.llvm.org/";
                                 version "/cfe-" version ".src.tar.xz"))
             (sha256
              (base32
               "0mdsbgj3p7mayhzm8hclzl3i46r2lwa8fr1cz399f9km3iqi40jm"))
             (patches (search-patches "clang-add-CUDA-path-params.patch"))
             (file-name (string-append name "-" version ".tar.gz"))))
    (build-system cmake-build-system)
    (native-inputs (package-native-inputs llvm))
    (inputs
     `(("libxml2" ,libxml2)
       ("gcc-lib" ,gcc "lib")
       ("gcc" ,gcc)
       ("clang-extra-tools"
        ,(origin
           (method url-fetch)
           (uri
            (string-append "http://releases.llvm.org/";
                           version "/clang-tools-extra-"
                           version ".src.tar.xz"))
           (file-name (string-append "clang-extra-tools-" version ".tar.xz"))
           (sha256
            (base32 "1glxl7bnr4k3j16s8xy8r9cl0llyg524f50591g1ig23ij65lz4k"))))
       ("linux-libre-headers" ,linux-libre-headers)
       ,@(package-inputs llvm)))
    (propagated-inputs
     `(("llvm" ,llvm)
       ("clang-runtime" ,clang-runtime)))
    (arguments
     `(#:configure-flags
       (list
        "-DCLANG_INCLUDE_TESTS=True"
        "-DCLANG_DEFAULT_CXX_STDLIB=libstdc++"
        "-DCLANG_DEFAULT_RTLIB=libgcc"
        ;; Find libgcc_s, crtbegin.o, and crtend.o.
        (string-append
         "-DGCC_INSTALL_PREFIX="
         (assoc-ref %build-inputs "gcc-lib"))
        ;; Use a sane default include directory.
        (string-append
         "-DC_INCLUDE_DIRS="
         (assoc-ref %build-inputs "libc")
         "/include" ":"
         (assoc-ref %build-inputs "gcc")
         "/include/c++" ":"
         (assoc-ref %build-inputs "gcc")
         "/include/c++/x86_64-unknown-linux-gnu/" ":"
         (assoc-ref %build-inputs "linux-libre-headers")
         "/include" ":"
         (assoc-ref %build-inputs "gcc-lib") ; openmp
         "/lib/gcc/x86_64-unknown-linux-gnu/" ,(package-version gcc) 
"/include/"))
       ;; Don't use '-g' during the build to save space.
       #:build-type "Release"
       #:phases
       (modify-phases %standard-phases
         (add-after 'unpack 'unpack-extra-tools
           (lambda* (#:key inputs #:allow-other-keys)
             (let ((untar
                    (lambda (tarball output)
                      (with-directory-excursion output
                        (invoke "tar" "-xvf" (assoc-ref inputs tarball))))))
               (untar "clang-extra-tools" "tools/")
               (with-directory-excursion "tools/"
                 (rename-file
                  (string-append "clang-tools-extra-" ,version ".src")
                  "extra"))
               #t)))
         (add-after
             'unpack 'set-glibc-file-names
           (lambda* (#:key inputs #:allow-other-keys)
             (let ((compiler-rt (assoc-ref inputs "clang-runtime")))
               (substitute* "lib/Driver/ToolChain.cpp"
                 (("getDriver\\(\\)\\.ResourceDir")
                  (string-append "\"" compiler-rt "\"")))
               #t))))))
    ;; Clang supports the same environment variables as GCC.
    (native-search-paths
     (list (search-path-specification
            (variable "CPATH")
            (files '("include")))
           (search-path-specification
            (variable "LIBRARY_PATH")
            (files '("lib" "lib64")))))
    (home-page "https://clang.llvm.org";)
    (synopsis "C language family frontend for LLVM")
    (description
     "Clang is a compiler front end for the C, C++, Objective-C and
Objective-C++ programming languages.  It uses LLVM as its back end.  The Clang
project includes the Clang front end, the Clang static analyzer, and several
code analysis tools.")
    (license license:ncsa)))

Brett Gilio writes:

> Hi all,
>
> Just curious, do we have clang-tidy packaged somewhere? I have clang
> installed and am not able to reference that binary in my exec path.
> As far as I understand, it should be included in the default clang 
> installation.
>
> Best,
> Brett Gilio


--
Jiaming



reply via email to

[Prev in Thread] Current Thread [Next in Thread]