diff options
| author | Adam Vandenberg | 2010-02-19 11:19:01 -0800 | 
|---|---|---|
| committer | Adam Vandenberg | 2010-02-21 23:37:49 -0800 | 
| commit | aad4dc23ece5869165b23f9637475503d2491db8 (patch) | |
| tree | 733f6c214af986df9db5c04728588fadaae2fbb2 | |
| parent | a6caeff4507f4502f5b9d9435ba009564e7c0669 (diff) | |
| download | homebrew-aad4dc23ece5869165b23f9637475503d2491db8.tar.bz2 | |
Use more inreplace features.
Update formulas to make more idiomatic use of "inreplace", including
its new ability to take a list of files to act on.
| -rw-r--r-- | Library/Formula/fsh.rb | 5 | ||||
| -rw-r--r-- | Library/Formula/glib.rb | 23 | ||||
| -rw-r--r-- | Library/Formula/grc.rb | 6 | ||||
| -rw-r--r-- | Library/Formula/grep.rb | 7 | ||||
| -rw-r--r-- | Library/Formula/io.rb | 6 | ||||
| -rw-r--r-- | Library/Formula/iodine.rb | 5 | ||||
| -rw-r--r-- | Library/Formula/lua.rb | 10 | ||||
| -rw-r--r-- | Library/Formula/mpg123.rb | 12 | ||||
| -rw-r--r-- | Library/Formula/omega.rb | 16 | ||||
| -rw-r--r-- | Library/Formula/optipng.rb | 6 | ||||
| -rw-r--r-- | Library/Formula/sdl.rb | 2 | ||||
| -rw-r--r-- | Library/Formula/shapefile.rb | 11 | ||||
| -rw-r--r-- | Library/Formula/xspringies.rb | 6 | ||||
| -rw-r--r-- | Library/Formula/zsh.rb | 7 | 
14 files changed, 61 insertions, 61 deletions
diff --git a/Library/Formula/fsh.rb b/Library/Formula/fsh.rb index ce8678c66..8e7cf8245 100644 --- a/Library/Formula/fsh.rb +++ b/Library/Formula/fsh.rb @@ -13,9 +13,8 @@ class Fsh <Formula      system "make install"      cd bin do -      inreplace "fsh", "#! /usr/local/bin/python", "#!/usr/bin/env python" -      inreplace "fshd", "#! /usr/local/bin/python", "#!/usr/bin/env python" -      inreplace "in.fshd", "#! /usr/local/bin/python", "#!/usr/bin/env python" +      inreplace ["fsh", "fshd", "in.fshd"], +        "#! /usr/local/bin/python", "#!/usr/bin/env python"      end    end  end diff --git a/Library/Formula/glib.rb b/Library/Formula/glib.rb index 7f1ee6048..0930efa50 100644 --- a/Library/Formula/glib.rb +++ b/Library/Formula/glib.rb @@ -44,20 +44,19 @@ class Glib <Formula      system "make"      system "make install" -    # this sucks, basically gettext is Keg only to prevent conflicts with -    # the wider system, but pkg-config or glib is not smart enough to -    # have determined that libintl.dylib isn't in the DYLIB_PATH so we have -    # to add it manually, we might have to do this a lot, so clearly we need -    # to make it automatic or solve the BSD/GNU gettext conflict in another -    # way -    gettext = Formula.factory 'gettext' -    inreplace lib+'pkgconfig'+'glib-2.0.pc', -              'Libs: -L${libdir} -lglib-2.0 -lintl', +    # This sucks; gettext is Keg only to prevent conflicts with the wider +    # system, but pkg-config or glib is not smart enough to have determined +    # that libintl.dylib isn't in the DYLIB_PATH so we have to add it +    # manually. +    gettext = Formula.factory('gettext') +    inreplace lib+'pkgconfig/glib-2.0.pc' do |s| +      s.gsub! 'Libs: -L${libdir} -lglib-2.0 -lintl',                "Libs: -L${libdir} -lglib-2.0 -L#{gettext.lib} -lintl" -    inreplace lib+'pkgconfig'+'glib-2.0.pc', -              'Cflags: -I${includedir}/glib-2.0 -I${libdir}/glib-2.0/include', +       +      s.gsub! 'Cflags: -I${includedir}/glib-2.0 -I${libdir}/glib-2.0/include',                "Cflags: -I${includedir}/glib-2.0 -I${libdir}/glib-2.0/include -I#{gettext.include}" +    end -    (prefix+'share'+'gtk-doc').rmtree +    (prefix+'share/gtk-doc').rmtree    end  end diff --git a/Library/Formula/grc.rb b/Library/Formula/grc.rb index 0d474ccbd..293b13b06 100644 --- a/Library/Formula/grc.rb +++ b/Library/Formula/grc.rb @@ -8,10 +8,8 @@ class Grc <Formula    def install      #TODO we should deprefixify since it's python and thus possible -    inreplace 'grc', '/etc', etc -    inreplace 'grc.1', '/etc', etc -    inreplace 'grcat', '/usr/local', prefix -    inreplace 'grcat.1', '/usr/local', prefix +    inreplace ['grc', 'grc.1'], '/etc', etc +    inreplace ['grcat', 'grcat.1'], '/usr/local', prefix      etc.install 'grc.conf'      bin.install %w[grc grcat] diff --git a/Library/Formula/grep.rb b/Library/Formula/grep.rb index 7dd4d0afa..d4c204a8a 100644 --- a/Library/Formula/grep.rb +++ b/Library/Formula/grep.rb @@ -9,14 +9,17 @@ class Grep <Formula    depends_on 'pcre'    def install -    system "./configure", "--prefix=#{prefix}", "--disable-debug", +    system "./configure", "--disable-debug",                            "--disable-dependency-tracking",                            "--disable-nls", +                          "--prefix=#{prefix}",                            "--infodir=#{info}",                            "--mandir=#{man}"      # Configure gives me 2 copies of -lpcre and no -lintl, so fix that -    inreplace "src/Makefile", /^LIBS = .*$/, "LIBS = -lintl  -lpcre" +    inreplace "src/Makefile" do |s| +      s.change_make_var! "LIBS", "-lintl -lpcre" +    end      system "make"      system "make install" diff --git a/Library/Formula/io.rb b/Library/Formula/io.rb index fed4300ad..7b80413b0 100644 --- a/Library/Formula/io.rb +++ b/Library/Formula/io.rb @@ -33,10 +33,10 @@ class Io <Formula    end    def install -    inreplace 'addons/SGML/build.io', 'sudo ', '' -    inreplace 'addons/TagDB/build.io', 'sudo ', '' +    inreplace ['addons/SGML/build.io', 'addons/TagDB/build.io'], +      'sudo ', '' -    hardcoded_prefixes.each{ |fn| inreplace fn, '/usr/local', prefix } +    inreplace hardcoded_prefixes, '/usr/local', prefix      system "make vm"      system "make" diff --git a/Library/Formula/iodine.rb b/Library/Formula/iodine.rb index 387d6fc3d..9d2e5f9b5 100644 --- a/Library/Formula/iodine.rb +++ b/Library/Formula/iodine.rb @@ -7,9 +7,8 @@ class Iodine <Formula    def install      if MACOS_VERSION >= 10.6 -      ["src/common.c", "src/dns.c", "src/iodine.c", "src/iodined.c"].each do |filename| -        inreplace filename, "arpa/nameser8_compat", "arpa/nameser_compat" -      end +      inreplace ["src/common.c", "src/dns.c", "src/iodine.c", "src/iodined.c"], +        "arpa/nameser8_compat", "arpa/nameser_compat"      end      system "make install prefix=#{prefix}" diff --git a/Library/Formula/lua.rb b/Library/Formula/lua.rb index ad92b0725..f3174d3a6 100644 --- a/Library/Formula/lua.rb +++ b/Library/Formula/lua.rb @@ -10,12 +10,12 @@ class Lua <Formula    end    def install -    inreplace 'Makefile', '/usr/local', prefix -    inreplace 'src/luaconf.h', '/usr/local', prefix -    inreplace 'etc/lua.pc', '/usr/local', prefix +    inreplace ['Makefile', 'src/luaconf.h', 'etc/lua.pc'], +      '/usr/local', prefix + +    inreplace ['Makefile', 'etc/lua.pc'], +      'man/man1', 'share/man/man1' -    inreplace 'Makefile', 'man/man1', 'share/man/man1' -    inreplace 'etc/lua.pc', 'man/man1', 'share/man/man1'      inreplace 'src/luaconf.h', '/usr/local', HOMEBREW_PREFIX      ENV.append "CFLAGS", "-DLUA_USE_LINUX" diff --git a/Library/Formula/mpg123.rb b/Library/Formula/mpg123.rb index 6d2bdae90..18e060f4e 100644 --- a/Library/Formula/mpg123.rb +++ b/Library/Formula/mpg123.rb @@ -28,13 +28,11 @@ class Mpg123 <Formula      system "./configure", *args      # ./configure incorrectly detects 10.5 as 10.4. Cut that crap out. -    ['', 'src/', 'src/output/', 'src/libmpg123/'].each do |path| -      inreplace "#{path}Makefile", # CFLAGS -        "-mmacosx-version-min=10.4 -isysroot /Developer/SDKs/MacOSX10.4u.sdk", "" - -      inreplace "#{path}Makefile", # LDFLAGS -        "LDFLAGS =  -Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk -Wl,-classic_linker -Wl,-read_only_relocs,suppress",  -        "LDFLAGS =  -Wl,-read_only_relocs,suppress" +    ['.', 'src', 'src/output', 'src/libmpg123'].each do |path| +      inreplace "#{path}/Makefile" do |s| +        s.gsub! "-mmacosx-version-min=10.4 -isysroot /Developer/SDKs/MacOSX10.4u.sdk", "" +        s.change_make_var! "LDFLAGS", "-Wl,-read_only_relocs,suppress" +      end      end      system "make install" diff --git a/Library/Formula/omega.rb b/Library/Formula/omega.rb index add68fc07..2a9a30c46 100644 --- a/Library/Formula/omega.rb +++ b/Library/Formula/omega.rb @@ -6,23 +6,21 @@ class Omega <Formula    @md5='6d65ec9e0cc87ccf89ab491533ec4b77'    def install -    # 'make install' is weird, so we do it ourselves -          # Set up our target folders      inreplace "defs.h", "#define OMEGALIB \"./omegalib/\"", "#define OMEGALIB \"#{libexec}/\"" -    # Don't alias CC this way; also, don't need that ncurses include path -    inreplace "Makefile", "CC = gcc -I/usr/include/ncurses", "" - +    # Don't alias CC; also, don't need that ncurses include path      # Set the system type in CFLAGS, not in makefile -    inreplace "Makefile", "CFLAGS = -DUNIX -DSYSV -O", "" -    ENV['CFLAGS'] = ENV['CFLAGS'] + " -DUNIX -DSYSV" -      # Remove an obsolete flag -    inreplace "Makefile", "LDFLAGS = -s", "" +    inreplace "Makefile" do |s| +      s.remove_make_var! ['CC', 'CFLAGS', 'LDFLAGS'] +    end +    ENV.append_to_cflags "-DUNIX -DSYSV" +      system "make" +    # 'make install' is weird, so we do it ourselves      bin.install "omega"      libexec.install Dir['omegalib/*']    end diff --git a/Library/Formula/optipng.rb b/Library/Formula/optipng.rb index fa1e4a92e..ea3eaf1de 100644 --- a/Library/Formula/optipng.rb +++ b/Library/Formula/optipng.rb @@ -6,8 +6,10 @@ class Optipng <Formula    md5 '6cef405197a878acff4c6216cf38e871'    def install -    inreplace 'src/scripts/gcc.mak.in', '/usr/local', prefix -    inreplace 'src/scripts/gcc.mak.in', 'mandir=$(prefix)/man', 'mandir=$(prefix)/share/man' +    inreplace 'src/scripts/gcc.mak.in' do |s| +      s.gsub! '/usr/local', prefix +      s.change_make_var! 'mandir', man +    end      system "./configure", "-with-system-zlib"      system "make install"    end diff --git a/Library/Formula/sdl.rb b/Library/Formula/sdl.rb index 275d28dae..f71cdde64 100644 --- a/Library/Formula/sdl.rb +++ b/Library/Formula/sdl.rb @@ -9,7 +9,7 @@ class Sdl <Formula    # are installed to the same prefix. Consequently SDL stuff cannot be    # keg-only but I doubt that will be needed.    def self.use_homebrew_prefix files -    files.each {|f| inreplace f, '@prefix@', HOMEBREW_PREFIX} +    inreplace files, '@prefix@', HOMEBREW_PREFIX    end    def install diff --git a/Library/Formula/shapefile.rb b/Library/Formula/shapefile.rb index a7dbf8e06..5d53507a8 100644 --- a/Library/Formula/shapefile.rb +++ b/Library/Formula/shapefile.rb @@ -8,7 +8,9 @@ class Shapefile <Formula    def install      dylib = lib+"libshp.#{version}.dylib" -    inreplace 'Makefile', /CFLAGS\s+=\s+-g/, "CFLAGS = #{ENV['CFLAGS']}" +    inreplace 'Makefile' do |s| +      s.change_make_var! "CFLAGS", ENV['CFLAGS'] +    end      system "make all"      system "make shptree.o" @@ -22,8 +24,9 @@ class Shapefile <Formula      include.install 'shapefil.h' -    Dir.chdir lib -    FileUtils.ln_s "libshp.#{version}.dylib", "libshp.#{version.split('.').first}.dylib" -    FileUtils.ln_s "libshp.#{version}.dylib", "libshp.dylib" +    Dir.chdir lib do +      FileUtils.ln_s "libshp.#{version}.dylib", "libshp.#{version.split('.').first}.dylib" +      FileUtils.ln_s "libshp.#{version}.dylib", "libshp.dylib" +    end    end  end diff --git a/Library/Formula/xspringies.rb b/Library/Formula/xspringies.rb index 3668a8696..9de783b4d 100644 --- a/Library/Formula/xspringies.rb +++ b/Library/Formula/xspringies.rb @@ -7,8 +7,10 @@ class Xspringies <Formula    version '1.12'    def install -    inreplace 'Makefile.std', 'LIBS = -lm -lX11', 'LIBS = -L/usr/X11/lib -lm -lX11' -    inreplace 'Makefile.std', 'mkdirhier', 'mkdir -p' +    inreplace 'Makefile.std' do |s| +      s.change_make_var! "LIBS", '-L/usr/X11/lib -lm -lX11' +      s.gsub! 'mkdirhier', 'mkdir -p' +    end      system "make -f Makefile.std DDIR=#{prefix}/ install"    end  end diff --git a/Library/Formula/zsh.rb b/Library/Formula/zsh.rb index af5d39dd7..b97acf82e 100644 --- a/Library/Formula/zsh.rb +++ b/Library/Formula/zsh.rb @@ -13,10 +13,9 @@ class Zsh <Formula                            "--enable-fndir=#{share}/zsh/functions",                            "--enable-scriptdir=#{share}/zsh/scripts" -    # again don't version installation directories -    [".", "Src"].each do |f| -      inreplace "#{f}/Makefile", "$(libdir)/$(tzsh)/$(VERSION)", "$(libdir)" -    end +    # Again, don't version installation directories +    inreplace ["Makefile", "Src/Makefile"], +      "$(libdir)/$(tzsh)/$(VERSION)", "$(libdir)"      system "make install"    end  | 
