2011-03-10 05:11:03 +00:00
|
|
|
class Global < Formula
|
2015-05-19 00:00:59 +00:00
|
|
|
desc "Source code tag system"
|
2014-06-10 21:11:00 +00:00
|
|
|
homepage "https://www.gnu.org/software/global/"
|
2015-09-17 07:17:28 +00:00
|
|
|
url "http://ftpmirror.gnu.org/global/global-6.5.1.tar.gz"
|
|
|
|
mirror "https://ftp.gnu.org/gnu/global/global-6.5.1.tar.gz"
|
|
|
|
sha256 "0e9d5227d400e8cb2ffa1732d98b8735d58d4bf8476c2845365770fdd5b264f8"
|
2014-01-16 10:36:49 +00:00
|
|
|
|
2014-03-31 22:11:03 +00:00
|
|
|
bottle do
|
2015-09-17 13:03:26 +00:00
|
|
|
sha256 "2c15f88285fc7eeb875e73808eac0f577335c7cf1c1727020909c48381aea623" => :el_capitan
|
|
|
|
sha256 "20b49507cf026b517f1b0a855f0cbf804ae16a20f2fe5073f2b1b957e95514ec" => :yosemite
|
|
|
|
sha256 "0b132bd00315344cf41234882274d50b2a36fe97647d05cc805571c05ddaf314" => :mavericks
|
2014-03-31 22:11:03 +00:00
|
|
|
end
|
|
|
|
|
2014-02-18 22:49:02 +00:00
|
|
|
head do
|
2014-12-22 05:43:02 +00:00
|
|
|
url ":pserver:anonymous:@cvs.savannah.gnu.org:/sources/global", :using => :cvs
|
2014-02-18 22:49:02 +00:00
|
|
|
|
2014-06-02 02:38:17 +00:00
|
|
|
depends_on "autoconf" => :build
|
|
|
|
depends_on "automake" => :build
|
|
|
|
depends_on "libtool" => :build
|
2014-01-16 10:36:49 +00:00
|
|
|
end
|
2009-09-14 16:31:54 +00:00
|
|
|
|
2014-06-10 21:11:00 +00:00
|
|
|
option "with-exuberant-ctags", "Enable Exuberant Ctags as a plug-in parser"
|
2014-09-08 02:00:29 +00:00
|
|
|
option "with-pygments", "Enable Pygments as a plug-in parser (should enable exuberent-ctags too)"
|
2015-04-04 07:09:50 +00:00
|
|
|
option "with-sqlite3", "Use SQLite3 API instead of BSD/DB API for making tag files"
|
2012-12-19 11:19:27 +00:00
|
|
|
|
2014-10-27 03:51:36 +00:00
|
|
|
depends_on "ctags" if build.with? "exuberant-ctags"
|
2012-05-31 18:45:28 +00:00
|
|
|
|
2014-10-27 03:51:36 +00:00
|
|
|
skip_clean "lib/gtags"
|
|
|
|
|
|
|
|
resource "pygments" do
|
2015-09-17 07:17:28 +00:00
|
|
|
url "https://pypi.python.org/packages/source/P/Pygments/Pygments-2.0.2.tar.gz"
|
|
|
|
sha256 "7320919084e6dac8f4540638a46447a3bd730fca172afc17d2c03eed22cf4f51"
|
2014-09-08 02:00:29 +00:00
|
|
|
end
|
|
|
|
|
2009-09-14 16:31:54 +00:00
|
|
|
def install
|
2014-01-16 10:36:49 +00:00
|
|
|
system "sh", "reconf.sh" if build.head?
|
|
|
|
|
2012-12-19 11:19:27 +00:00
|
|
|
args = %W[
|
|
|
|
--disable-dependency-tracking
|
|
|
|
--prefix=#{prefix}
|
2014-02-20 20:37:38 +00:00
|
|
|
--sysconfdir=#{etc}
|
2012-12-19 11:19:27 +00:00
|
|
|
]
|
|
|
|
|
2015-04-04 07:09:50 +00:00
|
|
|
args << "--with-sqlite3" if build.with? "sqlite3"
|
|
|
|
|
2014-06-10 21:11:00 +00:00
|
|
|
if build.with? "exuberant-ctags"
|
2014-10-27 03:51:36 +00:00
|
|
|
args << "--with-exuberant-ctags=#{Formula["ctags"].opt_bin}/ctags"
|
2012-12-19 11:19:27 +00:00
|
|
|
end
|
|
|
|
|
2014-09-08 02:00:29 +00:00
|
|
|
if build.with? "pygments"
|
2015-01-28 08:01:58 +00:00
|
|
|
ENV.prepend_create_path "PYTHONPATH", libexec+"lib/python2.7/site-packages"
|
|
|
|
pygments_args = %W[build install --prefix=#{libexec}]
|
|
|
|
resource("pygments").stage { system "python", "setup.py", *pygments_args }
|
2014-09-08 02:00:29 +00:00
|
|
|
end
|
|
|
|
|
2012-12-19 11:19:27 +00:00
|
|
|
system "./configure", *args
|
2015-01-28 08:01:58 +00:00
|
|
|
system "make", "install"
|
2010-04-07 05:58:35 +00:00
|
|
|
|
2014-09-08 02:00:29 +00:00
|
|
|
if build.with? "pygments"
|
2015-01-28 08:01:58 +00:00
|
|
|
bin.env_script_all_files(libexec/"bin", :PYTHONPATH => ENV["PYTHONPATH"])
|
2014-09-08 02:00:29 +00:00
|
|
|
end
|
|
|
|
|
2015-02-22 16:12:39 +00:00
|
|
|
inreplace "gtags.conf", prefix, opt_prefix
|
2014-06-10 21:11:00 +00:00
|
|
|
etc.install "gtags.conf"
|
2014-02-20 20:37:38 +00:00
|
|
|
|
2009-09-14 16:31:54 +00:00
|
|
|
# we copy these in already
|
2014-06-10 21:11:00 +00:00
|
|
|
cd share/"gtags" do
|
2010-04-07 05:58:35 +00:00
|
|
|
rm %w[README COPYING LICENSE INSTALL ChangeLog AUTHORS]
|
2010-02-17 14:10:26 +00:00
|
|
|
end
|
2009-09-14 16:31:54 +00:00
|
|
|
end
|
2014-09-08 02:00:29 +00:00
|
|
|
test do
|
2015-01-28 08:01:58 +00:00
|
|
|
(testpath/"test.c").write <<-EOF.undent
|
2014-09-08 02:00:29 +00:00
|
|
|
int c2func (void) { return 0; }
|
|
|
|
void cfunc (void) {int cvar = c2func(); }")
|
|
|
|
EOF
|
2015-01-28 08:01:58 +00:00
|
|
|
if build.with?("pygments") || build.with?("exuberant-ctags")
|
|
|
|
(testpath/"test.py").write <<-EOF
|
2014-09-08 02:00:29 +00:00
|
|
|
def py2func ():
|
|
|
|
return 0
|
|
|
|
def pyfunc ():
|
|
|
|
pyvar = py2func()
|
|
|
|
EOF
|
|
|
|
end
|
|
|
|
if build.with? "pygments"
|
|
|
|
assert shell_output("#{bin}/gtags --gtagsconf=#{share}/gtags/gtags.conf --gtagslabel=pygments .")
|
|
|
|
if build.with? "exuberant-ctags"
|
2015-09-17 07:17:28 +00:00
|
|
|
assert_match /test\.c/, shell_output("#{bin}/global -d cfunc")
|
|
|
|
assert_match /test\.c/, shell_output("#{bin}/global -d c2func")
|
|
|
|
assert_match /test\.c/, shell_output("#{bin}/global -r c2func")
|
|
|
|
assert_match /test\.c/, shell_output("#{bin}/global -s cvar")
|
|
|
|
assert_match /test\.py/, shell_output("#{bin}/global -d pyfunc")
|
|
|
|
assert_match /test\.py/, shell_output("#{bin}/global -r py2func")
|
|
|
|
assert_match /test\.py/, shell_output("#{bin}/global -s pyvar")
|
2014-09-08 02:00:29 +00:00
|
|
|
else
|
|
|
|
# Everything is a symbol in this case
|
2015-09-17 07:17:28 +00:00
|
|
|
assert_match /test\.c/, shell_output("#{bin}/global -s cfunc")
|
|
|
|
assert_match /test\.c/, shell_output("#{bin}/global -s c2func")
|
|
|
|
assert_match /test\.c/, shell_output("#{bin}/global -s cvar")
|
|
|
|
assert_match /test\.py/, shell_output("#{bin}/global -s pyfunc")
|
|
|
|
assert_match /test\.py/, shell_output("#{bin}/global -s py2func")
|
|
|
|
assert_match /test\.py/, shell_output("#{bin}/global -s pyvar")
|
2014-09-08 02:00:29 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
if build.with? "exuberant-ctags"
|
|
|
|
assert shell_output("#{bin}/gtags --gtagsconf=#{share}/gtags/gtags.conf --gtagslabel=exuberant-ctags .")
|
|
|
|
# ctags only yields definitions
|
2015-09-17 07:17:28 +00:00
|
|
|
assert_match /test\.c/, shell_output("#{bin}/global -d cfunc # passes")
|
|
|
|
assert_match /test\.c/, shell_output("#{bin}/global -d c2func # passes")
|
2015-09-18 06:37:30 +00:00
|
|
|
assert_no_match /test\.c/, shell_output("#{bin}/global -r c2func # correctly fails")
|
|
|
|
assert_no_match /test\.c/, shell_output("#{bin}/global -s cvar # correctly fails")
|
2015-09-17 07:17:28 +00:00
|
|
|
assert_match /test\.py/, shell_output("#{bin}/global -d pyfunc # passes")
|
|
|
|
assert_match /test\.py/, shell_output("#{bin}/global -d py2func # passes")
|
2015-09-18 06:37:30 +00:00
|
|
|
assert_no_match /test\.py/, shell_output("#{bin}/global -r py2func # correctly fails")
|
|
|
|
assert_no_match /test\.py/, shell_output("#{bin}/global -s pyvar # correctly fails")
|
2014-09-08 02:00:29 +00:00
|
|
|
end
|
2015-04-04 07:09:50 +00:00
|
|
|
if build.with? "sqlite3"
|
|
|
|
assert shell_output("#{bin}/gtags --sqlite3 --gtagsconf=#{share}/gtags/gtags.conf --gtagslabel=default .")
|
2015-09-17 07:17:28 +00:00
|
|
|
assert_match /test\.c/, shell_output("#{bin}/global -d cfunc")
|
|
|
|
assert_match /test\.c/, shell_output("#{bin}/global -d c2func")
|
|
|
|
assert_match /test\.c/, shell_output("#{bin}/global -r c2func")
|
|
|
|
assert_match /test\.c/, shell_output("#{bin}/global -s cvar")
|
2015-04-04 07:09:50 +00:00
|
|
|
end
|
2014-09-08 02:00:29 +00:00
|
|
|
# C should work with default parser for any build
|
|
|
|
assert shell_output("#{bin}/gtags --gtagsconf=#{share}/gtags/gtags.conf --gtagslabel=default .")
|
2015-09-17 07:17:28 +00:00
|
|
|
assert_match /test\.c/, shell_output("#{bin}/global -d cfunc")
|
|
|
|
assert_match /test\.c/, shell_output("#{bin}/global -d c2func")
|
|
|
|
assert_match /test\.c/, shell_output("#{bin}/global -r c2func")
|
|
|
|
assert_match /test\.c/, shell_output("#{bin}/global -s cvar")
|
2014-09-08 02:00:29 +00:00
|
|
|
end
|
2009-09-14 16:31:54 +00:00
|
|
|
end
|