aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula/rubinius.rb
blob: 28d5f9065dba883625a63eb5177b8906f5c639b8 (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
71
72
73
74
75
76
77
78
79
80
require 'formula'

class Rubinius < Formula
  homepage 'http://rubini.us/'
  url 'http://releases.rubini.us/rubinius-2.0.0.tar.bz2'
  sha1 'b2b6c0c95eddcadd5b8db058a26c6975f1af26a4'
  head 'https://github.com/rubinius/rubinius.git'

  # Yes, rubinius actually needs a pre-existing ruby 2.0 install to build
  depends_on 'ruby' => :build

  env :std

  # Configure options like --libdir are broken; submitted upstream:
  # https://github.com/rubinius/rubinius/pull/2658
  def patches; DATA; end

  def install
    # Let Rubinius define its own flags; messing with these causes build breaks.
    ENV.remove_cc_etc

    # Unset RUBYLIB to configure Rubinius
    ENV.delete("RUBYLIB")

    # Set to stop Rubinius messing with our prefix.
    ENV["RELEASE"] = "1"

    system "bundle"
    system "./configure",
           "--skip-system", # download and use the prebuilt LLVM
           "--bindir", bin,
           "--prefix", prefix,
           "--includedir", "#{include}/rubinius",
           "--libdir", lib,
           "--mandir", man, # For completeness; no manpages exist yet.
           "--gemsdir", "#{lib}/rubinius/gems"

    ohai "config.rb", File.open('config.rb').to_a if ARGV.debug? or ARGV.verbose?

    system "rake", "install"

    # Remove conflicting command aliases
    bin.children.select(&:symlink?).each(&:unlink)
    # This conclicts with the Ruby command of the same name
    (bin/'testrb').unlink
  end

  test do
    assert_equal 'rbx', `"#{bin}/rbx" -e "puts RUBY_ENGINE"`.chomp
  end
end

__END__
diff --git a/configure b/configure
index 3e1a715..03c2ea7 100755
--- a/configure
+++ b/configure
@@ -384,7 +384,7 @@ class Configure
 
     o.on "-P", "--prefix", "PATH", "Install Rubinius in subdirectories of PATH" do |dir|
       warn_prefix dir
-      @prefixdir = dir
+      @prefixdir = dir.dup
     end
 
     o.on "-B", "--bindir", "PATH", "Install Rubinius executable in PATH" do |dir|
@@ -396,11 +396,11 @@ class Configure
     end
 
     o.on "-A", "--appdir", "PATH", "Install Ruby runtime and libraries in PATH" do |dir|
-      @appdir = dir
+      @appdir = dir.dup
     end
 
     o.on "-L", "--libdir", "PATH", "Install Rubinius shared library in PATH" do |dir|
-      @libdir = dir
+      @libdir = dir.dup
     end
 
     o.on "-M", "--mandir", "PATH", "Install man pages in PATH" do |dir|