-
-
Save gitkaste/675200 to your computer and use it in GitHub Desktop.
fixing an aclocal issue
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/ruby | |
| # | |
| # I deliberately didn't DRY /usr/local references into a variable as this | |
| # script will not "just work" if you change the destination directory. However | |
| # please feel free to fork it and make that possible. | |
| # | |
| # If you do fork, please ensure you add a comment here that explains what the | |
| # changes are intended to do and how well you tested them. | |
| # | |
| module Tty extend self | |
| def blue; bold 34; end | |
| def white; bold 39; end | |
| def red; underline 31; end | |
| def reset; escape 0; end | |
| def underline; underline 39; end | |
| def bold n; escape "1;#{n}" end | |
| def underline n; escape "4;#{n}" end | |
| def escape n; "\033[#{n}m" if STDOUT.tty? end | |
| end | |
| def ohai s | |
| puts "#{Tty.blue}==>#{Tty.white} #{s}#{Tty.reset}" | |
| end | |
| def sudo *params | |
| if params.length == 1 | |
| cmd = "sudo #{params.first}" | |
| ohai cmd | |
| system cmd | |
| else | |
| ohai "sudo" + params.map{ |p| p.gsub ' ', '\\ ' } * ' ' | |
| system "sudo", *params | |
| end | |
| end | |
| def opoo warning | |
| puts "#{Tty.red}Warning#{Tty.reset}: #{warning}" | |
| end | |
| def getc # NOTE only tested on OS X | |
| system "stty raw -echo" | |
| STDIN.getc | |
| ensure | |
| system "stty -raw echo" | |
| end | |
| ####################################################################### script | |
| abort "/usr/local/.git already exists!" if File.directory? "/usr/local/.git" | |
| ohai "This script will install:" | |
| puts "/usr/local/bin/brew" | |
| puts "/usr/local/Library/Formula/..." | |
| puts "/usr/local/Library/Homebrew/..." | |
| chmods = %w(bin etc include lib sbin share var . share/locale share/man share/info share/doc share/aclocal). | |
| map{ |d| "/usr/local/#{d}" }. | |
| select{ |d| File.directory? d and not File.writable? d } | |
| unless chmods.empty? | |
| ohai "The following directories will be made group writable:" | |
| puts *chmods | |
| end | |
| puts | |
| puts "Press enter to continue" | |
| abort unless getc == 13 | |
| if File.directory? "/usr/local" | |
| sudo "/bin/chmod", "g+w", *chmods unless chmods.empty? | |
| else | |
| sudo "/bin/mkdir /usr/local" | |
| sudo "/bin/chmod g+w /usr/local" | |
| end | |
| Dir.chdir "/usr/local" do | |
| tarball = "http://github.com/mxcl/homebrew/tarball/master" | |
| ohai "Extracting: #{tarball}" | |
| # -m to stop tar erroring out if it can't modify the mtime for root owned directories | |
| system "/usr/bin/curl -#L #{tarball} | /usr/bin/tar xz -m --strip 1" | |
| end | |
| ohai "Installation successful!" | |
| if ENV['PATH'].split(':').include? '/usr/local/bin' | |
| puts "Yay! Now learn to brew:" | |
| puts | |
| puts " brew help" | |
| puts | |
| else | |
| opoo "/usr/local/bin is not in your PATH" | |
| end |
Author
Author
This document (https://github.com/mxcl/homebrew/wiki/installation) will need to be changed in the sections installing anywhere else, uninstalling and alternate installation style.
I don't understand.
Author
aclocal only looks into the directory $(PREFIX)/share/aclocal which for the system aclocal means /usr/share/aclocal. Every package we install that has m4 files copies them to /usr/local/share/aclocal. That means we either need to copy/symlink them to the other dir or do it the right way and make our dir known by putting the line /usr/local/share/aclocal into a file /usr/share/aclocal/dirlist.
What is the part you are unclear about?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
aclocal is not installable via homebrew because apple already ships it for us. On compilation of aclocal, the default search path is fixed. You can check it via aclocal --print-ac-dir (Gives /usr/share/aclocal). This is a problem for us because we set the prefix to /usr/local in our formulae, which affects --datarootdir=${PREFIX}/share and thus the placement of aclocals files $(DATAROOTDIR)/aclocal.
Effectively this means m4 files installed with libraries (quite a few actually) are lost to the build system. As http://www.gnu.org/software/hello/manual/automake/Macro-Search-Path.html explains there are ways to fix this. The right way for us to do it is to make our local aclocal dir known to the system aclocal via putting a line into the dirlist file in the system aclocal's dir. This is what this patch does.