class Folly < FPM::Cookery::Recipe
  description "Folly is an open-source C++ library developed and used at Facebook"
  name "folly"
  version "0.57.0"
  source "https://github.com/facebook/folly", :with => :git, :branch => "master"
  homepage "https://code.facebook.com/projects/527543867323997/folly/"
  license "apache2"

  build_depends "gcc", "gcc-c++", "autoconf", "autoconf-archive", "automake", "boost-devel",
    "libtool", "lz4-devel", "lzma-devel", "snappy-devel", "zlib-devel", "glog-devel",
    "gflags-devel", "scons", "double-conversion-devel", "gettext-devel", "openssl-devel",
    "libevent-devel"

  post_install 'reload-ldconfig'
  post_uninstall 'reload-ldconfig'

  def build
    Dir.chdir 'folly' do
      safesystem "autoreconf -iv"
      configure :prefix => prefix
      make
    end
  end

  def install
    Dir.chdir 'folly' do
      make :install, 'DESTDIR' => destdir
    end
    doc(name).install %w(LICENSE README.md)
  end
end
