This repository has been archived by the owner on Mar 25, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 19
/
universal-ctags.rb
56 lines (50 loc) · 1.63 KB
/
universal-ctags.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
class UniversalCtags < Formula
desc "Maintained ctags implementation"
homepage "https://github.com/universal-ctags/ctags"
head "https://github.com/universal-ctags/ctags.git"
option "without-xml", "Compile without libxml2"
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "pkg-config" => :build
depends_on "docutils" => :recommended
depends_on "jansson" => :optional
depends_on "libyaml" => :optional
conflicts_with "ctags", :because => "this formula installs the same executable as the ctags formula"
def install
opts = []
opts << "--disable-xml" if build.without? "xml"
system "./autogen.sh"
system "./configure", "--prefix=#{prefix}", *opts
system "make"
system "make", "install"
end
def caveats
<<~EOS
Under some circumstances, emacs and ctags can conflict. By default,
emacs provides an executable `ctags` that would conflict with the
executable of the same name that ctags provides. To prevent this,
Homebrew removes the emacs `ctags` and its manpage before linking.
However, if you install emacs with the `--keep-ctags` option, then
the `ctags` emacs provides will not be removed. In that case, you
won't be able to install ctags successfully. It will build but not
link.
EOS
end
test do
(testpath/"test.c").write <<~EOS
#include <stdio.h>
#include <stdlib.h>
void func()
{
printf("Hello World!");
}
int main()
{
func();
return 0;
}
EOS
system "#{bin}/ctags", "-R", "."
assert_match /func.*test\.c/, File.read("tags")
end
end