2009-10-15 08:07:12 +00:00
|
|
|
require 'formula'
|
2009-08-31 00:49:55 +00:00
|
|
|
|
2011-03-10 05:11:03 +00:00
|
|
|
class Coreutils < Formula
|
2010-07-02 02:03:04 +00:00
|
|
|
homepage 'http://www.gnu.org/software/coreutils'
|
2012-03-30 14:30:22 +00:00
|
|
|
url 'http://ftpmirror.gnu.org/coreutils/coreutils-8.16.tar.xz'
|
|
|
|
mirror 'http://ftp.gnu.org/gnu/coreutils/coreutils-8.16.tar.xz'
|
|
|
|
sha256 '2a458fead15d9336f46bb4304cc3eaa6ed9407b9130e7ee2ec533909881d2067'
|
2009-08-31 00:49:55 +00:00
|
|
|
|
2012-02-18 00:56:36 +00:00
|
|
|
depends_on 'xz' => :build
|
|
|
|
|
2009-08-31 00:49:55 +00:00
|
|
|
def install
|
2012-01-24 21:22:13 +00:00
|
|
|
system "./configure", "--prefix=#{prefix}", "--program-prefix=g"
|
2009-08-31 00:49:55 +00:00
|
|
|
system "make install"
|
2010-10-17 22:44:59 +00:00
|
|
|
|
2012-04-01 16:35:23 +00:00
|
|
|
# set installed binaries
|
|
|
|
commands = coreutils_bins
|
|
|
|
|
2012-01-27 19:38:16 +00:00
|
|
|
# create a gnubin dir that has all the commands without program-prefix
|
2012-02-22 04:48:36 +00:00
|
|
|
(libexec+'gnubin').mkpath
|
2012-04-01 16:35:23 +00:00
|
|
|
commands.each do |cmd|
|
|
|
|
ln_sf "../../bin/g#{cmd}", libexec+"gnubin/#{cmd}"
|
2012-01-27 19:38:16 +00:00
|
|
|
end
|
2009-08-31 00:49:55 +00:00
|
|
|
end
|
|
|
|
|
2012-01-27 19:38:16 +00:00
|
|
|
def caveats; <<-EOS.undent
|
|
|
|
All commands have been installed with the prefix 'g'.
|
2010-10-20 15:50:10 +00:00
|
|
|
|
2012-01-27 19:38:16 +00:00
|
|
|
If you really need to use these commands with their normal names, you
|
|
|
|
can add a "gnubin" directory to your PATH from your bashrc like:
|
2010-10-20 15:50:10 +00:00
|
|
|
|
2012-01-27 19:38:16 +00:00
|
|
|
PATH="$(brew --prefix coreutils)/libexec/gnubin:$PATH"
|
2009-08-31 00:49:55 +00:00
|
|
|
EOS
|
|
|
|
end
|
2012-04-01 16:35:23 +00:00
|
|
|
|
|
|
|
def coreutils_bins
|
|
|
|
require 'find'
|
|
|
|
bin_path = prefix+'bin'
|
|
|
|
commands = Array.new
|
|
|
|
Find.find(bin_path) do |path|
|
|
|
|
next if path == bin_path or File.basename(path) == '.DS_Store'
|
|
|
|
commands << File.basename(path).sub(/^g/,'')
|
|
|
|
end
|
|
|
|
return commands.sort
|
|
|
|
end
|
2009-09-23 11:43:52 +00:00
|
|
|
end
|