aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula/freeling.rb
blob: 83301bbaa64c01ae8611e2812f9e90ccffc65370 (plain)
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
require 'formula'

class Freeling < Formula
  homepage 'http://nlp.lsi.upc.edu/freeling/'
  url 'http://devel.cpl.upc.edu/freeling/downloads/21'
  version '3.0'
  sha1 'd05242e398f60d9720f9bbde2743ea469b1531d1'

  depends_on 'icu4c'
  # requires boost --with-icu.
  # At the moment I think that we can not force build options
  depends_on 'boost'
  depends_on 'libtool' => :build

  def install
    opoo 'Requires boost with icu support.'
    opoo 'If the installation fails, remove boost and do a \'brew install boost --with-icu\''

    icu4c_prefix = Formula.factory('icu4c').prefix
    libtool_prefix = Formula.factory('libtool').prefix
    ENV.append 'LDFLAGS', "-L#{libtool_prefix}/lib"
    ENV.append 'LDFLAGS', "-L#{icu4c_prefix}/lib"
    ENV.append 'CPPFLAGS', "-I#{libtool_prefix}/include"
    ENV.append 'CPPFLAGS', "-I#{icu4c_prefix}/include"

    system "./configure", "--prefix=#{prefix}"

    system "make install"
  end

  def test
    system "echo 'Hello world' | #{bin}/analyze -f #{share}/freeling/config/en.cfg | grep -c 'world world NN 1'"
  end

  def caveats; <<-EOS.undent
    This fomula requires that boost formula gets built with '--with-icu'
    option. If not, link will fail.

    If in doubt, try uninstalling boost (brew uninstall boost) and
    installint with ICU support (brew install --with-icu boost). For
    that you will also need icu4c installed (brew install icu4c).
    EOS
  end
end