diff options
| -rw-r--r-- | Library/Formula/coreutils.rb | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/Library/Formula/coreutils.rb b/Library/Formula/coreutils.rb index a02cc800d..cf62367b5 100644 --- a/Library/Formula/coreutils.rb +++ b/Library/Formula/coreutils.rb @@ -1,16 +1,5 @@ require 'formula' -$commands = %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 groups 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 sha224sum - 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 - } - class Coreutils < Formula homepage 'http://www.gnu.org/software/coreutils' url 'http://ftpmirror.gnu.org/coreutils/coreutils-8.16.tar.xz' @@ -23,10 +12,13 @@ class Coreutils < Formula system "./configure", "--prefix=#{prefix}", "--program-prefix=g" system "make install" + # set installed binaries + commands = coreutils_bins + # create a gnubin dir that has all the commands without program-prefix (libexec+'gnubin').mkpath - $commands.each do |g| - ln_sf "../../bin/g#{g}", libexec+"gnubin/#{g}" + commands.each do |cmd| + ln_sf "../../bin/g#{cmd}", libexec+"gnubin/#{cmd}" end end @@ -39,4 +31,15 @@ class Coreutils < Formula PATH="$(brew --prefix coreutils)/libexec/gnubin:$PATH" EOS end + + 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 end |
