Skip to content

Instantly share code, notes, and snippets.

@zeekay
Last active December 10, 2015 19:29
Show Gist options
  • Save zeekay/4481788 to your computer and use it in GitHub Desktop.
Save zeekay/4481788 to your computer and use it in GitHub Desktop.
require 'formula'
class ClangCustom < Formula
homepage 'http://llvm.org/'
url 'http://llvm.org/releases/3.2/clang-3.2.src.tar.gz'
sha1 'b0515298c4088aa294edc08806bd671f8819f870'
head 'http://llvm.org/git/clang.git'
end
class LlvmCustom < Formula
homepage 'http://llvm.org/'
url 'http://llvm.org/releases/3.2/llvm-3.2.src.tar.gz'
sha1 '42d139ab4c9f0c539c60f5ac07486e9d30fc1280'
head 'http://llvm.org/git/llvm.git'
bottle do
sha1 '9fddf0bfed060ade86c88b64c40cc4bd5f1f0f2c' => :mountainlion
sha1 '8d3f3d5090d3bd2cf0c953da105efc63080e948f' => :lion
sha1 '3ba0beee27d60e80e9790cca9d5e21b2b8169ffe' => :snowleopard
end
option :universal
def install
ClangCustom.new("clang").brew { clang_dir.install Dir['*'] }
# check out cling
system "svn co https://root.cern.ch/svn/root/trunk/interpreter/cling tools/cling"
# apply patch to build system
system "cat tools/cling/patches/*.diff | patch -p0"
args = [
"--prefix=#{prefix}",
"--enable-optimized",
# As of LLVM 3.1, attempting to build ocaml bindings with Homebrew's
# OCaml 3.12.1 results in errors.
"--disable-bindings",
]
args << "--enable-targets=host"
args << "--enable-shared"
system "./configure", *args
system "make install"
# install llvm python bindings
(share/'llvm/bindings').install buildpath/'bindings/python'
# install clang tools and bindings
cd clang_dir do
system 'make install'
(share/'clang/tools').install 'tools/scan-build', 'tools/scan-view'
(share/'clang/bindings').install 'bindings/python'
end
end
def test
system "#{bin}/llvm-config", "--version"
end
def caveats; <<-EOS.undent
Extra tools and bindings are installed in #{share}/llvm and #{share}/clang.
If you already have LLVM installed, then "brew upgrade llvm" might not work.
Instead, try:
brew rm llvm && brew install llvm
EOS
end
def clang_dir
buildpath/'tools/clang'
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment