├── .gitignore ├── Aliases ├── llvm-4.rb ├── llvm-5.rb └── llvm-6.rb ├── BOTTLES.md ├── Formula ├── llvm-10.rb ├── llvm-11.rb ├── llvm-12.rb ├── llvm-13.rb ├── llvm-3.7.rb ├── llvm-3.8.rb ├── llvm-3.9.rb ├── llvm-4.0.rb ├── llvm-5.0.rb ├── llvm-6.0.rb ├── llvm-7.rb ├── llvm-8.rb └── llvm-9.rb └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | *.json 3 | *.tar.gz 4 | -------------------------------------------------------------------------------- /Aliases/llvm-4.rb: -------------------------------------------------------------------------------- 1 | ../Formula/llvm-4.0.rb -------------------------------------------------------------------------------- /Aliases/llvm-5.rb: -------------------------------------------------------------------------------- 1 | ../Formula/llvm-5.0.rb -------------------------------------------------------------------------------- /Aliases/llvm-6.rb: -------------------------------------------------------------------------------- 1 | ../Formula/llvm-6.0.rb -------------------------------------------------------------------------------- /BOTTLES.md: -------------------------------------------------------------------------------- 1 | # Bottles 2 | 3 | General instructions for writing formula: https://docs.brew.sh/Formula-Cookbook 4 | 5 | ## GitHub 6 | 7 | GitHub allows attaching up to 2GB to a release, so we can use this as the host 8 | for the bottles. 9 | 10 | Example for llvm-10 release 11 | 12 | * Commit llvm-10.rb and add a new tag v10.0.0 13 | 14 | * brew install --build-bottle [--debug --verbose] ./Formula/llvm-10.rb 15 | 16 | * brew bottle --json --force-core-tap --root-url https://github.com/llvm-hs/homebrew-llvm/releases/download/v10.0.0 ./Formula/llvm-10.rb 17 | 18 | * edit llvm-10.rb to add the bottle information and commit 19 | 20 | * The bottle likely has an incorrect name; if it contains a double-dash it 21 | should be changed to a single dash: 22 | llvm-10--10.0.0.mojave.bottle.tar.gz ➜ llvm-10-10.0.0.mojave.bottle.tar.gz 23 | 24 | * Go to https://github.com/llvm-hs/homebrew-llvm/releases and edit tag v10.0.0. 25 | Attach the binary .bottle 26 | 27 | 28 | ## Bintray 29 | 30 | Bintray is the default host used by Homebrew, but limits binary files to 250MB, 31 | which is not large enough for us. 32 | 33 | https://jonathanchang.org/blog/maintain-your-own-homebrew-repository-with-binary-bottles/ 34 | 35 | Set environment variables `HOMEBREW_BINTRAY_USER` and `HOMEBREW_BINTRAY_KEY` 36 | (from bintray.com -> Edit Profile -> API Key) 37 | 38 | > brew test-bot --root-url=https://bintray.com/tmcdonell/bottles-llvm --bintray-org=BINTRAY_USER --tap=llvm-hs/llvm llvm-hs/homebrew-llvm/llvm-9 39 | > brew test-bot --ci-upload --git-name=USERNAME --git-email=EMAIL --bintray-org=BINTRAY_USER --root-url=https://bintray.com/tmcdonell/bottles-llvm 40 | 41 | Go to the package on bintray.com and hit "Publish". 42 | 43 | -------------------------------------------------------------------------------- /Formula/llvm-10.rb: -------------------------------------------------------------------------------- 1 | class Llvm10 < Formula 2 | desc "Next-gen compiler infrastructure" 3 | homepage "http://llvm.org/" 4 | 5 | version = "10.0.0" 6 | 7 | stable do 8 | url "https://github.com/llvm/llvm-project/releases/download/llvmorg-#{version}/llvm-#{version}.src.tar.xz" 9 | sha256 "df83a44b3a9a71029049ec101fb0077ecbbdf5fe41e395215025779099a98fdf" 10 | 11 | resource "clang" do 12 | url "https://github.com/llvm/llvm-project/releases/download/llvmorg-#{version}/clang-#{version}.src.tar.xz" 13 | sha256 "885b062b00e903df72631c5f98b9579ed1ed2790f74e5646b4234fa084eacb21" 14 | end 15 | 16 | resource "clang-tools-extra" do 17 | url "https://github.com/llvm/llvm-project/releases/download/llvmorg-#{version}/clang-tools-extra-#{version}.src.tar.xz" 18 | sha256 "acdf8cf6574b40e6b1dabc93e76debb84a9feb6f22970126b04d4ba18b92911c" 19 | end 20 | 21 | resource "compiler-rt" do 22 | url "https://github.com/llvm/llvm-project/releases/download/llvmorg-#{version}/compiler-rt-#{version}.src.tar.xz" 23 | sha256 "6a7da64d3a0a7320577b68b9ca4933bdcab676e898b759850e827333c3282c75" 24 | end 25 | 26 | resource "polly" do 27 | url "https://github.com/llvm/llvm-project/releases/download/llvmorg-#{version}/polly-#{version}.src.tar.xz" 28 | sha256 "35fba6ed628896fe529be4c10407f1b1c8a7264d40c76bced212180e701b4d97" 29 | end 30 | 31 | resource "lld" do 32 | url "https://github.com/llvm/llvm-project/releases/download/llvmorg-#{version}/lld-#{version}.src.tar.xz" 33 | sha256 "b9a0d7c576eeef05bc06d6e954938a01c5396cee1d1e985891e0b1cf16e3d708" 34 | end 35 | 36 | resource "openmp" do 37 | url "https://github.com/llvm/llvm-project/releases/download/llvmorg-#{version}/openmp-#{version}.src.tar.xz" 38 | sha256 "3b9ff29a45d0509a1e9667a0feb43538ef402ea8cfc7df3758a01f20df08adfa" 39 | end 40 | 41 | resource "libcxx" do 42 | url "https://github.com/llvm/llvm-project/releases/download/llvmorg-#{version}/libcxx-#{version}.src.tar.xz" 43 | sha256 "270f8a3f176f1981b0f6ab8aa556720988872ec2b48ed3b605d0ced8d09156c7" 44 | end 45 | 46 | resource "libunwind" do 47 | url "https://github.com/llvm/llvm-project/releases/download/llvmorg-#{version}/libunwind-#{version}.src.tar.xz" 48 | sha256 "09dc5ecc4714809ecf62908ae8fe8635ab476880455287036a2730966833c626" 49 | end 50 | end 51 | 52 | bottle do 53 | root_url "https://github.com/llvm-hs/homebrew-llvm/releases/download/v10.0.0" 54 | sha256 cellar: :any, mojave: "05ddd0e387a766edd302b55f9635f7108a4ebdbd5fb39d8f4c3c57cb5d472961" 55 | end 56 | 57 | head do 58 | url "https://git.llvm.org/git/llvm.git" 59 | 60 | resource "clang" do 61 | url "https://git.llvm.org/git/clang.git" 62 | end 63 | 64 | resource "clang-extra-tools" do 65 | url "https://git.llvm.org/git/clang-tools-extra.git" 66 | end 67 | 68 | resource "compiler-rt" do 69 | url "https://git.llvm.org/git/compiler-rt.git" 70 | end 71 | 72 | resource "libcxx" do 73 | url "https://git.llvm.org/git/libcxx.git" 74 | end 75 | 76 | resource "libunwind" do 77 | url "https://git.llvm.org/git/libunwind.git" 78 | end 79 | 80 | resource "lld" do 81 | url "https://git.llvm.org/git/lld.git" 82 | end 83 | 84 | resource "lldb" do 85 | url "https://git.llvm.org/git/lldb.git" 86 | end 87 | 88 | resource "openmp" do 89 | url "https://git.llvm.org/git/openmp.git" 90 | end 91 | 92 | resource "polly" do 93 | url "https://git.llvm.org/git/polly.git" 94 | end 95 | end 96 | 97 | # http://releases.llvm.org/10.0.0/docs/GettingStarted.html#requirements 98 | depends_on "cmake" => :build 99 | depends_on xcode: :build 100 | depends_on "libffi" 101 | 102 | # version suffix 103 | def ver 104 | "10" 105 | end 106 | 107 | # http://releases.llvm.org/10.0.0/docs/CMake.html 108 | def install 109 | # Apple's libstdc++ is too old to build LLVM 110 | ENV.libcxx if ENV.compiler == :clang 111 | 112 | # compiler-rt has some iOS simulator features that require i386 symbols. I'm 113 | # assuming the rest of clang also needs support for 32-bit compilation to 114 | # work correctly, but if not, perhaps universal binaries could be limited to 115 | # compiler-rt. LLVM makes this somewhat easier because compiler-rt can 116 | # almost be treated as an entirely different build from LLVM. 117 | ENV.permit_arch_flags 118 | 119 | clang_buildpath = buildpath/"tools/clang" 120 | libcxx_buildpath = buildpath/"projects/libcxx" 121 | 122 | clang_buildpath.install resource("clang") 123 | libcxx_buildpath.install resource("libcxx") 124 | (buildpath/"tools/lld").install resource("lld") 125 | (buildpath/"tools/polly").install resource("polly") 126 | (buildpath/"tools/clang/tools/extra").install resource("clang-tools-extra") 127 | (buildpath/"projects/openmp").install resource("openmp") 128 | (buildpath/"projects/libunwind").install resource("libunwind") 129 | (buildpath/"projects/compiler-rt").install resource("compiler-rt") 130 | 131 | install_prefix = lib/"llvm-#{ver}" 132 | 133 | args = %W[ 134 | -DCMAKE_INSTALL_PREFIX=#{install_prefix} 135 | -DCMAKE_BUILD_TYPE=Release 136 | -DLLVM_ENABLE_ASSERTIONS=ON 137 | -DLLVM_OPTIMIZED_TABLEGEN=ON 138 | -DLLVM_INCLUDE_DOCS=OFF 139 | -DLLVM_ENABLE_RTTI=ON 140 | -DLLVM_ENABLE_EH=ON 141 | -DLLVM_INSTALL_UTILS=ON 142 | -DWITH_POLLY=ON 143 | -DLINK_POLLY_INTO_TOOLS=ON 144 | -DLLVM_TARGETS_TO_BUILD=all 145 | -DLIBOMP_ARCH=x86_64 146 | -DLLVM_BUILD_EXTERNAL_COMPILER_RT=ON 147 | -DLLVM_BUILD_LLVM_DYLIB=ON 148 | -DLLVM_LINK_LLVM_DYLIB=ON 149 | -DLLVM_ENABLE_LIBCXX=ON 150 | -DLLVM_ENABLE_FFI=ON 151 | -DFFI_INCLUDE_DIR=#{Formula["libffi"].opt_lib}/libffi-#{Formula["libffi"].version}/include 152 | -DFFI_LIBRARY_DIR=#{Formula["libffi"].opt_lib} 153 | -DLLVM_CREATE_XCODE_TOOLCHAIN=ON 154 | ] 155 | 156 | mkdir "build" do 157 | system "cmake", "-G", "Unix Makefiles", "..", *(std_cmake_args + args) 158 | system "make" 159 | system "make", "install" 160 | system "make", "install-xcode-toolchain" 161 | end 162 | 163 | (share/"clang-#{ver}/tools").install Dir["tools/clang/tools/scan-{build,view}"] 164 | inreplace share/"clang-#{ver}/tools/scan-build/bin/scan-build", "$RealBin/bin/clang", install_prefix/"bin/clang" 165 | (install_prefix/"bin").install_symlink share/"clang-#{ver}/tools/scan-view/bin/scan-view" 166 | (install_prefix/"bin").install_symlink share/"clang-#{ver}/tools/scan-build/bin/scan-build" 167 | (install_prefix/"share/man/man1").install_symlink share/"clang-#{ver}/tools/scan-build/scan-build.1" 168 | 169 | (lib/"python2.7/site-packages").install "bindings/python/llvm" => "llvm-#{ver}", 170 | clang_buildpath/"bindings/python/clang" => "clang-#{ver}" 171 | 172 | # replace the existing "clang -> clang-10" symlink 173 | rm install_prefix/"bin/clang" 174 | mv install_prefix/"bin/clang-#{ver}", install_prefix/"bin/clang" 175 | 176 | # These versioned .dylib symlinks are missing for some reason 177 | # Note that we use relative symlinks 178 | ln_s "libLLVM.dylib", install_prefix/"lib/libLLVM-#{ver}.dylib" 179 | 180 | # Set LC_LOAD_DYLIB entries to absolute paths 181 | system "install_name_tool", "-change", "@rpath/libLLVM.dylib", install_prefix/"lib/libLLVM.dylib", install_prefix/"lib/libLTO.dylib" 182 | system "install_name_tool", "-change", "@rpath/libLLVM.dylib", install_prefix/"lib/libLLVM.dylib", install_prefix/"lib/libclang.dylib" 183 | 184 | # Set LC_ID_DYLIB entries to absolute paths 185 | system "install_name_tool", "-id", install_prefix/"lib/libLLVM.dylib", install_prefix/"lib/libLLVM.dylib" 186 | system "install_name_tool", "-id", install_prefix/"lib/libLTO.dylib", install_prefix/"lib/libLTO.dylib" 187 | system "install_name_tool", "-id", install_prefix/"lib/libc++.1.0.dylib", install_prefix/"lib/libc++.1.0.dylib" 188 | system "install_name_tool", "-id", install_prefix/"lib/libclang.dylib", install_prefix/"lib/libclang.dylib" 189 | system "install_name_tool", "-id", install_prefix/"lib/libomp.dylib", install_prefix/"lib/libomp.dylib" 190 | system "install_name_tool", "-id", install_prefix/"lib/libunwind.1.0.dylib", install_prefix/"lib/libunwind.1.0.dylib" 191 | 192 | Dir.glob(install_prefix/"bin/*") do |exec_path| 193 | basename = File.basename(exec_path) 194 | bin.install_symlink exec_path => "#{basename}-#{ver}" 195 | end 196 | 197 | Dir.glob(install_prefix/"share/man/man1/*") do |manpage| 198 | basename = File.basename(manpage, ".1") 199 | man1.install_symlink manpage => "#{basename}-#{ver}.1" 200 | end 201 | end 202 | 203 | def caveats 204 | <<~EOS 205 | Extra tools are installed in #{opt_share}/clang-#{ver} 206 | 207 | To link to libc++, something like the following is required: 208 | CXX="clang++-#{ver} -stdlib=libc++" 209 | CXXFLAGS="$CXXFLAGS -nostdinc++ -I#{opt_lib}/llvm-#{ver}/include/c++/v1" 210 | LDFLAGS="$LDFLAGS -L#{opt_lib}/llvm-#{ver}/lib" 211 | EOS 212 | end 213 | 214 | test do 215 | assert_equal prefix.to_s, shell_output("#{bin}/llvm-config-#{ver} --prefix").chomp 216 | 217 | # test for sed errors since some llvm makefiles assume that sed 218 | # understands '\n' which is true for gnu sed and not for bsd sed. 219 | assert_no_match(/PATH\)n/, (lib/"llvm-#{ver}/share/llvm/cmake/LLVMConfig.cmake").read) 220 | system "#{bin}/llvm-config-#{ver}", "--version" 221 | end 222 | end 223 | 224 | -------------------------------------------------------------------------------- /Formula/llvm-11.rb: -------------------------------------------------------------------------------- 1 | class Llvm11 < Formula 2 | desc "Next-gen compiler infrastructure" 3 | homepage "http://llvm.org/" 4 | # The LLVM Project is under the Apache License v2.0 with LLVM Exceptions 5 | license "Apache-2.0" => { with: "LLVM-exception" } 6 | revision 1 7 | 8 | version = "11.1.0" 9 | stable do 10 | url "https://github.com/llvm/llvm-project/releases/download/llvmorg-#{version}/llvm-project-#{version}.src.tar.xz" 11 | sha256 "74d2529159fd118c3eac6f90107b5611bccc6f647fdea104024183e8d5e25831" 12 | 13 | patch do 14 | url "https://github.com/llvm/llvm-project/commit/c86f56e32e724c6018e579bb2bc11e667c96fc96.patch?full_index=1" 15 | sha256 "6e13e01b4f9037bb6f43f96cb752d23b367fe7db4b66d9bf2a4aeab9234b740a" 16 | end 17 | 18 | patch do 19 | url "https://github.com/llvm/llvm-project/commit/31e5f7120bdd2f76337686d9d169b1c00e6ee69c.patch?full_index=1" 20 | sha256 "f025110aa6bf80bd46d64a0e2b1e2064d165353cd7893bef570b6afba7e90b4d" 21 | end 22 | 23 | patch do 24 | url "https://github.com/llvm/llvm-project/commit/3c7bfbd6831b2144229734892182d403e46d7baf.patch?full_index=1" 25 | sha256 "62014ddad6d5c485ecedafe3277fe7978f3f61c940976e3e642536726abaeb68" 26 | end 27 | 28 | patch do 29 | url "https://github.com/llvm/llvm-project/commit/c4d7536136b331bada079b2afbb2bd09ad8296bf.patch?full_index=1" 30 | sha256 "2b894cbaf990510969bf149697882c86a068a1d704e749afa5d7b71b6ee2eb9f" 31 | end 32 | 33 | # Upstream ARM patch for OpenMP runtime, remove in next version 34 | # https://reviews.llvm.org/D91002 35 | # https://bugs.llvm.org/show_bug.cgi?id=47609 36 | patch do 37 | url "https://raw.githubusercontent.com/Homebrew/formula-patches/6166a68c/llvm/openmp_arm.patch" 38 | sha256 "70fe3836b423e593688cd1cc7a3d76ee6406e64b9909f1a2f780c6f018f89b1e" 39 | end 40 | end 41 | 42 | bottle do 43 | root_url "https://github.com/llvm-hs/homebrew-llvm/releases/download/v11.1.0" 44 | sha256 cellar: :any, big_sur: "53755f19b6999b6744b637c62d54235663d385d7e73207e188a4790e33e4cac5" 45 | end 46 | 47 | # Clang cannot find system headers if Xcode CLT is not installed 48 | pour_bottle? do 49 | on_macos do 50 | reason "The bottle needs the Xcode CLT to be installed." 51 | satisfy { MacOS::CLT.installed? } 52 | end 53 | end 54 | 55 | # http://releases.llvm.org/11.0.0/docs/GettingStarted.html#requirements 56 | depends_on "cmake" => :build 57 | 58 | uses_from_macos "libedit" 59 | uses_from_macos "libffi", since: :catalina 60 | uses_from_macos "libxml2" 61 | uses_from_macos "ncurses" 62 | uses_from_macos "zlib" 63 | 64 | # version suffix 65 | def ver 66 | "11" 67 | end 68 | 69 | # http://releases.llvm.org/11.0.0/docs/CMake.html 70 | def install 71 | projects = %w[ 72 | clang 73 | clang-tools-extra 74 | lld 75 | openmp 76 | polly 77 | ] 78 | runtimes = %w[ 79 | libcxx 80 | libcxxabi 81 | libunwind 82 | ] 83 | 84 | # Apple's libstdc++ is too old to build LLVM 85 | ENV.libcxx if ENV.compiler == :clang 86 | 87 | # compiler-rt has some iOS simulator features that require i386 symbols. I'm 88 | # assuming the rest of clang also needs support for 32-bit compilation to 89 | # work correctly, but if not, perhaps universal binaries could be limited to 90 | # compiler-rt. LLVM makes this somewhat easier because compiler-rt can 91 | # almost be treated as an entirely different build from LLVM. 92 | ENV.permit_arch_flags 93 | 94 | install_prefix = lib/"llvm-#{ver}" 95 | 96 | args = %W[ 97 | -DCMAKE_BUILD_TYPE=Release 98 | -DCMAKE_INSTALL_PREFIX=#{install_prefix} 99 | -DLLVM_ENABLE_PROJECTS=#{projects.join(";")} 100 | -DLLVM_ENABLE_RUNTIMES=#{runtimes.join(";")} 101 | -DLLVM_TARGETS_TO_BUILD=all 102 | -DLLVM_ENABLE_ASSERTIONS=ON 103 | -DLLVM_OPTIMIZED_TABLEGEN=ON 104 | -DLLVM_INCLUDE_DOCS=OFF 105 | -DLLVM_INCLUDE_TESTS=OFF 106 | -DLLVM_ENABLE_RTTI=ON 107 | -DLLVM_ENABLE_EH=ON 108 | -DLLVM_INSTALL_UTILS=ON 109 | -DLLVM_ENABLE_Z3_SOLVER=OFF 110 | -DLLVM_BUILD_EXTERNAL_COMPILER_RT=ON 111 | -DLLVM_BUILD_LLVM_C_DYLIB=ON 112 | -DLLVM_LINK_LLVM_DYLIB=ON 113 | -DLLVM_ENABLE_LIBCXX=ON 114 | -DLLVM_ENABLE_FFI=ON 115 | -DLLVM_CREATE_XCODE_TOOLCHAIN=ON 116 | -DLLVM_CREATE_XCODE_TOOLCHAIN=#{MacOS::Xcode.installed? ? "ON" : "OFF"} 117 | ] 118 | 119 | if MacOS.version >= :catalina 120 | args << "-DFFI_INCLUDE_DIR=#{MacOS.sdk_path}/usr/include/ffi" 121 | args << "-DFFI_LIBRARY_DIR=#{MacOS.sdk_path}/usr/lib" 122 | else 123 | args << "-DFFI_INCLUDE_DIR=#{Formula["libffi"].opt_include}" 124 | args << "-DFFI_LIBRARY_DIR=#{Formula["libffi"].opt_lib}" 125 | end 126 | 127 | sdk = MacOS.sdk_path_if_needed 128 | args << "-DDEFAULT_SYSROOT=#{sdk}" if sdk 129 | 130 | if MacOS.version == :mojave && MacOS::CLT.installed? 131 | # Mojave CLT linker via software update is older than Xcode. 132 | # Use it to retain compatibility. 133 | args << "-DCMAKE_LINKER=/Library/Developer/CommandLineTools/usr/bin/ld" 134 | end 135 | 136 | llvmpath = buildpath/"llvm" 137 | mkdir llvmpath/"build" do 138 | system "cmake", "-G", "Unix Makefiles", "..", *(std_cmake_args + args) 139 | system "cmake", "--build", "." 140 | system "cmake", "--build", ".", "--target", "install" 141 | system "cmake", "--build", ".", "--target", "install-xcode-toolchain" if MacOS::Xcode.installed? 142 | end 143 | 144 | # replace the existing "clang -> clang-11" symlink 145 | rm install_prefix/"bin/clang" 146 | mv install_prefix/"bin/clang-#{ver}", install_prefix/"bin/clang" 147 | 148 | # These versioned .dylib symlinks are missing for some reason 149 | # Note that we use relative symlinks 150 | ln_s "libLLVM.dylib", install_prefix/"lib/libLLVM-#{ver}.dylib" 151 | 152 | Dir.glob(install_prefix/"bin/*") do |exec_path| 153 | basename = File.basename(exec_path) 154 | bin.install_symlink exec_path => "#{basename}-#{ver}" 155 | end 156 | 157 | Dir.glob(install_prefix/"share/man/man1/*") do |manpage| 158 | basename = File.basename(manpage, ".1") 159 | man1.install_symlink manpage => "#{basename}-#{ver}.1" 160 | end 161 | end 162 | 163 | def caveats 164 | <<~EOS 165 | Extra tools are installed in #{opt_share}/clang-#{ver} 166 | 167 | To link to libc++, something like the following is required: 168 | CXX="clang++-#{ver} -stdlib=libc++" 169 | CXXFLAGS="$CXXFLAGS -nostdinc++ -I#{opt_lib}/llvm-#{ver}/include/c++/v1" 170 | LDFLAGS="$LDFLAGS -L#{opt_lib}/llvm-#{ver}/lib" 171 | EOS 172 | end 173 | 174 | test do 175 | assert_equal prefix.to_s, shell_output("#{bin}/llvm-config-#{ver} --prefix").chomp 176 | 177 | # test for sed errors since some llvm makefiles assume that sed 178 | # understands '\n' which is true for gnu sed and not for bsd sed. 179 | assert_no_match(/PATH\)n/, (lib/"llvm-#{ver}/share/llvm/cmake/LLVMConfig.cmake").read) 180 | system "#{bin}/llvm-config-#{ver}", "--version" 181 | end 182 | end 183 | 184 | -------------------------------------------------------------------------------- /Formula/llvm-12.rb: -------------------------------------------------------------------------------- 1 | class Llvm12 < Formula 2 | desc "Next-gen compiler infrastructure" 3 | homepage "http://llvm.org/" 4 | # The LLVM Project is under the Apache License v2.0 with LLVM Exceptions 5 | license "Apache-2.0" => { with: "LLVM-exception" } 6 | revision 2 7 | 8 | stable do 9 | url "https://github.com/llvm/llvm-project/releases/download/llvmorg-12.0.1/llvm-project-12.0.1.src.tar.xz" 10 | sha256 "129cb25cd13677aad951ce5c2deb0fe4afc1e9d98950f53b51bdcfb5a73afa0e" 11 | end 12 | 13 | bottle do 14 | root_url "https://github.com/llvm-hs/homebrew-llvm/releases/download/v12.0.1" 15 | rebuild 1 16 | sha256 cellar: :any, monterey: "c850e0581606a97c2e619edb6396d331ed38e262df552dc6068bd0182f9eaa4e" 17 | end 18 | 19 | # Clang cannot find system headers if Xcode CLT is not installed 20 | pour_bottle? do 21 | on_macos do 22 | reason "The bottle needs the Xcode CLT to be installed." 23 | satisfy { MacOS::CLT.installed? } 24 | end 25 | end 26 | 27 | # http://releases.llvm.org/12.0.0/docs/GettingStarted.html#requirements 28 | depends_on "cmake" => :build 29 | 30 | uses_from_macos "libedit" 31 | uses_from_macos "libffi", since: :catalina 32 | uses_from_macos "libxml2" 33 | uses_from_macos "ncurses" 34 | uses_from_macos "zlib" 35 | 36 | # version suffix 37 | def version 38 | "12" 39 | end 40 | 41 | # http://releases.llvm.org/12.0.0/docs/CMake.html 42 | def install 43 | projects = %w[ 44 | clang 45 | clang-tools-extra 46 | compiler-rt 47 | libcxx 48 | libcxxabi 49 | libunwind 50 | lld 51 | lldb 52 | mlir 53 | openmp 54 | polly 55 | ] 56 | runtimes = %w[ 57 | ] 58 | 59 | # Apple's libstdc++ is too old to build LLVM 60 | ENV.libcxx if ENV.compiler == :clang 61 | 62 | # compiler-rt has some iOS simulator features that require i386 symbols. I'm 63 | # assuming the rest of clang also needs support for 32-bit compilation to 64 | # work correctly, but if not, perhaps universal binaries could be limited to 65 | # compiler-rt. LLVM makes this somewhat easier because compiler-rt can 66 | # almost be treated as an entirely different build from LLVM. 67 | ENV.permit_arch_flags 68 | 69 | install_prefix = lib/"llvm-#{version}" 70 | 71 | args = %W[ 72 | -DCMAKE_BUILD_TYPE=Release 73 | -DCMAKE_INSTALL_PREFIX=#{install_prefix} 74 | -DLLVM_ENABLE_PROJECTS=#{projects.join(";")} 75 | -DLLVM_ENABLE_RUNTIMES=#{runtimes.join(";")} 76 | -DLLVM_TARGETS_TO_BUILD=all 77 | -DLLVM_ENABLE_ASSERTIONS=ON 78 | -DLLVM_OPTIMIZED_TABLEGEN=ON 79 | -DLLVM_INCLUDE_DOCS=OFF 80 | -DLLVM_INCLUDE_TESTS=OFF 81 | -DLLVM_ENABLE_RTTI=ON 82 | -DLLVM_ENABLE_EH=ON 83 | -DLLVM_INSTALL_UTILS=ON 84 | -DLLVM_ENABLE_Z3_SOLVER=OFF 85 | -DLLVM_BUILD_EXTERNAL_COMPILER_RT=ON 86 | -DLLVM_BUILD_LLVM_C_DYLIB=ON 87 | -DLLVM_LINK_LLVM_DYLIB=ON 88 | -DLLVM_ENABLE_LIBCXX=ON 89 | -DLLVM_ENABLE_FFI=ON 90 | -DLLVM_CREATE_XCODE_TOOLCHAIN=ON 91 | -DLLVM_CREATE_XCODE_TOOLCHAIN=#{MacOS::Xcode.installed? ? "ON" : "OFF"} 92 | -DLLDB_USE_SYSTEM_DEBUGSERVER=ON 93 | ] 94 | 95 | if MacOS.version >= :catalina 96 | args << "-DFFI_INCLUDE_DIR=#{MacOS.sdk_path}/usr/include/ffi" 97 | args << "-DFFI_LIBRARY_DIR=#{MacOS.sdk_path}/usr/lib" 98 | else 99 | args << "-DFFI_INCLUDE_DIR=#{Formula["libffi"].opt_include}" 100 | args << "-DFFI_LIBRARY_DIR=#{Formula["libffi"].opt_lib}" 101 | end 102 | 103 | sdk = MacOS.sdk_path_if_needed 104 | args << "-DDEFAULT_SYSROOT=#{sdk}" if sdk 105 | 106 | if MacOS.version == :mojave && MacOS::CLT.installed? 107 | # Mojave CLT linker via software update is older than Xcode. 108 | # Use it to retain compatibility. 109 | args << "-DCMAKE_LINKER=/Library/Developer/CommandLineTools/usr/bin/ld" 110 | end 111 | 112 | llvmpath = buildpath/"llvm" 113 | mkdir llvmpath/"build" do 114 | system "cmake", "-G", "Unix Makefiles", "..", *(std_cmake_args + args) 115 | system "cmake", "--build", "." 116 | system "cmake", "--build", ".", "--target", "install" 117 | system "cmake", "--build", ".", "--target", "install-xcode-toolchain" if MacOS::Xcode.installed? 118 | end 119 | 120 | # replace the existing "clang -> clang-12" symlink 121 | rm install_prefix/"bin/clang" 122 | mv install_prefix/"bin/clang-#{version}", install_prefix/"bin/clang" 123 | 124 | # These versioned .dylib symlinks are missing for some reason 125 | # Note that we use relative symlinks 126 | ln_s "libLLVM.dylib", install_prefix/"lib/libLLVM-#{version}.dylib" 127 | 128 | Dir.glob(install_prefix/"bin/*") do |exec_path| 129 | basename = File.basename(exec_path) 130 | bin.install_symlink exec_path => "#{basename}-#{version}" 131 | end 132 | 133 | Dir.glob(install_prefix/"share/man/man1/*") do |manpage| 134 | basename = File.basename(manpage, ".1") 135 | man1.install_symlink manpage => "#{basename}-#{version}.1" 136 | end 137 | end 138 | 139 | def caveats 140 | <<~EOS 141 | Extra tools are installed in #{opt_share}/clang-#{version} 142 | 143 | To link to libc++, something like the following is required: 144 | CXX="clang++-#{version} -stdlib=libc++" 145 | CXXFLAGS="$CXXFLAGS -nostdinc++ -I#{opt_lib}/llvm-#{version}/include/c++/v1" 146 | LDFLAGS="$LDFLAGS -L#{opt_lib}/llvm-#{version}/lib" 147 | EOS 148 | end 149 | 150 | test do 151 | assert_equal prefix.to_s, shell_output("#{bin}/llvm-config-#{version} --prefix").chomp 152 | 153 | # test for sed errors since some llvm makefiles assume that sed 154 | # understands '\n' which is true for gnu sed and not for bsd sed. 155 | assert_no_match(/PATH\)n/, (lib/"llvm-#{version}/share/llvm/cmake/LLVMConfig.cmake").read) 156 | system "#{bin}/llvm-config-#{version}", "--version" 157 | end 158 | end 159 | 160 | -------------------------------------------------------------------------------- /Formula/llvm-13.rb: -------------------------------------------------------------------------------- 1 | class Llvm13 < Formula 2 | desc "Next-gen compiler infrastructure" 3 | homepage "http://llvm.org/" 4 | # The LLVM Project is under the Apache License v2.0 with LLVM Exceptions 5 | license "Apache-2.0" => { with: "LLVM-exception" } 6 | # revision 1 7 | 8 | stable do 9 | url "https://github.com/llvm/llvm-project/releases/download/llvmorg-13.0.1/llvm-project-13.0.1.src.tar.xz" 10 | sha256 "326335a830f2e32d06d0a36393b5455d17dc73e0bd1211065227ee014f92cbf8" 11 | end 12 | 13 | bottle do 14 | root_url "https://github.com/llvm-hs/homebrew-llvm/releases/download/v13.0.1" 15 | rebuild 1 16 | sha256 cellar: :any, monterey: "d173cf9a4a290544591fe7a4f43e2f7a33d2c53d32391943745420c702f6ff01" 17 | end 18 | 19 | # Clang cannot find system headers if Xcode CLT is not installed 20 | pour_bottle? do 21 | on_macos do 22 | reason "The bottle needs the Xcode CLT to be installed." 23 | satisfy { MacOS::CLT.installed? } 24 | end 25 | end 26 | 27 | # http://releases.llvm.org/13.0.0/docs/GettingStarted.html#requirements 28 | depends_on "cmake" => :build 29 | 30 | uses_from_macos "libedit" 31 | uses_from_macos "libffi", since: :catalina 32 | uses_from_macos "libxml2" 33 | uses_from_macos "ncurses" 34 | uses_from_macos "zlib" 35 | 36 | # version suffix 37 | def version 38 | "13" 39 | end 40 | 41 | # http://releases.llvm.org/13.0.0/docs/CMake.html 42 | def install 43 | projects = %w[ 44 | clang 45 | clang-tools-extra 46 | compiler-rt 47 | libcxx 48 | libcxxabi 49 | libunwind 50 | lld 51 | lldb 52 | mlir 53 | openmp 54 | polly 55 | ] 56 | runtimes = %w[ 57 | ] 58 | 59 | # Apple's libstdc++ is too old to build LLVM 60 | ENV.libcxx if ENV.compiler == :clang 61 | 62 | # compiler-rt has some iOS simulator features that require i386 symbols. I'm 63 | # assuming the rest of clang also needs support for 32-bit compilation to 64 | # work correctly, but if not, perhaps universal binaries could be limited to 65 | # compiler-rt. LLVM makes this somewhat easier because compiler-rt can 66 | # almost be treated as an entirely different build from LLVM. 67 | ENV.permit_arch_flags 68 | 69 | install_prefix = lib/"llvm-#{version}" 70 | 71 | args = %W[ 72 | -DCMAKE_BUILD_TYPE=Release 73 | -DCMAKE_INSTALL_PREFIX=#{install_prefix} 74 | -DLLVM_ENABLE_PROJECTS=#{projects.join(";")} 75 | -DLLVM_ENABLE_RUNTIMES=#{runtimes.join(";")} 76 | -DLLVM_TARGETS_TO_BUILD=all 77 | -DLLVM_ENABLE_ASSERTIONS=ON 78 | -DLLVM_OPTIMIZED_TABLEGEN=ON 79 | -DLLVM_INCLUDE_DOCS=OFF 80 | -DLLVM_INCLUDE_TESTS=OFF 81 | -DLLVM_ENABLE_RTTI=ON 82 | -DLLVM_ENABLE_EH=ON 83 | -DLLVM_INSTALL_UTILS=ON 84 | -DLLVM_ENABLE_Z3_SOLVER=OFF 85 | -DLLVM_BUILD_EXTERNAL_COMPILER_RT=ON 86 | -DLLVM_BUILD_LLVM_C_DYLIB=ON 87 | -DLLVM_LINK_LLVM_DYLIB=ON 88 | -DLLVM_ENABLE_LIBCXX=ON 89 | -DLLVM_ENABLE_FFI=ON 90 | -DLLVM_CREATE_XCODE_TOOLCHAIN=ON 91 | -DLLVM_CREATE_XCODE_TOOLCHAIN=#{MacOS::Xcode.installed? ? "ON" : "OFF"} 92 | -DLLDB_USE_SYSTEM_DEBUGSERVER=ON 93 | ] 94 | 95 | if MacOS.version >= :catalina 96 | args << "-DFFI_INCLUDE_DIR=#{MacOS.sdk_path}/usr/include/ffi" 97 | args << "-DFFI_LIBRARY_DIR=#{MacOS.sdk_path}/usr/lib" 98 | else 99 | args << "-DFFI_INCLUDE_DIR=#{Formula["libffi"].opt_include}" 100 | args << "-DFFI_LIBRARY_DIR=#{Formula["libffi"].opt_lib}" 101 | end 102 | 103 | sdk = MacOS.sdk_path_if_needed 104 | args << "-DDEFAULT_SYSROOT=#{sdk}" if sdk 105 | 106 | if MacOS.version == :mojave && MacOS::CLT.installed? 107 | # Mojave CLT linker via software update is older than Xcode. 108 | # Use it to retain compatibility. 109 | args << "-DCMAKE_LINKER=/Library/Developer/CommandLineTools/usr/bin/ld" 110 | end 111 | 112 | llvmpath = buildpath/"llvm" 113 | mkdir llvmpath/"build" do 114 | system "cmake", "-G", "Unix Makefiles", "..", *(std_cmake_args + args) 115 | system "cmake", "--build", "." 116 | system "cmake", "--build", ".", "--target", "install" 117 | system "cmake", "--build", ".", "--target", "install-xcode-toolchain" if MacOS::Xcode.installed? 118 | end 119 | 120 | # replace the existing "clang -> clang-13" symlink 121 | rm install_prefix/"bin/clang" 122 | mv install_prefix/"bin/clang-#{version}", install_prefix/"bin/clang" 123 | 124 | # These versioned .dylib symlinks are missing for some reason 125 | # Note that we use relative symlinks 126 | ln_s "libLLVM.dylib", install_prefix/"lib/libLLVM-#{version}.dylib" 127 | 128 | Dir.glob(install_prefix/"bin/*") do |exec_path| 129 | basename = File.basename(exec_path) 130 | bin.install_symlink exec_path => "#{basename}-#{version}" 131 | end 132 | 133 | Dir.glob(install_prefix/"share/man/man1/*") do |manpage| 134 | basename = File.basename(manpage, ".1") 135 | man1.install_symlink manpage => "#{basename}-#{version}.1" 136 | end 137 | end 138 | 139 | def caveats 140 | <<~EOS 141 | Extra tools are installed in #{opt_share}/clang-#{version} 142 | 143 | To link to libc++, something like the following is required: 144 | CXX="clang++-#{version} -stdlib=libc++" 145 | CXXFLAGS="$CXXFLAGS -nostdinc++ -I#{opt_lib}/llvm-#{version}/include/c++/v1" 146 | LDFLAGS="$LDFLAGS -L#{opt_lib}/llvm-#{version}/lib" 147 | EOS 148 | end 149 | 150 | test do 151 | assert_equal prefix.to_s, shell_output("#{bin}/llvm-config-#{version} --prefix").chomp 152 | 153 | # test for sed errors since some llvm makefiles assume that sed 154 | # understands '\n' which is true for gnu sed and not for bsd sed. 155 | assert_no_match(/PATH\)n/, (lib/"llvm-#{version}/share/llvm/cmake/LLVMConfig.cmake").read) 156 | system "#{bin}/llvm-config-#{version}", "--version" 157 | end 158 | end 159 | 160 | -------------------------------------------------------------------------------- /Formula/llvm-3.7.rb: -------------------------------------------------------------------------------- 1 | class Llvm37 < Formula 2 | desc "Next-gen compiler infrastructure" 3 | homepage "http://llvm.org/" 4 | 5 | stable do 6 | url "http://llvm.org/releases/3.7.1/llvm-3.7.1.src.tar.xz" 7 | sha256 "be7794ed0cec42d6c682ca8e3517535b54555a3defabec83554dbc74db545ad5" 8 | 9 | resource "clang" do 10 | url "http://llvm.org/releases/3.7.1/cfe-3.7.1.src.tar.xz" 11 | sha256 "56e2164c7c2a1772d5ed2a3e57485ff73ff06c97dff12edbeea1acc4412b0674" 12 | end 13 | 14 | resource "clang-tools-extra" do 15 | url "http://llvm.org/releases/3.7.1/clang-tools-extra-3.7.1.src.tar.xz" 16 | sha256 "4a91edaccad1ce984c7c49a4a87db186b7f7b21267b2b03bcf4bd7820715bc6b" 17 | end 18 | 19 | resource "polly" do 20 | url "http://llvm.org/releases/3.7.1/polly-3.7.1.src.tar.xz" 21 | sha256 "ce9273ad315e1904fd35dc64ac4375fd592f3c296252ab1d163b9ff593ec3542" 22 | end 23 | 24 | resource "libcxx" do 25 | url "http://llvm.org/releases/3.7.1/libcxx-3.7.1.src.tar.xz" 26 | sha256 "357fbd4288ce99733ba06ae2bec6f503413d258aeebaab8b6a791201e6f7f144" 27 | end 28 | 29 | resource "lld" do 30 | url "http://releases.llvm.org/3.7.1/lld-3.7.1.src.tar.xz" 31 | sha256 "a929cb44b45e3181a0ad02d8c9df1d3fc71e001139455c6805f3abf2835ef3ac" 32 | end 33 | 34 | resource "openmp" do 35 | url "http://releases.llvm.org/3.7.1/openmp-3.7.1.src.tar.xz" 36 | sha256 "9a702e20c247014f6de8c45b738c6ea586eca0559304520f565ac9a7cba4bf9a" 37 | end 38 | 39 | if MacOS.version <= :snow_leopard 40 | resource "libcxxabi" do 41 | url "http://llvm.org/releases/3.7.1/libcxxabi-3.7.1.src.tar.xz" 42 | sha256 "a47faaed90f577da8ca3b5f044be9458d354a53fab03003a44085a912b73ab2a" 43 | end 44 | end 45 | end 46 | 47 | bottle do 48 | end 49 | 50 | head do 51 | url "http://llvm.org/git/llvm.git", :branch => "release_37" 52 | 53 | resource "clang" do 54 | url "http://llvm.org/git/clang.git", :branch => "release_37" 55 | end 56 | 57 | resource "clang-tools-extra" do 58 | url "http://llvm.org/git/clang-tools-extra.git", :branch => "release_37" 59 | end 60 | 61 | resource "polly" do 62 | url "http://llvm.org/git/polly.git", :branch => "release_37" 63 | end 64 | 65 | resource "lld" do 66 | url "http://llvm.org/git/lld.git", :branch => "release_37" 67 | end 68 | 69 | resource "openmp" do 70 | url "http://llvm.org/git/openmp.git", :branch => "release_37" 71 | end 72 | 73 | resource "libcxx" do 74 | url "http://llvm.org/git/libcxx.git", :branch => "release_37" 75 | end 76 | 77 | if MacOS.version <= :snow_leopard 78 | resource "libcxxabi" do 79 | url "http://llvm.org/git/libcxxabi.git", :branch => "release_37" 80 | end 81 | end 82 | end 83 | 84 | patch :DATA 85 | 86 | depends_on "gnu-sed" => :build 87 | depends_on "gmp" 88 | depends_on "libffi" 89 | 90 | # version suffix 91 | def ver 92 | "3.7" 93 | end 94 | 95 | # LLVM installs its own standard library which confuses stdlib checking. 96 | cxxstdlib_check :skip 97 | 98 | # http://releases.llvm.org/3.7.1/docs/CMake.html 99 | def install 100 | # One of llvm makefiles relies on gnu sed behavior to generate CMake modules correctly 101 | ENV.prepend_path "PATH", "#{Formula["gnu-sed"].opt_libexec}/gnubin" 102 | # Apple's libstdc++ is too old to build LLVM 103 | ENV.libcxx if ENV.compiler == :clang 104 | 105 | clang_buildpath = buildpath/"tools/clang" 106 | libcxx_buildpath = buildpath/"projects/libcxx" 107 | libcxxabi_buildpath = buildpath/"libcxxabi" # build failure if put in projects due to no Makefile 108 | 109 | clang_buildpath.install resource("clang") 110 | libcxx_buildpath.install resource("libcxx") 111 | (buildpath/"tools/lld").install resource("lld") 112 | (buildpath/"tools/polly").install resource("polly") 113 | (buildpath/"tools/clang/tools/extra").install resource("clang-tools-extra") 114 | (buildpath/"projects/openmp").install resource("openmp") 115 | 116 | ENV["REQUIRES_RTTI"] = "1" 117 | 118 | install_prefix = lib/"llvm-#{ver}" 119 | 120 | args = %W[ 121 | --prefix=#{install_prefix} 122 | --enable-optimized 123 | --disable-bindings 124 | --with-gmp=#{Formula["gmp"].opt_prefix} 125 | --enable-shared 126 | --enable-targets=all 127 | --enable-libffi 128 | ] 129 | 130 | mktemp do 131 | system buildpath/"configure", *args 132 | system "make", "VERBOSE=1" 133 | system "make", "VERBOSE=1", "install" 134 | end 135 | 136 | if MacOS.version <= :snow_leopard 137 | libcxxabi_buildpath.install resource("libcxxabi") 138 | 139 | cd libcxxabi_buildpath/"lib" do 140 | # Set rpath to save user from setting DYLD_LIBRARY_PATH 141 | inreplace "buildit", "-install_name /usr/lib/libc++abi.dylib", "-install_name #{install_prefix}/usr/lib/libc++abi.dylib" 142 | 143 | ENV["CC"] = "#{install_prefix}/bin/clang" 144 | ENV["CXX"] = "#{install_prefix}/bin/clang++" 145 | ENV["TRIPLE"] = "*-apple-*" 146 | system "./buildit" 147 | (install_prefix/"usr/lib").install "libc++abi.dylib" 148 | cp libcxxabi_buildpath/"include/cxxabi.h", install_prefix/"lib/c++/v1" 149 | end 150 | 151 | # Snow Leopard make rules hardcode libc++ and libc++abi path. 152 | # Change to Cellar path here. 153 | inreplace "#{libcxx_buildpath}/lib/buildit" do |s| 154 | s.gsub! "-install_name /usr/lib/libc++.1.dylib", "-install_name #{install_prefix}/usr/lib/libc++.1.dylib" 155 | s.gsub! "-Wl,-reexport_library,/usr/lib/libc++abi.dylib", "-Wl,-reexport_library,#{install_prefix}/usr/lib/libc++abi.dylib" 156 | end 157 | 158 | # On Snow Leopard and older system libc++abi is not shipped but 159 | # needed here. It is hard to tweak environment settings to change 160 | # include path as libc++ uses a custom build script, so just 161 | # symlink the needed header here. 162 | ln_s libcxxabi_buildpath/"include/cxxabi.h", libcxx_buildpath/"include" 163 | end 164 | 165 | if MacOS.version >= :el_capitan 166 | inreplace "#{libcxx_buildpath}/include/string", 167 | "basic_string<_CharT, _Traits, _Allocator>::basic_string(const allocator_type& __a)", 168 | "basic_string<_CharT, _Traits, _Allocator>::basic_string(const allocator_type& __a) noexcept(is_nothrow_copy_constructible::value)" 169 | end 170 | 171 | # Putting libcxx in projects only ensures that headers are installed. 172 | # Manually "make install" to actually install the shared libs. 173 | libcxx_make_args = [ 174 | # Use the built clang for building 175 | "CC=#{install_prefix}/bin/clang", 176 | "CXX=#{install_prefix}/bin/clang++", 177 | # Properly set deployment target, which is needed for Snow Leopard 178 | "MACOSX_DEPLOYMENT_TARGET=#{MacOS.version}", 179 | # The following flags are needed so it can be installed correctly. 180 | "DSTROOT=#{install_prefix}", 181 | "SYMROOT=#{libcxx_buildpath}", 182 | ] 183 | 184 | system "make", "-C", libcxx_buildpath, "install", *libcxx_make_args 185 | 186 | (share/"clang-#{ver}/tools").install Dir["tools/clang/tools/scan-{build,view}"] 187 | inreplace share/"clang-#{ver}/tools/scan-build/scan-build", "$RealBin/bin/clang", install_prefix/"bin/clang" 188 | ln_s share/"clang-#{ver}/tools/scan-build/scan-build", install_prefix/"bin" 189 | ln_s share/"clang-#{ver}/tools/scan-view/scan-view", install_prefix/"bin" 190 | (install_prefix/"share/man/man1").install share/"clang-#{ver}/tools/scan-build/scan-build.1" 191 | 192 | (lib/"python2.7/site-packages").install "bindings/python/llvm" => "llvm-#{ver}", 193 | clang_buildpath/"bindings/python/clang" => "clang-#{ver}" 194 | 195 | Dir.glob(install_prefix/"bin/*") do |exec_path| 196 | basename = File.basename(exec_path) 197 | bin.install_symlink exec_path => "#{basename}-#{ver}" 198 | end 199 | 200 | Dir.glob(install_prefix/"share/man/man1/*") do |manpage| 201 | basename = File.basename(manpage, ".1") 202 | man1.install_symlink manpage => "#{basename}-#{ver}.1" 203 | end 204 | end 205 | 206 | def caveats; <<~EOS 207 | Extra tools are installed in #{opt_share}/clang-#{ver} 208 | 209 | To link to libc++, something like the following is required: 210 | CXX="clang++-#{ver} -stdlib=libc++" 211 | CXXFLAGS="$CXXFLAGS -nostdinc++ -I#{opt_lib}/llvm-#{ver}/include/c++/v1" 212 | LDFLAGS="$LDFLAGS -L#{opt_lib}/llvm-#{ver}/lib" 213 | EOS 214 | end 215 | 216 | test do 217 | # test for sed errors since some llvm makefiles assume that sed 218 | # understands '\n' which is true for gnu sed and not for bsd sed. 219 | assert_no_match /PATH\)n/, (lib/"llvm-3.7/share/llvm/cmake/LLVMConfig.cmake").read 220 | system "#{bin}/llvm-config-#{ver}", "--version" 221 | end 222 | end 223 | 224 | __END__ 225 | diff --git a/Makefile.rules b/Makefile.rules 226 | index ebebc0a..b0bb378 100644 227 | --- a/Makefile.rules 228 | +++ b/Makefile.rules 229 | @@ -599,7 +599,12 @@ ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW)) 230 | ifneq ($(HOST_OS),Darwin) 231 | LD.Flags += $(RPATH) -Wl,'$$ORIGIN' 232 | else 233 | - LD.Flags += -Wl,-install_name -Wl,"@rpath/lib$(LIBRARYNAME)$(SHLIBEXT)" 234 | + LD.Flags += -Wl,-install_name 235 | + ifdef LOADABLE_MODULE 236 | + LD.Flags += -Wl,"$(PROJ_libdir)/$(LIBRARYNAME)$(SHLIBEXT)" 237 | + else 238 | + LD.Flags += -Wl,"$(PROJ_libdir)/$(SharedPrefix)$(LIBRARYNAME)$(SHLIBEXT)" 239 | + endif 240 | endif 241 | endif 242 | endif 243 | -------------------------------------------------------------------------------- /Formula/llvm-3.8.rb: -------------------------------------------------------------------------------- 1 | class Llvm38 < Formula 2 | desc "Next-gen compiler infrastructure" 3 | homepage "http://llvm.org/" 4 | 5 | stable do 6 | url "http://llvm.org/releases/3.8.1/llvm-3.8.1.src.tar.xz" 7 | sha256 "6e82ce4adb54ff3afc18053d6981b6aed1406751b8742582ed50f04b5ab475f9" 8 | 9 | resource "clang" do 10 | url "http://llvm.org/releases/3.8.1/cfe-3.8.1.src.tar.xz" 11 | sha256 "4cd3836dfb4b88b597e075341cae86d61c63ce3963e45c7fe6a8bf59bb382cdf" 12 | end 13 | 14 | resource "clang-tools-extra" do 15 | url "http://llvm.org/releases/3.8.1/clang-tools-extra-3.8.1.src.tar.xz" 16 | sha256 "664a5c60220de9c290bf2a5b03d902ab731a4f95fe73a00856175ead494ec396" 17 | end 18 | 19 | resource "polly" do 20 | url "http://llvm.org/releases/3.8.1/polly-3.8.1.src.tar.xz" 21 | sha256 "453c27e1581614bb3b6351bf5a2da2939563ea9d1de99c420f85ca8d87b928a2" 22 | end 23 | 24 | resource "lld" do 25 | url "http://llvm.org/releases/3.8.1/lld-3.8.1.src.tar.xz" 26 | sha256 "2bd9be8bb18d82f7f59e31ea33b4e58387dbdef0bc11d5c9fcd5ce9a4b16dc00" 27 | end 28 | 29 | resource "openmp" do 30 | url "http://llvm.org/releases/3.8.1/openmp-3.8.1.src.tar.xz" 31 | sha256 "68fcde6ef34e0275884a2de3450a31e931caf1d6fda8606ef14f89c4123617dc" 32 | end 33 | 34 | resource "libcxx" do 35 | url "http://llvm.org/releases/3.8.1/libcxx-3.8.1.src.tar.xz" 36 | sha256 "77d7f3784c88096d785bd705fa1bab7031ce184cd91ba8a7008abf55264eeecc" 37 | end 38 | 39 | if MacOS.version <= :snow_leopard 40 | resource "libcxxabi" do 41 | url "http://llvm.org/releases/3.8.1/libcxxabi-3.8.1.src.tar.xz" 42 | sha256 "e1b55f7be3fad746bdd3025f43e42d429fb6194aac5919c2be17c4a06314dae1" 43 | end 44 | end 45 | end 46 | 47 | bottle do 48 | end 49 | 50 | head do 51 | url "http://llvm.org/git/llvm.git", :branch => "release_38" 52 | 53 | resource "clang" do 54 | url "http://llvm.org/git/clang.git", :branch => "release_38" 55 | end 56 | 57 | resource "clang-tools-extra" do 58 | url "http://llvm.org/git/clang-tools-extra.git", :branch => "release_38" 59 | end 60 | 61 | resource "polly" do 62 | url "http://llvm.org/git/polly.git", :branch => "release_38" 63 | end 64 | 65 | resource "lld" do 66 | url "http://llvm.org/git/lld.git", :branch => "release_38" 67 | end 68 | 69 | resource "openmp" do 70 | url "http://llvm.org/git/openmp.git", :branch => "release_38" 71 | end 72 | 73 | resource "libcxx" do 74 | url "http://llvm.org/git/libcxx.git", :branch => "release_38" 75 | end 76 | 77 | if MacOS.version <= :snow_leopard 78 | resource "libcxxabi" do 79 | url "http://llvm.org/git/libcxxabi.git", :branch => "release_38" 80 | end 81 | end 82 | end 83 | 84 | patch :DATA 85 | 86 | depends_on "gnu-sed" => :build 87 | depends_on "gmp" 88 | depends_on "libffi" 89 | 90 | # version suffix 91 | def ver 92 | "3.8" 93 | end 94 | 95 | # LLVM installs its own standard library which confuses stdlib checking. 96 | cxxstdlib_check :skip 97 | 98 | # http://releases.llvm.org/3.8.1/docs/CMake.html 99 | def install 100 | # One of llvm makefiles relies on gnu sed behavior to generate CMake modules correctly 101 | ENV.prepend_path "PATH", "#{Formula["gnu-sed"].opt_libexec}/gnubin" 102 | # Apple's libstdc++ is too old to build LLVM 103 | ENV.libcxx if ENV.compiler == :clang 104 | 105 | clang_buildpath = buildpath/"tools/clang" 106 | libcxx_buildpath = buildpath/"projects/libcxx" 107 | libcxxabi_buildpath = buildpath/"libcxxabi" # build failure if put in projects due to no Makefile 108 | 109 | clang_buildpath.install resource("clang") 110 | libcxx_buildpath.install resource("libcxx") 111 | (buildpath/"tools/lld").install resource("lld") 112 | (buildpath/"tools/polly").install resource("polly") 113 | (buildpath/"tools/clang/tools/extra").install resource("clang-tools-extra") 114 | (buildpath/"projects/openmp").install resource("openmp") 115 | 116 | ENV["REQUIRES_RTTI"] = "1" 117 | 118 | install_prefix = lib/"llvm-#{ver}" 119 | 120 | args = %W[ 121 | --prefix=#{install_prefix} 122 | --enable-optimized 123 | --disable-bindings 124 | --with-gmp=#{Formula["gmp"].opt_prefix} 125 | --enable-shared 126 | --enable-targets=all 127 | --enable-libffi 128 | ] 129 | 130 | mktemp do 131 | system buildpath/"configure", *args 132 | system "make", "VERBOSE=1", "install" 133 | end 134 | 135 | if MacOS.version <= :snow_leopard 136 | libcxxabi_buildpath.install resource("libcxxabi") 137 | 138 | cd libcxxabi_buildpath/"lib" do 139 | # Set rpath to save user from setting DYLD_LIBRARY_PATH 140 | inreplace "buildit", "-install_name /usr/lib/libc++abi.dylib", "-install_name #{install_prefix}/usr/lib/libc++abi.dylib" 141 | 142 | ENV["CC"] = "#{install_prefix}/bin/clang" 143 | ENV["CXX"] = "#{install_prefix}/bin/clang++" 144 | ENV["TRIPLE"] = "*-apple-*" 145 | system "./buildit" 146 | (install_prefix/"usr/lib").install "libc++abi.dylib" 147 | cp libcxxabi_buildpath/"include/cxxabi.h", install_prefix/"lib/c++/v1" 148 | end 149 | 150 | # Snow Leopard make rules hardcode libc++ and libc++abi path. 151 | # Change to Cellar path here. 152 | inreplace "#{libcxx_buildpath}/lib/buildit" do |s| 153 | s.gsub! "-install_name /usr/lib/libc++.1.dylib", "-install_name #{install_prefix}/usr/lib/libc++.1.dylib" 154 | s.gsub! "-Wl,-reexport_library,/usr/lib/libc++abi.dylib", "-Wl,-reexport_library,#{install_prefix}/usr/lib/libc++abi.dylib" 155 | end 156 | 157 | # On Snow Leopard and older system libc++abi is not shipped but 158 | # needed here. It is hard to tweak environment settings to change 159 | # include path as libc++ uses a custom build script, so just 160 | # symlink the needed header here. 161 | ln_s libcxxabi_buildpath/"include/cxxabi.h", libcxx_buildpath/"include" 162 | end 163 | 164 | # Putting libcxx in projects only ensures that headers are installed. 165 | # Manually "make install" to actually install the shared libs. 166 | libcxx_make_args = [ 167 | # Use the built clang for building 168 | "CC=#{install_prefix}/bin/clang", 169 | "CXX=#{install_prefix}/bin/clang++", 170 | # Properly set deployment target, which is needed for Snow Leopard 171 | "MACOSX_DEPLOYMENT_TARGET=#{MacOS.version}", 172 | # The following flags are needed so it can be installed correctly. 173 | "DSTROOT=#{install_prefix}", 174 | "SYMROOT=#{libcxx_buildpath}", 175 | ] 176 | 177 | system "make", "-C", libcxx_buildpath, "install", *libcxx_make_args 178 | 179 | (share/"clang-#{ver}/tools").install Dir["tools/clang/tools/scan-{build,view}"] 180 | inreplace share/"clang-#{ver}/tools/scan-build/bin/scan-build", "$RealBin/bin/clang", install_prefix/"bin/clang" 181 | (install_prefix/"bin").install_symlink share/"clang-#{ver}/tools/scan-view/bin/scan-view" 182 | (install_prefix/"bin").install_symlink share/"clang-#{ver}/tools/scan-build/bin/scan-build" 183 | (install_prefix/"share/man/man1").install_symlink share/"clang-#{ver}/tools/scan-build/scan-build.1" 184 | 185 | (lib/"python2.7/site-packages").install "bindings/python/llvm" => "llvm-#{ver}", 186 | clang_buildpath/"bindings/python/clang" => "clang-#{ver}" 187 | 188 | Dir.glob(install_prefix/"bin/*") do |exec_path| 189 | basename = File.basename(exec_path) 190 | bin.install_symlink exec_path => "#{basename}-#{ver}" 191 | end 192 | 193 | Dir.glob(install_prefix/"share/man/man1/*") do |manpage| 194 | basename = File.basename(manpage, ".1") 195 | man1.install_symlink manpage => "#{basename}-#{ver}.1" 196 | end 197 | end 198 | 199 | def caveats; <<~EOS 200 | Extra tools are installed in #{opt_share}/clang-#{ver} 201 | 202 | To link to libc++, something like the following is required: 203 | CXX="clang++-#{ver} -stdlib=libc++" 204 | CXXFLAGS="$CXXFLAGS -nostdinc++ -I#{opt_lib}/llvm-#{ver}/include/c++/v1" 205 | LDFLAGS="$LDFLAGS -L#{opt_lib}/llvm-#{ver}/lib" 206 | EOS 207 | end 208 | 209 | test do 210 | # test for sed errors since some llvm makefiles assume that sed 211 | # understands '\n' which is true for gnu sed and not for bsd sed. 212 | assert_no_match /PATH\)n/, (lib/"llvm-3.8/share/llvm/cmake/LLVMConfig.cmake").read 213 | system "#{bin}/llvm-config-#{ver}", "--version" 214 | end 215 | end 216 | 217 | __END__ 218 | diff --git a/Makefile.rules b/Makefile.rules 219 | index ebebc0a..b0bb378 100644 220 | --- a/Makefile.rules 221 | +++ b/Makefile.rules 222 | @@ -600,7 +600,12 @@ ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW)) 223 | ifneq ($(HOST_OS),Darwin) 224 | LD.Flags += $(RPATH) -Wl,'$$ORIGIN' 225 | else 226 | - LD.Flags += -Wl,-install_name -Wl,"@rpath/lib$(LIBRARYNAME)$(SHLIBEXT)" 227 | + LD.Flags += -Wl,-install_name 228 | + ifdef LOADABLE_MODULE 229 | + LD.Flags += -Wl,"$(PROJ_libdir)/$(LIBRARYNAME)$(SHLIBEXT)" 230 | + else 231 | + LD.Flags += -Wl,"$(PROJ_libdir)/$(SharedPrefix)$(LIBRARYNAME)$(SHLIBEXT)" 232 | + endif 233 | endif 234 | endif 235 | endif 236 | diff --git a/configure b/configure 237 | index c94fb13..8d61650 100755 238 | --- a/configure 239 | +++ b/configure 240 | @@ -1,6 +1,6 @@ 241 | #! /bin/sh 242 | # Guess values for system-dependent variables and create Makefiles. 243 | -# Generated by GNU Autoconf 2.60 for LLVM 3.8.0. 244 | +# Generated by GNU Autoconf 2.60 for LLVM 3.8.1. 245 | # 246 | # Report bugs to . 247 | # 248 | @@ -561,8 +561,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} 249 | # Identity of this package. 250 | PACKAGE_NAME='LLVM' 251 | PACKAGE_TARNAME='llvm' 252 | -PACKAGE_VERSION='3.8.0' 253 | -PACKAGE_STRING='LLVM 3.8.0' 254 | +PACKAGE_VERSION='3.8.1' 255 | +PACKAGE_STRING='LLVM 3.8.1' 256 | PACKAGE_BUGREPORT='http://llvm.org/bugs/' 257 | 258 | ac_unique_file="lib/IR/Module.cpp" 259 | @@ -1334,7 +1334,7 @@ if test "$ac_init_help" = "long"; then 260 | # Omit some internal or obsolete options to make the list less imposing. 261 | # This message is too long to be a string in the A/UX 3.1 sh. 262 | cat <<_ACEOF 263 | -\`configure' configures LLVM 3.8.0 to adapt to many kinds of systems. 264 | +\`configure' configures LLVM 3.8.1 to adapt to many kinds of systems. 265 | 266 | Usage: $0 [OPTION]... [VAR=VALUE]... 267 | 268 | @@ -1400,7 +1400,7 @@ fi 269 | 270 | if test -n "$ac_init_help"; then 271 | case $ac_init_help in 272 | - short | recursive ) echo "Configuration of LLVM 3.8.0:";; 273 | + short | recursive ) echo "Configuration of LLVM 3.8.1:";; 274 | esac 275 | cat <<\_ACEOF 276 | 277 | @@ -1584,7 +1584,7 @@ fi 278 | test -n "$ac_init_help" && exit $ac_status 279 | if $ac_init_version; then 280 | cat <<\_ACEOF 281 | -LLVM configure 3.8.0 282 | +LLVM configure 3.8.1 283 | generated by GNU Autoconf 2.60 284 | 285 | Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 286 | @@ -1600,7 +1600,7 @@ cat >config.log <<_ACEOF 287 | This file contains any messages produced by compilers while 288 | running configure, to aid debugging if configure makes a mistake. 289 | 290 | -It was created by LLVM $as_me 3.8.0, which was 291 | +It was created by LLVM $as_me 3.8.1, which was 292 | generated by GNU Autoconf 2.60. Invocation command line was 293 | 294 | $ $0 $@ 295 | @@ -1956,7 +1956,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu 296 | 297 | LLVM_VERSION_MAJOR=3 298 | LLVM_VERSION_MINOR=8 299 | -LLVM_VERSION_PATCH=0 300 | +LLVM_VERSION_PATCH=1 301 | LLVM_VERSION_SUFFIX= 302 | 303 | 304 | @@ -18279,7 +18279,7 @@ exec 6>&1 305 | # report actual input values of CONFIG_FILES etc. instead of their 306 | # values after options handling. 307 | ac_log=" 308 | -This file was extended by LLVM $as_me 3.8.0, which was 309 | +This file was extended by LLVM $as_me 3.8.1, which was 310 | generated by GNU Autoconf 2.60. Invocation command line was 311 | 312 | CONFIG_FILES = $CONFIG_FILES 313 | @@ -18332,7 +18332,7 @@ Report bugs to ." 314 | _ACEOF 315 | cat >>$CONFIG_STATUS <<_ACEOF 316 | ac_cs_version="\\ 317 | -LLVM config.status 3.8.0 318 | +LLVM config.status 3.8.1 319 | configured by $0, generated by GNU Autoconf 2.60, 320 | with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" 321 | -------------------------------------------------------------------------------- /Formula/llvm-3.9.rb: -------------------------------------------------------------------------------- 1 | class Llvm39 < Formula 2 | desc "Next-gen compiler infrastructure" 3 | homepage "http://llvm.org/" 4 | 5 | stable do 6 | url "http://releases.llvm.org/3.9.1/llvm-3.9.1.src.tar.xz" 7 | sha256 "1fd90354b9cf19232e8f168faf2220e79be555df3aa743242700879e8fd329ee" 8 | 9 | resource "clang" do 10 | url "http://releases.llvm.org/3.9.1/cfe-3.9.1.src.tar.xz" 11 | sha256 "e6c4cebb96dee827fa0470af313dff265af391cb6da8d429842ef208c8f25e63" 12 | end 13 | 14 | resource "clang-tools-extra" do 15 | url "http://releases.llvm.org/3.9.1/clang-tools-extra-3.9.1.src.tar.xz" 16 | sha256 "29a5b65bdeff7767782d4427c7c64d54c3a8684bc6b217b74a70e575e4813635" 17 | end 18 | 19 | resource "compiler-rt" do 20 | url "http://releases.llvm.org/3.9.1/compiler-rt-3.9.1.src.tar.xz" 21 | sha256 "d30967b1a5fa51a2503474aacc913e69fd05ae862d37bf310088955bdb13ec99" 22 | end 23 | 24 | resource "polly" do 25 | url "http://releases.llvm.org/3.9.1/polly-3.9.1.src.tar.xz" 26 | sha256 "9ba5e61fc7bf8c7435f64e2629e0810c9b1d1b03aa5b5605b780d0e177b4cb46" 27 | end 28 | 29 | resource "lld" do 30 | url "http://releases.llvm.org/3.9.1/lld-3.9.1.src.tar.xz" 31 | sha256 "48e128fabb2ddaee64ecb8935f7ac315b6e68106bc48aeaf655d179c65d87f34" 32 | end 33 | 34 | resource "openmp" do 35 | url "http://releases.llvm.org/3.9.1/openmp-3.9.1.src.tar.xz" 36 | sha256 "d23b324e422c0d5f3d64bae5f550ff1132c37a070e43c7ca93991676c86c7766" 37 | end 38 | 39 | resource "libcxx" do 40 | url "http://releases.llvm.org/3.9.1/libcxx-3.9.1.src.tar.xz" 41 | sha256 "25e615e428f60e651ed09ffd79e563864e3f4bc69a9e93ee41505c419d1a7461" 42 | end 43 | 44 | resource "libunwind" do 45 | url "http://releases.llvm.org/3.9.1/libunwind-3.9.1.src.tar.xz" 46 | sha256 "0b0bc73264d7ab77d384f8a7498729e3c4da8ffee00e1c85ad02a2f85e91f0e6" 47 | end 48 | end 49 | 50 | bottle do 51 | end 52 | 53 | head do 54 | url "http://llvm.org/git/llvm.git", :branch => "release_39" 55 | 56 | resource "clang" do 57 | url "http://llvm.org/git/clang.git", :branch => "release_39" 58 | end 59 | 60 | resource "clang-tools-extra" do 61 | url "http://llvm.org/git/clang-tools-extra.git", :branch => "release_39" 62 | end 63 | 64 | resource "compiler-rt" do 65 | url "http://llvm.org/git/compiler-rt.git", :branch => "release_39" 66 | end 67 | 68 | resource "polly" do 69 | url "http://llvm.org/git/polly.git", :branch => "release_39" 70 | end 71 | 72 | resource "lld" do 73 | url "http://llvm.org/git/lld.git", :branch => "release_39" 74 | end 75 | 76 | resource "openmp" do 77 | url "http://llvm.org/git/openmp.git", :branch => "release_39" 78 | end 79 | 80 | resource "libcxx" do 81 | url "http://llvm.org/git/libcxx.git", :branch => "release_39" 82 | end 83 | 84 | resource "libunwind" do 85 | url "http://llvm.org/git/libunwind.git", :branceh => "release_39" 86 | end 87 | end 88 | 89 | # http://releases.llvm.org/3.9.1/docs/GettingStarted.html#requirements 90 | depends_on "libffi" 91 | depends_on "cmake" => :build 92 | 93 | # version suffix 94 | def ver 95 | "3.9" 96 | end 97 | 98 | # http://releases.llvm.org/3.9.1/docs/CMake.html 99 | def install 100 | # Apple's libstdc++ is too old to build LLVM 101 | ENV.libcxx if ENV.compiler == :clang 102 | 103 | # compiler-rt has some iOS simulator features that require i386 symbols. I'm 104 | # assuming the rest of clang also needs support for 32-bit compilation to 105 | # work correctly, but if not, perhaps universal binaries could be limited to 106 | # compiler-rt. LLVM makes this somewhat easier because compiler-rt can 107 | # almost be treated as an entirely different build from LLVM. 108 | ENV.permit_arch_flags 109 | 110 | clang_buildpath = buildpath/"tools/clang" 111 | libcxx_buildpath = buildpath/"projects/libcxx" 112 | 113 | clang_buildpath.install resource("clang") 114 | libcxx_buildpath.install resource("libcxx") 115 | (buildpath/"tools/lld").install resource("lld") 116 | (buildpath/"tools/polly").install resource("polly") 117 | (buildpath/"tools/clang/tools/extra").install resource("clang-tools-extra") 118 | (buildpath/"projects/openmp").install resource("openmp") 119 | (buildpath/"projects/libcxx").install resource("libcxx") 120 | (buildpath/"projects/libunwind").install resource("libunwind") 121 | (buildpath/"projects/compiler-rt").install resource("compiler-rt") 122 | 123 | install_prefix = lib/"llvm-#{ver}" 124 | 125 | args = %W[ 126 | -DCMAKE_INSTALL_PREFIX=#{install_prefix} 127 | -DCMAKE_BUILD_TYPE=Release 128 | -DLLVM_ENABLE_ASSERTIONS=ON 129 | -DLLVM_OPTIMIZED_TABLEGEN=ON 130 | -DLLVM_INCLUDE_DOCS=OFF 131 | -DLLVM_ENABLE_RTTI=ON 132 | -DLLVM_ENABLE_EH=ON 133 | -DLLVM_INSTALL_UTILS=ON 134 | -DWITH_POLLY=ON 135 | -DLINK_POLLY_INTO_TOOLS=ON 136 | -DLLVM_TARGETS_TO_BUILD=all 137 | -DLIBOMP_ARCH=x86_64 138 | -DLLVM_BUILD_LLVM_DYLIB=ON 139 | -DLLVM_ENABLE_LIBCXX=ON 140 | -DLLVM_ENABLE_FFI=ON 141 | -DFFI_INCLUDE_DIR=#{Formula["libffi"].opt_lib}/libffi-#{Formula["libffi"].version}/include 142 | -DFFI_LIBRARY_DIR=#{Formula["libffi"].opt_lib} 143 | ] 144 | 145 | mktemp do 146 | system "cmake", buildpath, *(std_cmake_args + args) 147 | system "cmake", "--build", "." 148 | system "cmake", "--build", ".", "--target", "install" 149 | end 150 | 151 | (share/"clang-#{ver}/tools").install Dir["tools/clang/tools/scan-{build,view}"] 152 | inreplace share/"clang-#{ver}/tools/scan-build/bin/scan-build", "$RealBin/bin/clang", install_prefix/"bin/clang" 153 | (install_prefix/"bin").install_symlink share/"clang-#{ver}/tools/scan-view/bin/scan-view" 154 | (install_prefix/"bin").install_symlink share/"clang-#{ver}/tools/scan-build/bin/scan-build" 155 | (install_prefix/"share/man/man1").install_symlink share/"clang-#{ver}/tools/scan-build/scan-build.1" 156 | 157 | (lib/"python2.7/site-packages").install "bindings/python/llvm" => "llvm-#{ver}", 158 | clang_buildpath/"bindings/python/clang" => "clang-#{ver}" 159 | 160 | # replace the existing "clang -> clang-3.9" symlink 161 | rm install_prefix/"bin/clang" 162 | mv install_prefix/"bin/clang-#{ver}", install_prefix/"bin/clang" 163 | 164 | # These versioned .dylib symlinks are missing for some reason 165 | # Note that we use relative symlinks 166 | ln_s "libLLVM.dylib", install_prefix/"lib/libLLVM-3.9.dylib" 167 | ln_s "libLLVM.dylib", install_prefix/"lib/libLLVM-3.9.1.dylib" 168 | 169 | # Set LC_LOAD_DYLIB entries to absolute paths 170 | system "install_name_tool", "-change", "@rpath/libLTO.dylib", install_prefix/"lib/libLTO.dylib", install_prefix/"lib/libLLVM.dylib" 171 | 172 | # Set LC_ID_DYLIB entries to absolute paths 173 | system "install_name_tool", "-id", install_prefix/"lib/libLLVM.dylib", install_prefix/"lib/libLLVM.dylib" 174 | system "install_name_tool", "-id", install_prefix/"lib/libLTO.dylib", install_prefix/"lib/libLTO.dylib" 175 | system "install_name_tool", "-id", install_prefix/"lib/libc++.1.0.dylib", install_prefix/"lib/libc++.1.0.dylib" 176 | system "install_name_tool", "-id", install_prefix/"lib/libclang.dylib", install_prefix/"lib/libclang.dylib" 177 | system "install_name_tool", "-id", install_prefix/"lib/libomp.dylib", install_prefix/"lib/libomp.dylib" 178 | system "install_name_tool", "-id", install_prefix/"lib/libunwind.1.0.dylib", install_prefix/"lib/libunwind.1.0.dylib" 179 | 180 | Dir.glob(install_prefix/"bin/*") do |exec_path| 181 | basename = File.basename(exec_path) 182 | bin.install_symlink exec_path => "#{basename}-#{ver}" 183 | end 184 | 185 | Dir.glob(install_prefix/"share/man/man1/*") do |manpage| 186 | basename = File.basename(manpage, ".1") 187 | man1.install_symlink manpage => "#{basename}-#{ver}.1" 188 | end 189 | end 190 | 191 | def caveats; <<~EOS 192 | Extra tools are installed in #{opt_share}/clang-#{ver} 193 | 194 | To link to libc++, something like the following is required: 195 | CXX="clang++-#{ver} -stdlib=libc++" 196 | CXXFLAGS="$CXXFLAGS -nostdinc++ -I#{opt_lib}/llvm-#{ver}/include/c++/v1" 197 | LDFLAGS="$LDFLAGS -L#{opt_lib}/llvm-#{ver}/lib" 198 | EOS 199 | end 200 | 201 | test do 202 | assert_equal prefix.to_s, shell_output("#{bin}/llvm-config-#{ver} --prefix").chomp 203 | 204 | # test for sed errors since some llvm makefiles assume that sed 205 | # understands '\n' which is true for gnu sed and not for bsd sed. 206 | assert_no_match /PATH\)n/, (lib/"llvm-3.9/share/llvm/cmake/LLVMConfig.cmake").read 207 | system "#{bin}/llvm-config-#{ver}", "--version" 208 | end 209 | end 210 | -------------------------------------------------------------------------------- /Formula/llvm-4.0.rb: -------------------------------------------------------------------------------- 1 | class Llvm40 < Formula 2 | desc "Next-gen compiler infrastructure" 3 | homepage "http://llvm.org/" 4 | 5 | stable do 6 | url "http://releases.llvm.org/4.0.1/llvm-4.0.1.src.tar.xz" 7 | sha256 "da783db1f82d516791179fe103c71706046561f7972b18f0049242dee6712b51" 8 | 9 | resource "clang" do 10 | url "http://releases.llvm.org/4.0.1/cfe-4.0.1.src.tar.xz" 11 | sha256 "61738a735852c23c3bdbe52d035488cdb2083013f384d67c1ba36fabebd8769b" 12 | end 13 | 14 | resource "clang-tools-extra" do 15 | url "http://releases.llvm.org/4.0.1/clang-tools-extra-4.0.1.src.tar.xz" 16 | sha256 "35d1e64efc108076acbe7392566a52c35df9ec19778eb9eb12245fc7d8b915b6" 17 | end 18 | 19 | resource "compiler-rt" do 20 | url "http://releases.llvm.org/4.0.1/compiler-rt-4.0.1.src.tar.xz" 21 | sha256 "a3c87794334887b93b7a766c507244a7cdcce1d48b2e9249fc9a94f2c3beb440" 22 | end 23 | 24 | resource "polly" do 25 | url "http://releases.llvm.org/4.0.1/polly-4.0.1.src.tar.xz" 26 | sha256 "b443bb9617d776a7d05970e5818aa49aa2adfb2670047be8e9f242f58e84f01a" 27 | end 28 | 29 | resource "lld" do 30 | url "http://releases.llvm.org/4.0.1/lld-4.0.1.src.tar.xz" 31 | sha256 "63ce10e533276ca353941ce5ab5cc8e8dcd99dbdd9c4fa49f344a212f29d36ed" 32 | end 33 | 34 | resource "openmp" do 35 | url "http://releases.llvm.org/4.0.1/openmp-4.0.1.src.tar.xz" 36 | sha256 "ec693b170e0600daa7b372240a06e66341ace790d89eaf4a843e8d56d5f4ada4" 37 | end 38 | 39 | resource "libcxx" do 40 | url "http://releases.llvm.org/4.0.1/libcxx-4.0.1.src.tar.xz" 41 | sha256 "520a1171f272c9ff82f324d5d89accadcec9bc9f3c78de11f5575cdb99accc4c" 42 | end 43 | 44 | resource "libunwind" do 45 | url "http://releases.llvm.org/4.0.1/libunwind-4.0.1.src.tar.xz" 46 | sha256 "3b072e33b764b4f9b5172698e080886d1f4d606531ab227772a7fc08d6a92555" 47 | end 48 | end 49 | 50 | bottle do 51 | end 52 | 53 | head do 54 | url "http://llvm.org/git/llvm.git", :branch => "release_40" 55 | 56 | resource "clang" do 57 | url "http://llvm.org/git/clang.git", :branch => "release_40" 58 | end 59 | 60 | resource "clang-tools-extra" do 61 | url "http://llvm.org/git/clang-tools-extra.git", :branch => "release_40" 62 | end 63 | 64 | resource "compiler-rt" do 65 | url "http://llvm.org/git/compiler-rt.git", :branch => "release_40" 66 | end 67 | 68 | resource "polly" do 69 | url "http://llvm.org/git/polly.git", :branch => "release_40" 70 | end 71 | 72 | resource "lld" do 73 | url "http://llvm.org/git/lld.git", :branch => "release_40" 74 | end 75 | 76 | resource "openmp" do 77 | url "http://llvm.org/git/openmp.git", :branch => "release_40" 78 | end 79 | 80 | resource "libcxx" do 81 | url "http://llvm.org/git/libcxx.git", :branch => "release_40" 82 | end 83 | 84 | resource "libunwind" do 85 | url "http://llvm.org/git/libunwind.git", :branceh => "release_40" 86 | end 87 | end 88 | 89 | # http://releases.llvm.org/4.0.1/docs/GettingStarted.html#requirements 90 | depends_on "libffi" 91 | depends_on "cmake" => :build 92 | 93 | # version suffix 94 | def ver 95 | "4.0" 96 | end 97 | 98 | # http://releases.llvm.org/4.0.1/docs/CMake.html 99 | def install 100 | # Apple's libstdc++ is too old to build LLVM 101 | ENV.libcxx if ENV.compiler == :clang 102 | 103 | # compiler-rt has some iOS simulator features that require i386 symbols. I'm 104 | # assuming the rest of clang also needs support for 32-bit compilation to 105 | # work correctly, but if not, perhaps universal binaries could be limited to 106 | # compiler-rt. LLVM makes this somewhat easier because compiler-rt can 107 | # almost be treated as an entirely different build from LLVM. 108 | ENV.permit_arch_flags 109 | 110 | clang_buildpath = buildpath/"tools/clang" 111 | libcxx_buildpath = buildpath/"projects/libcxx" 112 | 113 | clang_buildpath.install resource("clang") 114 | libcxx_buildpath.install resource("libcxx") 115 | (buildpath/"tools/lld").install resource("lld") 116 | (buildpath/"tools/polly").install resource("polly") 117 | (buildpath/"tools/clang/tools/extra").install resource("clang-tools-extra") 118 | (buildpath/"projects/openmp").install resource("openmp") 119 | (buildpath/"projects/libcxx").install resource("libcxx") 120 | (buildpath/"projects/libunwind").install resource("libunwind") 121 | (buildpath/"projects/compiler-rt").install resource("compiler-rt") 122 | 123 | install_prefix = lib/"llvm-#{ver}" 124 | 125 | args = %W[ 126 | -DCMAKE_INSTALL_PREFIX=#{install_prefix} 127 | -DCMAKE_BUILD_TYPE=Release 128 | -DLLVM_ENABLE_ASSERTIONS=ON 129 | -DLLVM_OPTIMIZED_TABLEGEN=ON 130 | -DLLVM_INCLUDE_DOCS=OFF 131 | -DLLVM_ENABLE_RTTI=ON 132 | -DLLVM_ENABLE_EH=ON 133 | -DLLVM_INSTALL_UTILS=ON 134 | -DWITH_POLLY=ON 135 | -DLINK_POLLY_INTO_TOOLS=ON 136 | -DLLVM_TARGETS_TO_BUILD=all 137 | -DLIBOMP_ARCH=x86_64 138 | -DLLVM_BUILD_EXTERNAL_COMPILER_RT=ON 139 | -DLLVM_BUILD_LLVM_DYLIB=ON 140 | -DLLVM_LINK_LLVM_DYLIB=ON 141 | -DLLVM_ENABLE_LIBCXX=ON 142 | -DLLVM_ENABLE_FFI=ON 143 | -DFFI_INCLUDE_DIR=#{Formula["libffi"].opt_lib}/libffi-#{Formula["libffi"].version}/include 144 | -DFFI_LIBRARY_DIR=#{Formula["libffi"].opt_lib} 145 | ] 146 | 147 | mktemp do 148 | system "cmake", buildpath, *(std_cmake_args + args) 149 | system "cmake", "--build", "." 150 | system "cmake", "--build", ".", "--target", "install" 151 | end 152 | 153 | (share/"clang-#{ver}/tools").install Dir["tools/clang/tools/scan-{build,view}"] 154 | inreplace share/"clang-#{ver}/tools/scan-build/bin/scan-build", "$RealBin/bin/clang", install_prefix/"bin/clang" 155 | (install_prefix/"bin").install_symlink share/"clang-#{ver}/tools/scan-view/bin/scan-view" 156 | (install_prefix/"bin").install_symlink share/"clang-#{ver}/tools/scan-build/bin/scan-build" 157 | (install_prefix/"share/man/man1").install_symlink share/"clang-#{ver}/tools/scan-build/scan-build.1" 158 | 159 | (lib/"python2.7/site-packages").install "bindings/python/llvm" => "llvm-#{ver}", 160 | clang_buildpath/"bindings/python/clang" => "clang-#{ver}" 161 | 162 | # replace the existing "clang -> clang-4.0" symlink 163 | rm install_prefix/"bin/clang" 164 | mv install_prefix/"bin/clang-#{ver}", install_prefix/"bin/clang" 165 | 166 | # These versioned .dylib symlinks are missing for some reason 167 | # Note that we use relative symlinks 168 | ln_s "libLLVM.dylib", install_prefix/"lib/libLLVM-4.0.dylib" 169 | 170 | # Set LC_LOAD_DYLIB entries to absolute paths 171 | system "install_name_tool", "-change", "@rpath/libLLVM.dylib", install_prefix/"lib/libLLVM.dylib", install_prefix/"lib/libLTO.dylib" 172 | system "install_name_tool", "-change", "@rpath/libLLVM.dylib", install_prefix/"lib/libLLVM.dylib", install_prefix/"lib/libclang.dylib" 173 | 174 | # Set LC_ID_DYLIB entries to absolute paths 175 | system "install_name_tool", "-id", install_prefix/"lib/libLLVM.dylib", install_prefix/"lib/libLLVM.dylib" 176 | system "install_name_tool", "-id", install_prefix/"lib/libLTO.dylib", install_prefix/"lib/libLTO.dylib" 177 | system "install_name_tool", "-id", install_prefix/"lib/libc++.1.0.dylib", install_prefix/"lib/libc++.1.0.dylib" 178 | system "install_name_tool", "-id", install_prefix/"lib/libclang.dylib", install_prefix/"lib/libclang.dylib" 179 | system "install_name_tool", "-id", install_prefix/"lib/libomp.dylib", install_prefix/"lib/libomp.dylib" 180 | system "install_name_tool", "-id", install_prefix/"lib/libunwind.1.0.dylib", install_prefix/"lib/libunwind.1.0.dylib" 181 | 182 | Dir.glob(install_prefix/"bin/*") do |exec_path| 183 | basename = File.basename(exec_path) 184 | bin.install_symlink exec_path => "#{basename}-#{ver}" 185 | end 186 | 187 | Dir.glob(install_prefix/"share/man/man1/*") do |manpage| 188 | basename = File.basename(manpage, ".1") 189 | man1.install_symlink manpage => "#{basename}-#{ver}.1" 190 | end 191 | end 192 | 193 | def caveats; <<~EOS 194 | Extra tools are installed in #{opt_share}/clang-#{ver} 195 | 196 | To link to libc++, something like the following is required: 197 | CXX="clang++-#{ver} -stdlib=libc++" 198 | CXXFLAGS="$CXXFLAGS -nostdinc++ -I#{opt_lib}/llvm-#{ver}/include/c++/v1" 199 | LDFLAGS="$LDFLAGS -L#{opt_lib}/llvm-#{ver}/lib" 200 | EOS 201 | end 202 | 203 | test do 204 | assert_equal prefix.to_s, shell_output("#{bin}/llvm-config-#{ver} --prefix").chomp 205 | 206 | # test for sed errors since some llvm makefiles assume that sed 207 | # understands '\n' which is true for gnu sed and not for bsd sed. 208 | assert_no_match /PATH\)n/, (lib/"llvm-4.0/share/llvm/cmake/LLVMConfig.cmake").read 209 | system "#{bin}/llvm-config-#{ver}", "--version" 210 | end 211 | end 212 | -------------------------------------------------------------------------------- /Formula/llvm-5.0.rb: -------------------------------------------------------------------------------- 1 | class Llvm50 < Formula 2 | desc "Next-gen compiler infrastructure" 3 | homepage "http://llvm.org/" 4 | 5 | version = "5.0.2" 6 | 7 | stable do 8 | url "http://releases.llvm.org/#{version}/llvm-#{version}.src.tar.xz" 9 | sha256 "d522eda97835a9c75f0b88ddc81437e5edbb87dc2740686cb8647763855c2b3c" 10 | 11 | resource "clang" do 12 | url "http://releases.llvm.org/#{version}/cfe-#{version}.src.tar.xz" 13 | sha256 "fa9ce9724abdb68f166deea0af1f71ca0dfa9af8f7e1261f2cae63c280282800" 14 | end 15 | 16 | resource "clang-tools-extra" do 17 | url "http://releases.llvm.org/#{version}/clang-tools-extra-#{version}.src.tar.xz" 18 | sha256 "a3362a854ba4a60336b21a95612f647f4b6de0afd88858f2420e41c5a31b0b05" 19 | end 20 | 21 | resource "compiler-rt" do 22 | url "http://releases.llvm.org/#{version}/compiler-rt-#{version}.src.tar.xz" 23 | sha256 "3efe9ddf3f69e0c0a45cde57ee93911f36f3ab5f2a7f6ab8c8efb3db9b24ed46" 24 | end 25 | 26 | resource "polly" do 27 | url "http://releases.llvm.org/#{version}/polly-#{version}.src.tar.xz" 28 | sha256 "dda84e48b2195768c4ef25893edd5eeca731bed7e80a2376119dfbc3350e91b8" 29 | end 30 | 31 | resource "lld" do 32 | url "http://releases.llvm.org/#{version}/lld-#{version}.src.tar.xz" 33 | sha256 "46456d72ec411c6d5327ad3fea1358296f0dfe508caf1fa63ce4184f652e07aa" 34 | end 35 | 36 | resource "openmp" do 37 | url "http://releases.llvm.org/#{version}/openmp-#{version}.src.tar.xz" 38 | sha256 "39ca542c540608d95d3299a474836a7b5f8377bcc5a68493379872738c28565c" 39 | end 40 | 41 | resource "libcxx" do 42 | url "http://releases.llvm.org/#{version}/libcxx-#{version}.src.tar.xz" 43 | sha256 "6edf88e913175536e1182058753fff2365e388e017a9ec7427feb9929c52e298" 44 | end 45 | 46 | resource "libunwind" do 47 | url "http://releases.llvm.org/#{version}/libunwind-#{version}.src.tar.xz" 48 | sha256 "706e43c69c7be0fdeb55ebdf653cf47ca77e471d1584f1dbf12a568a93df9928" 49 | end 50 | end 51 | 52 | bottle do 53 | end 54 | 55 | head do 56 | url "http://llvm.org/git/llvm.git", :branch => "release_50" 57 | 58 | resource "clang" do 59 | url "http://llvm.org/git/clang.git", :branch => "release_50" 60 | end 61 | 62 | resource "clang-tools-extra" do 63 | url "http://llvm.org/git/clang-tools-extra.git", :branch => "release_50" 64 | end 65 | 66 | resource "compiler-rt" do 67 | url "http://llvm.org/git/compiler-rt.git", :branch => "release_50" 68 | end 69 | 70 | resource "polly" do 71 | url "http://llvm.org/git/polly.git", :branch => "release_50" 72 | end 73 | 74 | resource "lld" do 75 | url "http://llvm.org/git/lld.git", :branch => "release_50" 76 | end 77 | 78 | resource "openmp" do 79 | url "http://llvm.org/git/openmp.git", :branch => "release_50" 80 | end 81 | 82 | resource "libcxx" do 83 | url "http://llvm.org/git/libcxx.git", :branch => "release_50" 84 | end 85 | 86 | resource "libunwind" do 87 | url "http://llvm.org/git/libunwind.git", :branceh => "release_50" 88 | end 89 | end 90 | 91 | # http://releases.llvm.org/5.0.0/docs/GettingStarted.html#requirements 92 | depends_on "libffi" 93 | depends_on "cmake" => :build 94 | 95 | # version suffix 96 | def ver 97 | "5.0" 98 | end 99 | 100 | # http://releases.llvm.org/5.0.0/docs/CMake.html 101 | def install 102 | # Apple's libstdc++ is too old to build LLVM 103 | ENV.libcxx if ENV.compiler == :clang 104 | 105 | # compiler-rt has some iOS simulator features that require i386 symbols. I'm 106 | # assuming the rest of clang also needs support for 32-bit compilation to 107 | # work correctly, but if not, perhaps universal binaries could be limited to 108 | # compiler-rt. LLVM makes this somewhat easier because compiler-rt can 109 | # almost be treated as an entirely different build from LLVM. 110 | ENV.permit_arch_flags 111 | 112 | clang_buildpath = buildpath/"tools/clang" 113 | libcxx_buildpath = buildpath/"projects/libcxx" 114 | 115 | clang_buildpath.install resource("clang") 116 | libcxx_buildpath.install resource("libcxx") 117 | (buildpath/"tools/lld").install resource("lld") 118 | (buildpath/"tools/polly").install resource("polly") 119 | (buildpath/"tools/clang/tools/extra").install resource("clang-tools-extra") 120 | (buildpath/"projects/openmp").install resource("openmp") 121 | (buildpath/"projects/libcxx").install resource("libcxx") 122 | (buildpath/"projects/libunwind").install resource("libunwind") 123 | (buildpath/"projects/compiler-rt").install resource("compiler-rt") 124 | 125 | install_prefix = lib/"llvm-#{ver}" 126 | 127 | args = %W[ 128 | -DCMAKE_INSTALL_PREFIX=#{install_prefix} 129 | -DCMAKE_BUILD_TYPE=Release 130 | -DLLVM_ENABLE_ASSERTIONS=ON 131 | -DLLVM_OPTIMIZED_TABLEGEN=ON 132 | -DLLVM_INCLUDE_DOCS=OFF 133 | -DLLVM_ENABLE_RTTI=ON 134 | -DLLVM_ENABLE_EH=ON 135 | -DLLVM_INSTALL_UTILS=ON 136 | -DWITH_POLLY=ON 137 | -DLINK_POLLY_INTO_TOOLS=ON 138 | -DLLVM_TARGETS_TO_BUILD=all 139 | -DLIBOMP_ARCH=x86_64 140 | -DLLVM_BUILD_EXTERNAL_COMPILER_RT=ON 141 | -DLLVM_BUILD_LLVM_DYLIB=ON 142 | -DLLVM_LINK_LLVM_DYLIB=ON 143 | -DLLVM_ENABLE_LIBCXX=ON 144 | -DLLVM_ENABLE_FFI=ON 145 | -DFFI_INCLUDE_DIR=#{Formula["libffi"].opt_lib}/libffi-#{Formula["libffi"].version}/include 146 | -DFFI_LIBRARY_DIR=#{Formula["libffi"].opt_lib} 147 | ] 148 | 149 | mktemp do 150 | system "cmake", buildpath, *(std_cmake_args + args) 151 | system "cmake", "--build", "." 152 | system "cmake", "--build", ".", "--target", "install" 153 | end 154 | 155 | (share/"clang-#{ver}/tools").install Dir["tools/clang/tools/scan-{build,view}"] 156 | inreplace share/"clang-#{ver}/tools/scan-build/bin/scan-build", "$RealBin/bin/clang", install_prefix/"bin/clang" 157 | (install_prefix/"bin").install_symlink share/"clang-#{ver}/tools/scan-view/bin/scan-view" 158 | (install_prefix/"bin").install_symlink share/"clang-#{ver}/tools/scan-build/bin/scan-build" 159 | (install_prefix/"share/man/man1").install_symlink share/"clang-#{ver}/tools/scan-build/scan-build.1" 160 | 161 | (lib/"python2.7/site-packages").install "bindings/python/llvm" => "llvm-#{ver}", 162 | clang_buildpath/"bindings/python/clang" => "clang-#{ver}" 163 | 164 | # replace the existing "clang -> clang-5.0" symlink 165 | rm install_prefix/"bin/clang" 166 | mv install_prefix/"bin/clang-#{ver}", install_prefix/"bin/clang" 167 | 168 | # These versioned .dylib symlinks are missing for some reason 169 | # Note that we use relative symlinks 170 | ln_s "libLLVM.dylib", install_prefix/"lib/libLLVM-#{ver}.dylib" 171 | 172 | # Set LC_LOAD_DYLIB entries to absolute paths 173 | system "install_name_tool", "-change", "@rpath/libLLVM.dylib", install_prefix/"lib/libLLVM.dylib", install_prefix/"lib/libLTO.dylib" 174 | system "install_name_tool", "-change", "@rpath/libLLVM.dylib", install_prefix/"lib/libLLVM.dylib", install_prefix/"lib/libclang.dylib" 175 | 176 | # Set LC_ID_DYLIB entries to absolute paths 177 | system "install_name_tool", "-id", install_prefix/"lib/libLLVM.dylib", install_prefix/"lib/libLLVM.dylib" 178 | system "install_name_tool", "-id", install_prefix/"lib/libLTO.dylib", install_prefix/"lib/libLTO.dylib" 179 | system "install_name_tool", "-id", install_prefix/"lib/libc++.1.0.dylib", install_prefix/"lib/libc++.1.0.dylib" 180 | system "install_name_tool", "-id", install_prefix/"lib/libclang.dylib", install_prefix/"lib/libclang.dylib" 181 | system "install_name_tool", "-id", install_prefix/"lib/libomp.dylib", install_prefix/"lib/libomp.dylib" 182 | system "install_name_tool", "-id", install_prefix/"lib/libunwind.1.0.dylib", install_prefix/"lib/libunwind.1.0.dylib" 183 | 184 | Dir.glob(install_prefix/"bin/*") do |exec_path| 185 | basename = File.basename(exec_path) 186 | bin.install_symlink exec_path => "#{basename}-#{ver}" 187 | end 188 | 189 | Dir.glob(install_prefix/"share/man/man1/*") do |manpage| 190 | basename = File.basename(manpage, ".1") 191 | man1.install_symlink manpage => "#{basename}-#{ver}.1" 192 | end 193 | end 194 | 195 | def caveats; <<~EOS 196 | Extra tools are installed in #{opt_share}/clang-#{ver} 197 | 198 | To link to libc++, something like the following is required: 199 | CXX="clang++-#{ver} -stdlib=libc++" 200 | CXXFLAGS="$CXXFLAGS -nostdinc++ -I#{opt_lib}/llvm-#{ver}/include/c++/v1" 201 | LDFLAGS="$LDFLAGS -L#{opt_lib}/llvm-#{ver}/lib" 202 | EOS 203 | end 204 | 205 | test do 206 | assert_equal prefix.to_s, shell_output("#{bin}/llvm-config-#{ver} --prefix").chomp 207 | 208 | # test for sed errors since some llvm makefiles assume that sed 209 | # understands '\n' which is true for gnu sed and not for bsd sed. 210 | assert_no_match /PATH\)n/, (lib/"llvm-#{ver}/share/llvm/cmake/LLVMConfig.cmake").read 211 | system "#{bin}/llvm-config-#{ver}", "--version" 212 | end 213 | end 214 | -------------------------------------------------------------------------------- /Formula/llvm-6.0.rb: -------------------------------------------------------------------------------- 1 | class Llvm60 < Formula 2 | desc "Next-gen compiler infrastructure" 3 | homepage "http://llvm.org/" 4 | 5 | version = "6.0.1" 6 | 7 | stable do 8 | url "http://releases.llvm.org/#{version}/llvm-#{version}.src.tar.xz" 9 | sha256 "b6d6c324f9c71494c0ccaf3dac1f16236d970002b42bb24a6c9e1634f7d0f4e2" 10 | 11 | resource "clang" do 12 | url "http://releases.llvm.org/#{version}/cfe-#{version}.src.tar.xz" 13 | sha256 "7c243f1485bddfdfedada3cd402ff4792ea82362ff91fbdac2dae67c6026b667" 14 | end 15 | 16 | resource "clang-tools-extra" do 17 | url "http://releases.llvm.org/#{version}/clang-tools-extra-#{version}.src.tar.xz" 18 | sha256 "0d2e3727786437574835b75135f9e36f861932a958d8547ced7e13ebdda115f1" 19 | end 20 | 21 | resource "compiler-rt" do 22 | url "http://releases.llvm.org/#{version}/compiler-rt-#{version}.src.tar.xz" 23 | sha256 "f4cd1e15e7d5cb708f9931d4844524e4904867240c306b06a4287b22ac1c99b9" 24 | end 25 | 26 | resource "polly" do 27 | url "http://releases.llvm.org/#{version}/polly-#{version}.src.tar.xz" 28 | sha256 "e7765fdf6c8c102b9996dbb46e8b3abc41396032ae2315550610cf5a1ecf4ecc" 29 | end 30 | 31 | resource "lld" do 32 | url "http://releases.llvm.org/#{version}/lld-#{version}.src.tar.xz" 33 | sha256 "e706745806921cea5c45700e13ebe16d834b5e3c0b7ad83bf6da1f28b0634e11" 34 | end 35 | 36 | resource "openmp" do 37 | url "http://releases.llvm.org/#{version}/openmp-#{version}.src.tar.xz" 38 | sha256 "66afca2b308351b180136cf899a3b22865af1a775efaf74dc8a10c96d4721c5a" 39 | end 40 | 41 | resource "libcxx" do 42 | url "http://releases.llvm.org/#{version}/libcxx-#{version}.src.tar.xz" 43 | sha256 "7654fbc810a03860e6f01a54c2297a0b9efb04c0b9aa0409251d9bdb3726fc67" 44 | end 45 | 46 | resource "libunwind" do 47 | url "http://releases.llvm.org/#{version}/libunwind-#{version}.src.tar.xz" 48 | sha256 "a8186c76a16298a0b7b051004d0162032b9b111b857fbd939d71b0930fd91b96" 49 | end 50 | end 51 | 52 | bottle do 53 | end 54 | 55 | head do 56 | url "http://llvm.org/git/llvm.git", :branch => "release_60" 57 | 58 | resource "clang" do 59 | url "http://llvm.org/git/clang.git", :branch => "release_60" 60 | end 61 | 62 | resource "clang-tools-extra" do 63 | url "http://llvm.org/git/clang-tools-extra.git", :branch => "release_60" 64 | end 65 | 66 | resource "compiler-rt" do 67 | url "http://llvm.org/git/compiler-rt.git", :branch => "release_60" 68 | end 69 | 70 | resource "polly" do 71 | url "http://llvm.org/git/polly.git", :branch => "release_60" 72 | end 73 | 74 | resource "lld" do 75 | url "http://llvm.org/git/lld.git", :branch => "release_60" 76 | end 77 | 78 | resource "openmp" do 79 | url "http://llvm.org/git/openmp.git", :branch => "release_60" 80 | end 81 | 82 | resource "libcxx" do 83 | url "http://llvm.org/git/libcxx.git", :branch => "release_60" 84 | end 85 | 86 | resource "libunwind" do 87 | url "http://llvm.org/git/libunwind.git", :branceh => "release_60" 88 | end 89 | end 90 | 91 | # http://releases.llvm.org/6.0.0/docs/GettingStarted.html#requirements 92 | depends_on "libffi" 93 | depends_on "cmake" => :build 94 | 95 | # version suffix 96 | def ver 97 | "6.0" 98 | end 99 | 100 | # http://releases.llvm.org/6.0.0/docs/CMake.html 101 | def install 102 | # Apple's libstdc++ is too old to build LLVM 103 | ENV.libcxx if ENV.compiler == :clang 104 | 105 | # compiler-rt has some iOS simulator features that require i386 symbols. I'm 106 | # assuming the rest of clang also needs support for 32-bit compilation to 107 | # work correctly, but if not, perhaps universal binaries could be limited to 108 | # compiler-rt. LLVM makes this somewhat easier because compiler-rt can 109 | # almost be treated as an entirely different build from LLVM. 110 | ENV.permit_arch_flags 111 | 112 | clang_buildpath = buildpath/"tools/clang" 113 | libcxx_buildpath = buildpath/"projects/libcxx" 114 | 115 | clang_buildpath.install resource("clang") 116 | libcxx_buildpath.install resource("libcxx") 117 | (buildpath/"tools/lld").install resource("lld") 118 | (buildpath/"tools/polly").install resource("polly") 119 | (buildpath/"tools/clang/tools/extra").install resource("clang-tools-extra") 120 | (buildpath/"projects/openmp").install resource("openmp") 121 | (buildpath/"projects/libunwind").install resource("libunwind") 122 | (buildpath/"projects/compiler-rt").install resource("compiler-rt") 123 | 124 | install_prefix = lib/"llvm-#{ver}" 125 | 126 | args = %W[ 127 | -DCMAKE_INSTALL_PREFIX=#{install_prefix} 128 | -DCMAKE_BUILD_TYPE=Release 129 | -DLLVM_ENABLE_ASSERTIONS=ON 130 | -DLLVM_OPTIMIZED_TABLEGEN=ON 131 | -DLLVM_INCLUDE_DOCS=OFF 132 | -DLLVM_ENABLE_RTTI=ON 133 | -DLLVM_ENABLE_EH=ON 134 | -DLLVM_INSTALL_UTILS=ON 135 | -DWITH_POLLY=ON 136 | -DLINK_POLLY_INTO_TOOLS=ON 137 | -DLLVM_TARGETS_TO_BUILD=all 138 | -DLIBOMP_ARCH=x86_64 139 | -DLLVM_BUILD_EXTERNAL_COMPILER_RT=ON 140 | -DLLVM_BUILD_LLVM_DYLIB=ON 141 | -DLLVM_LINK_LLVM_DYLIB=ON 142 | -DLLVM_ENABLE_LIBCXX=ON 143 | -DLLVM_ENABLE_FFI=ON 144 | -DFFI_INCLUDE_DIR=#{Formula["libffi"].opt_lib}/libffi-#{Formula["libffi"].version}/include 145 | -DFFI_LIBRARY_DIR=#{Formula["libffi"].opt_lib} 146 | ] 147 | 148 | mktemp do 149 | system "cmake", buildpath, *(std_cmake_args + args) 150 | system "cmake", "--build", "." 151 | system "cmake", "--build", ".", "--target", "install" 152 | end 153 | 154 | (share/"clang-#{ver}/tools").install Dir["tools/clang/tools/scan-{build,view}"] 155 | inreplace share/"clang-#{ver}/tools/scan-build/bin/scan-build", "$RealBin/bin/clang", install_prefix/"bin/clang" 156 | (install_prefix/"bin").install_symlink share/"clang-#{ver}/tools/scan-view/bin/scan-view" 157 | (install_prefix/"bin").install_symlink share/"clang-#{ver}/tools/scan-build/bin/scan-build" 158 | (install_prefix/"share/man/man1").install_symlink share/"clang-#{ver}/tools/scan-build/scan-build.1" 159 | 160 | (lib/"python2.7/site-packages").install "bindings/python/llvm" => "llvm-#{ver}", 161 | clang_buildpath/"bindings/python/clang" => "clang-#{ver}" 162 | 163 | # replace the existing "clang -> clang-6.0" symlink 164 | rm install_prefix/"bin/clang" 165 | mv install_prefix/"bin/clang-#{ver}", install_prefix/"bin/clang" 166 | 167 | # These versioned .dylib symlinks are missing for some reason 168 | # Note that we use relative symlinks 169 | ln_s "libLLVM.dylib", install_prefix/"lib/libLLVM-#{ver}.dylib" 170 | 171 | # Set LC_LOAD_DYLIB entries to absolute paths 172 | system "install_name_tool", "-change", "@rpath/libLLVM.dylib", install_prefix/"lib/libLLVM.dylib", install_prefix/"lib/libLTO.dylib" 173 | system "install_name_tool", "-change", "@rpath/libLLVM.dylib", install_prefix/"lib/libLLVM.dylib", install_prefix/"lib/libclang.dylib" 174 | 175 | # Set LC_ID_DYLIB entries to absolute paths 176 | system "install_name_tool", "-id", install_prefix/"lib/libLLVM.dylib", install_prefix/"lib/libLLVM.dylib" 177 | system "install_name_tool", "-id", install_prefix/"lib/libLTO.dylib", install_prefix/"lib/libLTO.dylib" 178 | system "install_name_tool", "-id", install_prefix/"lib/libc++.1.0.dylib", install_prefix/"lib/libc++.1.0.dylib" 179 | system "install_name_tool", "-id", install_prefix/"lib/libclang.dylib", install_prefix/"lib/libclang.dylib" 180 | system "install_name_tool", "-id", install_prefix/"lib/libomp.dylib", install_prefix/"lib/libomp.dylib" 181 | system "install_name_tool", "-id", install_prefix/"lib/libunwind.1.0.dylib", install_prefix/"lib/libunwind.1.0.dylib" 182 | 183 | Dir.glob(install_prefix/"bin/*") do |exec_path| 184 | basename = File.basename(exec_path) 185 | bin.install_symlink exec_path => "#{basename}-#{ver}" 186 | end 187 | 188 | Dir.glob(install_prefix/"share/man/man1/*") do |manpage| 189 | basename = File.basename(manpage, ".1") 190 | man1.install_symlink manpage => "#{basename}-#{ver}.1" 191 | end 192 | end 193 | 194 | def caveats; <<~EOS 195 | Extra tools are installed in #{opt_share}/clang-#{ver} 196 | 197 | To link to libc++, something like the following is required: 198 | CXX="clang++-#{ver} -stdlib=libc++" 199 | CXXFLAGS="$CXXFLAGS -nostdinc++ -I#{opt_lib}/llvm-#{ver}/include/c++/v1" 200 | LDFLAGS="$LDFLAGS -L#{opt_lib}/llvm-#{ver}/lib" 201 | EOS 202 | end 203 | 204 | test do 205 | assert_equal prefix.to_s, shell_output("#{bin}/llvm-config-#{ver} --prefix").chomp 206 | 207 | # test for sed errors since some llvm makefiles assume that sed 208 | # understands '\n' which is true for gnu sed and not for bsd sed. 209 | assert_no_match /PATH\)n/, (lib/"llvm-#{ver}/share/llvm/cmake/LLVMConfig.cmake").read 210 | system "#{bin}/llvm-config-#{ver}", "--version" 211 | end 212 | end 213 | 214 | -------------------------------------------------------------------------------- /Formula/llvm-7.rb: -------------------------------------------------------------------------------- 1 | class Llvm7 < Formula 2 | desc "Next-gen compiler infrastructure" 3 | homepage "http://llvm.org/" 4 | 5 | version = "7.0.1" 6 | 7 | stable do 8 | url "http://releases.llvm.org/#{version}/llvm-#{version}.src.tar.xz" 9 | sha256 "a38dfc4db47102ec79dcc2aa61e93722c5f6f06f0a961073bd84b78fb949419b" 10 | 11 | resource "clang" do 12 | url "http://releases.llvm.org/#{version}/cfe-#{version}.src.tar.xz" 13 | sha256 "a45b62dde5d7d5fdcdfa876b0af92f164d434b06e9e89b5d0b1cbc65dfe3f418" 14 | end 15 | 16 | resource "clang-tools-extra" do 17 | url "http://releases.llvm.org/#{version}/clang-tools-extra-#{version}.src.tar.xz" 18 | sha256 "4c93c7d2bb07923a8b272da3ef7914438080aeb693725f4fc5c19cd0e2613bed" 19 | end 20 | 21 | resource "compiler-rt" do 22 | url "http://releases.llvm.org/#{version}/compiler-rt-#{version}.src.tar.xz" 23 | sha256 "782edfc119ee172f169c91dd79f2c964fb6b248bd9b73523149030ed505bbe18" 24 | end 25 | 26 | resource "polly" do 27 | url "http://releases.llvm.org/#{version}/polly-#{version}.src.tar.xz" 28 | sha256 "1bf146842a09336b9c88d2d76c2d117484e5fad78786821718653d1a9d57fb71" 29 | end 30 | 31 | resource "lld" do 32 | url "http://releases.llvm.org/#{version}/lld-#{version}.src.tar.xz" 33 | sha256 "8869aab2dd2d8e00d69943352d3166d159d7eae2615f66a684f4a0999fc74031" 34 | end 35 | 36 | resource "openmp" do 37 | url "http://releases.llvm.org/#{version}/openmp-#{version}.src.tar.xz" 38 | sha256 "bf16b78a678da67d68405214ec7ee59d86a15f599855806192a75dcfca9b0d0c" 39 | end 40 | 41 | resource "libcxx" do 42 | url "http://releases.llvm.org/#{version}/libcxx-#{version}.src.tar.xz" 43 | sha256 "020002618b319dc2a8ba1f2cba88b8cc6a209005ed8ad29f9de0c562c6ebb9f1" 44 | end 45 | 46 | resource "libunwind" do 47 | url "http://releases.llvm.org/#{version}/libunwind-#{version}.src.tar.xz" 48 | sha256 "89c852991dfd9279dbca9d5ac10b53c67ad7d0f54bbab7156e9f057a978b5912" 49 | end 50 | end 51 | 52 | bottle do 53 | end 54 | 55 | head do 56 | url "http://llvm.org/git/llvm.git", :branch => "release_70" 57 | 58 | resource "clang" do 59 | url "http://llvm.org/git/clang.git", :branch => "release_70" 60 | end 61 | 62 | resource "clang-tools-extra" do 63 | url "http://llvm.org/git/clang-tools-extra.git", :branch => "release_70" 64 | end 65 | 66 | resource "compiler-rt" do 67 | url "http://llvm.org/git/compiler-rt.git", :branch => "release_70" 68 | end 69 | 70 | resource "polly" do 71 | url "http://llvm.org/git/polly.git", :branch => "release_70" 72 | end 73 | 74 | resource "lld" do 75 | url "http://llvm.org/git/lld.git", :branch => "release_70" 76 | end 77 | 78 | resource "openmp" do 79 | url "http://llvm.org/git/openmp.git", :branch => "release_70" 80 | end 81 | 82 | resource "libcxx" do 83 | url "http://llvm.org/git/libcxx.git", :branch => "release_70" 84 | end 85 | 86 | resource "libunwind" do 87 | url "http://llvm.org/git/libunwind.git", :branch => "release_70" 88 | end 89 | end 90 | 91 | # http://releases.llvm.org/7.0.0/docs/GettingStarted.html#requirements 92 | depends_on "libffi" 93 | depends_on "cmake" => :build 94 | 95 | # version suffix 96 | def ver 97 | "7" 98 | end 99 | 100 | # http://releases.llvm.org/7.0.0/docs/CMake.html 101 | def install 102 | # Apple's libstdc++ is too old to build LLVM 103 | ENV.libcxx if ENV.compiler == :clang 104 | 105 | # compiler-rt has some iOS simulator features that require i386 symbols. I'm 106 | # assuming the rest of clang also needs support for 32-bit compilation to 107 | # work correctly, but if not, perhaps universal binaries could be limited to 108 | # compiler-rt. LLVM makes this somewhat easier because compiler-rt can 109 | # almost be treated as an entirely different build from LLVM. 110 | ENV.permit_arch_flags 111 | 112 | clang_buildpath = buildpath/"tools/clang" 113 | libcxx_buildpath = buildpath/"projects/libcxx" 114 | 115 | clang_buildpath.install resource("clang") 116 | libcxx_buildpath.install resource("libcxx") 117 | (buildpath/"tools/lld").install resource("lld") 118 | (buildpath/"tools/polly").install resource("polly") 119 | (buildpath/"tools/clang/tools/extra").install resource("clang-tools-extra") 120 | (buildpath/"projects/openmp").install resource("openmp") 121 | (buildpath/"projects/libunwind").install resource("libunwind") 122 | (buildpath/"projects/compiler-rt").install resource("compiler-rt") 123 | 124 | install_prefix = lib/"llvm-#{ver}" 125 | 126 | args = %W[ 127 | -DCMAKE_INSTALL_PREFIX=#{install_prefix} 128 | -DCMAKE_BUILD_TYPE=Release 129 | -DLLVM_ENABLE_ASSERTIONS=ON 130 | -DLLVM_OPTIMIZED_TABLEGEN=ON 131 | -DLLVM_INCLUDE_DOCS=OFF 132 | -DLLVM_ENABLE_RTTI=ON 133 | -DLLVM_ENABLE_EH=ON 134 | -DLLVM_INSTALL_UTILS=ON 135 | -DWITH_POLLY=ON 136 | -DLINK_POLLY_INTO_TOOLS=ON 137 | -DLLVM_TARGETS_TO_BUILD=all 138 | -DLIBOMP_ARCH=x86_64 139 | -DLLVM_BUILD_EXTERNAL_COMPILER_RT=ON 140 | -DLLVM_BUILD_LLVM_DYLIB=ON 141 | -DLLVM_LINK_LLVM_DYLIB=ON 142 | -DLLVM_ENABLE_LIBCXX=ON 143 | -DLLVM_ENABLE_FFI=ON 144 | -DFFI_INCLUDE_DIR=#{Formula["libffi"].opt_lib}/libffi-#{Formula["libffi"].version}/include 145 | -DFFI_LIBRARY_DIR=#{Formula["libffi"].opt_lib} 146 | ] 147 | 148 | mktemp do 149 | system "cmake", buildpath, *(std_cmake_args + args) 150 | system "cmake", "--build", "." 151 | system "cmake", "--build", ".", "--target", "install" 152 | end 153 | 154 | (share/"clang-#{ver}/tools").install Dir["tools/clang/tools/scan-{build,view}"] 155 | inreplace share/"clang-#{ver}/tools/scan-build/bin/scan-build", "$RealBin/bin/clang", install_prefix/"bin/clang" 156 | (install_prefix/"bin").install_symlink share/"clang-#{ver}/tools/scan-view/bin/scan-view" 157 | (install_prefix/"bin").install_symlink share/"clang-#{ver}/tools/scan-build/bin/scan-build" 158 | (install_prefix/"share/man/man1").install_symlink share/"clang-#{ver}/tools/scan-build/scan-build.1" 159 | 160 | (lib/"python2.7/site-packages").install "bindings/python/llvm" => "llvm-#{ver}", 161 | clang_buildpath/"bindings/python/clang" => "clang-#{ver}" 162 | 163 | # replace the existing "clang -> clang-7" symlink 164 | rm install_prefix/"bin/clang" 165 | mv install_prefix/"bin/clang-7", install_prefix/"bin/clang" 166 | 167 | # These versioned .dylib symlinks are missing for some reason 168 | # Note that we use relative symlinks 169 | ln_s "libLLVM.dylib", install_prefix/"lib/libLLVM-7.dylib" 170 | 171 | # Set LC_LOAD_DYLIB entries to absolute paths 172 | system "install_name_tool", "-change", "@rpath/libLLVM.dylib", install_prefix/"lib/libLLVM.dylib", install_prefix/"lib/libLTO.dylib" 173 | system "install_name_tool", "-change", "@rpath/libLLVM.dylib", install_prefix/"lib/libLLVM.dylib", install_prefix/"lib/libclang.dylib" 174 | 175 | # Set LC_ID_DYLIB entries to absolute paths 176 | system "install_name_tool", "-id", install_prefix/"lib/libLLVM.dylib", install_prefix/"lib/libLLVM.dylib" 177 | system "install_name_tool", "-id", install_prefix/"lib/libLTO.dylib", install_prefix/"lib/libLTO.dylib" 178 | system "install_name_tool", "-id", install_prefix/"lib/libc++.1.0.dylib", install_prefix/"lib/libc++.1.0.dylib" 179 | system "install_name_tool", "-id", install_prefix/"lib/libclang.dylib", install_prefix/"lib/libclang.dylib" 180 | system "install_name_tool", "-id", install_prefix/"lib/libomp.dylib", install_prefix/"lib/libomp.dylib" 181 | system "install_name_tool", "-id", install_prefix/"lib/libunwind.1.0.dylib", install_prefix/"lib/libunwind.1.0.dylib" 182 | 183 | Dir.glob(install_prefix/"bin/*") do |exec_path| 184 | basename = File.basename(exec_path) 185 | bin.install_symlink exec_path => "#{basename}-#{ver}" 186 | end 187 | 188 | Dir.glob(install_prefix/"share/man/man1/*") do |manpage| 189 | basename = File.basename(manpage, ".1") 190 | man1.install_symlink manpage => "#{basename}-#{ver}.1" 191 | end 192 | end 193 | 194 | def caveats; <<~EOS 195 | Extra tools are installed in #{opt_share}/clang-#{ver} 196 | 197 | To link to libc++, something like the following is required: 198 | CXX="clang++-#{ver} -stdlib=libc++" 199 | CXXFLAGS="$CXXFLAGS -nostdinc++ -I#{opt_lib}/llvm-#{ver}/include/c++/v1" 200 | LDFLAGS="$LDFLAGS -L#{opt_lib}/llvm-#{ver}/lib" 201 | EOS 202 | end 203 | 204 | test do 205 | assert_equal prefix.to_s, shell_output("#{bin}/llvm-config-#{ver} --prefix").chomp 206 | 207 | # test for sed errors since some llvm makefiles assume that sed 208 | # understands '\n' which is true for gnu sed and not for bsd sed. 209 | assert_no_match /PATH\)n/, (lib/"llvm-#{ver}/share/llvm/cmake/LLVMConfig.cmake").read 210 | system "#{bin}/llvm-config-#{ver}", "--version" 211 | end 212 | end 213 | 214 | -------------------------------------------------------------------------------- /Formula/llvm-8.rb: -------------------------------------------------------------------------------- 1 | class Llvm8 < Formula 2 | desc "Next-gen compiler infrastructure" 3 | homepage "http://llvm.org/" 4 | 5 | version = "8.0.1" 6 | 7 | stable do 8 | url "https://github.com/llvm/llvm-project/releases/download/llvmorg-#{version}/llvm-#{version}.src.tar.xz" 9 | sha256 "44787a6d02f7140f145e2250d56c9f849334e11f9ae379827510ed72f12b75e7" 10 | 11 | resource "clang" do 12 | url "https://github.com/llvm/llvm-project/releases/download/llvmorg-#{version}/cfe-#{version}.src.tar.xz" 13 | sha256 "70effd69f7a8ab249f66b0a68aba8b08af52aa2ab710dfb8a0fba102685b1646" 14 | end 15 | 16 | resource "clang-tools-extra" do 17 | url "https://github.com/llvm/llvm-project/releases/download/llvmorg-#{version}/clang-tools-extra-#{version}.src.tar.xz" 18 | sha256 "187179b617e4f07bb605cc215da0527e64990b4a7dd5cbcc452a16b64e02c3e1" 19 | end 20 | 21 | resource "compiler-rt" do 22 | url "https://github.com/llvm/llvm-project/releases/download/llvmorg-#{version}/compiler-rt-#{version}.src.tar.xz" 23 | sha256 "11828fb4823387d820c6715b25f6b2405e60837d12a7469e7a8882911c721837" 24 | end 25 | 26 | resource "polly" do 27 | url "https://github.com/llvm/llvm-project/releases/download/llvmorg-#{version}/polly-#{version}.src.tar.xz" 28 | sha256 "e8a1f7e8af238b32ce39ab5de1f3317a2e3f7d71a8b1b8bbacbd481ac76fd2d1" 29 | end 30 | 31 | resource "lld" do 32 | url "https://github.com/llvm/llvm-project/releases/download/llvmorg-#{version}/lld-#{version}.src.tar.xz" 33 | sha256 "9fba1e94249bd7913e8a6c3aadcb308b76c8c3d83c5ce36c99c3f34d73873d88" 34 | end 35 | 36 | resource "openmp" do 37 | url "https://github.com/llvm/llvm-project/releases/download/llvmorg-#{version}/openmp-#{version}.src.tar.xz" 38 | sha256 "3e85dd3cad41117b7c89a41de72f2e6aa756ea7b4ef63bb10dcddf8561a7722c" 39 | end 40 | 41 | resource "libcxx" do 42 | url "https://github.com/llvm/llvm-project/releases/download/llvmorg-#{version}/libcxx-#{version}.src.tar.xz" 43 | sha256 "7f0652c86a0307a250b5741ab6e82bb10766fb6f2b5a5602a63f30337e629b78" 44 | end 45 | 46 | resource "libunwind" do 47 | url "https://github.com/llvm/llvm-project/releases/download/llvmorg-#{version}/libunwind-#{version}.src.tar.xz" 48 | sha256 "1870161dda3172c63e632c1f60624564e1eb0f9233cfa8f040748ca5ff630f6e" 49 | end 50 | end 51 | 52 | bottle do 53 | root_url "https://github.com/llvm-hs/homebrew-llvm/releases/download/v8.0.1" 54 | sha256 cellar: :any, mojave: "95987da7dac35c8115dc2a172bb1f19a36a8f9f88a1157c04ff08e9a6110b0f5" 55 | end 56 | 57 | head do 58 | url "http://llvm.org/git/llvm.git", branch: "release_80" 59 | 60 | resource "clang" do 61 | url "http://llvm.org/git/clang.git", branch: "release_80" 62 | end 63 | 64 | resource "clang-tools-extra" do 65 | url "http://llvm.org/git/clang-tools-extra.git", branch: "release_80" 66 | end 67 | 68 | resource "compiler-rt" do 69 | url "http://llvm.org/git/compiler-rt.git", branch: "release_80" 70 | end 71 | 72 | resource "polly" do 73 | url "http://llvm.org/git/polly.git", branch: "release_80" 74 | end 75 | 76 | resource "lld" do 77 | url "http://llvm.org/git/lld.git", branch: "release_80" 78 | end 79 | 80 | resource "openmp" do 81 | url "http://llvm.org/git/openmp.git", branch: "release_80" 82 | end 83 | 84 | resource "libcxx" do 85 | url "http://llvm.org/git/libcxx.git", branch: "release_80" 86 | end 87 | 88 | resource "libunwind" do 89 | url "http://llvm.org/git/libunwind.git", branch: "release_80" 90 | end 91 | end 92 | 93 | # http://releases.llvm.org/8.0.0/docs/GettingStarted.html#requirements 94 | depends_on "cmake" => :build 95 | depends_on xcode: :build 96 | depends_on "libffi" 97 | 98 | # version suffix 99 | def ver 100 | "8" 101 | end 102 | 103 | # http://releases.llvm.org/8.0.0/docs/CMake.html 104 | def install 105 | # Apple's libstdc++ is too old to build LLVM 106 | ENV.libcxx if ENV.compiler == :clang 107 | 108 | # compiler-rt has some iOS simulator features that require i386 symbols. I'm 109 | # assuming the rest of clang also needs support for 32-bit compilation to 110 | # work correctly, but if not, perhaps universal binaries could be limited to 111 | # compiler-rt. LLVM makes this somewhat easier because compiler-rt can 112 | # almost be treated as an entirely different build from LLVM. 113 | ENV.permit_arch_flags 114 | 115 | clang_buildpath = buildpath/"tools/clang" 116 | libcxx_buildpath = buildpath/"projects/libcxx" 117 | 118 | clang_buildpath.install resource("clang") 119 | libcxx_buildpath.install resource("libcxx") 120 | (buildpath/"tools/lld").install resource("lld") 121 | (buildpath/"tools/polly").install resource("polly") 122 | (buildpath/"tools/clang/tools/extra").install resource("clang-tools-extra") 123 | (buildpath/"projects/openmp").install resource("openmp") 124 | (buildpath/"projects/libunwind").install resource("libunwind") 125 | (buildpath/"projects/compiler-rt").install resource("compiler-rt") 126 | 127 | install_prefix = lib/"llvm-#{ver}" 128 | 129 | args = %W[ 130 | -DCMAKE_INSTALL_PREFIX=#{install_prefix} 131 | -DCMAKE_BUILD_TYPE=Release 132 | -DLLVM_ENABLE_ASSERTIONS=ON 133 | -DLLVM_OPTIMIZED_TABLEGEN=ON 134 | -DLLVM_INCLUDE_DOCS=OFF 135 | -DLLVM_ENABLE_RTTI=ON 136 | -DLLVM_ENABLE_EH=ON 137 | -DLLVM_INSTALL_UTILS=ON 138 | -DWITH_POLLY=ON 139 | -DLINK_POLLY_INTO_TOOLS=ON 140 | -DLLVM_TARGETS_TO_BUILD=all 141 | -DLIBOMP_ARCH=x86_64 142 | -DLLVM_BUILD_EXTERNAL_COMPILER_RT=ON 143 | -DLLVM_BUILD_LLVM_DYLIB=ON 144 | -DLLVM_LINK_LLVM_DYLIB=ON 145 | -DLLVM_ENABLE_LIBCXX=ON 146 | -DLLVM_ENABLE_FFI=ON 147 | -DFFI_INCLUDE_DIR=#{Formula["libffi"].opt_lib}/libffi-#{Formula["libffi"].version}/include 148 | -DFFI_LIBRARY_DIR=#{Formula["libffi"].opt_lib} 149 | -DLLVM_CREATE_XCODE_TOOLCHAIN=ON 150 | ] 151 | 152 | mkdir "build" do 153 | system "cmake", "-G", "Unix Makefiles", "..", *(std_cmake_args + args) 154 | system "make" 155 | system "make", "install" 156 | system "make", "install-xcode-toolchain" 157 | end 158 | 159 | (share/"clang-#{ver}/tools").install Dir["tools/clang/tools/scan-{build,view}"] 160 | inreplace share/"clang-#{ver}/tools/scan-build/bin/scan-build", "$RealBin/bin/clang", install_prefix/"bin/clang" 161 | (install_prefix/"bin").install_symlink share/"clang-#{ver}/tools/scan-view/bin/scan-view" 162 | (install_prefix/"bin").install_symlink share/"clang-#{ver}/tools/scan-build/bin/scan-build" 163 | (install_prefix/"share/man/man1").install_symlink share/"clang-#{ver}/tools/scan-build/scan-build.1" 164 | 165 | (lib/"python2.7/site-packages").install "bindings/python/llvm" => "llvm-#{ver}", 166 | clang_buildpath/"bindings/python/clang" => "clang-#{ver}" 167 | 168 | # replace the existing "clang -> clang-8" symlink 169 | rm install_prefix/"bin/clang" 170 | mv install_prefix/"bin/clang-8", install_prefix/"bin/clang" 171 | 172 | # These versioned .dylib symlinks are missing for some reason 173 | # Note that we use relative symlinks 174 | ln_s "libLLVM.dylib", install_prefix/"lib/libLLVM-8.dylib" 175 | 176 | # Set LC_LOAD_DYLIB entries to absolute paths 177 | system "install_name_tool", "-change", "@rpath/libLLVM.dylib", install_prefix/"lib/libLLVM.dylib", install_prefix/"lib/libLTO.dylib" 178 | system "install_name_tool", "-change", "@rpath/libLLVM.dylib", install_prefix/"lib/libLLVM.dylib", install_prefix/"lib/libclang.dylib" 179 | 180 | # Set LC_ID_DYLIB entries to absolute paths 181 | system "install_name_tool", "-id", install_prefix/"lib/libLLVM.dylib", install_prefix/"lib/libLLVM.dylib" 182 | system "install_name_tool", "-id", install_prefix/"lib/libLTO.dylib", install_prefix/"lib/libLTO.dylib" 183 | system "install_name_tool", "-id", install_prefix/"lib/libc++.1.0.dylib", install_prefix/"lib/libc++.1.0.dylib" 184 | system "install_name_tool", "-id", install_prefix/"lib/libclang.dylib", install_prefix/"lib/libclang.dylib" 185 | system "install_name_tool", "-id", install_prefix/"lib/libomp.dylib", install_prefix/"lib/libomp.dylib" 186 | system "install_name_tool", "-id", install_prefix/"lib/libunwind.1.0.dylib", install_prefix/"lib/libunwind.1.0.dylib" 187 | 188 | Dir.glob(install_prefix/"bin/*") do |exec_path| 189 | basename = File.basename(exec_path) 190 | bin.install_symlink exec_path => "#{basename}-#{ver}" 191 | end 192 | 193 | Dir.glob(install_prefix/"share/man/man1/*") do |manpage| 194 | basename = File.basename(manpage, ".1") 195 | man1.install_symlink manpage => "#{basename}-#{ver}.1" 196 | end 197 | end 198 | 199 | def caveats 200 | <<~EOS 201 | Extra tools are installed in #{opt_share}/clang-#{ver} 202 | 203 | To link to libc++, something like the following is required: 204 | CXX="clang++-#{ver} -stdlib=libc++" 205 | CXXFLAGS="$CXXFLAGS -nostdinc++ -I#{opt_lib}/llvm-#{ver}/include/c++/v1" 206 | LDFLAGS="$LDFLAGS -L#{opt_lib}/llvm-#{ver}/lib" 207 | EOS 208 | end 209 | 210 | test do 211 | assert_equal prefix.to_s, shell_output("#{bin}/llvm-config-#{ver} --prefix").chomp 212 | 213 | # test for sed errors since some llvm makefiles assume that sed 214 | # understands '\n' which is true for gnu sed and not for bsd sed. 215 | assert_no_match(/PATH\)n/, (lib/"llvm-#{ver}/share/llvm/cmake/LLVMConfig.cmake").read) 216 | system "#{bin}/llvm-config-#{ver}", "--version" 217 | end 218 | end 219 | 220 | -------------------------------------------------------------------------------- /Formula/llvm-9.rb: -------------------------------------------------------------------------------- 1 | class Llvm9 < Formula 2 | desc "Next-gen compiler infrastructure" 3 | homepage "http://llvm.org/" 4 | 5 | version = "9.0.1" 6 | 7 | stable do 8 | url "https://github.com/llvm/llvm-project/releases/download/llvmorg-#{version}/llvm-#{version}.src.tar.xz" 9 | sha256 "00a1ee1f389f81e9979f3a640a01c431b3021de0d42278f6508391a2f0b81c9a" 10 | 11 | resource "clang" do 12 | url "https://github.com/llvm/llvm-project/releases/download/llvmorg-#{version}/clang-#{version}.src.tar.xz" 13 | sha256 "5778512b2e065c204010f88777d44b95250671103e434f9dc7363ab2e3804253" 14 | end 15 | 16 | resource "clang-tools-extra" do 17 | url "https://github.com/llvm/llvm-project/releases/download/llvmorg-#{version}/clang-tools-extra-#{version}.src.tar.xz" 18 | sha256 "b26fd72a78bd7db998a26270ec9ec6a01346651d88fa87b4b323e13049fb6f07" 19 | end 20 | 21 | resource "compiler-rt" do 22 | url "https://github.com/llvm/llvm-project/releases/download/llvmorg-#{version}/compiler-rt-#{version}.src.tar.xz" 23 | sha256 "c2bfab95c9986318318363d7f371a85a95e333bc0b34fbfa52edbd3f5e3a9077" 24 | end 25 | 26 | resource "polly" do 27 | url "https://github.com/llvm/llvm-project/releases/download/llvmorg-#{version}/polly-#{version}.src.tar.xz" 28 | sha256 "9a4ac69df923230d13eb6cd0d03f605499f6a854b1dc96a9b72c4eb075040fcf" 29 | end 30 | 31 | resource "lld" do 32 | url "https://github.com/llvm/llvm-project/releases/download/llvmorg-#{version}/lld-#{version}.src.tar.xz" 33 | sha256 "86262bad3e2fd784ba8c5e2158d7aa36f12b85f2515e95bc81d65d75bb9b0c82" 34 | end 35 | 36 | resource "openmp" do 37 | url "https://github.com/llvm/llvm-project/releases/download/llvmorg-#{version}/openmp-#{version}.src.tar.xz" 38 | sha256 "5c94060f846f965698574d9ce22975c0e9f04c9b14088c3af5f03870af75cace" 39 | end 40 | 41 | resource "libcxx" do 42 | url "https://github.com/llvm/llvm-project/releases/download/llvmorg-#{version}/libcxx-#{version}.src.tar.xz" 43 | sha256 "0981ff11b862f4f179a13576ab0a2f5530f46bd3b6b4a90f568ccc6a62914b34" 44 | end 45 | 46 | resource "libunwind" do 47 | url "https://github.com/llvm/llvm-project/releases/download/llvmorg-#{version}/libunwind-#{version}.src.tar.xz" 48 | sha256 "535a106a700889274cc7b2f610b2dcb8fc4b0ea597c3208602d7d037141460f1" 49 | end 50 | end 51 | 52 | bottle do 53 | root_url "https://github.com/llvm-hs/homebrew-llvm/releases/download/v9.0.1" 54 | sha256 cellar: :any, mojave: "01ed42a41f51b661f9d5e159c7815ca603d79bec9ba6009a37768555fff9bfc6" 55 | end 56 | 57 | head do 58 | url "http://llvm.org/git/llvm.git", branch: "release_90" 59 | 60 | resource "clang" do 61 | url "http://llvm.org/git/clang.git", branch: "release_90" 62 | end 63 | 64 | resource "clang-tools-extra" do 65 | url "http://llvm.org/git/clang-tools-extra.git", branch: "release_90" 66 | end 67 | 68 | resource "compiler-rt" do 69 | url "http://llvm.org/git/compiler-rt.git", branch: "release_90" 70 | end 71 | 72 | resource "polly" do 73 | url "http://llvm.org/git/polly.git", branch: "release_90" 74 | end 75 | 76 | resource "lld" do 77 | url "http://llvm.org/git/lld.git", branch: "release_90" 78 | end 79 | 80 | resource "openmp" do 81 | url "http://llvm.org/git/openmp.git", branch: "release_90" 82 | end 83 | 84 | resource "libcxx" do 85 | url "http://llvm.org/git/libcxx.git", branch: "release_90" 86 | end 87 | 88 | resource "libunwind" do 89 | url "http://llvm.org/git/libunwind.git", branch: "release_90" 90 | end 91 | end 92 | 93 | # http://releases.llvm.org/9.0.0/docs/GettingStarted.html#requirements 94 | depends_on "cmake" => :build 95 | depends_on xcode: :build 96 | depends_on "libffi" 97 | 98 | # version suffix 99 | def ver 100 | "9" 101 | end 102 | 103 | # http://releases.llvm.org/9.0.0/docs/CMake.html 104 | def install 105 | # Apple's libstdc++ is too old to build LLVM 106 | ENV.libcxx if ENV.compiler == :clang 107 | 108 | # compiler-rt has some iOS simulator features that require i386 symbols. I'm 109 | # assuming the rest of clang also needs support for 32-bit compilation to 110 | # work correctly, but if not, perhaps universal binaries could be limited to 111 | # compiler-rt. LLVM makes this somewhat easier because compiler-rt can 112 | # almost be treated as an entirely different build from LLVM. 113 | ENV.permit_arch_flags 114 | 115 | clang_buildpath = buildpath/"tools/clang" 116 | libcxx_buildpath = buildpath/"projects/libcxx" 117 | 118 | clang_buildpath.install resource("clang") 119 | libcxx_buildpath.install resource("libcxx") 120 | (buildpath/"tools/lld").install resource("lld") 121 | (buildpath/"tools/polly").install resource("polly") 122 | (buildpath/"tools/clang/tools/extra").install resource("clang-tools-extra") 123 | (buildpath/"projects/openmp").install resource("openmp") 124 | (buildpath/"projects/libunwind").install resource("libunwind") 125 | (buildpath/"projects/compiler-rt").install resource("compiler-rt") 126 | 127 | install_prefix = lib/"llvm-#{ver}" 128 | 129 | args = %W[ 130 | -DCMAKE_INSTALL_PREFIX=#{install_prefix} 131 | -DCMAKE_BUILD_TYPE=Release 132 | -DLLVM_ENABLE_ASSERTIONS=ON 133 | -DLLVM_OPTIMIZED_TABLEGEN=ON 134 | -DLLVM_INCLUDE_DOCS=OFF 135 | -DLLVM_ENABLE_RTTI=ON 136 | -DLLVM_ENABLE_EH=ON 137 | -DLLVM_INSTALL_UTILS=ON 138 | -DWITH_POLLY=ON 139 | -DLINK_POLLY_INTO_TOOLS=ON 140 | -DLLVM_TARGETS_TO_BUILD=all 141 | -DLIBOMP_ARCH=x86_64 142 | -DLLVM_BUILD_EXTERNAL_COMPILER_RT=ON 143 | -DLLVM_BUILD_LLVM_DYLIB=ON 144 | -DLLVM_LINK_LLVM_DYLIB=ON 145 | -DLLVM_ENABLE_LIBCXX=ON 146 | -DLLVM_ENABLE_FFI=ON 147 | -DFFI_INCLUDE_DIR=#{Formula["libffi"].opt_lib}/libffi-#{Formula["libffi"].version}/include 148 | -DFFI_LIBRARY_DIR=#{Formula["libffi"].opt_lib} 149 | -DLLVM_CREATE_XCODE_TOOLCHAIN=ON 150 | ] 151 | 152 | mkdir "build" do 153 | system "cmake", "-G", "Unix Makefiles", "..", *(std_cmake_args + args) 154 | system "make" 155 | system "make", "install" 156 | system "make", "install-xcode-toolchain" 157 | end 158 | 159 | (share/"clang-#{ver}/tools").install Dir["tools/clang/tools/scan-{build,view}"] 160 | inreplace share/"clang-#{ver}/tools/scan-build/bin/scan-build", "$RealBin/bin/clang", install_prefix/"bin/clang" 161 | (install_prefix/"bin").install_symlink share/"clang-#{ver}/tools/scan-view/bin/scan-view" 162 | (install_prefix/"bin").install_symlink share/"clang-#{ver}/tools/scan-build/bin/scan-build" 163 | (install_prefix/"share/man/man1").install_symlink share/"clang-#{ver}/tools/scan-build/scan-build.1" 164 | 165 | (lib/"python2.7/site-packages").install "bindings/python/llvm" => "llvm-#{ver}", 166 | clang_buildpath/"bindings/python/clang" => "clang-#{ver}" 167 | 168 | # replace the existing "clang -> clang-9" symlink 169 | rm install_prefix/"bin/clang" 170 | mv install_prefix/"bin/clang-9", install_prefix/"bin/clang" 171 | 172 | # These versioned .dylib symlinks are missing for some reason 173 | # Note that we use relative symlinks 174 | ln_s "libLLVM.dylib", install_prefix/"lib/libLLVM-9.dylib" 175 | 176 | # Set LC_LOAD_DYLIB entries to absolute paths 177 | system "install_name_tool", "-change", "@rpath/libLLVM.dylib", install_prefix/"lib/libLLVM.dylib", install_prefix/"lib/libLTO.dylib" 178 | system "install_name_tool", "-change", "@rpath/libLLVM.dylib", install_prefix/"lib/libLLVM.dylib", install_prefix/"lib/libclang.dylib" 179 | 180 | # Set LC_ID_DYLIB entries to absolute paths 181 | system "install_name_tool", "-id", install_prefix/"lib/libLLVM.dylib", install_prefix/"lib/libLLVM.dylib" 182 | system "install_name_tool", "-id", install_prefix/"lib/libLTO.dylib", install_prefix/"lib/libLTO.dylib" 183 | system "install_name_tool", "-id", install_prefix/"lib/libc++.1.0.dylib", install_prefix/"lib/libc++.1.0.dylib" 184 | system "install_name_tool", "-id", install_prefix/"lib/libclang.dylib", install_prefix/"lib/libclang.dylib" 185 | system "install_name_tool", "-id", install_prefix/"lib/libomp.dylib", install_prefix/"lib/libomp.dylib" 186 | system "install_name_tool", "-id", install_prefix/"lib/libunwind.1.0.dylib", install_prefix/"lib/libunwind.1.0.dylib" 187 | 188 | Dir.glob(install_prefix/"bin/*") do |exec_path| 189 | basename = File.basename(exec_path) 190 | bin.install_symlink exec_path => "#{basename}-#{ver}" 191 | end 192 | 193 | Dir.glob(install_prefix/"share/man/man1/*") do |manpage| 194 | basename = File.basename(manpage, ".1") 195 | man1.install_symlink manpage => "#{basename}-#{ver}.1" 196 | end 197 | end 198 | 199 | def caveats 200 | <<~EOS 201 | Extra tools are installed in #{opt_share}/clang-#{ver} 202 | 203 | To link to libc++, something like the following is required: 204 | CXX="clang++-#{ver} -stdlib=libc++" 205 | CXXFLAGS="$CXXFLAGS -nostdinc++ -I#{opt_lib}/llvm-#{ver}/include/c++/v1" 206 | LDFLAGS="$LDFLAGS -L#{opt_lib}/llvm-#{ver}/lib" 207 | EOS 208 | end 209 | 210 | test do 211 | assert_equal prefix.to_s, shell_output("#{bin}/llvm-config-#{ver} --prefix").chomp 212 | 213 | # test for sed errors since some llvm makefiles assume that sed 214 | # understands '\n' which is true for gnu sed and not for bsd sed. 215 | assert_no_match(/PATH\)n/, (lib/"llvm-#{ver}/share/llvm/cmake/LLVMConfig.cmake").read) 216 | system "#{bin}/llvm-config-#{ver}", "--version" 217 | end 218 | end 219 | 220 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Homebrew LLVM 2 | 3 | A tap which contains versioned (executable suffixed with version number) 4 | formulae for the [LLVM compiler](http://llvm.org). This will build LLVM and 5 | Clang in Release+Assertions mode, including the `libLLVM` shared library. 6 | 7 | It currently provides: 8 | 9 | * llvm-3.7 10 | * llvm-3.8 11 | * llvm-3.9 12 | * llvm-4.0 13 | * llvm-5.0 14 | * llvm-6.0 15 | * llvm-7 16 | * llvm-8 17 | * llvm-9 18 | * llvm-10 19 | * llvm-11 20 | * llvm-12 21 | * llvm-13 22 | 23 | 24 | ## Quickstart 25 | 26 | To use these formulae, either: 27 | 28 | ```sh 29 | $ brew tap llvm-hs/llvm 30 | $ brew install 31 | ``` 32 | 33 | or: 34 | 35 | ```sh 36 | $ brew install llvm-hs/llvm/ 37 | ``` 38 | 39 | ## Troubleshooting 40 | 41 | Generic Homebrew troubleshooting advice: 42 | 43 | 1. Run `brew update` and `brew doctor` 44 | 45 | 2. Check the [troubleshooting checklist](https://github.com/Homebrew/brew/blob/master/docs/Troubleshooting.md#troubleshooting) 46 | 47 | --------------------------------------------------------------------------------