diff options
| author | Martin Probst | 2015-01-09 17:44:29 +0100 |
|---|---|---|
| committer | Mike McQuaid | 2015-01-13 10:51:08 +0000 |
| commit | 08e363cd65a20f27cc2980a9f75c2db1f7c11723 (patch) | |
| tree | d34bfcc29de2ba8f7993d085d889f4ce80e4a707 /Library/Formula | |
| parent | bc27b1837c9fdd6b8ab7a696cf2cdd62ff1c2a9d (diff) | |
| download | homebrew-08e363cd65a20f27cc2980a9f75c2db1f7c11723.tar.bz2 | |
clang-format 2014-12-03 (new formula)
clang-format is a versatile source code formatter, part of the clang
(and thus llvm) project. It can be used for C++, ObjC, Java, and
JavaScript.
The build is using cmake and ninja for speed; building all of llvm or
using configure and make is very slow.
clang-format is released in roughly monthly testing pushes, tracked by
the subversion tags in "google/testing/yyyy-MM-dd". This formula uses
tarballs from github that correspond to the resolved tags.
Closes #35777.
Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
Diffstat (limited to 'Library/Formula')
| -rw-r--r-- | Library/Formula/clang-format.rb | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/Library/Formula/clang-format.rb b/Library/Formula/clang-format.rb new file mode 100644 index 000000000..602e82807 --- /dev/null +++ b/Library/Formula/clang-format.rb @@ -0,0 +1,47 @@ +class ClangFormat < Formula + homepage "http://clang.llvm.org/docs/ClangFormat.html" + version "2014-12-03" + + stable do + url "http://llvm.org/svn/llvm-project/llvm/tags/google/testing/2014-12-03/", :using => :svn + + resource "clang" do + url "http://llvm.org/svn/llvm-project/cfe/tags/google/testing/2014-12-03/", :using => :svn + end + + resource "libcxx" do + url "http://llvm.org/releases/3.5.0/libcxx-3.5.0.src.tar.xz" + sha1 "c98beed86ae1adf9ab7132aeae8fd3b0893ea995" + end + end + + depends_on "cmake" => :build + depends_on "ninja" => :build + depends_on "subversion" => :build + + fails_with :clang do + build 503 + cause "Host Clang must be able to find libstdc++4.7 or newer!" + end + + def install + (buildpath/"projects/libcxx").install resource("libcxx") + (buildpath/"tools/clang").install resource("clang") + + mkdir "build" do + system "cmake", "..", "-G", "Ninja", *std_cmake_args + system "ninja", "clang-format" + bin.install "bin/clang-format" + end + end + + test do + # NB: below C code is messily formatted on purpose. + (testpath/"test.c").write <<-EOS + int main(char *args) { \n \t printf("hello"); } + EOS + + assert_equal "int main(char *args) { printf(\"hello\"); }\n", + shell_output("#{bin}/clang-format -style=Google test.c") + end +end |
