+ (arguments
+ `(#:configure-flags
+ (list "-DCLANG_INCLUDE_TESTS=True"
+
+ ;; 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"))
+
+ #:phases (modify-phases %standard-phases
+ (add-after
+ 'unpack 'set-glibc-file-names
+ (lambda* (#:key inputs #:allow-other-keys)
+ (let ((libc (assoc-ref inputs "libc")))
+ ;; Patch the 'getLinuxDynamicLinker' function to that
+ ;; it uses the right dynamic linker file name.
+ (substitute* "lib/Driver/Tools.cpp"
+ (("/lib64/ld-linux-x86-64.so.2")
+ (string-append libc
+ ,(glibc-dynamic-linker))))
+
+ ;; Same for libc's libdir, to allow crt1.o & co. to be
+ ;; found.
+ (substitute* "lib/Driver/ToolChains.cpp"
+ (("@GLIBC_LIBDIR@")
+ (string-append libc "/lib")))))))))