aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula/hexchat.rb
blob: 1ad692871b6dfddf72c7018d103b4b4b280d9ffa (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
45
46
47
48
49
50
51
52
53
require 'formula'

class Hexchat < Formula
  homepage 'http://hexchat.github.io/'
  url 'https://github.com/hexchat/hexchat/archive/v2.9.6.tar.gz'
  sha1 'f19248e8d255cf463d5c0eba3e3df02a431f3911'
  head 'https://github.com/hexchat/hexchat.git'

  depends_on :macos => :lion

  depends_on 'pkg-config' => :build
  depends_on 'automake' => :build
  depends_on 'autoconf' => :build
  depends_on 'libtool' => :build
  depends_on :python => :recommended
  depends_on 'gettext'
  depends_on 'gtk+'
  depends_on :x11

  option 'without-perl', 'Build without Perl support'
  option 'without-plugins', 'Build without plugin support'

  def install
    args = %W[--prefix=#{prefix}
              --disable-dependency-tracking
              --enable-openssl
              --disable-xlib]

    # Fails on 32-bit core solo without this
    args << "--disable-mmx" unless MacOS.prefer_64_bit?

    args << "--disable-python" unless build.with? "python"
    args << "--disable-perl" if build.include? "without-perl"
    args << "--disable-plugin" if build.include? "without-plugins"

    # Build fails because of a conflict with the system 'strptime',
    # so rename the function
    inreplace "src/fe-gtk/banlist.c" do |s|
      s.gsub! "strptime", "_strptime"
    end

    # The locations of the gettext dependencies are hardcoded, so copy them
    gettext = Formula.factory('gettext').opt_prefix/'share/gettext'
    cp_r ["#{gettext}/intl", "#{gettext}/po"], "."

    system "autoreconf -vi"
    system "./configure", *args
    system "make"
    system "make install"

    rm_rf share/"applications"
  end
end