aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula/nu.rb
blob: 2ca6e571e105cc38271d231ac82d398f6b70e524 (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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
class Nu < Formula
  homepage 'http://programming.nu'
  url 'https://github.com/timburks/nu/archive/v2.1.1.tar.gz'
  sha1 'ca0f9bbd5bbdb8528be516325f274d07d4be54bf'

  bottle do
    cellar :any
    sha1 "b5abfa521c0983c057820e51e6edad1d2e26c79e" => :yosemite
    sha1 "6f3cc8067845537ef5da9c7b702bba21c61dd86d" => :mavericks
    sha1 "4d21aa4cbc078e3d6d052f65ec9eef3b43f34e64" => :mountain_lion
  end

  depends_on :macos => :lion
  depends_on 'pcre'

  fails_with :llvm do
    build 2336
    cause 'nu only builds with clang'
  end

  fails_with :gcc do
    build 5666
    cause 'nu only builds with clang'
  end

  # remove deprecated -fobjc-gc
  # https://github.com/timburks/nu/pull/74
  # https://github.com/Homebrew/homebrew/issues/37341
  patch do
    url "https://github.com/timburks/nu/commit/c0b05f1.diff"
    sha256 "f6c1a66e470e7132ba11937c971f9b90824bb03eaa030b3e70004f9d2725c636"
  end

  def install
    ENV['PREFIX'] = prefix

    inreplace "Nukefile" do |s|
      s.gsub!('(SH "sudo ', '(SH "') # don't use sudo to install
      s.gsub!('#{@destdir}/Library/Frameworks', '#{@prefix}/Frameworks')
      s.sub! /^;; source files$/, <<-EOS
;; source files
(set @framework_install_path "#{frameworks}")
EOS
    end
    system "make"
    system "./mininush", "tools/nuke"
    bin.mkdir
    lib.mkdir
    include.mkdir
    system "./mininush", "tools/nuke", "install"
  end

  def caveats
    if self.installed? and File.exist? frameworks+"Nu.framework"
      return <<-EOS.undent
        Nu.framework was installed to:
          #{frameworks}/Nu.framework

        You may want to symlink this Framework to a standard OS X location,
        such as:
          ln -s "#{frameworks}/Nu.framework" /Library/Frameworks
      EOS
    end
    return nil
  end

  test do
    system bin/"nush", "-e", '(puts "Everything old is Nu again.")'
  end
end