valgrind: patch for xcode-only

Since even superenv cannot solve this, we need this ugly patch.
Valgrind devs have no Macs.

Closes Homebrew/homebrew#14441.

Signed-off-by: Max Howell <mxcl@me.com>

Quite a bit of amendment from me.
This commit is contained in:
Max Howell 2012-09-01 22:00:17 -04:00
parent 21183fa2ff
commit 3da8584c52

View file

@ -22,6 +22,12 @@ class Valgrind < Formula
skip_clean 'lib'
def patches
# For Xcode-only systems, we have to patch hard-coded paths, use xcrun and
# add missing CFLAGS. See: https://bugs.kde.org/show_bug.cgi?id=295084
DATA
end unless MacOS::CLT.installed?
def install
# avoid undefined symbol __bzero
ENV.remove_from_cflags "-mmacosx-version-min=#{MacOS.version}"
@ -35,7 +41,7 @@ class Valgrind < Formula
system "./autogen.sh" if build.head?
system "./configure", *args
system "make"
system "make", "AR=ar" # have to set AR or valgrind picks cc (WTF?)
system "make install"
end
@ -43,3 +49,36 @@ class Valgrind < Formula
system "#{bin}/valgrind", "ls", "-l"
end
end
__END__
diff --git a/coregrind/Makefile.in b/coregrind/Makefile.in
index d62cf92..477b069 100644
--- a/coregrind/Makefile.in
+++ b/coregrind/Makefile.in
@@ -82,10 +82,10 @@ bin_PROGRAMS = valgrind$(EXEEXT) vgdb$(EXEEXT)
@VGCONF_OS_IS_DARWIN_TRUE@ m_mach/vm_map.h
@VGCONF_OS_IS_DARWIN_TRUE@am__append_10 = \
-@VGCONF_OS_IS_DARWIN_TRUE@ /usr/include/mach/mach_vm.defs \
-@VGCONF_OS_IS_DARWIN_TRUE@ /usr/include/mach/task.defs \
-@VGCONF_OS_IS_DARWIN_TRUE@ /usr/include/mach/thread_act.defs \
-@VGCONF_OS_IS_DARWIN_TRUE@ /usr/include/mach/vm_map.defs
+@VGCONF_OS_IS_DARWIN_TRUE@ $(HOMEBREW_SDKROOT)/usr/include/mach/mach_vm.defs \
+@VGCONF_OS_IS_DARWIN_TRUE@ $(HOMEBREW_SDKROOT)/usr/include/mach/task.defs \
+@VGCONF_OS_IS_DARWIN_TRUE@ $(HOMEBREW_SDKROOT)/usr/include/mach/thread_act.defs \
+@VGCONF_OS_IS_DARWIN_TRUE@ $(HOMEBREW_SDKROOT)/usr/include/mach/vm_map.defs
@VGCONF_HAVE_PLATFORM_SEC_TRUE@am__append_11 = libcoregrind-@VGCONF_ARCH_SEC@-@VGCONF_OS@.a
@ENABLE_LINUX_TICKET_LOCK_PRIMARY_TRUE@am__append_12 = \
diff --git a/coregrind/link_tool_exe_darwin.in b/coregrind/link_tool_exe_darwin.in
index bf483a9..8474346 100644
--- a/coregrind/link_tool_exe_darwin.in
+++ b/coregrind/link_tool_exe_darwin.in
@@ -138,7 +138,7 @@ die "Can't find '-arch archstr' in command line"
# build the command line
-my $cmd = "/usr/bin/ld";
+my $cmd = "ld";
$cmd = "$cmd -static";