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.master
parent
c6869424f3
commit
193a78de04
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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}"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue