Merge pull request #52540 from hedning/cherry-pick-valgrind

valgrind: fix build on darwin
This commit is contained in:
Matthew Bauer 2018-12-19 15:12:28 -06:00 committed by GitHub
commit a16a9fc4e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -31,12 +31,8 @@ stdenv.mkDerivation rec {
in '' in ''
echo "Don't derive our xnu version using uname -r." echo "Don't derive our xnu version using uname -r."
substituteInPlace configure --replace "uname -r" "echo ${OSRELEASE}" substituteInPlace configure --replace "uname -r" "echo ${OSRELEASE}"
''
);
postPatch = stdenv.lib.optionalString (stdenv.isDarwin) # Apple's GCC doesn't recognize `-arch' (as of version 4.2.1, build 5666).
# Apple's GCC doesn't recognize `-arch' (as of version 4.2.1, build 5666).
''
echo "getting rid of the \`-arch' GCC option..." echo "getting rid of the \`-arch' GCC option..."
find -name Makefile\* -exec \ find -name Makefile\* -exec \
sed -i {} -e's/DARWIN\(.*\)-arch [^ ]\+/DARWIN\1/g' \; sed -i {} -e's/DARWIN\(.*\)-arch [^ ]\+/DARWIN\1/g' \;
@ -60,7 +56,10 @@ stdenv.mkDerivation rec {
echo "substitute hardcoded /usr/bin/ld with ${cctools}/bin/ld" echo "substitute hardcoded /usr/bin/ld with ${cctools}/bin/ld"
substituteInPlace coregrind/link_tool_exe_darwin.in \ substituteInPlace coregrind/link_tool_exe_darwin.in \
--replace /usr/bin/ld ${cctools}/bin/ld --replace /usr/bin/ld ${cctools}/bin/ld
''; '');
# To prevent rebuild on linux when moving darwin's postPatch fixes to preConfigure
postPatch = "";
configureFlags = configureFlags =
stdenv.lib.optional (stdenv.hostPlatform.system == "x86_64-linux" || stdenv.hostPlatform.system == "x86_64-darwin") "--enable-only64bit"; stdenv.lib.optional (stdenv.hostPlatform.system == "x86_64-linux" || stdenv.hostPlatform.system == "x86_64-darwin") "--enable-only64bit";