aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula/pig.rb
blob: 9bf8396ac8ea7a55fe55bde9db763b12d63fce08 (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
require 'formula'

class Pig < Formula
  homepage 'http://pig.apache.org/'
  url 'http://www.apache.org/dyn/closer.cgi?path=pig/pig-0.10.0/pig-0.10.0.tar.gz'
  md5 'b9a723f91cec9934317e50223de7e87a'

  def patches
    DATA
  end

  def install
    bin.install 'bin/pig'
    prefix.install ["pig-#{version}.jar", "pig-#{version}-withouthadoop.jar"]
  end

  def caveats; <<-EOS.undent
    You may need to set JAVA_HOME:
      export JAVA_HOME="$(/usr/libexec/java_home)"
    EOS
  end
end

# There's something weird with Pig's launch script, it doesn't find the correct
# path. This patch finds PIG_HOME from the pig binary path's symlink.
__END__
diff -u a/bin/pig b/bin/pig
--- a/bin/pig 2011-09-30 08:55:58.000000000 +1000
+++ b/bin/pig 2011-11-28 11:18:36.000000000 +1100
@@ -55,11 +55,8 @@

 # resolve links - $0 may be a softlink
 this="${BASH_SOURCE-$0}"
-
-# convert relative path to absolute path
-bin=$(cd -P -- "$(dirname -- "$this")">/dev/null && pwd -P)
-script="$(basename -- "$this")"
-this="$bin/$script"
+here=$(dirname $this)
+this="$here"/$(readlink $this)

 # the root of the Pig installation
 export PIG_HOME=`dirname "$this"`/..