aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Howell2010-01-13 11:06:52 +0000
committerMax Howell2010-01-13 11:23:11 +0000
commit99acd7f4fb773d7af8bef08ffa6a79c2cf4c9798 (patch)
treef8fec0fae27724f59a07b0561a9276f24e56f47a
parentaf6d133c80c0bbf26bf752260feececc99438fd5 (diff)
downloadhomebrew-99acd7f4fb773d7af8bef08ffa6a79c2cf4c9798.tar.bz2
Use new inreplace syntax where useful
-rw-r--r--Library/Formula/fortune.rb17
-rw-r--r--Library/Formula/frotz.rb9
-rw-r--r--Library/Formula/haproxy.rb13
-rw-r--r--Library/Formula/mod_wsgi.rb29
-rw-r--r--Library/Formula/pngcrush.rb7
-rw-r--r--Library/Formula/rabbitmq.rb15
-rw-r--r--Library/Formula/uwsgi.rb27
-rw-r--r--Library/Formula/xmlstarlet.rb8
-rw-r--r--Library/Formula/xu4.rb15
9 files changed, 67 insertions, 73 deletions
diff --git a/Library/Formula/fortune.rb b/Library/Formula/fortune.rb
index bb714e1fc..335202058 100644
--- a/Library/Formula/fortune.rb
+++ b/Library/Formula/fortune.rb
@@ -14,14 +14,15 @@ class Fortune <Formula
def install
ENV.deparallelize
- inreplace 'Makefile', 'FORTDIR=/usr/local/games', "FORTDIR=/usr/local/bin"
- inreplace 'Makefile', '/usr/local', prefix
- inreplace 'Makefile', 'CC=gcc', "CC=#{ENV.cc}"
- # OS X only supports POSIX regexes
- inreplace 'Makefile', 'REGEXDEFS=-DHAVE_REGEX_H -DBSD_REGEX', 'REGEXDEFS=-DHAVE_REGEX_H -DPOSIX_REGEX'
-
- # Don't install offensive fortunes
- inreplace 'Makefile', 'OFFENSIVE=1', 'OFFENSIVE=0' if ARGV.include? '--no-offensive'
+ inreplace 'Makefile' do |contents|
+ contents.change_make_var! 'FORTDIR', "/usr/local/bin" # indeed, correct
+ contents.gsub! '/usr/local', prefix
+ contents.change_make_var! 'CC', ENV.cc
+ # OS X only supports POSIX regexes
+ contents.change_make_var! 'REGEXDEFS', '-DHAVE_REGEX_H -DPOSIX_REGEX'
+ # Don't install offensive fortunes
+ contents.change_make_var! 'OFFENSIVE', '0' if ARGV.include? '--no-offensive'
+ end
system "make install"
end
diff --git a/Library/Formula/frotz.rb b/Library/Formula/frotz.rb
index 9a63ee828..c872d6c63 100644
--- a/Library/Formula/frotz.rb
+++ b/Library/Formula/frotz.rb
@@ -6,10 +6,11 @@ class Frotz <Formula
@md5='efe51879e012b92bb8d5f4a82e982677'
def install
- inreplace "Makefile", "CC = gcc", ""
- inreplace "Makefile", "OPTS = -O2", ""
- inreplace "Makefile", "PREFIX = /usr/local", "PREFIX = #{prefix}"
- inreplace "Makefile", "CONFIG_DIR = /usr/local/etc", ""
+ inreplace "Makefile" do |contents|
+ contents.remove_make_var! %w[CC OPTS]
+ contents.change_make_var! "PREFIX", prefix
+ contents.change_make_var! "CONFIG_DIR", etc
+ end
system "make frotz"
system "make install"
diff --git a/Library/Formula/haproxy.rb b/Library/Formula/haproxy.rb
index ed637ba5e..a96740950 100644
--- a/Library/Formula/haproxy.rb
+++ b/Library/Formula/haproxy.rb
@@ -6,13 +6,12 @@ class Haproxy <Formula
homepage 'http://haproxy.1wt.eu'
def install
- inreplace 'Makefile', 'PREFIX = /usr/local', "PREFIX = #{prefix}"
- inreplace 'Makefile', 'DOCDIR = $(PREFIX)/doc/haproxy', "DOCDIR = #{doc}"
- # use our CC, LD, CFLAGS and LDFLAGS
- inreplace 'Makefile', 'LDFLAGS = $(ARCH_FLAGS) -g', ''
- inreplace 'Makefile', 'CFLAGS = $(ARCH_FLAGS) $(CPU_CFLAGS) $(DEBUG_CFLAGS)', ''
- inreplace 'Makefile', 'CC = gcc', ''
- inreplace 'Makefile', 'LD = $(CC)', ''
+ inreplace 'Makefile' do |contents|
+ contents.change_make_var! 'PREFIX', prefix
+ contents.change_make_var! 'DOCDIR', doc
+ # use our CC, LD, CFLAGS and LDFLAGS
+ contents.remove_make_var! %w[LDFLAGS CFLAGS CC LD]
+ end
# We build generic since the Makefile.osx doesn't appear to work
system "make", "TARGET=generic"
diff --git a/Library/Formula/mod_wsgi.rb b/Library/Formula/mod_wsgi.rb
index 3f0cd4d59..d57afc5e4 100644
--- a/Library/Formula/mod_wsgi.rb
+++ b/Library/Formula/mod_wsgi.rb
@@ -12,29 +12,18 @@ class ModWsgi <Formula
end
def install
- FileUtils.mv 'LICENCE', 'LICENSE'
- system "./configure --prefix='#{prefix}' --disable-debug --disable-dependency-tracking"
+ system "./configure", "--prefix=#{prefix}", "--disable-debug", "--disable-dependency-tracking"
- # The arch flags should match your Python's arch flags.
- archs = arch_for_command "`which python`"
+ archs = archs_for_command("python").collect{ |arch| "-arch #{arch}" }
- comp_flags = ''
- link_flags = ''
- archs.each do |a|
- comp_flags += " -Wc,'-arch #{a}'"
- link_flags += " -arch #{a}"
+ inreplace 'Makefile' do |s|
+ s.gsub! "-Wc,'-arch ppc7400' -Wc,'-arch ppc64' -Wc,'-arch i386' -Wc,'-arch x86_64'",
+ archs.collect{ |a| "-Wc,'#{a}'" }.join(' ')
+ s.gsub! "-arch ppc7400 -arch ppc64 -arch i386 -arch x86_64",
+ archs*' '
+ # --libexecdir parameter to ./configure isn't changing this, so cram it in
+ s.change_make_var! "LIBEXECDIR", libexec
end
-
- inreplace 'Makefile',
- "-Wc,'-arch ppc7400' -Wc,'-arch ppc64' -Wc,'-arch i386' -Wc,'-arch x86_64'",
- "#{comp_flags}"
-
- inreplace 'Makefile',
- "-arch ppc7400 -arch ppc64 -arch i386 -arch x86_64",
- "#{link_flags}"
-
- # --libexecdir parameter to ./configure isn't changing this, so cram it in
- inreplace 'Makefile', "LIBEXECDIR = /usr/libexec/apache2", "LIBEXECDIR = #{libexec}"
system "make install"
end
diff --git a/Library/Formula/pngcrush.rb b/Library/Formula/pngcrush.rb
index decc007ff..682cd8200 100644
--- a/Library/Formula/pngcrush.rb
+++ b/Library/Formula/pngcrush.rb
@@ -7,10 +7,9 @@ class Pngcrush <Formula
def install
# use our CFLAGS, LDFLAGS, CC, and LD
- inreplace 'Makefile', 'CFLAGS = -I. -O3 -fomit-frame-pointer -Wall -Wshadow', ''
- inreplace 'Makefile', 'LDFLAGS =', ''
- inreplace 'Makefile', 'CC = gcc', ''
- inreplace 'Makefile', 'LD = gcc', ''
+ inreplace 'Makefile' do |contents|
+ contents.remove_make_var! %w[CFLAGS LDFLAGS CC LD]
+ end
system "make"
bin.install 'pngcrush'
diff --git a/Library/Formula/rabbitmq.rb b/Library/Formula/rabbitmq.rb
index 416c4ddfd..b06a9cdb5 100644
--- a/Library/Formula/rabbitmq.rb
+++ b/Library/Formula/rabbitmq.rb
@@ -21,15 +21,14 @@ class Rabbitmq <Formula
(var + "log" + "couchdb").mkpath
%w{rabbitmq-server rabbitmq-multi rabbitmqctl rabbitmq-env}.each do |script|
- inreplace sbin+script, '/etc/rabbitmq', "#{etc}/rabbitmq"
- inreplace sbin+script, '/var/log/rabbitmq', "#{var}/log/rabbitmq"
- inreplace sbin+script, '/var/lib/rabbitmq', "#{var}/lib/rabbitmq"
+ inreplace sbin+script do |contents|
+ contents.gsub! '/etc/rabbitmq', "#{etc}/rabbitmq"
+ contents.gsub! '/var/((log|lib)/rabbitmq)', "#{var}/\1"
+ end
end
- %w{rabbitmq-env}.each do |script|
- # RabbitMQ Erlang binaries are installed in lib/rabbitmq/erlang/lib/rabbitmq-x.y.z/ebin
- # therefore need to add this path for erl -pa
- inreplace sbin+script, '${SCRIPT_DIR}/..', "#{target_dir}"
- end
+ # RabbitMQ Erlang binaries are installed in lib/rabbitmq/erlang/lib/rabbitmq-x.y.z/ebin
+ # therefore need to add this path for erl -pa
+ inreplace sbin+'rabbitmq-env', '${SCRIPT_DIR}/..', "#{target_dir}"
end
end
diff --git a/Library/Formula/uwsgi.rb b/Library/Formula/uwsgi.rb
index 3228c178d..977dd5c9b 100644
--- a/Library/Formula/uwsgi.rb
+++ b/Library/Formula/uwsgi.rb
@@ -5,19 +5,24 @@ class Uwsgi <Formula
homepage 'http://projects.unbit.it/uwsgi/'
md5 'dd72040daea5a9ee982f3b3b98946ed9'
+ def python_archs
+ archs_for_command("python").collect{ |arch| "-arch #{arch}" }.join(' ')
+ end
+
+ def python_version
+ `python -c "import sys; print '%s.%s' % sys.version_info[:2]"`.chomp
+ end
+
def install
- # Getting the current Python version to determine pythonX.Y-config
- py_version = `python -c "import sys; print '%s.%s' % sys.version_info[:2]"`.chomp
- # The arch flags should match your Python's arch flags.
- archs = arch_for_command "`which python`"
- arch_flags = ''
- archs.each do |a|
- arch_flags += " -arch #{a}"
+ mv 'Makefile.OSX.ub.Py25', 'Makefile'
+
+ inreplace "Makefile" do |s|
+ s.gsub! "python2.5-config", "python#{ python_version }-config"
+ # The arch flags should match your Python's arch flags
+ s.gsub! "-arch ppc -arch i386", python_archs
end
- FileUtils.mv 'Makefile.OSX.ub.Py25', 'Makefile.OSX'
- inreplace "Makefile.OSX", "python2.5-config", "python#{py_version}-config"
- inreplace "Makefile.OSX", "-arch ppc -arch i386", "#{arch_flags}"
- system "make -f Makefile.OSX"
+
+ system "make all"
bin.install "uwsgi"
end
end
diff --git a/Library/Formula/xmlstarlet.rb b/Library/Formula/xmlstarlet.rb
index ca99a340c..6e0cae1bf 100644
--- a/Library/Formula/xmlstarlet.rb
+++ b/Library/Formula/xmlstarlet.rb
@@ -7,9 +7,11 @@ class Xmlstarlet <Formula
def install
# thanks, xmlstarlet but OS X doesn't have the static versions
- inreplace 'configure', '${LIBXML_PREFIX}/lib/libxml2.a', '-lxml2'
- inreplace 'configure', '${LIBXSLT_PREFIX}/lib/libxslt.a', '-lxslt'
- inreplace 'configure', '${LIBXSLT_PREFIX}/lib/libexslt.a', '-lexslt'
+ inreplace 'configure' do |s|
+ s.gsub! '${LIBXML_PREFIX}/lib/libxml2.a', '-lxml2'
+ s.gsub! '${LIBXSLT_PREFIX}/lib/libxslt.a', '-lxslt'
+ s.gsub! '${LIBXSLT_PREFIX}/lib/libexslt.a', '-lexslt'
+ end
system "./configure", "--prefix=#{prefix}", "--disable-debug", "--disable-dependency-tracking"
system "make"
diff --git a/Library/Formula/xu4.rb b/Library/Formula/xu4.rb
index bf9e47297..afff4e2c1 100644
--- a/Library/Formula/xu4.rb
+++ b/Library/Formula/xu4.rb
@@ -26,14 +26,13 @@ class Xu4 <Formula
# ...so we can copy the ObjC main files.
`cp -R #{sdl_prefix}/libexec/* macosx`
- inreplace "Makefile.macosx", "WHICH_FRAMEWORK=10.4u", "WHICH_FRAMEWORK=#{MACOS_VERSION}"
- inreplace "Makefile.macosx", "ARCHES=-arch i386 -arch ppc", "ARCHES="
- inreplace "Makefile.macosx",
- "BUNDLE_CONTENTS=../../xu4.app/Contents",
- "BUNDLE_CONTENTS=xu4.app/Contents"
-
- inreplace "Makefile.macosx", "../../ultima4.zip", "../ultima4-1.01.zip"
- inreplace "Makefile.macosx", "../../u4upgrad.zip", "../u4upgrad.zip"
+ inreplace "Makefile.macosx" do |s|
+ s.change_make_var! "WHICH_FRAMEWORK", MACOS_VERSION
+ s.remove_make_var! "ARCHES"
+ s.change_make_var! "BUNDLE_CONTENTS", "xu4.app/Contents"
+ s.gsub! "../../ultima4.zip", "../ultima4-1.01.zip"
+ s.gsub! "../../u4upgrad.zip", "../u4upgrad.zip"
+ end
system "make -f Makefile.macosx"
system "make -f Makefile.macosx install"