clang-format@8 8.0.1 (new formula)

master
František Bořánek 2020-08-17 10:44:49 +02:00 committed by Mike McQuaid
parent 7e8631862d
commit 3f39917c6e
2 changed files with 51 additions and 0 deletions

1
Aliases/clang-format@10 Symbolic link
View File

@ -0,0 +1 @@
../Formula/clang-format.rb

50
Formula/clang-format@8.rb Normal file
View File

@ -0,0 +1,50 @@
class ClangFormatAT8 < Formula
desc "Formatting tools for C, C++, Obj-C, Java, JavaScript, TypeScript"
homepage "https://clang.llvm.org/docs/ClangFormat.html"
url "https://github.com/llvm/llvm-project/releases/download/llvmorg-8.0.1/llvm-8.0.1.src.tar.xz"
sha256 "44787a6d02f7140f145e2250d56c9f849334e11f9ae379827510ed72f12b75e7"
license "Apache-2.0"
depends_on "cmake" => :build
depends_on "ninja" => :build
uses_from_macos "libxml2"
uses_from_macos "ncurses"
uses_from_macos "zlib"
resource "clang" do
url "https://github.com/llvm/llvm-project/releases/download/llvmorg-8.0.1/cfe-8.0.1.src.tar.xz"
sha256 "70effd69f7a8ab249f66b0a68aba8b08af52aa2ab710dfb8a0fba102685b1646"
end
resource "libcxx" do
url "https://github.com/llvm/llvm-project/releases/download/llvmorg-8.0.1/libcxx-8.0.1.src.tar.xz"
sha256 "7f0652c86a0307a250b5741ab6e82bb10766fb6f2b5a5602a63f30337e629b78"
end
def install
(buildpath/"projects/libcxx").install resource("libcxx")
(buildpath/"tools/clang").install resource("clang")
mkdir buildpath/"build" do
args = std_cmake_args
args << "-DLLVM_ENABLE_LIBCXX=ON"
args << ".."
system "cmake", "-G", "Ninja", *args
system "ninja", "clang-format"
end
bin.install buildpath/"build/bin/clang-format" => "clang-format-8"
bin.install buildpath/"tools/clang/tools/clang-format/git-clang-format" => "git-clang-format-8"
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-8 -style=Google test.c")
end
end