aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula/recode.rb
blob: 5d207edde9d9853bf32bbfeb5663c64c607ad7b2 (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
require 'formula'

class Recode < Formula
  homepage 'http://recode.progiciels-bpi.ca/index.html'
  url 'https://github.com/pinard/Recode/archive/v3.7-beta2.tar.gz'
  sha1 'a10c90009ad3e1743632ada2a302c824edc08eaf'
  version '3.7-beta2'

  depends_on "gettext"
  depends_on :libtool

  def copy_libtool_files!
    if not MacOS::Xcode.provides_autotools?
      s = Formula.factory('libtool').share
      d = "#{s}/libtool/config"
      cp ["#{d}/config.guess", "#{d}/config.sub"], "."
    elsif MacOS.version <= :leopard
      cp Dir["#{MacOS::Xcode.prefix}/usr/share/libtool/config.*"], "."
    else
      cp Dir["#{MacOS::Xcode.prefix}/usr/share/libtool/config/config.*"], "."
    end
  end

  def install
    # Yep, missing symbol errors without these
    ENV.append 'LDFLAGS', '-liconv'
    ENV.append 'LDFLAGS', '-lintl'

    copy_libtool_files!

    system "./configure", "--disable-debug",
                          "--disable-dependency-tracking",
                          "--without-included-gettext",
                          "--prefix=#{prefix}",
                          "--infodir=#{info}",
                          "--mandir=#{man}"
    system "make install"
  end
end