diff options
| author | Tsukasa OMOTO | 2012-04-02 01:35:23 +0900 | 
|---|---|---|
| committer | Adam Vandenberg | 2012-04-01 23:01:01 -0700 | 
| commit | 54a128ae5d4b7c73b9b6a517c6e15af91d50ae73 (patch) | |
| tree | 63543db4ac86e3f8a7f74709c99919d931a76605 /Library/Formula/coreutils.rb | |
| parent | a1f12a06aaea8384bc6e6090a45856584099c6a1 (diff) | |
| download | homebrew-54a128ae5d4b7c73b9b6a517c6e15af91d50ae73.tar.bz2 | |
coreutils: symlink all binaries
Instead of maintaining a list of binaries, just symlink
everything found in bin.
Signed-off-by: Adam Vandenberg <flangy@gmail.com>
Diffstat (limited to 'Library/Formula/coreutils.rb')
| -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 | 
