mldonkey 3.1.2 & fix errors w/cpp and sed

Mldonkey-3.1.2 has compile errors due to their changes in arguments
to the cpp command and because Apple sed and gnu-sed do not have
a `-o` option.  The formula also has a failing inreplace.

Fix the failing inreplace by changing `-O6` to `-O3`.
Add a patch that uses the suggested change to `$(CPP)` from the
report on their website (url is in the formula comments).
Add a patch that changes `sed -o` to `sed >`.
Note in the comments the bug reports and how the patches are
not upstream as of 13 JUN 2012.  According to the Homebrew issue
listed below, the user reports these patches work well.

Fixes Homebrew/homebrew#12774

Closes Homebrew/homebrew#12825.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
This commit is contained in:
nibbles 2bits 2012-06-13 19:54:33 -07:00 committed by Jack Nagel
parent 62fb0a9c91
commit b51d95b67d

View file

@ -2,8 +2,8 @@ require 'formula'
class Mldonkey < Formula
homepage 'http://mldonkey.sourceforge.net/Main_Page'
url 'http://downloads.sourceforge.net/project/mldonkey/mldonkey/3.1.1/mldonkey-3.1.1.tar.bz2'
sha1 '2d0bc9f849728528f833e32db3b051aab51b6c7f'
url 'http://downloads.sourceforge.net/project/mldonkey/mldonkey/3.1.2/mldonkey-3.1.2.tar.bz2'
sha1 'be8c261e2fbd365dd3866af15a854b074fbc59c1'
depends_on 'objective-caml'
@ -16,12 +16,23 @@ class Mldonkey < Formula
[["--with-x", "Build mldonkey with X11 support"]]
end
# Patches fix two compile errors with both clang and llvm. Reported as
# https://savannah.nongnu.org/patch/?7727 and in the following:
# https://savannah.nongnu.org/bugs/index.php?36654
# These patches are not yet in HEAD as of 13 JUN 2012. They do work according
# to the user report in issue #12774.
def patches
DATA
end
def install
ENV.libpng
# Fix compiler selection
ENV['OCAMLC'] = "#{HOMEBREW_PREFIX}/bin/ocamlc.opt -cc #{ENV.cc}"
inreplace 'Makefile', '-O6', '' if ENV.compiler == :clang
# Let it build with standard Homebrew optimization
inreplace 'Makefile', '-O3', ''
args = ["--prefix=#{prefix}"]
args << "--enable-gui=newgui2" if ARGV.include? "--with-x"
@ -30,3 +41,27 @@ class Mldonkey < Formula
system "make install"
end
end
__END__
--- a/Makefile 2012-04-05 07:11:34.000000000 -0700
+++ b/Makefile 2012-06-13 19:32:25.000000000 -0700
@@ -5447,7 +5447,7 @@
$(OCAMLC) $(DEVFLAGS) $(INCLUDES) -c $<
.mlcpp.ml:
- @$(CPP) -x c -P $< $(FIX_BROKEN_CPP) -o $@
+ cpp -P $< $(FIX_BROKEN_CPP) > $@
%.ml: %.mlp $(BITSTRING)/pa_bitstring.cmo
$(CAMLP4OF) build/bitstring.cma $(BITSTRING)/bitstring_persistent.cmo $(BITSTRING)/pa_bitstring.cmo -impl $< -o $@
--- a/config/Makefile.in 2012-04-04 13:22:49.000000000 -0700
+++ b/config/Makefile.in 2012-06-13 19:33:02.000000000 -0700
@@ -1848,7 +1848,7 @@
$(OCAMLC) $(DEVFLAGS) $(INCLUDES) -c $<
.mlcpp.ml:
- @$(CPP) -x c -P $< $(FIX_BROKEN_CPP) -o $@
+ cpp -P $< $(FIX_BROKEN_CPP) > $@
%.ml: %.mlp $(BITSTRING)/pa_bitstring.cmo
$(CAMLP4OF) build/bitstring.cma $(BITSTRING)/bitstring_persistent.cmo $(BITSTRING)/pa_bitstring.cmo -impl $< -o $@