| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 | |
| 13 | |
| 14 | |
| 15 | |
| 16 | |
| 17 | |
| 18 | |
| 19 | |
| 20 | |
| 21 | |
| 22 | |
| 23 | |
| 24 | |
| 25 | |
| 26 | |
| 27 | |
| 28 | |
| 29 | |
| 30 | |
| 31 | |
| 32 | |
| 33 | |
| 34 | |
| 35 | |
| 36 | |
| 37 | |
| 38 | |
| 39 | |
| 40 | |
| 41 | |
| 42 | |
| 43 | |
| 44 | |
| 45 | |
| 46 | |
| 47 | |
| 48 | |
| 49 | |
| 50 | |
| 51 |
|
| 52 | (define-module (gnu packages llvm)
|
| 53 | #:use-module (guix packages)
|
| 54 | #:use-module ((guix licenses) #:prefix license:)
|
| 55 | #:use-module (guix download)
|
| 56 | #:use-module (guix gexp)
|
| 57 | #:use-module (guix git-download)
|
| 58 | #:use-module (guix memoization)
|
| 59 | #:use-module (guix search-paths)
|
| 60 | #:use-module (guix utils)
|
| 61 | #:use-module (guix build-system cmake)
|
| 62 | #:use-module (guix build-system emacs)
|
| 63 | #:use-module (guix build-system gnu)
|
| 64 | #:use-module (guix build-system pyproject)
|
| 65 | #:use-module (guix build-system trivial)
|
| 66 | #:use-module (gnu packages)
|
| 67 | #:use-module (gnu packages autotools)
|
| 68 | #:use-module (gnu packages base)
|
| 69 | #:use-module (gnu packages cmake)
|
| 70 | #:use-module (gnu packages bash)
|
| 71 | #:use-module (gnu packages crypto)
|
| 72 | #:use-module (gnu packages gcc)
|
| 73 | #:use-module (gnu packages bootstrap) |
| 74 | #:use-module (gnu packages check) |
| 75 | #:use-module (gnu packages compression)
|
| 76 | #:use-module (gnu packages file)
|
| 77 | #:use-module (gnu packages libedit)
|
| 78 | #:use-module (gnu packages libffi)
|
| 79 | #:use-module (gnu packages linux)
|
| 80 | #:use-module (gnu packages llvm-meta)
|
| 81 | #:use-module (gnu packages lua)
|
| 82 | #:use-module (gnu packages mpi)
|
| 83 | #:use-module (gnu packages ncurses)
|
| 84 | #:use-module (gnu packages ocaml)
|
| 85 | #:use-module (gnu packages onc-rpc)
|
| 86 | #:use-module (gnu packages perl)
|
| 87 | #:use-module (gnu packages pkg-config)
|
| 88 | #:use-module (gnu packages python)
|
| 89 | #:use-module (gnu packages python-build)
|
| 90 | #:use-module (gnu packages rocm)
|
| 91 | #:use-module (gnu packages swig)
|
| 92 | #:use-module (gnu packages vulkan)
|
| 93 | #:use-module (gnu packages xml)
|
| 94 | #:use-module (srfi srfi-1)
|
| 95 | #:use-module (srfi srfi-34)
|
| 96 | #:use-module (srfi srfi-35)
|
| 97 | #:use-module (ice-9 match)
|
| 98 | #:export (make-lld-wrapper
|
| 99 | system->llvm-target))
|
| 100 |
|
| 101 | |
| 102 | (define gcc-toolchain*
|
| 103 | (delay (module-ref (resolve-interface '(gnu packages commencement))
|
| 104 | 'gcc-toolchain)))
|
| 105 |
|
| 106 | (define* (system->llvm-target #:optional
|
| 107 | (system (or (and=> (%current-target-system)
|
| 108 | gnu-triplet->nix-system)
|
| 109 | (%current-system))))
|
| 110 | "Return the LLVM target name that corresponds to SYSTEM, a system type such
|
| 111 | as \"x86_64-linux\"."
|
| 112 | |
| 113 | (match (system->llvm-target-arch system)
|
| 114 | ("RISCV64" "RISCV")
|
| 115 | ("X86_64" "X86")
|
| 116 | (x x)))
|
| 117 |
|
| 118 | (define* (system->llvm-target-arch #:optional
|
| 119 | (system (or (and=> (%current-target-system)
|
| 120 | gnu-triplet->nix-system)
|
| 121 | (%current-system))))
|
| 122 | "Return the LLVM target arch name that corresponds to SYSTEM, a system type such
|
| 123 | as \"x86_64-linux\"."
|
| 124 | |
| 125 | |
| 126 | (letrec-syntax ((matches (syntax-rules (=>)
|
| 127 | ((_ (system-prefix => target) rest ...)
|
| 128 | (if (string-prefix? system-prefix system)
|
| 129 | target
|
| 130 | (matches rest ...)))
|
| 131 | ((_) #f))))
|
| 132 | (matches ("aarch64" => "AArch64")
|
| 133 | ("armhf" => "ARM")
|
| 134 | ("mips64el" => "Mips")
|
| 135 | ("powerpc" => "PowerPC")
|
| 136 | ("riscv64" => "RISCV64")
|
| 137 | ("x86_64" => "X86_64")
|
| 138 | ("i686" => "X86")
|
| 139 | ("i586" => "X86")
|
| 140 | ("avr" => "AVR")
|
| 141 | ("loongarch64" => "LoongArch"))))
|
| 142 |
|
| 143 | (define (llvm-uri component version)
|
| 144 | |
| 145 | |
| 146 | (string-append "https://github.com/llvm/llvm-project/releases/download"
|
| 147 | "/llvmorg-" version "/" component "-" (string-delete #\- version) ".src.tar.xz"))
|
| 148 |
|
| 149 | (define %llvm-release-monitoring-url
|
| 150 | "https://github.com/llvm/llvm-project/releases")
|
| 151 |
|
| 152 | (define* (clang-runtime-from-llvm llvm
|
| 153 | #:optional
|
| 154 | hash
|
| 155 | (patches '()))
|
| 156 | (package
|
| 157 | (name "clang-runtime")
|
| 158 | (version (package-version llvm))
|
| 159 | (source
|
| 160 | (if hash
|
| 161 | (origin
|
| 162 | (method url-fetch)
|
| 163 | (uri (llvm-uri "compiler-rt" version))
|
| 164 | (sha256 (base32 hash))
|
| 165 | (patches (map search-patch patches)))
|
| 166 | (llvm-monorepo (package-version llvm))))
|
| 167 | (build-system cmake-build-system)
|
| 168 | (native-inputs
|
| 169 | (let ((native-inputs (modify-inputs (package-native-inputs llvm)
|
| 170 | (prepend python-setuptools))))
|
| 171 | (cond ((version>=? version "21")
|
| 172 | (modify-inputs native-inputs
|
| 173 | (prepend gcc-15)))
|
| 174 | ((version>=? version "19")
|
| 175 | native-inputs)
|
| 176 | ((version>=? version "18")
|
| 177 | |
| 178 | |
| 179 | |
| 180 | |
| 181 | (modify-inputs native-inputs
|
| 182 | (prepend gcc-13)))
|
| 183 | ((version>=? version "17")
|
| 184 | |
| 185 | |
| 186 | (modify-inputs native-inputs
|
| 187 | (prepend gcc-13)))
|
| 188 | ((version>=? version "16")
|
| 189 | |
| 190 | |
| 191 | |
| 192 | |
| 193 | (modify-inputs native-inputs
|
| 194 | (prepend gcc-12)))
|
| 195 | (else native-inputs))))
|
| 196 | (inputs
|
| 197 | (append
|
| 198 | (list llvm)
|
| 199 | (if (version>=? version "15")
|
| 200 | (list libffi)
|
| 201 | '())
|
| 202 | (if (member (version-major version) (list "10" "11"))
|
| 203 | (list libxcrypt)
|
| 204 | '())))
|
| 205 | (arguments
|
| 206 | `( |
| 207 | #:build-type "Release"
|
| 208 | #:tests? #f |
| 209 | #:modules ((srfi srfi-1)
|
| 210 | (ice-9 match)
|
| 211 | ,@%cmake-build-system-modules)
|
| 212 | #:phases (modify-phases (@ (guix build cmake-build-system) %standard-phases)
|
| 213 | ,@(if hash
|
| 214 | '()
|
| 215 | '((add-after 'unpack 'change-directory
|
| 216 | (lambda _
|
| 217 | (chdir "compiler-rt")))))
|
| 218 | (add-after 'set-paths 'hide-glibc
|
| 219 | |
| 220 | |
| 221 | |
| 222 | (lambda* (#:key inputs #:allow-other-keys)
|
| 223 | (let* ((filters '("libc"))
|
| 224 | (input-directories
|
| 225 | (filter-map (lambda (input)
|
| 226 | (match input
|
| 227 | ((name . dir)
|
| 228 | (and (not (member name filters))
|
| 229 | dir))))
|
| 230 | inputs)))
|
| 231 | (set-path-environment-variable "CPLUS_INCLUDE_PATH"
|
| 232 | '("include")
|
| 233 | input-directories)
|
| 234 | #t))))))
|
| 235 | (home-page "https://compiler-rt.llvm.org")
|
| 236 | (synopsis "Runtime library for Clang/LLVM")
|
| 237 | (description
|
| 238 | "The \"clang-runtime\" library provides the implementations of run-time
|
| 239 | functions for C and C++ programs. It also provides header files that allow C
|
| 240 | and C++ source code to interface with the \"sanitization\" passes of the clang
|
| 241 | compiler. In LLVM this library is called \"compiler-rt\".")
|
| 242 | (license (package-license llvm))
|
| 243 | (properties `((release-monitoring-url . ,%llvm-release-monitoring-url)
|
| 244 | (upstream-name . "compiler-rt")))
|
| 245 |
|
| 246 | |
| 247 | (supported-systems (delete "mips64el-linux" %supported-systems))))
|
| 248 |
|
| 249 | (define* (clang-from-llvm llvm clang-runtime
|
| 250 | #:optional hash
|
| 251 | #:key (patches '()) tools-extra
|
| 252 | (properties
|
| 253 | (append `((release-monitoring-url
|
| 254 | . ,%llvm-release-monitoring-url))
|
| 255 | (clang-properties (package-version llvm))))
|
| 256 | (legacy-build-shared-libs? #f))
|
| 257 | "Produce Clang with dependencies on LLVM and CLANG-RUNTIME, and applying the
|
| 258 | given PATCHES. When TOOLS-EXTRA is given, And the version is less than 22, it
|
| 259 | must point to the 'clang-tools-extra' tarball, which contains code for
|
| 260 | 'clang-tidy', 'pp-trace', 'modularize', and other tools, when the LLVM version
|
| 261 | is greater than 22, if TOOLS-EXTRA exists, the build process will use
|
| 262 | clang-tools-extra from the monorepo.
|
| 263 | LEGACY-BUILD-SHARED-LIBS? is used to configure the package to use the legacy
|
| 264 | BUILD_SHARED_LIBS CMake option, which was used until LLVM/Clang 14."
|
| 265 | (package
|
| 266 | (name "clang")
|
| 267 | (version (package-version llvm))
|
| 268 | (source
|
| 269 | (if hash
|
| 270 | (origin
|
| 271 | (method url-fetch)
|
| 272 | (uri (llvm-uri (if (version>=? version "9.0.1")
|
| 273 | "clang"
|
| 274 | "cfe")
|
| 275 | version))
|
| 276 | (sha256 (base32 hash))
|
| 277 | (patches (map search-patch patches)))
|
| 278 | (if patches
|
| 279 | (let ((llvm-source (llvm-monorepo (package-version llvm))))
|
| 280 | (origin
|
| 281 | (inherit llvm-source)
|
| 282 | (patches
|
| 283 | (append (origin-patches llvm-source)
|
| 284 | (map search-patch patches)))))
|
| 285 | (llvm-monorepo (package-version llvm)))))
|
| 286 | |
| 287 | |
| 288 | |
| 289 | (build-system cmake-build-system)
|
| 290 | (native-inputs (package-native-inputs llvm))
|
| 291 | (inputs
|
| 292 | `(("libxml2" ,libxml2)
|
| 293 | ("gcc-lib" ,gcc "lib")
|
| 294 | ,@(package-inputs llvm)
|
| 295 | ,@(if (and tools-extra (not (version>=? version "22")))
|
| 296 | `(("clang-tools-extra" ,tools-extra))
|
| 297 | '())))
|
| 298 | (propagated-inputs
|
| 299 | (list llvm clang-runtime))
|
| 300 | (arguments
|
| 301 | `( |
| 302 | #:tests? #f
|
| 303 |
|
| 304 | #:configure-flags
|
| 305 | (list "-DCLANG_INCLUDE_TESTS=True"
|
| 306 |
|
| 307 | |
| 308 | |
| 309 | ,@(if (version>=? version "19")
|
| 310 | '("-DUSE_DEPRECATED_GCC_INSTALL_PREFIX=ON")
|
| 311 | '())
|
| 312 | |
| 313 | (string-append "-DGCC_INSTALL_PREFIX="
|
| 314 | (assoc-ref %build-inputs "gcc-lib"))
|
| 315 |
|
| 316 | |
| 317 | (string-append "-DC_INCLUDE_DIRS="
|
| 318 | (assoc-ref %build-inputs "libc")
|
| 319 | "/include")
|
| 320 | ,@(if (target-riscv64?)
|
| 321 | (list "-DLIBOMP_LIBFLAGS=-latomic"
|
| 322 | "-DCMAKE_SHARED_LINKER_FLAGS=-latomic")
|
| 323 | `())
|
| 324 | ,@(if legacy-build-shared-libs?
|
| 325 | '()
|
| 326 | (list "-DCLANG_LINK_CLANG_DYLIB=ON")))
|
| 327 |
|
| 328 | ,@(if (target-riscv64?)
|
| 329 | `(#:make-flags '("LDFLAGS=-latomic"))
|
| 330 | '())
|
| 331 |
|
| 332 | |
| 333 | #:build-type "Release"
|
| 334 |
|
| 335 | #:phases (modify-phases %standard-phases
|
| 336 | ,@(if tools-extra
|
| 337 | (if (version>=? version "22")
|
| 338 | `((add-after 'unpack 'add-tools-extra
|
| 339 | (lambda* (#:key inputs #:allow-other-keys)
|
| 340 | (copy-recursively "../clang-tools-extra" "tools/extra"))))
|
| 341 | `((add-after 'unpack 'add-tools-extra
|
| 342 | (lambda* (#:key inputs #:allow-other-keys)
|
| 343 | |
| 344 | |
| 345 | (let ((extra (assoc-ref inputs
|
| 346 | "clang-tools-extra")))
|
| 347 | (invoke "tar" "xf" extra)
|
| 348 | (rename-file ,(string-append
|
| 349 | "clang-tools-extra-"
|
| 350 | (string-delete #\- (package-version llvm))
|
| 351 | ".src")
|
| 352 | "tools/extra")
|
| 353 | ,@(if legacy-build-shared-libs?
|
| 354 | |
| 355 | '((substitute* "cmake/modules/AddClang.cmake"
|
| 356 | (("BUILD_SHARED_LIBS") "True")))
|
| 357 | '())
|
| 358 | #t)))))
|
| 359 | '())
|
| 360 | (add-after 'unpack 'add-missing-triplets
|
| 361 | (lambda _
|
| 362 | |
| 363 | |
| 364 | |
| 365 | (substitute* ,@(if (version>=? version "6.0")
|
| 366 | '("lib/Driver/ToolChains/Gnu.cpp")
|
| 367 | '("lib/Driver/ToolChains.cpp"))
|
| 368 | (("\"aarch64-linux-gnu\"," all)
|
| 369 | (string-append "\"aarch64-unknown-linux-gnu\", "
|
| 370 | all))
|
| 371 | (("\"arm-linux-gnueabihf\"," all)
|
| 372 | (string-append all
|
| 373 | " \"arm-unknown-linux-gnueabihf\","))
|
| 374 | (("\"i686-pc-linux-gnu\"," all)
|
| 375 | (string-append "\"i686-unknown-linux-gnu\", "
|
| 376 | all)))
|
| 377 | #t))
|
| 378 | (add-after 'unpack 'set-glibc-file-names
|
| 379 | (lambda* (#:key inputs #:allow-other-keys)
|
| 380 | (let ((libc (assoc-ref inputs "libc"))
|
| 381 | (compiler-rt (assoc-ref inputs "clang-runtime"))
|
| 382 | (gcc (assoc-ref inputs "gcc")))
|
| 383 | ,@(cond
|
| 384 | ((version>=? version "6.0")
|
| 385 | `( |
| 386 | (substitute* "lib/Driver/ToolChain.cpp"
|
| 387 | (("getDriver\\(\\)\\.ResourceDir")
|
| 388 | (string-append "\"" compiler-rt "\"")))
|
| 389 |
|
| 390 | |
| 391 | |
| 392 | (substitute* "lib/Driver/ToolChains/Linux.cpp"
|
| 393 | (("(^[[:blank:]]+LibDir = ).*" _ declaration)
|
| 394 | (string-append declaration "\"" libc "/lib\";\n"))
|
| 395 |
|
| 396 | |
| 397 | |
| 398 | (("LibStdCXXIncludePathCandidates\\[\\] = \\{")
|
| 399 | (string-append
|
| 400 | "LibStdCXXIncludePathCandidates[] = { \"" gcc
|
| 401 | "/include/c++\","))
|
| 402 |
|
| 403 | |
| 404 | |
| 405 | (("@GLIBC_LIBDIR@")
|
| 406 | (string-append libc "/lib")))))
|
| 407 | (else
|
| 408 | `((substitute* "lib/Driver/Tools.cpp"
|
| 409 | |
| 410 | |
| 411 | (("/lib64/ld-linux-x86-64.so.2")
|
| 412 | (string-append libc
|
| 413 | ,(glibc-dynamic-linker))))
|
| 414 |
|
| 415 | |
| 416 | |
| 417 | ,@(if (version>=? version "3.8")
|
| 418 | '((substitute* "lib/Driver/Tools.cpp"
|
| 419 | (("TC\\.getDriver\\(\\)\\.ResourceDir")
|
| 420 | (string-append "\"" compiler-rt "\""))))
|
| 421 | '((substitute* "lib/Driver/ToolChain.cpp"
|
| 422 | (("getDriver\\(\\)\\.ResourceDir")
|
| 423 | (string-append "\"" compiler-rt "\"")))))
|
| 424 |
|
| 425 | |
| 426 | |
| 427 | (substitute* "lib/Driver/ToolChains.cpp"
|
| 428 | (("@GLIBC_LIBDIR@")
|
| 429 | (string-append libc "/lib"))))))
|
| 430 | #t)))
|
| 431 | ,@(if (version>=? version "17")
|
| 432 | '((add-after 'unpack 'include-test-runner
|
| 433 | (lambda _
|
| 434 | (substitute* "CMakeLists.txt"
|
| 435 | ((".*llvm_gtest" line)
|
| 436 | (string-append
|
| 437 | "add_subdirectory(${LLVM_THIRD_PARTY_DIR}/uni\
|
| 438 | ttest third-party/unittest)\n" line))))))
|
| 439 | '())
|
| 440 | |
| 441 | ,@(if (and (version>=? version "15")
|
| 442 | (target-x86-32?))
|
| 443 | '((delete 'make-dynamic-linker-cache))
|
| 444 | '())
|
| 445 | |
| 446 | |
| 447 | |
| 448 | |
| 449 | ,@(if (version>=? version "14")
|
| 450 | '((add-after 'unpack 'change-directory
|
| 451 | (lambda _
|
| 452 | (chdir "clang"))))
|
| 453 | '())
|
| 454 | ,@(if (version>=? version "10")
|
| 455 | `((add-after 'install 'adjust-cmake-file
|
| 456 | (lambda* (#:key outputs #:allow-other-keys)
|
| 457 | (let ((out (assoc-ref outputs "out")))
|
| 458 | |
| 459 | |
| 460 | |
| 461 | |
| 462 | |
| 463 | |
| 464 | |
| 465 | |
| 466 | |
| 467 | (substitute*
|
| 468 | (string-append
|
| 469 | out
|
| 470 | "/lib/cmake/clang/ClangTargets-release.cmake")
|
| 471 | (("list\\(APPEND _IMPORT_CHECK_TARGETS.*" all)
|
| 472 | (string-append "# Disabled by Guix.\n#" all)))
|
| 473 | #t))))
|
| 474 | '())
|
| 475 | ,@(if (version>? version "3.8")
|
| 476 | `((add-after 'install 'symlink-cfi_ignorelist
|
| 477 | (lambda* (#:key inputs outputs #:allow-other-keys)
|
| 478 | (let* ((out (assoc-ref outputs "out"))
|
| 479 | (lib-share (string-append out "/lib/clang/"
|
| 480 | ,version "/share"))
|
| 481 | (compiler-rt (assoc-ref inputs "clang-runtime"))
|
| 482 | (file-name ,(if (version>=? version "13")
|
| 483 | "cfi_ignorelist.txt"
|
| 484 | "cfi_blacklist.txt"))
|
| 485 | |
| 486 | (cfi-ignorelist
|
| 487 | (cond
|
| 488 | ((file-exists?
|
| 489 | (string-append compiler-rt "/" file-name))
|
| 490 | (string-append compiler-rt "/" file-name))
|
| 491 | (else (string-append compiler-rt
|
| 492 | "/share/" file-name)))))
|
| 493 | (mkdir-p lib-share)
|
| 494 | |
| 495 | |
| 496 | |
| 497 | |
| 498 | (when (file-exists? cfi-ignorelist)
|
| 499 | (symlink cfi-ignorelist
|
| 500 | (string-append lib-share "/" file-name)))))))
|
| 501 | '())
|
| 502 | (add-after 'install 'install-clean-up-/share/clang
|
| 503 | (lambda* (#:key outputs #:allow-other-keys)
|
| 504 | (let* ((out (assoc-ref outputs "out"))
|
| 505 | (compl-dir (string-append
|
| 506 | out "/etc/bash_completion.d")))
|
| 507 | (with-directory-excursion (string-append out
|
| 508 | "/share/clang")
|
| 509 | (for-each
|
| 510 | (lambda (file)
|
| 511 | (when (file-exists? file)
|
| 512 | (delete-file file)))
|
| 513 | |
| 514 | '("clang-format-bbedit.applescript"
|
| 515 | "clang-format-sublime.py"
|
| 516 | |
| 517 | |
| 518 | "clang-rename.el" "clang-format.el"))
|
| 519 | |
| 520 | (when (file-exists? "bash-autocomplete.sh")
|
| 521 | (mkdir-p compl-dir)
|
| 522 | (rename-file "bash-autocomplete.sh"
|
| 523 | (string-append compl-dir "/clang")))))
|
| 524 | #t)))))
|
| 525 |
|
| 526 | |
| 527 | (native-search-paths %gcc-search-paths)
|
| 528 |
|
| 529 | (home-page "https://clang.llvm.org")
|
| 530 | (synopsis "C language family frontend for LLVM")
|
| 531 | (description
|
| 532 | "Clang is a compiler front end for the C, C++, Objective-C and
|
| 533 | Objective-C++ programming languages. It uses LLVM as its back end. The Clang
|
| 534 | project includes the Clang front end, the Clang static analyzer, and several
|
| 535 | code analysis tools.")
|
| 536 | (properties properties)
|
| 537 | (license (if (version>=? version "9.0")
|
| 538 | license:asl2.0 |
| 539 | license:ncsa))))
|
| 540 |
|
| 541 | (define (clang-properties version)
|
| 542 | "Return package properties for Clang VERSION."
|
| 543 | `((clang-compiler-cpu-architectures version)))
|
| 544 |
|
| 545 | (define-public (make-clang-toolchain clang libomp)
|
| 546 | (package
|
| 547 | (name (string-append (package-name clang) "-toolchain"))
|
| 548 | (version (package-version clang))
|
| 549 | (source #f)
|
| 550 | (build-system trivial-build-system)
|
| 551 | (arguments
|
| 552 | '(#:modules ((guix build union))
|
| 553 | #:builder (begin
|
| 554 | (use-modules (ice-9 match)
|
| 555 | (srfi srfi-26)
|
| 556 | (guix build union))
|
| 557 |
|
| 558 | (let ((out (assoc-ref %outputs "out")))
|
| 559 |
|
| 560 | (match %build-inputs
|
| 561 | (((names . directories) ...)
|
| 562 | (union-build out directories)))
|
| 563 |
|
| 564 | |
| 565 | |
| 566 | |
| 567 | (symlink "clang" (string-append out "/bin/cc"))
|
| 568 | (symlink "clang++" (string-append out "/bin/c++"))
|
| 569 |
|
| 570 | (union-build (assoc-ref %outputs "debug")
|
| 571 | (list (assoc-ref %build-inputs
|
| 572 | "libc-debug")))
|
| 573 | (union-build (assoc-ref %outputs "static")
|
| 574 | (list (assoc-ref %build-inputs
|
| 575 | "libc-static")))
|
| 576 | #t))))
|
| 577 |
|
| 578 | (native-search-paths
|
| 579 | (append (package-native-search-paths clang)
|
| 580 | (list (search-path-specification |
| 581 | (variable "GUIX_LOCPATH")
|
| 582 | (files '("lib/locale"))))))
|
| 583 | (search-paths (package-search-paths clang))
|
| 584 |
|
| 585 | (license (package-license clang))
|
| 586 | (properties (package-properties clang)) |
| 587 | (home-page "https://clang.llvm.org")
|
| 588 | (synopsis "Complete Clang toolchain for C/C++ development")
|
| 589 | (description "This package provides a complete Clang toolchain for C/C++
|
| 590 | development to be installed in user profiles. This includes Clang, as well as
|
| 591 | libc (headers and binaries, plus debugging symbols in the @code{debug}
|
| 592 | output), and Binutils.")
|
| 593 | (outputs '("out" "debug" "static"))
|
| 594 | (inputs `(("clang" ,clang)
|
| 595 | ("ld-wrapper" ,(car (assoc-ref (%final-inputs) "ld-wrapper")))
|
| 596 | ("binutils" ,binutils)
|
| 597 | ("libomp" ,libomp) |
| 598 | ("libc" ,glibc)
|
| 599 | ("libc-debug" ,glibc "debug")
|
| 600 | ("libc-static" ,glibc "static")))))
|
| 601 |
|
| 602 | (define %llvm-monorepo-hashes
|
| 603 | '(("14.0.6" . "14f8nlvnmdkp9a9a79wv67jbmafvabczhah8rwnqrgd5g3hfxxxx")
|
| 604 | ("15.0.7" . "12sggw15sxq1krh1mfk3c1f07h895jlxbcifpwk3pznh4m1rjfy2")
|
| 605 | ("16.0.6" . "0jxmapg7shwkl88m4mqgfjv4ziqdmnppxhjz6vz51ycp2x4nmjky")
|
| 606 | ("17.0.6" . "1a7rq3rgw5vxm8y39fyzr4kv7w97lli4a0c1qrkchwk8p0n07hgh")
|
| 607 | ("18.1.8" . "1l9wm0g9jrpdf309kxjx7xrzf13h81kz8bbp0md14nrz38qll9la")
|
| 608 | ("19.1.7" . "18hkfhsm88bh3vnj21q7f118vrcnf7z6q1ylnwbknyb3yvk0343i")
|
| 609 | ("20.1.8" . "0v0lwf58i96vcwsql3hlgy72z3ncfvqwgyghyn26m2ri8vy83k6a")
|
| 610 | ("21.1.8" . "0v99a90546lrd3cxgam32c0jcnwzi0ljk0ihdvd9xghzss1pq1x6")
|
| 611 | ("22.1.8" . "1rww5cs3rw2yyjnz84ywlpkcvh46p1m9ac1nkhwprjbjw2vwv20q")
|
| 612 | ("23.1.1" . "0nyr1k7324qv7xa4r1sn4mvw47y7sswhax6fgmq3lnh4x7qbavnw")))
|
| 613 |
|
| 614 | (define %llvm-patches
|
| 615 | '(("14.0.6" . ("clang-14.0-libc-search-path.patch"
|
| 616 | "clang-runtime-14-glibc-2.36-compat.patch"
|
| 617 | "clang-14-remove-crypt-interceptors.patch"))
|
| 618 | ("15.0.7" . ("clang-15.0-libc-search-path.patch"
|
| 619 | "clang-16-remove-crypt-interceptors.patch"))
|
| 620 | ("16.0.6" . ("clang-16.0-libc-search-path.patch"
|
| 621 | "clang-16-remove-crypt-interceptors.patch"))
|
| 622 | ("17.0.6" . ("clang-17.0-libc-search-path.patch"
|
| 623 | "clang-17.0-link-dsymutil-latomic.patch"))
|
| 624 | ("18.1.8" . ("clang-18.0-libc-search-path.patch"
|
| 625 | "clang-17.0-link-dsymutil-latomic.patch"))
|
| 626 | ("19.1.7" . ("clang-18.0-libc-search-path.patch"
|
| 627 | "clang-17.0-link-dsymutil-latomic.patch"))
|
| 628 | ("20.1.8" . ("clang-18.0-libc-search-path.patch"
|
| 629 | "clang-17.0-link-dsymutil-latomic.patch"))
|
| 630 | ("21.1.8" . ("clang-18.0-libc-search-path.patch"
|
| 631 | "clang-17.0-link-dsymutil-latomic.patch"))
|
| 632 | ("22.1.8" . ("clang-18.0-libc-search-path.patch"
|
| 633 | "clang-17.0-link-dsymutil-latomic.patch"
|
| 634 | "llvm-22-cfloat128-detection.patch"))
|
| 635 | ("23.1.1" . ("clang-18.0-libc-search-path.patch"
|
| 636 | "clang-17.0-link-dsymutil-latomic.patch"))))
|
| 637 |
|
| 638 | (define (llvm-monorepo version)
|
| 639 | (origin
|
| 640 | (method git-fetch)
|
| 641 | (uri (git-reference
|
| 642 | (url "https://github.com/llvm/llvm-project")
|
| 643 | (commit (string-append "llvmorg-" version))))
|
| 644 | (file-name (git-file-name "llvm-project" version))
|
| 645 | (sha256 (base32 (assoc-ref %llvm-monorepo-hashes version)))
|
| 646 | (patches (map search-patch (assoc-ref %llvm-patches version)))))
|
| 647 |
|
| 648 | |
| 649 | (define make-llvm
|
| 650 | (mlambda (version)
|
| 651 | (package
|
| 652 | (name "llvm")
|
| 653 | (version version)
|
| 654 | (source (llvm-monorepo version))
|
| 655 | (build-system cmake-build-system)
|
| 656 | (outputs '("out" "opt-viewer"))
|
| 657 | (arguments
|
| 658 | (list
|
| 659 | #:tests? (not (or (%current-target-system)
|
| 660 | (target-x86-32?)))
|
| 661 | #:configure-flags
|
| 662 | #~(list
|
| 663 | |
| 664 | |
| 665 | #$@(if (%current-target-system)
|
| 666 | (or (and=>
|
| 667 | (system->llvm-target-arch)
|
| 668 | (lambda (llvm-target-arch)
|
| 669 | #~((string-append "-DLLVM_TABLEGEN="
|
| 670 | #+(file-append this-package
|
| 671 | "/bin/llvm-tblgen"))
|
| 672 | #$@(if (version>=? version "16.0")
|
| 673 | #~((string-append
|
| 674 | "-DLLVM_NATIVE_TOOL_DIR="
|
| 675 | #+(file-append this-package "/bin")))
|
| 676 | #~())
|
| 677 | #$@(if (version>=? version "17.0")
|
| 678 | #~((string-append "-DLLVM_HOST_TRIPLE="
|
| 679 | #$(%current-target-system)))
|
| 680 | #~((string-append "-DLLVM_DEFAULT_TARGET_TRIPLE="
|
| 681 | #$(%current-target-system))
|
| 682 | (string-append "-DLLVM_TARGET_ARCH="
|
| 683 | #$llvm-target-arch)))
|
| 684 | #$(string-append "-DLLVM_TARGETS_TO_BUILD="
|
| 685 | (system->llvm-target)))))
|
| 686 | (raise (condition
|
| 687 | (&package-unsupported-target-error
|
| 688 | (package this-package)
|
| 689 | (target (%current-target-system))))))
|
| 690 | '())
|
| 691 | |
| 692 | |
| 693 | |
| 694 | "-DLLVM_BUILD_LLVM_DYLIB=ON"
|
| 695 | "-DLLVM_LINK_LLVM_DYLIB=ON"
|
| 696 | "-DLLVM_ENABLE_FFI=ON"
|
| 697 | "-DLLVM_ENABLE_RTTI=ON" |
| 698 | "-DLLVM_INSTALL_UTILS=ON" |
| 699 | "-DLLVM_PARALLEL_LINK_JOBS=1") |
| 700 | |
| 701 | #:build-type "Release"
|
| 702 | #:modules '((guix build cmake-build-system)
|
| 703 | ((guix build gnu-build-system) #:prefix gnu:)
|
| 704 | (guix build utils))
|
| 705 | #:phases
|
| 706 | #~(modify-phases %standard-phases
|
| 707 | (add-after 'unpack 'change-directory
|
| 708 | (lambda _
|
| 709 | (chdir "llvm")))
|
| 710 | (replace 'check
|
| 711 | (lambda* (#:rest args)
|
| 712 | (setenv "HOME" "/tmp")
|
| 713 | (apply (assoc-ref gnu:%standard-phases 'check)
|
| 714 | #:test-target "check-llvm" args)))
|
| 715 | (add-after 'install 'install-opt-viewer
|
| 716 | (lambda* (#:key outputs #:allow-other-keys)
|
| 717 | (let* ((opt-viewer-share (string-append #$output:opt-viewer
|
| 718 | "/share")))
|
| 719 | (mkdir-p opt-viewer-share)
|
| 720 | (rename-file (string-append #$output "/share/opt-viewer")
|
| 721 | opt-viewer-share))))
|
| 722 | |
| 723 | #$@(if (and (version>=? version "15.0")
|
| 724 | (target-x86-32?))
|
| 725 | #~((delete 'make-dynamic-linker-cache))
|
| 726 | #~()))))
|
| 727 | (native-inputs (list python-wrapper perl))
|
| 728 | (inputs (list libffi))
|
| 729 | (propagated-inputs (list zlib)) |
| 730 | (home-page "https://www.llvm.org")
|
| 731 | (synopsis "Optimizing compiler infrastructure")
|
| 732 | (description
|
| 733 | "LLVM is a compiler infrastructure designed for compile-time, link-time,
|
| 734 | runtime, and idle-time optimization of programs from arbitrary programming
|
| 735 | languages. It currently supports compilation of C and C++ programs, using
|
| 736 | front-ends derived from GCC 4.0.1. A new front-end for the C family of
|
| 737 | languages is in development. The compiler infrastructure includes mirror sets
|
| 738 | of programming tools as well as libraries with equivalent functionality.")
|
| 739 | (license license:asl2.0)
|
| 740 | (properties `((release-monitoring-url . ,%llvm-release-monitoring-url))))))
|
| 741 |
|
| 742 | (define-public llvm-15
|
| 743 | (make-llvm "15.0.7"))
|
| 744 |
|
| 745 | (define-public llvm-14
|
| 746 | (package
|
| 747 | (inherit llvm-15)
|
| 748 | (version "14.0.6")
|
| 749 | (source (llvm-monorepo version))
|
| 750 | (arguments
|
| 751 | (list
|
| 752 | #:modules '((guix build cmake-build-system)
|
| 753 | ((guix build gnu-build-system) #:prefix gnu:)
|
| 754 | (guix build utils))
|
| 755 | #:tests? (not (or (%current-target-system)
|
| 756 | (target-x86-32?)))
|
| 757 | #:configure-flags
|
| 758 | #~(list
|
| 759 | |
| 760 | |
| 761 | #$@(if (%current-target-system)
|
| 762 | (or (and=>
|
| 763 | (system->llvm-target-arch)
|
| 764 | (lambda (llvm-target-arch)
|
| 765 | #~((string-append "-DLLVM_TABLEGEN="
|
| 766 | #+(file-append this-package
|
| 767 | "/bin/llvm-tblgen"))
|
| 768 | #$(string-append "-DLLVM_DEFAULT_TARGET_TRIPLE="
|
| 769 | (%current-target-system))
|
| 770 | #$(string-append "-DLLVM_TARGET_ARCH=" llvm-target-arch)
|
| 771 | #$(string-append "-DLLVM_TARGETS_TO_BUILD="
|
| 772 | (system->llvm-target)))))
|
| 773 | (raise (condition
|
| 774 | (&package-unsupported-target-error
|
| 775 | (package this-package)
|
| 776 | (target (%current-target-system))))))
|
| 777 | '())
|
| 778 | |
| 779 | #$@(if (target-ppc32?)
|
| 780 | (list "-DCMAKE_SHARED_LINKER_FLAGS=-latomic")
|
| 781 | `())
|
| 782 | "-DCMAKE_SKIP_BUILD_RPATH=FALSE"
|
| 783 | "-DCMAKE_BUILD_WITH_INSTALL_RPATH=FALSE"
|
| 784 | "-DBUILD_SHARED_LIBS:BOOL=TRUE"
|
| 785 | "-DLLVM_ENABLE_FFI:BOOL=TRUE"
|
| 786 | "-DLLVM_ENABLE_RTTI:BOOL=TRUE" |
| 787 | "-DLLVM_INSTALL_UTILS=ON") |
| 788 | |
| 789 | #:build-type "Release"
|
| 790 | #:phases
|
| 791 | #~(modify-phases %standard-phases
|
| 792 | (add-after 'unpack 'change-directory
|
| 793 | (lambda _
|
| 794 | (chdir "llvm")))
|
| 795 | (replace 'check
|
| 796 | (lambda* (#:rest args)
|
| 797 | (setenv "HOME" "/tmp")
|
| 798 | (apply (assoc-ref gnu:%standard-phases 'check)
|
| 799 | #:test-target "check-llvm" args)))
|
| 800 | (add-after 'install 'install-opt-viewer
|
| 801 | (lambda* (#:key outputs #:allow-other-keys)
|
| 802 | (let* ((out (assoc-ref outputs "out"))
|
| 803 | (opt-viewer-out (assoc-ref outputs "opt-viewer"))
|
| 804 | (opt-viewer-share-dir (string-append opt-viewer-out "/share"))
|
| 805 | (opt-viewer-dir (string-append opt-viewer-share-dir "/opt-viewer")))
|
| 806 | (mkdir-p opt-viewer-share-dir)
|
| 807 | (rename-file (string-append out "/share/opt-viewer")
|
| 808 | opt-viewer-dir)))))))
|
| 809 |
|
| 810 | (native-inputs (list perl python-wrapper which))))
|
| 811 |
|
| 812 | (define-public clang-runtime-15
|
| 813 | (clang-runtime-from-llvm llvm-15))
|
| 814 |
|
| 815 | (define-public clang-runtime-14
|
| 816 | (clang-runtime-from-llvm llvm-14))
|
| 817 |
|
| 818 | (define-public clang-15
|
| 819 | (clang-from-llvm
|
| 820 | llvm-15 clang-runtime-15
|
| 821 | #:tools-extra
|
| 822 | (origin
|
| 823 | (method url-fetch)
|
| 824 | (uri (llvm-uri "clang-tools-extra"
|
| 825 | (package-version llvm-15)))
|
| 826 | (sha256
|
| 827 | (base32
|
| 828 | "1lagnspm5limxh1cp5jlixnzlhf09905d4rqra1kpgj6dps2x6l0")))))
|
| 829 |
|
| 830 | (define-public clang-14
|
| 831 | (clang-from-llvm
|
| 832 | llvm-14 clang-runtime-14
|
| 833 | #:legacy-build-shared-libs? #t
|
| 834 | #:tools-extra
|
| 835 | (origin
|
| 836 | (method url-fetch)
|
| 837 | (uri (llvm-uri "clang-tools-extra"
|
| 838 | (package-version llvm-14)))
|
| 839 | (sha256
|
| 840 | (base32
|
| 841 | "0rhq4wkmvr369nkk059skzzw7jx6qhzqhmiwmqg4sp66avzviwvw")))))
|
| 842 |
|
| 843 | (define-public libomp-15
|
| 844 | (package
|
| 845 | (name "libomp")
|
| 846 | (version (package-version llvm-15))
|
| 847 | (source (llvm-monorepo version))
|
| 848 | (build-system cmake-build-system)
|
| 849 | |
| 850 | |
| 851 | (arguments
|
| 852 | (list
|
| 853 | #:configure-flags
|
| 854 | #~(list "-DLIBOMP_USE_HWLOC=ON"
|
| 855 | "-DOPENMP_TEST_C_COMPILER=clang"
|
| 856 | "-DOPENMP_TEST_CXX_COMPILER=clang++")
|
| 857 | #:modules '((guix build cmake-build-system)
|
| 858 | ((guix build gnu-build-system) #:prefix gnu:)
|
| 859 | (guix build utils))
|
| 860 | #:phases
|
| 861 | #~(modify-phases %standard-phases
|
| 862 | (add-after 'unpack 'chdir-to-source-and-install-license
|
| 863 | (lambda _
|
| 864 | (chdir "openmp")
|
| 865 | (install-file "LICENSE.TXT"
|
| 866 | (string-append #$output "/share/doc"))))
|
| 867 | (replace 'check
|
| 868 | (lambda* (#:rest args)
|
| 869 | (apply (assoc-ref gnu:%standard-phases 'check)
|
| 870 | #:test-target "check-libomp" args))))))
|
| 871 | (native-inputs (list clang-15 llvm-15 perl pkg-config python))
|
| 872 | (inputs (list `(,hwloc "lib")))
|
| 873 | (home-page "https://openmp.llvm.org")
|
| 874 | (synopsis "OpenMP run-time support library")
|
| 875 | (description "This package provides the run-time support library developed
|
| 876 | by the LLVM project for the OpenMP multi-theaded programming extension. This
|
| 877 | package notably provides @file{libgomp.so}, which is has a binary interface
|
| 878 | compatible with that of libgomp, the GNU Offloading and Multi Processing
|
| 879 | Library.")
|
| 880 | (properties `((release-monitoring-url . ,%llvm-release-monitoring-url)
|
| 881 | (upstream-name . "openmp")))
|
| 882 | (license license:expat)))
|
| 883 |
|
| 884 | (define-public clang-toolchain-15
|
| 885 | (make-clang-toolchain clang-15 libomp-15))
|
| 886 |
|
| 887 | (define-public libomp-14
|
| 888 | (package
|
| 889 | (inherit libomp-15)
|
| 890 | (version (package-version llvm-14))
|
| 891 | (source (origin
|
| 892 | (method url-fetch)
|
| 893 | (uri (llvm-uri "openmp" version))
|
| 894 | (sha256
|
| 895 | (base32
|
| 896 | "07zby3gwy5c8jssabrhjk3nsxlwipnm6sk4dsvck1l5d0br1ywsg"))
|
| 897 | (file-name (string-append "libomp-" version ".tar.xz"))))
|
| 898 | (arguments
|
| 899 | (substitute-keyword-arguments arguments
|
| 900 | ((#:phases phases)
|
| 901 | #~(modify-phases #$phases
|
| 902 | (replace 'chdir-to-source-and-install-license
|
| 903 | (lambda _
|
| 904 | (chdir #$(string-append "../openmp-" version ".src"))
|
| 905 | (install-file "LICENSE.TXT"
|
| 906 | (string-append #$output "/share/doc"))))))))
|
| 907 | (native-inputs
|
| 908 | (modify-inputs native-inputs
|
| 909 | (replace "clang" clang-14)
|
| 910 | (replace "llvm" llvm-14)))))
|
| 911 |
|
| 912 | (define-public clang-toolchain-14
|
| 913 | (make-clang-toolchain clang-14 libomp-14))
|
| 914 |
|
| 915 | (define-public llvm-13
|
| 916 | (package
|
| 917 | (inherit llvm-14)
|
| 918 | (version "13.0.1")
|
| 919 | (source
|
| 920 | (origin
|
| 921 | (method url-fetch)
|
| 922 | (uri (llvm-uri "llvm" version))
|
| 923 | (sha256
|
| 924 | (base32
|
| 925 | "0d681xiixmx9inwvz14vi3xsznrcryk06a8rvk9cljiq5kc80szc"))
|
| 926 | (patches (search-patches "llvm-13-gcc-14.patch"))))
|
| 927 | (arguments
|
| 928 | (substitute-keyword-arguments arguments
|
| 929 | ((#:tests? _ #t)
|
| 930 | |
| 931 | |
| 932 | (not (or (%current-target-system)
|
| 933 | (target-x86-32?)
|
| 934 | (target-riscv64?))))
|
| 935 | ((#:phases phases '%standard-phases)
|
| 936 | #~(modify-phases #$phases
|
| 937 | (delete 'change-directory)))))
|
| 938 | (properties `((release-monitoring-url . ,%llvm-release-monitoring-url)))))
|
| 939 |
|
| 940 | (define-public clang-runtime-13
|
| 941 | (clang-runtime-from-llvm
|
| 942 | llvm-13
|
| 943 | "1z2xr9nn4mgc3hn9ark2k5y4wznpk47xppkp63bcbagr6589acvv"
|
| 944 | '("clang-runtime-13-glibc-2.36-compat.patch"
|
| 945 | "clang-13-remove-crypt-interceptors.patch")))
|
| 946 |
|
| 947 | (define-public clang-13
|
| 948 | (clang-from-llvm llvm-13 clang-runtime-13
|
| 949 | "1j8pr5kk8iqyb4jds3yl7c6x672617h4ngkpl4575j7mk4nrwykq"
|
| 950 | #:legacy-build-shared-libs? #t
|
| 951 | #:patches '("clang-13.0-libc-search-path.patch")
|
| 952 | #:tools-extra
|
| 953 | (origin
|
| 954 | (method url-fetch)
|
| 955 | (uri (llvm-uri "clang-tools-extra"
|
| 956 | (package-version llvm-13)))
|
| 957 | (sha256
|
| 958 | (base32
|
| 959 | "1l4jjdqfl9hrh0fwzv27hc263zc6x61h09vs4ni3yla8i1cwhayc")))))
|
| 960 |
|
| 961 | (define-public libomp-13
|
| 962 | (package
|
| 963 | (inherit libomp-14)
|
| 964 | (version (package-version llvm-13))
|
| 965 | (source (origin
|
| 966 | (method url-fetch)
|
| 967 | (uri (llvm-uri "openmp" version))
|
| 968 | (sha256
|
| 969 | (base32
|
| 970 | "0kvbr4j6ldpssiv7chgqra5y77n7jwbyxlwcl7z32v31f49jcybb"))
|
| 971 | (file-name (string-append "libomp-" version ".tar.xz"))))
|
| 972 | (arguments
|
| 973 | (substitute-keyword-arguments arguments
|
| 974 | ((#:configure-flags flags)
|
| 975 | |
| 976 | |
| 977 | #~(cons* "-DLIBOMPTARGET_BUILD_AMDGCN_BCLIB=OFF" #$flags))
|
| 978 | ((#:phases phases)
|
| 979 | #~(modify-phases #$phases
|
| 980 | (delete 'chdir-to-source-and-install-license)))))
|
| 981 | (native-inputs
|
| 982 | (modify-inputs native-inputs
|
| 983 | (replace "clang" clang-13)
|
| 984 | (replace "llvm" llvm-13)))))
|
| 985 |
|
| 986 | (define-public clang-toolchain-13
|
| 987 | (make-clang-toolchain clang-13 libomp-13))
|
| 988 |
|
| 989 | (define-public llvm-12
|
| 990 | (package
|
| 991 | (inherit llvm-13)
|
| 992 | (version "12.0.1")
|
| 993 | (source
|
| 994 | (origin
|
| 995 | (method url-fetch)
|
| 996 | (uri (llvm-uri "llvm" version))
|
| 997 | (sha256
|
| 998 | (base32
|
| 999 | "1pzx9zrmd7r3481sbhwvkms68fwhffpp4mmz45dgrkjpyl2q96kx"))
|
| 1000 | (patches (search-patches "llvm-13-gcc-14.patch"))))
|
| 1001 | (arguments
|
| 1002 | (substitute-keyword-arguments arguments
|
| 1003 | |
| 1004 | ((#:tests? _ #false) #false)
|
| 1005 | ((#:phases phases)
|
| 1006 | #~(modify-phases #$phases
|
| 1007 | #$@(if (assoc "config" (package-native-inputs this-package))
|
| 1008 | #~((add-after 'unpack 'update-config
|
| 1009 | (lambda* (#:key inputs native-inputs #:allow-other-keys)
|
| 1010 | (let ((config.guess (search-input-file
|
| 1011 | (or inputs native-inputs)
|
| 1012 | "/bin/config.guess")))
|
| 1013 | (copy-file config.guess "cmake/config.guess")))))
|
| 1014 | #~())
|
| 1015 | (add-after 'unpack 'delete-failing-tests
|
| 1016 | (lambda _
|
| 1017 | (delete-file "test/DebugInfo/X86/vla-multi.ll")))
|
| 1018 | (add-before 'build 'shared-lib-workaround
|
| 1019 | |
| 1020 | |
| 1021 | |
| 1022 | |
| 1023 | (lambda _
|
| 1024 | (setenv "LD_LIBRARY_PATH"
|
| 1025 | (string-append (getcwd) "/lib"))))))))))
|
| 1026 |
|
| 1027 | (define-public llvm-16
|
| 1028 | (make-llvm "16.0.6"))
|
| 1029 |
|
| 1030 | (define-public clang-runtime-16
|
| 1031 | (clang-runtime-from-llvm llvm-16))
|
| 1032 |
|
| 1033 | (define-public clang-16
|
| 1034 | (clang-from-llvm
|
| 1035 | llvm-16 clang-runtime-16
|
| 1036 | #:tools-extra
|
| 1037 | (origin
|
| 1038 | (method url-fetch)
|
| 1039 | (uri (llvm-uri "clang-tools-extra"
|
| 1040 | (package-version llvm-16)))
|
| 1041 | (sha256
|
| 1042 | (base32
|
| 1043 | "0cbgffciql06a1i0ybyyqbnkkr4g7x8cxaar5a5v3415vd27hk0p")))))
|
| 1044 |
|
| 1045 | (define-public libomp-16
|
| 1046 | (package
|
| 1047 | (inherit libomp-15)
|
| 1048 | (version (package-version llvm-16))
|
| 1049 | (source (llvm-monorepo version))
|
| 1050 | (native-inputs
|
| 1051 | (modify-inputs native-inputs
|
| 1052 | (replace "clang" clang-16)
|
| 1053 | (replace "llvm" llvm-16)))))
|
| 1054 |
|
| 1055 | (define-public clang-toolchain-16
|
| 1056 | (make-clang-toolchain clang-16 libomp-16))
|
| 1057 |
|
| 1058 | (define-public llvm-17
|
| 1059 | (make-llvm "17.0.6"))
|
| 1060 |
|
| 1061 | (define-public clang-runtime-17
|
| 1062 | (clang-runtime-from-llvm llvm-17))
|
| 1063 |
|
| 1064 | (define-public clang-17
|
| 1065 | (clang-from-llvm
|
| 1066 | llvm-17 clang-runtime-17
|
| 1067 | #:patches '("clang-17.0-fix-build-with-gcc-14-on-arm.patch")
|
| 1068 | #:tools-extra
|
| 1069 | (origin
|
| 1070 | (method url-fetch)
|
| 1071 | (uri (llvm-uri "clang-tools-extra"
|
| 1072 | (package-version llvm-17)))
|
| 1073 | (sha256
|
| 1074 | (base32
|
| 1075 | "1f8szx762c325916gjxb5lw7zxyidynwnvx6fxxqscsx8514cxxa")))))
|
| 1076 |
|
| 1077 | (define-public libomp-17
|
| 1078 | (package
|
| 1079 | (inherit libomp-15)
|
| 1080 | (version (package-version llvm-17))
|
| 1081 | (source (llvm-monorepo version))
|
| 1082 | (native-inputs
|
| 1083 | (modify-inputs native-inputs
|
| 1084 | (replace "clang" clang-17)
|
| 1085 | (replace "llvm" llvm-17)))))
|
| 1086 |
|
| 1087 | (define-public clang-toolchain-17
|
| 1088 | (make-clang-toolchain clang-17 libomp-17))
|
| 1089 |
|
| 1090 | (define-public llvm-18
|
| 1091 | (package
|
| 1092 | (inherit llvm-15)
|
| 1093 | (version "18.1.8")
|
| 1094 | (source (llvm-monorepo version))
|
| 1095 | (arguments
|
| 1096 | (substitute-keyword-arguments arguments
|
| 1097 | ((#:modules modules '((guix build cmake-build-system)
|
| 1098 | (guix build utils)))
|
| 1099 | (if (%current-target-system)
|
| 1100 | `((ice-9 regex)
|
| 1101 | (srfi srfi-1)
|
| 1102 | (srfi srfi-26)
|
| 1103 | ,@modules)
|
| 1104 | modules))
|
| 1105 | |
| 1106 | ((#:tests? current-test-config #t)
|
| 1107 | (and current-test-config
|
| 1108 | (not (target-ppc64le?))
|
| 1109 | (not (target-arm32?))))
|
| 1110 | ((#:configure-flags cf #~'())
|
| 1111 | (if (%current-target-system)
|
| 1112 | |
| 1113 | |
| 1114 | #~(cons* (string-append "-DLLVM_TABLEGEN="
|
| 1115 | #+(file-append this-package
|
| 1116 | "/bin/llvm-tblgen"))
|
| 1117 | (string-append "-DLLVM_NATIVE_TOOL_DIR="
|
| 1118 | #+(file-append this-package "/bin"))
|
| 1119 | (string-append "-DLLVM_HOST_TRIPLE="
|
| 1120 | #$(%current-target-system))
|
| 1121 | (remove
|
| 1122 | (cut string-match
|
| 1123 | "-DLLVM_(DEFAULT_TARGET|TARGET_ARCH|TABLEGEN).*" <>)
|
| 1124 | #$cf))
|
| 1125 | cf))
|
| 1126 | |
| 1127 | ((#:phases phases #~'%standard-phases)
|
| 1128 | (if (target-x86-32?)
|
| 1129 | #~(modify-phases #$phases
|
| 1130 | (delete 'make-dynamic-linker-cache))
|
| 1131 | phases))))))
|
| 1132 |
|
| 1133 | (define-public clang-runtime-18
|
| 1134 | (clang-runtime-from-llvm llvm-18))
|
| 1135 |
|
| 1136 | (define-public clang-18
|
| 1137 | (clang-from-llvm
|
| 1138 | llvm-18 clang-runtime-18
|
| 1139 | #:tools-extra
|
| 1140 | (origin
|
| 1141 | (method url-fetch)
|
| 1142 | (uri (llvm-uri "clang-tools-extra"
|
| 1143 | (package-version llvm-18)))
|
| 1144 | (sha256
|
| 1145 | (base32
|
| 1146 | "1wd7y1a0db4y51swlq6dmm9hrv8pvmv158yi9f10dlayv7y7g275")))))
|
| 1147 |
|
| 1148 | (define-public libomp-18
|
| 1149 | (package
|
| 1150 | (inherit libomp-15)
|
| 1151 | (version (package-version llvm-18))
|
| 1152 | (source (llvm-monorepo version))
|
| 1153 | (native-inputs
|
| 1154 | (modify-inputs native-inputs
|
| 1155 | (replace "clang" clang-18)
|
| 1156 | (replace "llvm" llvm-18)))))
|
| 1157 |
|
| 1158 | (define-public clang-toolchain-18
|
| 1159 | (make-clang-toolchain clang-18 libomp-18))
|
| 1160 |
|
| 1161 | (define-public llvm-19
|
| 1162 | (make-llvm "19.1.7"))
|
| 1163 |
|
| 1164 | (define-public clang-runtime-19
|
| 1165 | (clang-runtime-from-llvm llvm-19))
|
| 1166 |
|
| 1167 | (define-public clang-19
|
| 1168 | (clang-from-llvm
|
| 1169 | llvm-19 clang-runtime-19
|
| 1170 | #:tools-extra
|
| 1171 | (origin
|
| 1172 | (method url-fetch)
|
| 1173 | (uri (llvm-uri "clang-tools-extra"
|
| 1174 | (package-version llvm-19)))
|
| 1175 | (sha256
|
| 1176 | (base32
|
| 1177 | "1rqv769nvr07a9n1sgwbq5rm411x31kyq3ngls800m90z25hh2s3")))))
|
| 1178 |
|
| 1179 | (define-public libomp-19
|
| 1180 | (package
|
| 1181 | (inherit libomp-15)
|
| 1182 | (version (package-version llvm-19))
|
| 1183 | (source (llvm-monorepo version))
|
| 1184 | (native-inputs
|
| 1185 | (modify-inputs native-inputs
|
| 1186 | (replace "clang" clang-19)
|
| 1187 | (replace "llvm" llvm-19)))))
|
| 1188 |
|
| 1189 | (define-public clang-toolchain-19
|
| 1190 | (make-clang-toolchain clang-19 libomp-19))
|
| 1191 |
|
| 1192 | (define-public llvm-20
|
| 1193 | (make-llvm "20.1.8"))
|
| 1194 |
|
| 1195 | (define-public clang-runtime-20
|
| 1196 | (clang-runtime-from-llvm llvm-20))
|
| 1197 |
|
| 1198 | (define-public clang-20
|
| 1199 | (clang-from-llvm
|
| 1200 | llvm-20 clang-runtime-20
|
| 1201 | #:tools-extra
|
| 1202 | (origin
|
| 1203 | (method url-fetch)
|
| 1204 | (uri (llvm-uri "clang-tools-extra"
|
| 1205 | (package-version llvm-20)))
|
| 1206 | (sha256
|
| 1207 | (base32
|
| 1208 | "1z52ka12mg74n445yhzkn8ybqnh6awwc1lv9afdxg650higy2p3x")))))
|
| 1209 |
|
| 1210 | (define-public libomp-20
|
| 1211 | (package
|
| 1212 | (inherit libomp-15)
|
| 1213 | (version (package-version llvm-20))
|
| 1214 | (source (llvm-monorepo version))
|
| 1215 | (native-inputs
|
| 1216 | (modify-inputs native-inputs
|
| 1217 | (replace "clang" clang-20)
|
| 1218 | (replace "llvm" llvm-20)))))
|
| 1219 |
|
| 1220 | (define-public clang-toolchain-20
|
| 1221 | (make-clang-toolchain clang-20 libomp-20))
|
| 1222 |
|
| 1223 | (define-public llvm-21
|
| 1224 | (make-llvm "21.1.8"))
|
| 1225 |
|
| 1226 | (define-public clang-runtime-21
|
| 1227 | (clang-runtime-from-llvm llvm-21))
|
| 1228 |
|
| 1229 | (define-public clang-21
|
| 1230 | (clang-from-llvm
|
| 1231 | llvm-21 clang-runtime-21
|
| 1232 | #:tools-extra
|
| 1233 | (origin
|
| 1234 | (method url-fetch)
|
| 1235 | (uri (llvm-uri "clang-tools-extra"
|
| 1236 | (package-version llvm-21)))
|
| 1237 | (sha256
|
| 1238 | (base32
|
| 1239 | "0ac8qb3ajxh9xnlyk71ar599qvbbf0y8lbif2chvi6ph3drpxnvd")))))
|
| 1240 |
|
| 1241 | (define-public libomp-21
|
| 1242 | (package
|
| 1243 | (inherit libomp-15)
|
| 1244 | (version (package-version llvm-21))
|
| 1245 | (source (llvm-monorepo version))
|
| 1246 | (native-inputs
|
| 1247 | (modify-inputs native-inputs
|
| 1248 | (replace "clang" clang-21)
|
| 1249 | (replace "llvm" llvm-21)))))
|
| 1250 |
|
| 1251 | (define-public clang-toolchain-21
|
| 1252 | (make-clang-toolchain clang-21 libomp-21))
|
| 1253 |
|
| 1254 | (define-public llvm-22
|
| 1255 | (make-llvm "22.1.8"))
|
| 1256 |
|
| 1257 | (define-public clang-runtime-22
|
| 1258 | (clang-runtime-from-llvm llvm-22))
|
| 1259 |
|
| 1260 | (define-public clang-22
|
| 1261 | (clang-from-llvm
|
| 1262 | llvm-22 clang-runtime-22
|
| 1263 | |
| 1264 | |
| 1265 | |
| 1266 | #:tools-extra #t))
|
| 1267 |
|
| 1268 | (define-public libomp-22
|
| 1269 | (package
|
| 1270 | (inherit libomp-15)
|
| 1271 | (version (package-version llvm-22))
|
| 1272 | (source (llvm-monorepo version))
|
| 1273 | (native-inputs
|
| 1274 | (modify-inputs (package-native-inputs libomp-15)
|
| 1275 | (replace "clang" clang-22)
|
| 1276 | (replace "llvm" llvm-22)))))
|
| 1277 |
|
| 1278 | (define-public clang-toolchain-22
|
| 1279 | (make-clang-toolchain clang-22 libomp-22))
|
| 1280 |
|
| 1281 |
|
| 1282 | (define-public llvm-23
|
| 1283 | (make-llvm "23.1.1"))
|
| 1284 |
|
| 1285 | (define-public clang-runtime-23
|
| 1286 | (clang-runtime-from-llvm llvm-23))
|
| 1287 |
|
| 1288 | (define-public clang-23
|
| 1289 | (clang-from-llvm
|
| 1290 | llvm-23 clang-runtime-23
|
| 1291 | #:tools-extra #t))
|
| 1292 |
|
| 1293 | (define-public libomp-23
|
| 1294 | (package
|
| 1295 | (inherit libomp-15)
|
| 1296 | (version (package-version llvm-23))
|
| 1297 | (source (llvm-monorepo version))
|
| 1298 | (arguments (substitute-keyword-arguments arguments
|
| 1299 | ((#:configure-flags configure-flag #~())
|
| 1300 | #~(cons* "-DLLVM_ENABLE_RUNTIMES=openmp"
|
| 1301 | #$configure-flag))
|
| 1302 | ((#:phases phases)
|
| 1303 | #~(modify-phases #$phases
|
| 1304 | (replace 'chdir-to-source-and-install-license
|
| 1305 | (lambda _
|
| 1306 | (install-file "openmp/LICENSE.TXT"
|
| 1307 | (string-append #$output "/share/doc"))
|
| 1308 | (chdir "runtimes")))))))
|
| 1309 | (native-inputs
|
| 1310 | (modify-inputs (package-native-inputs libomp-15)
|
| 1311 | (replace "clang" clang-23)
|
| 1312 | (replace "llvm" llvm-23)))))
|
| 1313 |
|
| 1314 | (define-public clang-toolchain-23
|
| 1315 | (make-clang-toolchain clang-23 libomp-23))
|
| 1316 |
|
| 1317 | |
| 1318 | (define-public libomp libomp-22)
|
| 1319 | (define-public llvm llvm-22)
|
| 1320 | (define-public clang-runtime clang-runtime-22)
|
| 1321 | (define-public clang clang-22)
|
| 1322 | (define-public clang-toolchain clang-toolchain-22)
|
| 1323 |
|
| 1324 |
|
| 1325 |
|
| 1326 | |
| 1327 | |
| 1328 | |
| 1329 | |
| 1330 |
|
| 1331 | |
| 1332 | |
| 1333 | (define %rocm-llvm-version "7.1.1")
|
| 1334 |
|
| 1335 | (define %clang-rocm-supported-gpu-targets
|
| 1336 | |
| 1337 | |
| 1338 | |
| 1339 | |
| 1340 | |
| 1341 | |
| 1342 | |
| 1343 | |
| 1344 | '("bonaire"
|
| 1345 | "carrizo"
|
| 1346 | "fiji"
|
| 1347 | "generic"
|
| 1348 | "generic-hsa"
|
| 1349 | "gfx10-1-generic"
|
| 1350 | "gfx10-3-generic"
|
| 1351 | "gfx1010"
|
| 1352 | "gfx1011"
|
| 1353 | "gfx1012"
|
| 1354 | "gfx1013"
|
| 1355 | "gfx1030"
|
| 1356 | "gfx1031"
|
| 1357 | "gfx1032"
|
| 1358 | "gfx1033"
|
| 1359 | "gfx1034"
|
| 1360 | "gfx1035"
|
| 1361 | "gfx1036"
|
| 1362 | "gfx11-generic"
|
| 1363 | "gfx1100"
|
| 1364 | "gfx1101"
|
| 1365 | "gfx1102"
|
| 1366 | "gfx1103"
|
| 1367 | "gfx1150"
|
| 1368 | "gfx1151"
|
| 1369 | "gfx1152"
|
| 1370 | "gfx1153"
|
| 1371 | "gfx12-generic"
|
| 1372 | "gfx1200"
|
| 1373 | "gfx1201"
|
| 1374 | "gfx600"
|
| 1375 | "gfx601"
|
| 1376 | "gfx602"
|
| 1377 | "gfx700"
|
| 1378 | "gfx701"
|
| 1379 | "gfx702"
|
| 1380 | "gfx703"
|
| 1381 | "gfx704"
|
| 1382 | "gfx705"
|
| 1383 | "gfx801"
|
| 1384 | "gfx802"
|
| 1385 | "gfx803"
|
| 1386 | "gfx805"
|
| 1387 | "gfx810"
|
| 1388 | "gfx9-4-generic"
|
| 1389 | "gfx9-generic"
|
| 1390 | "gfx900"
|
| 1391 | "gfx902"
|
| 1392 | "gfx904"
|
| 1393 | "gfx906"
|
| 1394 | "gfx908"
|
| 1395 | "gfx909"
|
| 1396 | "gfx90a"
|
| 1397 | "gfx90c"
|
| 1398 | "gfx940"
|
| 1399 | "gfx941"
|
| 1400 | "gfx942"
|
| 1401 | "gfx950"
|
| 1402 | "hainan"
|
| 1403 | "hawaii"
|
| 1404 | "iceland"
|
| 1405 | "kabini"
|
| 1406 | "kaveri"
|
| 1407 | "mullins"
|
| 1408 | "oland"
|
| 1409 | "pitcairn"
|
| 1410 | "polaris10"
|
| 1411 | "polaris11"
|
| 1412 | "stoney"
|
| 1413 | "tahiti"
|
| 1414 | "tonga"
|
| 1415 | "tongapro"
|
| 1416 | "verde"))
|
| 1417 |
|
| 1418 | (define (make-llvm-rocm llvm-base)
|
| 1419 | (package
|
| 1420 | (inherit llvm-base)
|
| 1421 | |
| 1422 | |
| 1423 | (version %rocm-llvm-version)
|
| 1424 | (name "llvm-rocm")
|
| 1425 | (source (origin
|
| 1426 | (method git-fetch)
|
| 1427 | (uri (git-reference
|
| 1428 | (url "https://github.com/ROCm/llvm-project")
|
| 1429 | (commit (string-append "rocm-" %rocm-llvm-version))))
|
| 1430 | (file-name (git-file-name "rocm-llvm" %rocm-llvm-version))
|
| 1431 | (sha256
|
| 1432 | (base32
|
| 1433 | "0ni9s9sd8hlgmj34nkqn96kmbs6xlmrcsw8x5b15cisy2lhjgy89"))
|
| 1434 | |
| 1435 | |
| 1436 | |
| 1437 | |
| 1438 | |
| 1439 | |
| 1440 | (patches
|
| 1441 | (map search-patch
|
| 1442 | (cons
|
| 1443 | "clang-rocm-default-new-dtags.patch"
|
| 1444 | (assoc-ref %llvm-patches (package-version llvm-base)))))))
|
| 1445 | (arguments
|
| 1446 | (substitute-keyword-arguments arguments
|
| 1447 | ((#:configure-flags flags)
|
| 1448 | #~(append #$flags
|
| 1449 | (list #$(string-append
|
| 1450 | "-DLLVM_TARGETS_TO_BUILD=AMDGPU;X86"
|
| 1451 | (if (string=? "X86" (system->llvm-target))
|
| 1452 | ""
|
| 1453 | (string-append ";" (system->llvm-target))))
|
| 1454 | "-DLLVM_VERSION_SUFFIX=")))))
|
| 1455 | (properties `((hidden? . #t)
|
| 1456 | ,@(package-properties llvm-base)))
|
| 1457 | (home-page "https://github.com/ROCm/llvm-project")
|
| 1458 | (synopsis
|
| 1459 | (string-append (package-synopsis llvm-base) " (AMD fork)"))
|
| 1460 | (description
|
| 1461 | (string-append (package-description llvm-base) "
|
| 1462 |
|
| 1463 | This AMD fork includes AMD-specific additions."))))
|
| 1464 |
|
| 1465 | (define-public llvm-rocm (make-llvm-rocm llvm-20))
|
| 1466 |
|
| 1467 | (define (make-clang-runtime-rocm clang-runtime-base)
|
| 1468 | (package
|
| 1469 | (inherit clang-runtime-base)
|
| 1470 | (name "clang-runtime-rocm")
|
| 1471 | (version (package-version llvm-rocm))
|
| 1472 | (source (package-source llvm-rocm))
|
| 1473 | (inputs (modify-inputs inputs
|
| 1474 | (replace "llvm" llvm-rocm)))))
|
| 1475 |
|
| 1476 | (define-public clang-runtime-rocm (make-clang-runtime-rocm clang-runtime-20))
|
| 1477 |
|
| 1478 | (define (make-clang-rocm clang-base)
|
| 1479 | |
| 1480 | (package
|
| 1481 | (inherit clang-base)
|
| 1482 | (name "clang-rocm")
|
| 1483 | (version (package-version llvm-rocm))
|
| 1484 | (source (package-source llvm-rocm))
|
| 1485 | (inputs (modify-inputs inputs
|
| 1486 | (delete "clang-tools-extra")))
|
| 1487 | (propagated-inputs
|
| 1488 | (modify-inputs propagated-inputs
|
| 1489 | (replace "llvm" llvm-rocm)
|
| 1490 | (replace "clang-runtime" clang-runtime-rocm)
|
| 1491 | (append python-lit)))
|
| 1492 | (arguments
|
| 1493 | (substitute-keyword-arguments arguments
|
| 1494 | |
| 1495 | |
| 1496 | |
| 1497 | |
| 1498 | |
| 1499 | |
| 1500 | |
| 1501 | |
| 1502 | |
| 1503 | |
| 1504 | |
| 1505 | |
| 1506 | ((#:tests? _ #t) #f)
|
| 1507 | ((#:configure-flags flags)
|
| 1508 | #~(append #$flags
|
| 1509 | (list
|
| 1510 | "-DLLVM_TARGETS_TO_BUILD=AMDGPU;X86"
|
| 1511 | |
| 1512 | |
| 1513 | |
| 1514 | |
| 1515 | |
| 1516 | |
| 1517 | |
| 1518 | (string-append
|
| 1519 | "-DLLVM_EXTERNAL_LIT="
|
| 1520 | (search-input-file %build-inputs "bin/.lit-real")))))
|
| 1521 | ((#:phases phases '%standard-phases)
|
| 1522 | #~(modify-phases #$phases
|
| 1523 | (replace 'check
|
| 1524 | (lambda* (#:rest args)
|
| 1525 | (setenv "HOME" "/tmp")
|
| 1526 | (apply (assoc-ref
|
| 1527 | (@ (guix build gnu-build-system) %standard-phases)
|
| 1528 | 'check)
|
| 1529 | #:test-target "check-clang" args)))
|
| 1530 | (replace 'add-tools-extra
|
| 1531 | (lambda _
|
| 1532 | (copy-recursively "../clang-tools-extra" "tools/extra")))))))
|
| 1533 |
|
| 1534 | (properties
|
| 1535 | `((compiler-amd-gpu-targets . ,%clang-rocm-supported-gpu-targets)
|
| 1536 | ,@(package-properties clang-base)))))
|
| 1537 |
|
| 1538 | (define-public clang-rocm (make-clang-rocm clang-20))
|
| 1539 |
|
| 1540 | (define-public rocm-device-libs
|
| 1541 | (package
|
| 1542 | (name "rocm-device-libs")
|
| 1543 | (version (package-version llvm-rocm))
|
| 1544 | (source (package-source llvm-rocm))
|
| 1545 | (build-system cmake-build-system)
|
| 1546 | (arguments
|
| 1547 | (list
|
| 1548 | #:tests? #f |
| 1549 | #:build-type "Release"
|
| 1550 | #:phases
|
| 1551 | #~(modify-phases %standard-phases
|
| 1552 | (add-after 'unpack 'chdir
|
| 1553 | (lambda _
|
| 1554 | (chdir "amd/device-libs")))
|
| 1555 | (add-after 'install 'copy-include-directories
|
| 1556 | (lambda _
|
| 1557 | |
| 1558 | |
| 1559 | |
| 1560 | (with-directory-excursion "../device-libs"
|
| 1561 | (for-each
|
| 1562 | (lambda (directory)
|
| 1563 | (let ((include-directory (string-append directory "/inc")))
|
| 1564 | (copy-recursively
|
| 1565 | include-directory
|
| 1566 | (string-append #$output "/" include-directory))))
|
| 1567 | (list "irif" "oclc" "ockl" "ocml"))))))))
|
| 1568 | (inputs (list clang-rocm))
|
| 1569 | (home-page "https://github.com/ROCm/llvm-project/")
|
| 1570 | (synopsis "ROCm Device libraries")
|
| 1571 | (description "ROCm device libraries provide AMD-specific device-side language runtime
|
| 1572 | libraries, namely oclc, ocml, ockl, opencl, hip and hc.")
|
| 1573 | (license license:ncsa)))
|
| 1574 |
|
| 1575 | |
| 1576 | |
| 1577 | (define-public rocm-comgr
|
| 1578 | (package
|
| 1579 | (name "rocm-comgr")
|
| 1580 | (version (package-version llvm-rocm))
|
| 1581 | (source (package-source llvm-rocm))
|
| 1582 | (build-system cmake-build-system)
|
| 1583 | (arguments
|
| 1584 | (list
|
| 1585 | #:build-type "Release"
|
| 1586 | #:phases
|
| 1587 | #~(modify-phases %standard-phases
|
| 1588 | (add-after 'unpack 'prepare-to-build
|
| 1589 | (lambda _
|
| 1590 | (chdir "amd/comgr")
|
| 1591 | (setenv "ROCM_PATH"
|
| 1592 | #$(this-package-input "rocm-device-libs")))))))
|
| 1593 | (inputs (list libffi rocm-device-libs))
|
| 1594 | (native-inputs (list
|
| 1595 | clang-rocm
|
| 1596 | lld-rocm
|
| 1597 | python))
|
| 1598 | (home-page "https://github.com/ROCm/ROCm-CompilerSupport")
|
| 1599 | (synopsis "ROCm Code Object Manager")
|
| 1600 | (description "The Comgr library provides APIs for compiling and inspecting
|
| 1601 | AMDGPU code objects.")
|
| 1602 | (license license:ncsa)))
|
| 1603 |
|
| 1604 | (define-public rocm-hipcc
|
| 1605 | |
| 1606 | |
| 1607 | |
| 1608 | (hidden-package
|
| 1609 | (package
|
| 1610 | (name "rocm-hipcc")
|
| 1611 | (version (package-version llvm-rocm))
|
| 1612 | (source (package-source llvm-rocm))
|
| 1613 | (build-system cmake-build-system)
|
| 1614 | (arguments
|
| 1615 | (list
|
| 1616 | #:tests? #f |
| 1617 | #:build-type "Release"
|
| 1618 | #:phases
|
| 1619 | #~(modify-phases %standard-phases
|
| 1620 | (add-after 'unpack 'chdir
|
| 1621 | (lambda _
|
| 1622 | (chdir "amd/hipcc")))
|
| 1623 | (add-after 'chdir 'patch-paths
|
| 1624 | (lambda* (#:key inputs #:allow-other-keys)
|
| 1625 | (substitute* (find-files "src" "\\.h$")
|
| 1626 | (("roccmPath \\+ \"/bin/rocm_agent_enumerator\"")
|
| 1627 | (format #f "~s" (search-input-file
|
| 1628 | inputs
|
| 1629 | "/bin/rocm_agent_enumerator"))))
|
| 1630 | (substitute* "src/hipBin_amd.h"
|
| 1631 | (("which hipconfig")
|
| 1632 | (string-append (search-input-file inputs "/bin/which")
|
| 1633 | " hipconfig"))
|
| 1634 | |
| 1635 | |
| 1636 | (("constructHipPath\\(\\);\n" all)
|
| 1637 | (string-append all " constructHsaPath();\n")))))
|
| 1638 | |
| 1639 | |
| 1640 | |
| 1641 | (add-after 'install 'info-version
|
| 1642 | (lambda _
|
| 1643 | (let ((hip-version-dir (string-append #$output "/share/hip")))
|
| 1644 | (mkdir hip-version-dir)
|
| 1645 | (with-directory-excursion hip-version-dir
|
| 1646 | (with-output-to-file "version"
|
| 1647 | (lambda _
|
| 1648 | (apply format #t
|
| 1649 | "HIP_VERSION_MAJOR=~a~%~
|
| 1650 | HIP_VERSION_MINOR=~a~%~
|
| 1651 | HIP_VERSION_PATCH=~a~%~
|
| 1652 | HIP_VERSION_GITHASH=0~%"
|
| 1653 | (string-split
|
| 1654 | #$(version-major+minor+point version) #\.))))))))
|
| 1655 | (add-after 'install 'wrap-programs
|
| 1656 | (lambda* (#:key inputs outputs #:allow-other-keys)
|
| 1657 | (let ((output-bindir (string-append (assoc-ref outputs "out") "/bin")))
|
| 1658 | (for-each
|
| 1659 | (lambda (file)
|
| 1660 | (wrap-program (string-append output-bindir "/" file)
|
| 1661 | |
| 1662 | |
| 1663 | |
| 1664 |
|
| 1665 | |
| 1666 | |
| 1667 | |
| 1668 |
|
| 1669 | |
| 1670 |
|
| 1671 | |
| 1672 | |
| 1673 | |
| 1674 | (list "HIP_PATH" '= (list (string-append "${HIP_PATH:-" #$output "}")))
|
| 1675 | |
| 1676 | |
| 1677 | |
| 1678 | |
| 1679 | |
| 1680 | |
| 1681 | |
| 1682 | (list "HIP_CLANG_PATH"
|
| 1683 | '=
|
| 1684 | (list
|
| 1685 | (string-append "${HIP_CLANG_PATH:-"
|
| 1686 | #$(file-append (this-package-input "clang-rocm")
|
| 1687 | "/bin")
|
| 1688 | "}")))
|
| 1689 | (list "DEVICE_LIB_PATH"
|
| 1690 | '=
|
| 1691 | (list
|
| 1692 | (string-append "${DEVICE_LIB_PATH:-"
|
| 1693 | #$(file-append (this-package-input "rocm-device-libs")
|
| 1694 | "/amdgcn/bitcode")
|
| 1695 | "}")))
|
| 1696 |
|
| 1697 | |
| 1698 | |
| 1699 | (list "LD_LIBRARY_PATH"
|
| 1700 | 'suffix
|
| 1701 | (list #$(this-package-input "rocr-runtime")))
|
| 1702 | |
| 1703 | (list "PATH" 'suffix (list output-bindir))))
|
| 1704 | '( "hipcc" "hipconfig" ))))))))
|
| 1705 | (inputs (list clang-rocm
|
| 1706 | rocm-device-libs
|
| 1707 | rocr-runtime
|
| 1708 | rocminfo
|
| 1709 | perl
|
| 1710 | bash-minimal
|
| 1711 | which))
|
| 1712 | (home-page "https://github.com/ROCm/llvm-project/")
|
| 1713 | (synopsis "ROCm HIP compiler driver (@command{hipcc})")
|
| 1714 | (description "The HIP compiler driver (@command{hipcc}) is a compiler utility that will
|
| 1715 | call @command{clang} and pass the appropriate include and library options for
|
| 1716 | the target compiler and HIP infrastructure.")
|
| 1717 | (license license:expat))))
|
| 1718 |
|
| 1719 |
|
| 1720 |
|
| 1721 | (define-public libunwind-headers
|
| 1722 | (package
|
| 1723 | (name "libunwind-headers")
|
| 1724 | (version "13.0.0")
|
| 1725 | (source (origin
|
| 1726 | (method url-fetch)
|
| 1727 | (uri (llvm-uri "libunwind" version))
|
| 1728 | (sha256
|
| 1729 | (base32
|
| 1730 | "1qb5ickp7qims5q7sxacj3fwq1kklvnl94k3v9hpl5qn284iky1n"))))
|
| 1731 | (build-system cmake-build-system)
|
| 1732 | (arguments
|
| 1733 | '(#:phases (modify-phases (map (lambda (phase)
|
| 1734 | (assq phase %standard-phases))
|
| 1735 | '(set-paths unpack))
|
| 1736 | (add-after 'unpack 'install
|
| 1737 | (lambda* (#:key outputs #:allow-other-keys)
|
| 1738 | (let ((out (assoc-ref outputs "out")))
|
| 1739 | (mkdir out)
|
| 1740 | (copy-recursively "include"
|
| 1741 | (string-append out "/include"))))))))
|
| 1742 | (home-page "https://clang.llvm.org/docs/Toolchain.html")
|
| 1743 | (synopsis "LLVM libunwind header files")
|
| 1744 | (description
|
| 1745 | "This package contains header files for the LLVM C++ unwinding library.")
|
| 1746 | (properties `((release-monitoring-url . ,%llvm-release-monitoring-url)))
|
| 1747 | (license license:asl2.0))) |
| 1748 |
|
| 1749 | (define-public lld-15
|
| 1750 | (package
|
| 1751 | (name "lld")
|
| 1752 | (version (package-version llvm-15))
|
| 1753 | (source (llvm-monorepo version))
|
| 1754 | (build-system cmake-build-system)
|
| 1755 | (inputs
|
| 1756 | (list llvm-15))
|
| 1757 | (arguments
|
| 1758 | '(#:build-type "Release"
|
| 1759 | |
| 1760 | |
| 1761 | #:tests? #f
|
| 1762 | #:phases (modify-phases %standard-phases
|
| 1763 | (add-after 'unpack 'change-directory
|
| 1764 | (lambda _
|
| 1765 | (chdir "lld"))))))
|
| 1766 | (home-page "https://lld.llvm.org/")
|
| 1767 | (synopsis "Linker from the LLVM project")
|
| 1768 | (description "LLD is a high-performance linker, built as a set of reusable
|
| 1769 | components which highly leverage existing libraries in the larger LLVM Project.")
|
| 1770 | (license license:asl2.0))) |
| 1771 |
|
| 1772 | (define-public lld-14
|
| 1773 | (package
|
| 1774 | (inherit lld-15)
|
| 1775 | (version "14.0.6")
|
| 1776 | (source (llvm-monorepo version))
|
| 1777 | (inputs
|
| 1778 | (list llvm-14))))
|
| 1779 |
|
| 1780 | (define-public lld-13
|
| 1781 | (package
|
| 1782 | (inherit lld-14)
|
| 1783 | (version "13.0.1")
|
| 1784 | (source (origin
|
| 1785 | (method url-fetch)
|
| 1786 | (uri (llvm-uri "lld" version))
|
| 1787 | (sha256
|
| 1788 | (base32
|
| 1789 | "1yscckcszfr234k4svhybdbsnz6w65x8pldl6c2nhyxzx12zfsk6"))))
|
| 1790 | (native-inputs
|
| 1791 | |
| 1792 | |
| 1793 | (list libunwind-headers))
|
| 1794 | (inputs
|
| 1795 | (list llvm-13))
|
| 1796 | (arguments
|
| 1797 | '(#:build-type "Release"
|
| 1798 | |
| 1799 | |
| 1800 | #:tests? #f))
|
| 1801 | (properties `((release-monitoring-url . ,%llvm-release-monitoring-url)))))
|
| 1802 |
|
| 1803 | (define-public lld-16
|
| 1804 | (package
|
| 1805 | (inherit lld-15)
|
| 1806 | (version (package-version llvm-16))
|
| 1807 | (source (llvm-monorepo version))
|
| 1808 | (inputs (list llvm-16))))
|
| 1809 |
|
| 1810 | (define-public lld-17
|
| 1811 | (package
|
| 1812 | (inherit lld-15)
|
| 1813 | (version (package-version llvm-17))
|
| 1814 | (source (llvm-monorepo version))
|
| 1815 | (inputs (list llvm-17))))
|
| 1816 |
|
| 1817 | (define-public lld-18
|
| 1818 | (package
|
| 1819 | (inherit lld-15)
|
| 1820 | (version (package-version llvm-18))
|
| 1821 | (source (llvm-monorepo version))
|
| 1822 | (inputs (list llvm-18))))
|
| 1823 |
|
| 1824 | (define-public lld-19
|
| 1825 | (package
|
| 1826 | (inherit lld-15)
|
| 1827 | (version (package-version llvm-19))
|
| 1828 | (source (llvm-monorepo version))
|
| 1829 | (inputs (list llvm-19))))
|
| 1830 |
|
| 1831 | (define-public lld-20
|
| 1832 | (package
|
| 1833 | (inherit lld-15)
|
| 1834 | (version (package-version llvm-20))
|
| 1835 | (source (llvm-monorepo version))
|
| 1836 | (inputs (list llvm-20))))
|
| 1837 |
|
| 1838 | (define-public lld-21
|
| 1839 | (package
|
| 1840 | (inherit lld-15)
|
| 1841 | (version (package-version llvm-21))
|
| 1842 | (source (llvm-monorepo version))
|
| 1843 | (inputs (list llvm-21))))
|
| 1844 |
|
| 1845 | (define-public lld-22
|
| 1846 | (package
|
| 1847 | (inherit lld-15)
|
| 1848 | (version (package-version llvm-22))
|
| 1849 | (source (llvm-monorepo version))
|
| 1850 | (inputs (list llvm-22))))
|
| 1851 |
|
| 1852 | (define-public lld-23
|
| 1853 | (package
|
| 1854 | (inherit lld-15)
|
| 1855 | (version (package-version llvm-23))
|
| 1856 | (source (llvm-monorepo version))
|
| 1857 | (inputs (list llvm-23))))
|
| 1858 |
|
| 1859 | (define-public lld lld-22)
|
| 1860 |
|
| 1861 | (define* (make-lld-wrapper lld #:key lld-as-ld?)
|
| 1862 | "Return a LLD wrapper. When LLD-AS-LD? is true, create a 'ld' symlink that
|
| 1863 | points to 'lld'."
|
| 1864 | (package
|
| 1865 | (inherit lld)
|
| 1866 | (name (if lld-as-ld? "lld-as-ld-wrapper" "lld-wrapper"))
|
| 1867 | (source #f)
|
| 1868 | (native-inputs '())
|
| 1869 | (inputs (list (make-ld-wrapper "ld.lld-wrapper" #:binutils lld
|
| 1870 | #:linker "ld.lld")
|
| 1871 | (make-ld-wrapper "lld-wrapper" #:binutils lld #:linker
|
| 1872 | "lld")))
|
| 1873 | (propagated-inputs '())
|
| 1874 | (build-system trivial-build-system)
|
| 1875 | (arguments
|
| 1876 | (list #:builder
|
| 1877 | #~(let ((ld.lld (string-append #$(this-package-input
|
| 1878 | "ld.lld-wrapper")
|
| 1879 | "/bin/ld.lld"))
|
| 1880 | (lld (string-append #$(this-package-input "lld-wrapper")
|
| 1881 | "/bin/lld")))
|
| 1882 | (mkdir #$output)
|
| 1883 | (mkdir (string-append #$output "/bin"))
|
| 1884 | (symlink ld.lld (string-append #$output "/bin/ld.lld"))
|
| 1885 | (symlink lld (string-append #$output "/bin/lld"))
|
| 1886 | (when #$lld-as-ld?
|
| 1887 | (symlink ld.lld (string-append #$output "/bin/ld"))))))
|
| 1888 | (synopsis "LLD linker wrapper")
|
| 1889 | (description "This is a linker wrapper for LLD; like @code{ld-wrapper}, it
|
| 1890 | wraps the linker to add any missing @code{-rpath} flags, and to detect any
|
| 1891 | misuse of libraries outside of the store.")))
|
| 1892 |
|
| 1893 | |
| 1894 | (define-public lld-wrapper
|
| 1895 | (make-lld-wrapper lld))
|
| 1896 |
|
| 1897 | |
| 1898 | (define-public lld-as-ld-wrapper-18
|
| 1899 | (make-lld-wrapper lld-18 #:lld-as-ld? #t))
|
| 1900 |
|
| 1901 | (define-public lld-as-ld-wrapper
|
| 1902 | (make-lld-wrapper lld #:lld-as-ld? #t))
|
| 1903 |
|
| 1904 | (define-public lldb
|
| 1905 | (package
|
| 1906 | (name "lldb")
|
| 1907 | (version (package-version llvm-23))
|
| 1908 | (source (llvm-monorepo version))
|
| 1909 | (build-system cmake-build-system)
|
| 1910 | (arguments
|
| 1911 | (list
|
| 1912 | |
| 1913 | #:tests? #f
|
| 1914 | #:configure-flags #~(list "-DOPENMP_TEST_CXX_COMPILER=clang++")
|
| 1915 | #:phases
|
| 1916 | #~(modify-phases %standard-phases
|
| 1917 | (add-after 'unpack 'chdir-to-source
|
| 1918 | (lambda _
|
| 1919 | (chdir "lldb"))))))
|
| 1920 | (native-inputs
|
| 1921 | (list pkg-config swig-4.0))
|
| 1922 | (inputs
|
| 1923 | (list clang-23
|
| 1924 | llvm-23
|
| 1925 | |
| 1926 | ncurses
|
| 1927 | libedit
|
| 1928 | xz
|
| 1929 | libxml2
|
| 1930 | lua
|
| 1931 | python))
|
| 1932 | (home-page "https://lldb.llvm.org/")
|
| 1933 | (synopsis "Low level debugger")
|
| 1934 | (description
|
| 1935 | "LLDB is a high performance debugger built as a set of reusable components
|
| 1936 | which highly leverage existing libraries in the larger LLVM project.")
|
| 1937 | (properties `((release-monitoring-url . ,%llvm-release-monitoring-url)))
|
| 1938 | (license license:asl2.0))) |
| 1939 |
|
| 1940 | (define-public libcxx
|
| 1941 | (package
|
| 1942 | (name "libcxx")
|
| 1943 | (version (package-version llvm-19))
|
| 1944 | (source (llvm-monorepo version))
|
| 1945 | (build-system cmake-build-system)
|
| 1946 | (arguments
|
| 1947 | (list
|
| 1948 | #:tests? #f |
| 1949 | #:implicit-inputs? #f |
| 1950 | #:configure-flags
|
| 1951 | #~(list "-DLLVM_ENABLE_RUNTIMES=libcxx;libcxxabi;libunwind"
|
| 1952 | "-DCMAKE_C_COMPILER=clang"
|
| 1953 | "-DCMAKE_CXX_COMPILER=clang++"
|
| 1954 | |
| 1955 | |
| 1956 | |
| 1957 | |
| 1958 | |
| 1959 | "-DCMAKE_BUILD_WITH_INSTALL_RPATH=TRUE")
|
| 1960 | #:modules '((guix build cmake-build-system)
|
| 1961 | ((guix build gnu-build-system) #:prefix gnu:)
|
| 1962 | (guix build utils))
|
| 1963 | #:phases
|
| 1964 | #~(modify-phases %standard-phases
|
| 1965 | (add-after 'unpack 'enter-subdirectory
|
| 1966 | (lambda _
|
| 1967 | (chdir "runtimes")))
|
| 1968 | (replace 'check
|
| 1969 | (lambda* (#:rest args)
|
| 1970 | (apply (assoc-ref gnu:%standard-phases 'check)
|
| 1971 | #:test-target "check-cxx" args))))))
|
| 1972 | (native-inputs
|
| 1973 | (modify-inputs (standard-packages)
|
| 1974 | |
| 1975 | |
| 1976 | |
| 1977 | (delete "gcc")
|
| 1978 | (prepend clang-19 python-minimal)))
|
| 1979 | (home-page "https://libcxx.llvm.org")
|
| 1980 | (synopsis "C++ standard library")
|
| 1981 | (description
|
| 1982 | "This package provides an implementation of the C++ standard library for
|
| 1983 | use with Clang, targeting C++11, C++14 and above.")
|
| 1984 | (properties `((release-monitoring-url . ,%llvm-release-monitoring-url)))
|
| 1985 | (license license:expat)))
|
| 1986 |
|
| 1987 | |
| 1988 | (define-public libclc
|
| 1989 | (package
|
| 1990 | (name "libclc")
|
| 1991 | (version (package-version llvm-18))
|
| 1992 | (source (llvm-monorepo version))
|
| 1993 | (build-system cmake-build-system)
|
| 1994 | (arguments
|
| 1995 | (list
|
| 1996 | #:configure-flags
|
| 1997 | #~(list (string-append "-DLLVM_CLANG="
|
| 1998 | (assoc-ref %build-inputs "clang")
|
| 1999 | "/bin/clang")
|
| 2000 | (string-append "-DLLVM_SPIRV="
|
| 2001 | (assoc-ref %build-inputs "spirv-llvm-translator")
|
| 2002 | "/bin/llvm-spirv"))
|
| 2003 | #:phases
|
| 2004 | #~(modify-phases %standard-phases
|
| 2005 | (add-after 'unpack 'enter-subdirectory
|
| 2006 | (lambda _
|
| 2007 | (chdir "libclc")))
|
| 2008 | (add-after 'enter-subdirectory 'skip-clspv-tests
|
| 2009 | (lambda _
|
| 2010 | (substitute* "CMakeLists.txt"
|
| 2011 | (("ptx\\.\\*") "[ptx|clspv].*")))))))
|
| 2012 | (propagated-inputs
|
| 2013 | (list spirv-llvm-translator spirv-tools))
|
| 2014 | (native-inputs
|
| 2015 | (list clang-18 llvm-18 python))
|
| 2016 | (home-page "https://libclc.llvm.org")
|
| 2017 | (synopsis "Libraries for the OpenCL programming language")
|
| 2018 | (description
|
| 2019 | "This package provides an implementation of the OpenCL library
|
| 2020 | requirements according to version 1.1 of the OpenCL specification.")
|
| 2021 | (properties `((release-monitoring-url . ,%llvm-release-monitoring-url)))
|
| 2022 | |
| 2023 | (license license:asl2.0)))
|
| 2024 |
|
| 2025 | (define (mlir-from-llvm llvm)
|
| 2026 | "Produce MLIR with dependencies on LLVM."
|
| 2027 | (package
|
| 2028 | (name "mlir")
|
| 2029 | (version (package-version llvm))
|
| 2030 | (source (llvm-monorepo version))
|
| 2031 | (build-system cmake-build-system)
|
| 2032 | (native-inputs (package-native-inputs llvm))
|
| 2033 | (inputs
|
| 2034 | (list llvm))
|
| 2035 | (arguments
|
| 2036 | (list #:build-type "Release"
|
| 2037 | #:configure-flags
|
| 2038 | #~(list "-DMLIR_BUILD_MLIR_C_DYLIB=ON"
|
| 2039 | "-DLLVM_BUILD_LLVM_DYLIB=ON"
|
| 2040 | "-DLLVM_LINK_LLVM_DYLIB=ON"
|
| 2041 | |
| 2042 | |
| 2043 | "-DLLVM_INSTALL_TOOLCHAIN_ONLY=OFF"
|
| 2044 | "-DLLVM_BUILD_UTILS=ON")
|
| 2045 | #:tests? #f |
| 2046 | #:phases #~(modify-phases %standard-phases
|
| 2047 | (add-after 'unpack 'change-directory
|
| 2048 | (lambda _
|
| 2049 | (chdir "mlir"))))))
|
| 2050 | (home-page "https://mlir.llvm.org/")
|
| 2051 | (synopsis "Multi-Level Intermediate Representation")
|
| 2052 | (description "This package is a novel approach to building reusable
|
| 2053 | and extensible compiler infrastructure. MLIR aims to address software
|
| 2054 | fragmentation, improve compilation for heterogeneous hardware, significantly
|
| 2055 | reduce the cost of building domain specific compilers, and aid in connecting
|
| 2056 | existing compilers together.")
|
| 2057 | (license license:asl2.0))) |
| 2058 |
|
| 2059 | (define-public mlir-19
|
| 2060 | (mlir-from-llvm llvm-19))
|
| 2061 |
|
| 2062 | (define-public mlir-15
|
| 2063 | (mlir-from-llvm llvm-15))
|
| 2064 |
|
| 2065 | (define-public rocmlir
|
| 2066 | (package
|
| 2067 | (name "rocmlir")
|
| 2068 | (version %rocm-llvm-version)
|
| 2069 | (source (origin
|
| 2070 | (method git-fetch)
|
| 2071 | (uri (git-reference
|
| 2072 | (url "https://github.com/ROCm/rocMLIR")
|
| 2073 | (commit (string-append "rocm-" version))))
|
| 2074 | (file-name (git-file-name name version))
|
| 2075 | (sha256
|
| 2076 | (base32
|
| 2077 | "0yr76dj465rw4ck9dk1mjjn3rgp8gb0v273f256rkb8rq6zd9nq3"))))
|
| 2078 | (build-system cmake-build-system)
|
| 2079 | (arguments
|
| 2080 | (list
|
| 2081 | #:build-type "Release"
|
| 2082 | #:configure-flags
|
| 2083 | #~(list
|
| 2084 | "-DCMAKE_C_COMPILER=clang"
|
| 2085 | "-DCMAKE_CXX_COMPILER=clang++"
|
| 2086 | "-DBUILD_FAT_LIBROCKCOMPILER=ON")
|
| 2087 | |
| 2088 | #:tests? #f))
|
| 2089 | (native-inputs (list clang-rocm rocm-hip-runtime python rocm-cmake))
|
| 2090 | (home-page "https://github.com/ROCm/rocMLIR")
|
| 2091 | (synopsis "MLIR-based convolution and GEMM kernel generator")
|
| 2092 | (description "rocMLIR is a MLIR-based convolution and GEMM kernel
|
| 2093 | generator targetting AMD hardware.")
|
| 2094 | (license license:expat)))
|
| 2095 |
|
| 2096 | (define-public python-llvmlite
|
| 2097 | (package
|
| 2098 | (name "python-llvmlite")
|
| 2099 | (version "0.48.0")
|
| 2100 | (source
|
| 2101 | (origin
|
| 2102 | |
| 2103 | (method url-fetch)
|
| 2104 | (uri (pypi-uri "llvmlite" version))
|
| 2105 | (sha256
|
| 2106 | (base32
|
| 2107 | "1lpdjbg9ip8d9kv5cgcakyzkf58vxvj930a6s5h7qg4gxzwijfsl"))))
|
| 2108 | (build-system pyproject-build-system)
|
| 2109 | (arguments
|
| 2110 | (list
|
| 2111 | #:test-backend #~'custom
|
| 2112 | #:test-flags #~(list "-m" "llvmlite.tests")
|
| 2113 | #:phases
|
| 2114 | #~(modify-phases %standard-phases
|
| 2115 | (add-after 'unpack 'skip-test
|
| 2116 | (lambda _
|
| 2117 | (substitute* "llvmlite/tests/test_binding.py"
|
| 2118 | |
| 2119 | |
| 2120 | |
| 2121 | (("test_linux" all)
|
| 2122 | (string-append "__off_" all)))))
|
| 2123 | (add-before 'build 'set-compiler/linker-flags
|
| 2124 | (lambda _
|
| 2125 | (let ((llvm #$(this-package-input "llvm")))
|
| 2126 | |
| 2127 | (setenv "CPPFLAGS" "-fPIC")
|
| 2128 | (setenv "LDFLAGS" (string-append "-Wl,-rpath="
|
| 2129 | llvm "/lib")))))
|
| 2130 | (add-before 'check 'pre-check
|
| 2131 | (lambda _
|
| 2132 | (setenv "LLVMLITE_DIST_TEST" "1"))))))
|
| 2133 | (native-inputs
|
| 2134 | (list cmake-minimal
|
| 2135 | python-setuptools))
|
| 2136 | (inputs
|
| 2137 | (list llvm))
|
| 2138 | (home-page "https://llvmlite.pydata.org")
|
| 2139 | (synopsis "Wrapper around basic LLVM functionality")
|
| 2140 | (description
|
| 2141 | "This package provides a Python binding to LLVM for use in Numba.")
|
| 2142 | (license (list license:asl2.0 license:bsd-2))))
|
| 2143 |
|
| 2144 | (define-public (clang-python-bindings clang)
|
| 2145 | "Return a package for the Python bindings of CLANG."
|
| 2146 | (package
|
| 2147 | (inherit clang)
|
| 2148 | (name "python-clang")
|
| 2149 | (build-system pyproject-build-system)
|
| 2150 | (outputs '("out"))
|
| 2151 | (arguments
|
| 2152 | (list
|
| 2153 | #:test-backend #~'unittest
|
| 2154 | #:phases #~(modify-phases %standard-phases
|
| 2155 | (add-before 'build 'change-directory
|
| 2156 | (lambda _
|
| 2157 | (chdir "bindings/python")))
|
| 2158 | (add-before 'build 'set-libclang-file-name
|
| 2159 | (lambda* (#:key inputs #:allow-other-keys)
|
| 2160 | |
| 2161 | (let ((libclang (search-input-file inputs
|
| 2162 | "/lib/libclang.so")))
|
| 2163 | (substitute* "clang/cindex.py"
|
| 2164 | (("libclang\\.so") libclang))))))))
|
| 2165 | (native-inputs (list python-setuptools))
|
| 2166 | (inputs (list clang))
|
| 2167 | (native-inputs (modify-inputs (package-native-inputs clang)
|
| 2168 | (append python-setuptools)))
|
| 2169 | (synopsis "Python bindings to libclang")))
|
| 2170 |
|
| 2171 | (define-public python-clang-13
|
| 2172 | (clang-python-bindings clang-13))
|
| 2173 |
|
| 2174 | |
| 2175 | |
| 2176 |
|
| 2177 | (define (make-lld-rocm lld-base)
|
| 2178 | (package
|
| 2179 | (inherit lld-base)
|
| 2180 | (name "lld-rocm")
|
| 2181 | (version (package-version llvm-rocm))
|
| 2182 | (source (package-source llvm-rocm))
|
| 2183 | (inputs (list llvm-rocm))
|
| 2184 | (arguments
|
| 2185 | (substitute-keyword-arguments arguments
|
| 2186 | ((#:configure-flags flags)
|
| 2187 | #~(append #$flags
|
| 2188 | '("-DLLVM_TARGETS_TO_BUILD=AMDGPU;X86")))))))
|
| 2189 |
|
| 2190 | (define-public lld-rocm (make-lld-rocm lld-20))
|
| 2191 |
|
| 2192 | (define-public lld-wrapper-rocm
|
| 2193 | (package
|
| 2194 | (inherit (make-lld-wrapper lld-rocm))
|
| 2195 | (name "lld-wrapper-rocm")))
|
| 2196 |
|
| 2197 | (define-public libomp-rocm
|
| 2198 | (package
|
| 2199 | (inherit libomp-20)
|
| 2200 | (name "libomp-rocm")
|
| 2201 | (version (package-version llvm-rocm))
|
| 2202 | (source (package-source llvm-rocm))
|
| 2203 | (arguments
|
| 2204 | (substitute-keyword-arguments arguments
|
| 2205 | ((#:configure-flags flags '())
|
| 2206 | #~(cons
|
| 2207 | (string-append "-DOPENMP_LIT_ARGS="
|
| 2208 | "-sv --show-unsupported --show-xfail"
|
| 2209 | |
| 2210 | " --filter-out tasking/task_teams_stress_test.cpp")
|
| 2211 | #$flags))
|
| 2212 | ((#:phases phases)
|
| 2213 | #~(modify-phases #$phases
|
| 2214 | (add-after 'unpack 'fix-lit
|
| 2215 | (lambda _
|
| 2216 | (substitute* "openmp/cmake/OpenMPTesting.cmake"
|
| 2217 | (((string-append "COMMAND \\$\\{Python3_EXECUTABLE\\}"
|
| 2218 | " \\$\\{OPENMP_LLVM_LIT_EXECUTABLE\\}"))
|
| 2219 | "COMMAND ${OPENMP_LLVM_LIT_EXECUTABLE}"))
|
| 2220 | (substitute* "openmp/runtime/test/lit.cfg"
|
| 2221 | (("config\\.name =.*" orig)
|
| 2222 | (string-append
|
| 2223 | orig
|
| 2224 | "\nconfig.environment['C_INCLUDE_PATH']"
|
| 2225 | " = os.environ['C_INCLUDE_PATH']\n"
|
| 2226 | "config.environment['CPLUS_INCLUDE_PATH']"
|
| 2227 | " = os.environ['CPLUS_INCLUDE_PATH']\n")))))))))
|
| 2228 | (native-inputs
|
| 2229 | (modify-inputs native-inputs
|
| 2230 | (replace "clang" clang-rocm)
|
| 2231 | (replace "llvm" llvm-rocm)))))
|
| 2232 |
|
| 2233 | (define-public clang-rocm-toolchain
|
| 2234 | (make-clang-toolchain clang-rocm libomp-rocm))
|
| 2235 |
|
| 2236 | (define-public offload-rocm
|
| 2237 | (package
|
| 2238 | (name "offload-rocm")
|
| 2239 | (version (package-version llvm-rocm))
|
| 2240 | (source (package-source llvm-rocm))
|
| 2241 | (build-system cmake-build-system)
|
| 2242 | (arguments
|
| 2243 | (list
|
| 2244 | #:configure-flags
|
| 2245 | #~(list
|
| 2246 | "-DCMAKE_EXE_LINKER_FLAGS=-fuse-ld=lld"
|
| 2247 | "-DCMAKE_SHARED_LINKER_FLAGS=-fuse-ld=lld")
|
| 2248 | #:phases
|
| 2249 | #~(modify-phases %standard-phases
|
| 2250 | (add-after 'unpack 'chdir
|
| 2251 | (lambda _
|
| 2252 | (chdir "offload")))
|
| 2253 | (add-after 'chdir 'libffi-dynamic-link
|
| 2254 | (lambda _
|
| 2255 | (substitute* "plugins-nextgen/host/CMakeLists.txt"
|
| 2256 | (("if\\(FFI_STATIC.*") "if(FALSE)\n"))))
|
| 2257 | (add-after 'install 'install-license
|
| 2258 | (lambda _
|
| 2259 | (install-file "../LICENSE.TXT"
|
| 2260 | (string-append #$output "/share/doc/"
|
| 2261 | #$name "-" #$version)))))
|
| 2262 | |
| 2263 | |
| 2264 | #:tests? #f))
|
| 2265 | (native-inputs
|
| 2266 | (list clang-rocm-toolchain
|
| 2267 | lld-wrapper-rocm
|
| 2268 | python))
|
| 2269 | (inputs
|
| 2270 | (list libffi
|
| 2271 | libomp-rocm
|
| 2272 | rocm-device-libs
|
| 2273 | rocr-runtime))
|
| 2274 | (home-page "https://github.com/ROCm/llvm-project/")
|
| 2275 | (synopsis "LLVM offloading library")
|
| 2276 | (description "This LLVM component provides tooling, runtimes and APIs for
|
| 2277 | executing code on accelerators which may have a different architecture than
|
| 2278 | the host.")
|
| 2279 | |
| 2280 | (license license:asl2.0)))
|
| 2281 |
|
| 2282 | (define-public rocm-toolchain
|
| 2283 | (package
|
| 2284 | (inherit clang-rocm-toolchain)
|
| 2285 | (name "rocm-toolchain")
|
| 2286 | (inputs
|
| 2287 | (modify-inputs inputs
|
| 2288 | (append bash-minimal |
| 2289 | lld-wrapper-rocm
|
| 2290 | offload-rocm
|
| 2291 | rocr-runtime
|
| 2292 | rocm-hipcc
|
| 2293 | rocm-device-libs)))
|
| 2294 | (arguments
|
| 2295 | (substitute-keyword-arguments arguments
|
| 2296 | ((#:modules modules)
|
| 2297 | `(,@modules
|
| 2298 | (guix build utils)))
|
| 2299 | ((#:builder _)
|
| 2300 | #~(begin
|
| 2301 | (use-modules (ice-9 match)
|
| 2302 | (guix build union)
|
| 2303 | (guix build utils))
|
| 2304 |
|
| 2305 | (define (unionize output inputs)
|
| 2306 | (union-build output inputs
|
| 2307 | #:symlink (lambda (old new)
|
| 2308 | |
| 2309 | |
| 2310 | |
| 2311 | |
| 2312 | (unless (wrapped-program? old)
|
| 2313 | (symlink old new)))
|
| 2314 | |
| 2315 | |
| 2316 | |
| 2317 | #:create-all-directories? #t))
|
| 2318 |
|
| 2319 | |
| 2320 | (setenv "PATH" #$(file-append (this-package-input "bash-minimal")
|
| 2321 | "/bin"))
|
| 2322 |
|
| 2323 | (match %build-inputs
|
| 2324 | (((names . directories) ...)
|
| 2325 | (unionize #$output directories)))
|
| 2326 |
|
| 2327 | (unionize #$output:debug
|
| 2328 | (list #$(this-package-input "libc-debug")))
|
| 2329 | (unionize #$output:static
|
| 2330 | (list #$(this-package-input "libc-static")))
|
| 2331 |
|
| 2332 | |
| 2333 | (let ((bin (string-append #$output "/bin")))
|
| 2334 | (for-each
|
| 2335 | (lambda (file)
|
| 2336 | (wrap-program file
|
| 2337 | |
| 2338 | |
| 2339 | |
| 2340 | |
| 2341 | `("HSA_PATH" = ,(list #$(this-package-input "rocr-runtime")))
|
| 2342 | `("HIP_PATH" = ,(list #$output))
|
| 2343 | `("HIP_CLANG_PATH" = ,(list bin))))
|
| 2344 | (find-files bin ".")))))))
|
| 2345 | (native-search-paths
|
| 2346 | (append (package-native-search-paths clang-rocm-toolchain)
|
| 2347 | (list (search-path-specification
|
| 2348 | (variable "HIP_DEVICE_LIB_PATH")
|
| 2349 | (files '("amdgcn/bitcode"))))))
|
| 2350 | (synopsis "Clang-based ROCm toolchain for C/C++ development")
|
| 2351 | (description
|
| 2352 | "This package provides a complete ROCm toolchain for C/C++ development to
|
| 2353 | be installed in user profiles. This includes Clang, as well as libc (headers
|
| 2354 | and binaries, plus debugging symbols in the @code{debug} output), Binutils,
|
| 2355 | the ROCm device libraries, and the ROCr runtime.")))
|
| 2356 |
|
| 2357 |
|
| 2358 |
|
| 2359 | (define-public include-what-you-use
|
| 2360 | (package
|
| 2361 | (name "include-what-you-use")
|
| 2362 | |
| 2363 | |
| 2364 | (version "0.24")
|
| 2365 | (source
|
| 2366 | (origin
|
| 2367 | (method git-fetch)
|
| 2368 | (uri (git-reference
|
| 2369 | (url "https://github.com/include-what-you-use/include-what-you-use")
|
| 2370 | (commit version)))
|
| 2371 | (file-name (git-file-name name version))
|
| 2372 | (sha256
|
| 2373 | (base32 "0dkk65y6abf7bzv10q1ch3dyzj4d5y89qhh43jn189l861d6pzs0"))))
|
| 2374 | (build-system cmake-build-system)
|
| 2375 | (inputs (list llvm-20 clang-20 python-3))
|
| 2376 | (synopsis
|
| 2377 | "Tool for use with clang to analyze #includes in C and C++ source files")
|
| 2378 | (home-page "https://github.com/include-what-you-use/include-what-you-use")
|
| 2379 | (description
|
| 2380 | "@code{include-what-you-use} lints C and C++ sources to ensure
|
| 2381 | @code{#include}s declaring every symbol used in a given file are present.
|
| 2382 | When every file directly includes what it uses rather than relying on
|
| 2383 | transitive inclusions, builds tend to be more efficient and refactoring
|
| 2384 | dependency relationships is easier, particularly for large projects.")
|
| 2385 | |
| 2386 | |
| 2387 | |
| 2388 | (license (list license:ncsa license:bsd-3))))
|
| 2389 |
|
| 2390 | (define-public emacs-clang-format
|
| 2391 | (package
|
| 2392 | (inherit clang)
|
| 2393 | (name "emacs-clang-format")
|
| 2394 | (build-system emacs-build-system)
|
| 2395 | (inputs
|
| 2396 | (list clang))
|
| 2397 | (propagated-inputs '())
|
| 2398 | (arguments
|
| 2399 | (list
|
| 2400 | #:lisp-directory "clang/tools/clang-format"
|
| 2401 | #:phases
|
| 2402 | #~(modify-phases %standard-phases
|
| 2403 | (add-after 'unpack 'configure
|
| 2404 | (lambda* (#:key inputs #:allow-other-keys)
|
| 2405 | (let ((clang-format (search-input-file inputs "/bin/clang-format")))
|
| 2406 | (emacs-substitute-variables "clang-format.el"
|
| 2407 | ("clang-format-executable"
|
| 2408 | clang-format))))))
|
| 2409 | #:test-command #~(list "emacs" "-Q" "--batch"
|
| 2410 | "-l" "clang-format.el"
|
| 2411 | "-l" "clang-format-test.el"
|
| 2412 | "-f" "ert-run-tests-batch-and-exit")))
|
| 2413 | (synopsis "Format code using clang-format")
|
| 2414 | (description "This package filters code through @code{clang-format}
|
| 2415 | to fix its formatting. @code{clang-format} is a tool that formats
|
| 2416 | C/C++/Obj-C code according to a set of style options, see
|
| 2417 | @url{https://clang.llvm.org/docs/ClangFormatStyleOptions.html}.")))
|
| 2418 |
|
| 2419 | (define-public emacs-clang-include-fixer
|
| 2420 | (package
|
| 2421 | (inherit clang)
|
| 2422 | (name "emacs-clang-include-fixer")
|
| 2423 | (build-system emacs-build-system)
|
| 2424 | (inputs
|
| 2425 | (list clang))
|
| 2426 | (propagated-inputs '())
|
| 2427 | (arguments
|
| 2428 | (list
|
| 2429 | #:lisp-directory "clang-tools-extra/clang-include-fixer/tool"
|
| 2430 | #:phases
|
| 2431 | #~(modify-phases %standard-phases
|
| 2432 | (add-after 'unpack 'configure
|
| 2433 | (lambda* (#:key inputs #:allow-other-keys)
|
| 2434 | (let ((clang-include-fixer
|
| 2435 | (search-input-file inputs "/bin/clang-include-fixer")))
|
| 2436 | (emacs-substitute-variables "clang-include-fixer.el"
|
| 2437 | ("clang-include-fixer-executable"
|
| 2438 | clang-include-fixer))))))
|
| 2439 | #:test-command #~(list "emacs" "-Q" "--batch"
|
| 2440 | "-l" "clang-include-fixer.el"
|
| 2441 | "-l" "clang-include-fixer-test.el"
|
| 2442 | "-f" "ert-run-tests-batch-and-exit")))
|
| 2443 | (synopsis "Emacs interface to @code{clang-include-fixer}")
|
| 2444 | (description "This package provides an automated way of adding #include
|
| 2445 | directives for missing symbols in one translation unit, see
|
| 2446 | @url{http://clang.llvm.org/extra/clang-include-fixer.html}.")))
|
| 2447 |
|
| 2448 | (define-public emacs-clang-rename
|
| 2449 | (package
|
| 2450 | (inherit clang-19)
|
| 2451 | (name "emacs-clang-rename")
|
| 2452 | (build-system emacs-build-system)
|
| 2453 | (inputs
|
| 2454 | (list clang-19))
|
| 2455 | (propagated-inputs '())
|
| 2456 | (arguments
|
| 2457 | (list #:lisp-directory "clang/tools/clang-rename"
|
| 2458 | #:tests? #f |
| 2459 | #:phases
|
| 2460 | #~(modify-phases %standard-phases
|
| 2461 | (add-after 'unpack 'configure
|
| 2462 | (lambda* (#:key inputs #:allow-other-keys)
|
| 2463 | (let ((clang-rename (search-input-file inputs "/bin/clang-rename")))
|
| 2464 | (emacs-substitute-variables "clang-rename.el"
|
| 2465 | ("clang-rename-binary" clang-rename))))))))
|
| 2466 | (synopsis "Rename every occurrence of a symbol using clang-rename")
|
| 2467 | (description "This package renames every occurrence of a symbol at point
|
| 2468 | using @code{clang-rename}.")))
|
| 2469 |
|
| 2470 |
|
| 2471 | |
| 2472 | |
| 2473 | |
| 2474 |
|
| 2475 | (define-public llvm-for-mesa
|
| 2476 | |
| 2477 | (let ((base-llvm llvm-18))
|
| 2478 | (package
|
| 2479 | (inherit base-llvm)
|
| 2480 | (name "llvm-for-mesa")
|
| 2481 | (arguments
|
| 2482 | (substitute-keyword-arguments arguments
|
| 2483 | ((#:modules modules '((guix build cmake-build-system)
|
| 2484 | (guix build utils)))
|
| 2485 | `((ice-9 regex)
|
| 2486 | (srfi srfi-1)
|
| 2487 | (srfi srfi-26)
|
| 2488 | ,@modules))
|
| 2489 | ((#:configure-flags cf ''())
|
| 2490 | #~(cons*
|
| 2491 | #$@(if (%current-target-system)
|
| 2492 | '("-DBUILD_SHARED_LIBS:BOOL=TRUE"
|
| 2493 | "-DCMAKE_BUILD_WITH_INSTALL_RPATH=TRUE")
|
| 2494 | '())
|
| 2495 | |
| 2496 | "-DLLVM_BUILD_TOOLS=NO"
|
| 2497 | (remove
|
| 2498 | (cut string-match
|
| 2499 | #$(if (%current-target-system)
|
| 2500 | "-DLLVM_(LINK_LLVM_DYLIB|INSTALL_UTILS).*"
|
| 2501 | "-DLLVM_INSTALL_UTILS.*") <>)
|
| 2502 | #$cf)))
|
| 2503 | ((#:phases phases '%standard-phases)
|
| 2504 | #~(modify-phases #$phases
|
| 2505 | #$@(if (%current-target-system)
|
| 2506 | '()
|
| 2507 | #~((add-after 'install 'delete-static-libraries
|
| 2508 | |
| 2509 | |
| 2510 | (lambda* (#:key outputs #:allow-other-keys)
|
| 2511 | (for-each delete-file
|
| 2512 | (find-files
|
| 2513 | (string-append
|
| 2514 | (assoc-ref outputs "out") "/lib")
|
| 2515 | "\\.a$"))))))
|
| 2516 | |
| 2517 | |
| 2518 | (add-after 'install 'build-and-install-llvm-config
|
| 2519 | (lambda* (#:key outputs #:allow-other-keys)
|
| 2520 | (let ((out (assoc-ref outputs "out")))
|
| 2521 | (substitute*
|
| 2522 | "tools/llvm-config/CMakeFiles/llvm-config.dir/link.txt"
|
| 2523 | (((string-append (getcwd) "/build/lib"))
|
| 2524 | (string-append out "/lib")))
|
| 2525 | (invoke "make" "llvm-config")
|
| 2526 | (install-file "bin/llvm-config"
|
| 2527 | (string-append out "/bin"))))))))))))
|
| 2528 |
|
| 2529 | (define make-ocaml-llvm
|
| 2530 | |
| 2531 | |
| 2532 | (mlambdaq (llvm)
|
| 2533 | (package
|
| 2534 | (inherit llvm)
|
| 2535 | (name "ocaml-llvm")
|
| 2536 | (outputs '("out"))
|
| 2537 | (arguments
|
| 2538 | `(#:configure-flags
|
| 2539 | (list
|
| 2540 | (string-append "-DLLVM_OCAML_EXTERNAL_LLVM_LIBDIR="
|
| 2541 | (assoc-ref %build-inputs "llvm") "/lib")
|
| 2542 | "-DBUILD_SHARED_LIBS=TRUE"
|
| 2543 | "-DLLVM_OCAML_OUT_OF_TREE=TRUE"
|
| 2544 | (string-append "-DLLVM_OCAML_INSTALL_PATH="
|
| 2545 | (assoc-ref %outputs "out") "/lib/ocaml/site-lib"))
|
| 2546 | #:tests? #f |
| 2547 | #:phases
|
| 2548 | (modify-phases %standard-phases
|
| 2549 | (replace 'build
|
| 2550 | (lambda _
|
| 2551 | (invoke "make" "ocaml_all")))
|
| 2552 | (replace 'install
|
| 2553 | (lambda _
|
| 2554 | (invoke "cmake" "-P" "bindings/ocaml/cmake_install.cmake"))))))
|
| 2555 | (inputs
|
| 2556 | (list llvm))
|
| 2557 | (native-inputs
|
| 2558 | (list ocaml ocaml-findlib ocaml-ounit python))
|
| 2559 | (propagated-inputs
|
| 2560 | (list ocaml-integers ocaml-ctypes))
|
| 2561 | (synopsis "OCaml bindings to LLVM")
|
| 2562 | (description "This package contains the OCaml bindings distributed with
|
| 2563 | LLVM."))))
|
| 2564 |
|
| 2565 | (define-public ocaml-llvm (make-ocaml-llvm llvm-13))
|
| 2566 |
|
| 2567 | (define-public wllvm
|
| 2568 | (package
|
| 2569 | (name "wllvm")
|
| 2570 | (properties '((commit . "948cdb8bd8fb446c700a6aefc218153db5ce2591")
|
| 2571 | (revision . "0")))
|
| 2572 | (version (git-version "1.3.1"
|
| 2573 | (assoc-ref properties 'revision)
|
| 2574 | (assoc-ref properties 'commit)))
|
| 2575 | (source
|
| 2576 | (origin
|
| 2577 | (method git-fetch)
|
| 2578 | (uri (git-reference
|
| 2579 | |
| 2580 | (url "https://github.com/travitch/whole-program-llvm")
|
| 2581 | (commit (assoc-ref properties 'commit))))
|
| 2582 | (file-name (git-file-name name version))
|
| 2583 | (sha256
|
| 2584 | (base32 "0ksasakx0ihg86j0qdla0zy14ljdhzpgi11as4kkgj51v4haihn4"))))
|
| 2585 | (build-system pyproject-build-system)
|
| 2586 | (arguments
|
| 2587 | (list
|
| 2588 | #:test-flags
|
| 2589 | |
| 2590 | #~(list "--ignore=test/test_dragonegg_driver.py")
|
| 2591 | #:phases
|
| 2592 | #~(modify-phases %standard-phases
|
| 2593 | (add-after 'unpack 'fix-paths
|
| 2594 | (lambda* (#:key inputs #:allow-other-keys)
|
| 2595 | (let ((pystr (lambda (s) (string-append "'" s "'"))))
|
| 2596 | (substitute* "wllvm/compilers.py"
|
| 2597 | (("'objcopy'")
|
| 2598 | (pystr (search-input-file inputs "/bin/objcopy"))))
|
| 2599 | (substitute* "wllvm/extraction.py"
|
| 2600 | (("'objdump'")
|
| 2601 | (pystr (search-input-file inputs "/bin/objdump")))
|
| 2602 | (("'ar'")
|
| 2603 | (pystr (search-input-file inputs "/bin/ar"))))
|
| 2604 | (substitute* "wllvm/filetype.py"
|
| 2605 | (("'file'")
|
| 2606 | (pystr (search-input-file inputs "/bin/file"))))))))))
|
| 2607 | (inputs (list binutils file))
|
| 2608 | (native-inputs (list clang-13 procps python-pytest python-setuptools))
|
| 2609 | (home-page "https://github.com/SRI-CSL/whole-program-llvm")
|
| 2610 | (synopsis "Whole Program LLVM")
|
| 2611 | (description "This package provides a toolkit for building whole-program
|
| 2612 | LLVM bitcode files.")
|
| 2613 | (license license:expat)))
|
| 2614 |
|
| 2615 | (define-public llvm-julia
|
| 2616 | (package
|
| 2617 | (inherit llvm-13)
|
| 2618 | (arguments
|
| 2619 | (substitute-keyword-arguments arguments
|
| 2620 | ((#:configure-flags flags ''())
|
| 2621 | #~(cons* "-DLLVM_BUILD_LLVM_DYLIB=ON"
|
| 2622 | "-DLLVM_LINK_LLVM_DYLIB=ON"
|
| 2623 | |
| 2624 | "-DLLVM_VERSION_SUFFIX:STRING=jl" |
| 2625 | #$(string-append "-DLLVM_TARGETS_TO_BUILD="
|
| 2626 | (system->llvm-target))
|
| 2627 | (delete "-DBUILD_SHARED_LIBS:BOOL=TRUE" #$flags)))
|
| 2628 | ((#:build-type _) "Release")))
|
| 2629 | (properties `((hidden? . #t)
|
| 2630 | ,@(package-properties llvm-13)))))
|
| 2631 |
|
| 2632 | (define llvm-cling-base llvm-16)
|
| 2633 |
|
| 2634 | (define llvm-cling
|
| 2635 | (let ((base llvm-cling-base))
|
| 2636 | (package/inherit base
|
| 2637 | (name "llvm-cling")
|
| 2638 | |
| 2639 | |
| 2640 | (version "16-20240621-02")
|
| 2641 | (source
|
| 2642 | (origin
|
| 2643 | (inherit (package-source base))
|
| 2644 | (method git-fetch)
|
| 2645 | (uri (git-reference
|
| 2646 | (url "https://github.com/root-project/llvm-project")
|
| 2647 | (commit (string-append "cling-llvm" version))))
|
| 2648 | (file-name (git-file-name "llvm-cling" version))
|
| 2649 | (sha256
|
| 2650 | (base32
|
| 2651 | "05libb4mc385n8sq0bilalvidwzzrcyiqsfkn7j179kkx66a8rzy"))))
|
| 2652 | (arguments
|
| 2653 | |
| 2654 | |
| 2655 | |
| 2656 | (substitute-keyword-arguments arguments
|
| 2657 | ((#:configure-flags cf ''())
|
| 2658 | #~(cons* "-DLLVM_TARGETS_TO_BUILD=host;NVPTX" #$cf)))))))
|
| 2659 |
|
| 2660 | (define clang-cling-runtime
|
| 2661 | (let ((base clang-runtime-16))
|
| 2662 | (package/inherit base
|
| 2663 | (name "clang-cling-runtime")
|
| 2664 | (version (package-version llvm-cling))
|
| 2665 | (source (package-source llvm-cling))
|
| 2666 | (arguments
|
| 2667 | (substitute-keyword-arguments arguments
|
| 2668 | ((#:phases phases '%standard-phases)
|
| 2669 | #~(modify-phases #$phases
|
| 2670 | (add-after 'install 'delete-static-libraries
|
| 2671 | |
| 2672 | (lambda _
|
| 2673 | (for-each delete-file (find-files #$output "\\.a$"))))))))
|
| 2674 | (inputs (modify-inputs inputs
|
| 2675 | (replace "llvm" llvm-cling))))))
|
| 2676 |
|
| 2677 | (define clang-cling
|
| 2678 | (let ((base clang-16))
|
| 2679 | (package/inherit base
|
| 2680 | (name "clang-cling")
|
| 2681 | (version (package-version llvm-cling))
|
| 2682 | (source (package-source llvm-cling))
|
| 2683 | (propagated-inputs
|
| 2684 | (modify-inputs propagated-inputs
|
| 2685 | (replace "llvm" llvm-cling)
|
| 2686 | (replace "clang-runtime" clang-cling-runtime))))))
|
| 2687 |
|
| 2688 | (define-public cling
|
| 2689 | (package
|
| 2690 | (name "cling")
|
| 2691 | (version "1.1")
|
| 2692 | (source (origin
|
| 2693 | (method git-fetch)
|
| 2694 | (uri (git-reference
|
| 2695 | (url "https://github.com/root-project/cling")
|
| 2696 | (commit (string-append "v" version))))
|
| 2697 | (file-name (git-file-name name version))
|
| 2698 | (sha256
|
| 2699 | (base32
|
| 2700 | "13ghbqjppvbmkhjgfk9xggxh17xpmx18ghdqgkkg9a3mh19hf69h"))))
|
| 2701 | (build-system cmake-build-system)
|
| 2702 | (arguments
|
| 2703 | (list
|
| 2704 | #:build-type "Release" |
| 2705 | |
| 2706 | |
| 2707 | #:tests? #f
|
| 2708 | #:configure-flags
|
| 2709 | #~(list (string-append "-DCLING_CXX_PATH="
|
| 2710 | (search-input-file %build-inputs "bin/g++"))
|
| 2711 | |
| 2712 | |
| 2713 | (string-append "-DLLVM_EXTERNAL_LIT="
|
| 2714 | (search-input-file %build-inputs "bin/.lit-real")))
|
| 2715 | #:phases
|
| 2716 | #~(modify-phases %standard-phases
|
| 2717 | (add-after 'unpack 'set-version
|
| 2718 | (lambda _
|
| 2719 | (make-file-writable "VERSION")
|
| 2720 | (call-with-output-file "VERSION"
|
| 2721 | (lambda (port)
|
| 2722 | (format port "~a~%" #$version)))))
|
| 2723 | (add-after 'unpack 'patch-paths
|
| 2724 | (lambda* (#:key inputs #:allow-other-keys)
|
| 2725 | (substitute* "lib/Interpreter/CIFactory.cpp"
|
| 2726 | (("\\bsed\\b")
|
| 2727 | (which "sed"))
|
| 2728 | |
| 2729 | |
| 2730 | |
| 2731 | |
| 2732 | |
| 2733 | |
| 2734 | |
| 2735 | (("static std::string getResourceDir.*" all)
|
| 2736 | (string-append all
|
| 2737 | " return std::string(\""
|
| 2738 | #$(this-package-input "clang-cling")
|
| 2739 | "/lib/clang/"
|
| 2740 | #$(first
|
| 2741 | (take (string-split
|
| 2742 | (package-version clang-cling) #\-)
|
| 2743 | 1)) |
| 2744 | "\");")))
|
| 2745 | |
| 2746 | |
| 2747 | (substitute* "CMakeLists.txt"
|
| 2748 | (("lit.py")
|
| 2749 | "lit"))))
|
| 2750 | (add-after 'unpack 'adjust-lit.cfg
|
| 2751 | |
| 2752 | (lambda _
|
| 2753 | (substitute* "test/lit.cfg"
|
| 2754 | (("config.llvm_tools_dir \\+ '")
|
| 2755 | "config.cling_obj_root + '/bin"))))
|
| 2756 | (add-before 'check 'set-CLANG
|
| 2757 | (lambda* (#:key native-inputs inputs #:allow-other-keys)
|
| 2758 | |
| 2759 | |
| 2760 | (setenv "CLANG" (search-input-file (or native-inputs inputs)
|
| 2761 | "bin/clang"))))
|
| 2762 | (add-after 'install 'delete-static-libraries
|
| 2763 | |
| 2764 | (lambda _
|
| 2765 | (for-each delete-file (find-files #$output "\\.a$"))))
|
| 2766 | (add-after 'install 'wrap-with-include-paths
|
| 2767 | |
| 2768 | |
| 2769 | |
| 2770 | (lambda* (#:key inputs #:allow-other-keys)
|
| 2771 | (let ((gcc-toolchain #$(this-package-input "gcc-toolchain")))
|
| 2772 | (wrap-program (string-append #$output "/bin/cling")
|
| 2773 | `("C_INCLUDE_PATH" prefix
|
| 2774 | (,(string-append gcc-toolchain "/include")))
|
| 2775 | `("CPLUS_INCLUDE_PATH" prefix
|
| 2776 | (,(string-append gcc-toolchain "/include/c++")
|
| 2777 | ,(string-append gcc-toolchain "/include")))))))
|
| 2778 | (add-after 'wrap-with-include-paths 'fix-wrapper
|
| 2779 | (lambda _
|
| 2780 | |
| 2781 | |
| 2782 | (substitute* (string-append #$output "/bin/cling")
|
| 2783 | (("\"\\$0\"")
|
| 2784 | "\"${0##*/}\"")))))))
|
| 2785 | (native-inputs (list clang-cling python python-lit))
|
| 2786 | (inputs (list clang-cling (force gcc-toolchain*) llvm-cling libxcrypt))
|
| 2787 | (home-page "https://root.cern/cling/")
|
| 2788 | (synopsis "Interactive C++ interpreter")
|
| 2789 | (description "Cling is an interactive C++17 standard compliant
|
| 2790 | interpreter, built on top of LLVM and Clang. Cling can be used as a
|
| 2791 | read-eval-print loop (REPL) to assist with rapid application development.
|
| 2792 | Here's how to print @samp{\"Hello World!\"} using @command{cling}:
|
| 2793 |
|
| 2794 | @example
|
| 2795 | cling '#include <stdio.h>' 'printf(\"Hello World!\\n\");'
|
| 2796 | @end example")
|
| 2797 | (license license:lgpl2.1+))) |
| 2798 |
|
| 2799 | (define %swift-llvm-clang-version "5.7.3")
|
| 2800 |
|
| 2801 | (define-public swift-llvm
|
| 2802 | (package
|
| 2803 | (name "swift-llvm")
|
| 2804 | (version %swift-llvm-clang-version)
|
| 2805 | (source (origin
|
| 2806 | (method git-fetch)
|
| 2807 | (uri (git-reference
|
| 2808 | (url "https://github.com/apple/llvm-project.git")
|
| 2809 | (commit (string-append "swift-" %swift-llvm-clang-version
|
| 2810 | "-RELEASE"))))
|
| 2811 | (file-name (git-file-name "swift-llvm" %swift-llvm-clang-version))
|
| 2812 | (sha256
|
| 2813 | (base32
|
| 2814 | "0ai460v5kqq3mhp0vz1f5rr2fcwqmx91bnwbkaksjp9cxlylnfr0"))
|
| 2815 | (patches (search-patches "swift-llvm-5.7.3-linux.patch"))))
|
| 2816 | (build-system cmake-build-system)
|
| 2817 | (arguments
|
| 2818 | (list
|
| 2819 | |
| 2820 | |
| 2821 | |
| 2822 | #:tests? #f
|
| 2823 | #:build-type "Release"
|
| 2824 | #:configure-flags
|
| 2825 | #~(list "-DCMAKE_C_FLAGS=-fno-stack-protector"
|
| 2826 | "-DCMAKE_CXX_FLAGS=-fno-stack-protector"
|
| 2827 | "-DCMAKE_C_FLAGS_RELWITHDEBINFO=-O2 -DNDEBUG"
|
| 2828 | "-DCMAKE_CXX_FLAGS_RELWITHDEBINFO=-O2 -DNDEBUG"
|
| 2829 | "-DLLVM_TOOL_SWIFT_BUILD:BOOL=NO"
|
| 2830 | "-DINTERNAL_INSTALL_PREFIX=local"
|
| 2831 | "-DLLVM_INCLUDE_DOCS=YES"
|
| 2832 | "-DLLVM_ENABLE_LTO="
|
| 2833 | "-DLLVM_ENABLE_DUMP=ON"
|
| 2834 | "-DLLVM_ENABLE_PROJECTS=clang"
|
| 2835 | "-DLLVM_TARGETS_TO_BUILD=X86;ARM;AArch64;PowerPC;SystemZ;Mips"
|
| 2836 | |
| 2837 | |
| 2838 | "-DLLVM_ENABLE_ASSERTIONS=TRUE"
|
| 2839 | "-DLLVM_LIT_ARGS=-sv -j 16"
|
| 2840 | (string-append "-DGCC_INSTALL_PREFIX="
|
| 2841 | (assoc-ref %build-inputs "gcc-lib"))
|
| 2842 | (string-append "-DC_INCLUDE_DIRS="
|
| 2843 | (assoc-ref %build-inputs "libc")
|
| 2844 | "/include")
|
| 2845 | (string-append "-DCMAKE_INSTALL_PREFIX=" #$output))
|
| 2846 | #:phases
|
| 2847 | #~(modify-phases %standard-phases
|
| 2848 | (add-after 'unpack 'enter-llvm-directory
|
| 2849 | (lambda _
|
| 2850 | (chdir "llvm")))
|
| 2851 | (add-after 'enter-llvm-directory 'allow-config-h-install
|
| 2852 | (lambda _
|
| 2853 | |
| 2854 | (substitute* "CMakeLists.txt"
|
| 2855 | (("PATTERN \"config\\.h\" EXCLUDE")
|
| 2856 | ""))))
|
| 2857 | (add-after 'allow-config-h-install 'fix-demangle-includes
|
| 2858 | (lambda _
|
| 2859 | (substitute* "include/llvm/Demangle/MicrosoftDemangleNodes.h"
|
| 2860 | (("#include <array>")
|
| 2861 | "#include <array>\n#include <cstdint>\n#include <string>"))
|
| 2862 | (substitute* "utils/benchmark/src/benchmark_register.h"
|
| 2863 | (("#include <vector>")
|
| 2864 | "#include <vector>\n#include <limits>"))
|
| 2865 | (substitute* "include/llvm/Support/Signals.h"
|
| 2866 | (("#include <string>")
|
| 2867 | "#include <string>
|
| 2868 | #include <cstdint>"))
|
| 2869 | |
| 2870 | |
| 2871 | |
| 2872 | |
| 2873 | (substitute* "lib/Analysis/ConstantFolding.cpp"
|
| 2874 | (("#include \"llvm/Config/config.h\"")
|
| 2875 | "#include \"llvm/Config/config.h\"\n#define _GLIBCXX_HAVE_FENV_H 1\n#include <fenv.h>"))))
|
| 2876 | (add-after 'fix-demangle-includes 'set-glibc-file-names
|
| 2877 | (lambda* (#:key inputs #:allow-other-keys)
|
| 2878 | (let ((libc (assoc-ref inputs "libc"))
|
| 2879 | (gcc (assoc-ref inputs "gcc")))
|
| 2880 | (substitute* "../clang/lib/Driver/ToolChains/Linux.cpp"
|
| 2881 | |
| 2882 | |
| 2883 | (("(^[[:blank:]]+LibDir = ).*" _ declaration)
|
| 2884 | (string-append declaration "\"" libc "/lib\";\n"))
|
| 2885 | |
| 2886 | (("LibStdCXXIncludePathCandidates\\[\\] = \\{")
|
| 2887 | (string-append
|
| 2888 | "LibStdCXXIncludePathCandidates[] = { \"" gcc
|
| 2889 | "/include/c++\","))
|
| 2890 | |
| 2891 | |
| 2892 | (("@GLIBC_LIBDIR@")
|
| 2893 | (string-append libc "/lib"))))))
|
| 2894 | (add-after 'install 'install-filecheck
|
| 2895 | (lambda _
|
| 2896 | |
| 2897 | |
| 2898 | (install-file "bin/FileCheck"
|
| 2899 | (string-append #$output "/bin")))))))
|
| 2900 | (native-inputs
|
| 2901 | (list python-3))
|
| 2902 | (inputs
|
| 2903 | `(("libxml2" ,libxml2)
|
| 2904 | ("gcc-lib" ,gcc "lib")
|
| 2905 | ("gcc" ,gcc)
|
| 2906 | ("libc" ,glibc)
|
| 2907 | ("libffi" ,libffi)))
|
| 2908 | (propagated-inputs
|
| 2909 | (list zlib))
|
| 2910 | (home-page "https://swift.org/")
|
| 2911 | (synopsis "LLVM for Swift (Apple's fork)")
|
| 2912 | (description
|
| 2913 | "This is Apple's fork of LLVM with Swift-specific modifications,
|
| 2914 | required to build Swift.")
|
| 2915 | (license license:ncsa)))
|
| 2916 |
|
| 2917 | |
| 2918 | |
| 2919 | |
| 2920 | |
| 2921 | |
| 2922 | |
| 2923 | |
| 2924 | |
| 2925 |
|
| 2926 | (define-public swift-llvm-6.2
|
| 2927 | (package
|
| 2928 | (inherit swift-llvm)
|
| 2929 | (version "6.2")
|
| 2930 | (source (origin
|
| 2931 | (method git-fetch)
|
| 2932 | (uri (git-reference
|
| 2933 | (url "https://github.com/apple/llvm-project.git")
|
| 2934 | (commit (string-append "swift-" version "-RELEASE"))))
|
| 2935 | (file-name (git-file-name "swift-llvm" version))
|
| 2936 | (sha256
|
| 2937 | (base32
|
| 2938 | "00bpplh8zd495n7dw5a64ncy23r2sgj7071kyhw7r9s53ihw1k1m"))
|
| 2939 | (patches (search-patches "clang-18.0-libc-search-path.patch"))))
|
| 2940 | (arguments
|
| 2941 | (substitute-keyword-arguments arguments
|
| 2942 | ((#:configure-flags flags)
|
| 2943 | #~(cons "-DUSE_DEPRECATED_GCC_INSTALL_PREFIX=ON" #$flags))
|
| 2944 | ((#:phases phases)
|
| 2945 | #~(modify-phases #$phases
|
| 2946 | (replace 'fix-demangle-includes
|
| 2947 | (lambda _
|
| 2948 | (substitute* "include/llvm/Demangle/MicrosoftDemangleNodes.h"
|
| 2949 | (("#include <array>")
|
| 2950 | "#include <array>
|
| 2951 | #include <cstdint>
|
| 2952 | #include <string>"))
|
| 2953 | (substitute* "../third-party/benchmark/src/benchmark_register.h"
|
| 2954 | (("#include <vector>")
|
| 2955 | "#include <vector>
|
| 2956 | #include <limits>"))
|
| 2957 | (substitute* "include/llvm/Support/Signals.h"
|
| 2958 | (("#include <string>")
|
| 2959 | "#include <string>
|
| 2960 | #include <cstdint>"))
|
| 2961 | (substitute* "lib/Analysis/ConstantFolding.cpp"
|
| 2962 | (("#include \"llvm/Config/config.h\"")
|
| 2963 | "#include \"llvm/Config/config.h\"
|
| 2964 | #define _GLIBCXX_HAVE_FENV_H 1
|
| 2965 | #include <fenv.h>"))))))))))
|