2009-10-15 08:07:12 +00:00
|
|
|
require 'formula'
|
2009-08-31 00:49:55 +00:00
|
|
|
|
2010-08-10 20:05:20 +00:00
|
|
|
def use_default_names?
|
|
|
|
ARGV.include? '--default-names'
|
|
|
|
end
|
|
|
|
|
2010-07-02 02:03:04 +00:00
|
|
|
def coreutils_aliases
|
2010-07-22 20:42:00 +00:00
|
|
|
s = "brew_prefix=`brew --prefix`\n"
|
|
|
|
|
|
|
|
%w{
|
|
|
|
base64 basename cat chcon chgrp chmod chown chroot cksum comm cp csplit
|
|
|
|
cut date dd df dir dircolors dirname du echo env expand expr factor false
|
|
|
|
fmt fold gropus head hostid id install join kill link ln logname ls md5sum
|
|
|
|
mkdir mkfifo mknod mktemp mv nice nl nohup od paste pathchk pinky pr
|
|
|
|
printenv printf ptx pwd readlink rm rmdir runcon seq sha1sum sha225sum
|
|
|
|
sha256sum sha384sum sha512sum shred shuf sleep sort split stat stty sum
|
|
|
|
sync tac tail tee test touch tr true tsort tty uname unexpand uniq unlink
|
|
|
|
uptime users vdir wc who whoami yes
|
|
|
|
}.each do |g|
|
|
|
|
s += "alias #{g}=\"$brew_prefix/bin/g#{g}\"\n"
|
|
|
|
end
|
|
|
|
|
2010-12-20 16:41:10 +00:00
|
|
|
s += "alias '['=\"$brew_prefix/bin/g\\[\"\n"
|
2010-07-22 20:42:00 +00:00
|
|
|
|
|
|
|
return s
|
2010-07-02 02:03:04 +00:00
|
|
|
end
|
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'
|
2011-04-14 22:31:57 +00:00
|
|
|
url 'ftp://ftp.gnu.org/gnu/coreutils/coreutils-8.11.tar.gz'
|
|
|
|
sha256 '39a126bdd54ba8af15a1fc4004a78fc7910c0650b435d903df7556b0028450b2'
|
2009-08-31 00:49:55 +00:00
|
|
|
|
2010-07-22 20:42:00 +00:00
|
|
|
def options
|
2010-10-17 22:44:59 +00:00
|
|
|
[['--default-names', "Do NOT prepend 'g' to the binary; will override system utils."]]
|
2010-07-22 20:42:00 +00:00
|
|
|
end
|
|
|
|
|
2009-08-31 00:49:55 +00:00
|
|
|
def install
|
2010-10-17 22:44:59 +00:00
|
|
|
args = ["--prefix=#{prefix}"]
|
2010-08-10 20:05:20 +00:00
|
|
|
args << "--program-prefix=g" unless use_default_names?
|
2010-01-14 18:21:27 +00:00
|
|
|
|
|
|
|
system "./configure", *args
|
2009-08-31 00:49:55 +00:00
|
|
|
system "make install"
|
2010-10-17 22:44:59 +00:00
|
|
|
|
|
|
|
(prefix+'aliases').write(coreutils_aliases)
|
2009-08-31 00:49:55 +00:00
|
|
|
end
|
|
|
|
|
2010-01-14 18:21:27 +00:00
|
|
|
def caveats
|
2010-08-10 20:05:20 +00:00
|
|
|
unless use_default_names?; <<-EOS
|
2010-10-20 15:50:10 +00:00
|
|
|
All commands have been installed with the prefix 'g'.
|
2009-08-31 00:49:55 +00:00
|
|
|
|
2010-10-20 15:50:10 +00:00
|
|
|
A file that aliases these commands to their normal names is available
|
|
|
|
and may be used in your bashrc like:
|
2010-01-14 18:21:27 +00:00
|
|
|
|
2010-10-20 15:50:10 +00:00
|
|
|
source #{prefix}/aliases
|
|
|
|
|
|
|
|
But note that sourcing these aliases will cause them to be used instead
|
|
|
|
of Bash built-in commands, which may cause problems in shell scripts.
|
|
|
|
The Bash "printf" built-in behaves differently than gprintf, for instance,
|
|
|
|
which is known to cause problems with "bash-completion".
|
|
|
|
|
|
|
|
The man pages are still referenced with the g-prefix.
|
2009-08-31 00:49:55 +00:00
|
|
|
EOS
|
2010-01-14 18:21:27 +00:00
|
|
|
end
|
2009-08-31 00:49:55 +00:00
|
|
|
end
|
2009-09-23 11:43:52 +00:00
|
|
|
end
|