diff --git a/Aliases/llvm@11 b/Aliases/llvm@12 similarity index 100% rename from Aliases/llvm@11 rename to Aliases/llvm@12 diff --git a/Formula/llvm.rb b/Formula/llvm.rb index b658a90321b..72e266346c6 100644 --- a/Formula/llvm.rb +++ b/Formula/llvm.rb @@ -1,44 +1,12 @@ class Llvm < Formula desc "Next-gen compiler infrastructure" homepage "https://llvm.org/" + url "https://github.com/llvm/llvm-project/releases/download/llvmorg-12.0.0/llvm-project-12.0.0.src.tar.xz" + sha256 "9ed1688943a4402d7c904cc4515798cdb20080066efa010fe7e1f2551b423628" # The LLVM Project is under the Apache License v2.0 with LLVM Exceptions license "Apache-2.0" => { with: "LLVM-exception" } - revision 1 head "https://github.com/llvm/llvm-project.git", branch: "main" - stable do - url "https://github.com/llvm/llvm-project/releases/download/llvmorg-11.1.0/llvm-project-11.1.0.src.tar.xz" - sha256 "74d2529159fd118c3eac6f90107b5611bccc6f647fdea104024183e8d5e25831" - - patch do - url "https://github.com/llvm/llvm-project/commit/c86f56e32e724c6018e579bb2bc11e667c96fc96.patch?full_index=1" - sha256 "6e13e01b4f9037bb6f43f96cb752d23b367fe7db4b66d9bf2a4aeab9234b740a" - end - - patch do - url "https://github.com/llvm/llvm-project/commit/31e5f7120bdd2f76337686d9d169b1c00e6ee69c.patch?full_index=1" - sha256 "f025110aa6bf80bd46d64a0e2b1e2064d165353cd7893bef570b6afba7e90b4d" - end - - patch do - url "https://github.com/llvm/llvm-project/commit/3c7bfbd6831b2144229734892182d403e46d7baf.patch?full_index=1" - sha256 "62014ddad6d5c485ecedafe3277fe7978f3f61c940976e3e642536726abaeb68" - end - - patch do - url "https://github.com/llvm/llvm-project/commit/c4d7536136b331bada079b2afbb2bd09ad8296bf.patch?full_index=1" - sha256 "2b894cbaf990510969bf149697882c86a068a1d704e749afa5d7b71b6ee2eb9f" - end - - # Upstream ARM patch for OpenMP runtime, remove in next version - # https://reviews.llvm.org/D91002 - # https://bugs.llvm.org/show_bug.cgi?id=47609 - patch do - url "https://raw.githubusercontent.com/Homebrew/formula-patches/6166a68c/llvm/openmp_arm.patch" - sha256 "70fe3836b423e593688cd1cc7a3d76ee6406e64b9909f1a2f780c6f018f89b1e" - end - end - livecheck do url :homepage regex(/LLVM (\d+\.\d+\.\d+)/i) @@ -66,10 +34,10 @@ class Llvm < Formula # See: Homebrew/homebrew-core/issues/35513 depends_on "cmake" => :build depends_on "swig" => :build - depends_on "libffi" depends_on "python@3.9" uses_from_macos "libedit" + uses_from_macos "libffi", since: :catalina uses_from_macos "libxml2" uses_from_macos "ncurses" uses_from_macos "zlib" @@ -128,8 +96,6 @@ class Llvm < Formula -DLLVM_ENABLE_Z3_SOLVER=OFF -DLLVM_OPTIMIZED_TABLEGEN=ON -DLLVM_TARGETS_TO_BUILD=all - -DFFI_INCLUDE_DIR=#{Formula["libffi"].opt_lib}/libffi-#{Formula["libffi"].version}/include - -DFFI_LIBRARY_DIR=#{Formula["libffi"].opt_lib} -DLLDB_USE_SYSTEM_DEBUGSERVER=ON -DLLDB_ENABLE_PYTHON=ON -DLLDB_ENABLE_LUA=OFF @@ -139,19 +105,22 @@ class Llvm < Formula -DCLANG_PYTHON_BINDINGS_VERSIONS=#{py_ver} ] + if MacOS.version >= :catalina + args << "-DFFI_INCLUDE_DIR=#{MacOS.sdk_path}/usr/include/ffi" + args << "-DFFI_LIBRARY_DIR=#{MacOS.sdk_path}/usr/lib" + else + args << "-DFFI_INCLUDE_DIR=#{Formula["libffi"].opt_include}" + args << "-DFFI_LIBRARY_DIR=#{Formula["libffi"].opt_lib}" + end + on_macos do args << "-DLLVM_BUILD_LLVM_C_DYLIB=ON" args << "-DLLVM_ENABLE_LIBCXX=ON" args << "-DLLVM_CREATE_XCODE_TOOLCHAIN=#{MacOS::Xcode.installed? ? "ON" : "OFF"}" + args << "-DRUNTIMES_CMAKE_ARGS=-DCMAKE_INSTALL_RPATH=@loader_path/../lib" sdk = MacOS.sdk_path_if_needed args << "-DDEFAULT_SYSROOT=#{sdk}" if sdk - - if MacOS.version == :mojave && MacOS::CLT.installed? - # Mojave CLT linker via software update is older than Xcode. - # Use it to retain compatibility. - args << "-DCMAKE_LINKER=/Library/Developer/CommandLineTools/usr/bin/ld" - end end on_linux do @@ -165,6 +134,8 @@ class Llvm < Formula llvmpath = buildpath/"llvm" mkdir llvmpath/"build" do system "cmake", "-G", "Unix Makefiles", "..", *(std_cmake_args + args) + # Workaround for CMake Error: failed to create symbolic link + ENV.deparallelize if Hardware::CPU.arm? system "cmake", "--build", "." system "cmake", "--build", ".", "--target", "install" system "cmake", "--build", ".", "--target", "install-xcode-toolchain" if MacOS::Xcode.installed?