Skip to content

Instantly share code, notes, and snippets.

@ziodave
Created November 12, 2012 16:29
Show Gist options
  • Save ziodave/4060323 to your computer and use it in GitHub Desktop.
Save ziodave/4060323 to your computer and use it in GitHub Desktop.
Freeling Formula for Brew
require 'formula'
# thanks to ambs for the seed of this formula, https://github.com/ambs
class Freeling < Formula
url 'http://devel.cpl.upc.edu/freeling/downloads/21'
version '3.0'
sha1 'd05242e398f60d9720f9bbde2743ea469b1531d1'
# head 'http://devel.cpl.upc.edu/freeling/svn/trunk', :using => :svn
homepage 'http://nlp.lsi.upc.edu/freeling/'
# url 'http://devel.cpl.upc.edu/freeling/downloads/17'
# version '3.0-beta1'
# sha1 'ca788396e8d8970ad87fe5db612c65bc74c68c75'
depends_on 'automake'
depends_on 'libtool'
depends_on 'autoconf'
# 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
depends_on 'libtool' if MacOS::Xcode.version >= "4.3"
def options
[
['--java-api', "Build the JAVA APIs."]
]
end
def install
opoo 'Requires boost with icu support.'
opoo 'If the installation fails, remove boost and do a \'brew install boost --with-icu\''
opoo 'JAVA APIs require swig 2.0.4 that you can install with the following command:'
opoo 'brew install https://raw.github.com/mxcl/homebrew/0d8d92bfcd00f42d6af777ba8bf548cbd5502638/Library/Formula/swig.rb'
automake_prefix = Formula.factory('automake').prefix
autoconf_prefix = Formula.factory('autoconf').prefix
icu4c_prefix = Formula.factory('icu4c').prefix
libtool_prefix = Formula.factory('libtool').prefix
boost_prefix = Formula.factory('boost').prefix
ENV.append 'LDFLAGS', "-L#{libtool_prefix}/lib"
ENV.append 'LDFLAGS', "-L#{icu4c_prefix}/lib"
ENV.append 'LDFLAGS', "-L/opt/local/lib"
# ENV.append 'LDFLAGS', "-L#{icu4c_prefix}/lib"
ENV.append 'CPPFLAGS', "-I#{libtool_prefix}/include"
ENV.append 'CPPFLAGS', "-I/opt/local/include"
# ENV.append 'CPPFLAGS', "-I#{boost_prefix}/include/boost"
ENV.append 'CPPFLAGS', "-I/usr/local/Cellar/boost/1.48.0/include/boost"
ENV.append 'CPPFLAGS', "-I#{icu4c_prefix}/include"
# ENV.append 'CPPFLAGS', "-I#{icu4c_prefix}/include"
system "#{automake_prefix}/bin/aclocal"
system "#{libtool_prefix}/bin/glibtoolize"
system "#{autoconf_prefix}/bin/autoconf"
system "#{automake_prefix}/bin/automake -a"
# system "env LDFLAGS='-L#{libtool_prefix}/lib -L#{icu4c_prefix}/lib -L/opt/local/lib' CPPFLAGS='-I#{libtool_prefix}/include -I/opt/local/include -I#{boost_prefix}/include -I#{icu4c_prefix}/include' ./configure --prefix=#{prefix}"
system "./configure --prefix=#{prefix}"
system "make"
system "make install"
chdir "APIs/java"
end
# def patches
# { :p0 => "https://raw.github.com/gist/3295084/b0b4ff695b5bf37a021504e9f29dba94b49ebb84/000-homebrew.diff" }
# end
def test
# echo 'Hello world' | analyze -f /usr/local/Cellar/freeling/HEAD/share/freeling/config/en.cfg | grep -c 'world world NN 1'
system "echo 'Hello world' | #{bin}/analyze -f #{share}/freeling/config/en.cfg | grep -c 'world world NN 1'"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment