homebrew-core/Formula/freeling.rb
2017-10-20 14:10:54 +01:00

97 lines
3 KiB
Ruby

class Freeling < Formula
desc "Suite of language analyzers"
homepage "http://nlp.lsi.upc.edu/freeling/"
url "https://github.com/TALP-UPC/FreeLing/releases/download/4.0/FreeLing-4.0.tar.gz"
sha256 "c79d21c5af215105ba16eb69ee75b589bf7d41abce86feaa40757513e33c6ecf"
revision 6
bottle do
sha256 "50eaf967e34770372cc6a948c6dbf03848bba0909e9dcbd2905115dbc5649b61" => :high_sierra
sha256 "3df68f616ee8f3fbaccce1590801b3d7ded18be3f156b1516203eb5d95598313" => :sierra
sha256 "547a6ba6bd77707c482c73657df14a7bce784bcf03f0b3fdfee7ab3cbcb85086" => :el_capitan
sha256 "c9e6a2cc3fe69b02c2db31c942ec41cbd5a85b69688cd7f5b4a69cccc18508f8" => :yosemite
end
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "libtool" => :build
depends_on "icu4c"
conflicts_with "hunspell", :because => "both install 'analyze' binary"
resource "boost" do
url "https://dl.bintray.com/boostorg/release/1.64.0/source/boost_1_64_0.tar.bz2"
sha256 "7bcc5caace97baa948931d712ea5f37038dbb1c5d89b43ad4def4ed7cb683332"
end
def install
resource("boost").stage do
# Force boost to compile with the desired compiler
open("user-config.jam", "a") do |file|
file.write "using darwin : : #{ENV.cxx} ;\n"
end
bootstrap_args = %W[
--without-icu
--prefix=#{libexec}/boost
--libdir=#{libexec}/boost/lib
--with-icu=#{Formula["icu4c"].opt_prefix}
--with-libraries=program_options,regex,system,thread
]
args = %W[
--prefix=#{libexec}/boost
--libdir=#{libexec}/boost/lib
-d2
-j#{ENV.make_jobs}
--ignore-site-config
--layout=tagged
--user-config=user-config.jam
install
threading=multi
link=shared
optimization=space
variant=release
cxxflags=-std=c++11
]
if ENV.compiler == :clang
args << "cxxflags=-stdlib=libc++" << "linkflags=-stdlib=libc++"
end
system "./bootstrap.sh", *bootstrap_args
system "./b2", "headers"
system "./b2", *args
end
(libexec/"boost/lib").each_child do |dylib|
MachO::Tools.change_dylib_id(dylib.to_s, dylib.to_s)
end
icu4c = Formula["icu4c"]
libtool = Formula["libtool"]
ENV.append "LDFLAGS", "-L#{libtool.lib}"
ENV.append "LDFLAGS", "-L#{icu4c.lib}"
ENV.append "LDFLAGS", "-L#{libexec}/boost/lib"
ENV.append "CPPFLAGS", "-I#{libtool.include}"
ENV.append "CPPFLAGS", "-I#{icu4c.include}"
ENV.append "CPPFLAGS", "-I#{libexec}/boost/include"
system "autoreconf", "--install"
system "./configure", "--prefix=#{prefix}", "--enable-boost-locale"
system "make", "install"
libexec.install "#{bin}/fl_initialize"
inreplace "#{bin}/analyze",
". $(cd $(dirname $0) && echo $PWD)/fl_initialize",
". #{libexec}/fl_initialize"
end
test do
expected = <<~EOS
Hello hello NN 1
world world NN 1
EOS
assert_equal expected, pipe_output("#{bin}/analyze -f #{pkgshare}/config/en.cfg", "Hello world").chomp
end
end