Use new inreplace syntax where useful

This commit is contained in:
Max Howell 2010-01-13 11:06:52 +00:00
parent cf97477814
commit 0103671fa0
9 changed files with 67 additions and 73 deletions

View file

@ -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

View file

@ -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"

View file

@ -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"

View file

@ -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

View file

@ -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'

View file

@ -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

View file

@ -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

View file

@ -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"

View file

@ -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"