Browse Source

2015-03-16 Ryoichi INAGAKI <ryo1@toki.waseda.jp>

	* valgrind: updated
	


git-svn-id: http://trac.vinelinux.org/repos/projects/specs@9437 ec354946-7b23-47d6-9f5a-488ba84defc7
inagaki 9 years ago
parent
commit
8be07bd62b
1 changed files with 251 additions and 38 deletions
  1. 251 38
      v/valgrind/valgrind-vl.spec

+ 251 - 38
v/valgrind/valgrind-vl.spec

@@ -1,30 +1,124 @@
-Summary: Valgrind Memory Debugger
-Summary(ja): Valgrind メモリデバッガ
-Name: valgrind
-Version: 3.7.0
-Release: 1%{?_dist_release}
-License: GPL
-URL: http://www.valgrind.org/
-Group: Development/Tools
-Source: http://valgrind.org/downloads/%{name}-%{version}.tar.bz2
-Buildroot: %{_tmppath}/%{name}-%{version}-root
-BuildRequires: glibc-devel >= 2.14
-Requires: glibc >= 2.14
-ExclusiveArch: %{ix86} x86_64 ppc
-
-## from fedora
-Patch1: valgrind-3.7.0-cachegrind-improvements.patch
-Patch2: valgrind-3.7.0-openat.patch
-Patch3: valgrind-3.7.0-helgrind-race-supp.patch
-Patch4: valgrind-3.7.0-stat_h.patch
-Patch5: valgrind-3.7.0-config_h.patch
-Patch6: valgrind-3.7.0-capget.patch
-Patch7: valgrind-3.7.0-glibc-2.15.patch
-Patch8: valgrind-3.7.0-pie.patch
-Patch9: valgrind-3.7.0-tests.patch
-Patch10: valgrind-3.7.0-f-sgetown-ex.patch
-Patch11: valgrind-3.7.0-scsi-ioctls.patch
-Patch12: valgrind-3.7.0-enable-armv5.patch
+# Only arches that are supported upstream as multilib and that the distro
+# has multilib builds for should set build_multilib 1. In practice that
+# is only x86_64 and ppc64 (but not in fedora 21 and later, and never
+# for ppc64le).
+%global build_multilib 0
+
+%ifarch x86_64 ppc64
+%global build_multilib 1
+%endif
+
+# Vine Linux doesn't have openmpi package
+#ifarch %{ix86} x86_64 ppc ppc64 ppc64le %{arm} aarch64
+#global build_openmpi 1
+#else
+%global build_openmpi 0
+#endif
+
+# Don't run dwz or generate minisymtab, valgrind doesn't handle compressed
+# DWARF very well and it might read its own vgpreload libraries. Generating
+# minisymtabs doesn't really work for the staticly linked tools.
+%define _find_debuginfo_dwz_opts %{nil}
+%undefine _include_minidebuginfo
+
+Name: 		valgrind
+Version: 	3.10.1
+Release: 	1%{?_dist_release}
+Summary: 	Tool for finding memory management bugs in programs
+Summary(ja): 	プログラムのメモリ管理バグを発見するためのツール
+
+License: 	GPLv2+
+Group: 		Development/Debuggers
+URL: 		http://valgrind.org/
+
+Source0: 	http://valgrind.org/downloads/%{name}-%{version}.tar.bz2
+
+# Needs investigation and pushing upstream
+Patch1: 	valgrind-3.9.0-cachegrind-improvements.patch
+# KDE#211352 - helgrind races in helgrind's own mythread_wrapper
+Patch2: 	valgrind-3.9.0-helgrind-race-supp.patch
+# undef st_atime, st_mtime and st_ctime. Unknown why this is (still?) needed.
+Patch3: 	valgrind-3.9.0-stat_h.patch
+# Make ld.so supressions slightly less specific.
+Patch4: 	valgrind-3.9.0-ldso-supp.patch
+# KDE#342795 Internal glibc __GI_mempcpy call should be intercepted
+Patch5: 	valgrind-3.10.1-mempcpy.patch
+# KDE#343802 - s390x memcheck reports spurious conditional jump
+Patch6: 	valgrind-3.10-s390-spechelper.patch
+# KDE#342038, KDE#343732, KDE#343733, KDE#344007, KDE#344307
+# mbind, get_mempolicy, set_mempolicy, flock, setgid, msgget, msgctl,
+# msgrcv, msgsnd, accept4, mount, umount2
+Patch7: 	valgrind-3.10.1-aarch64-syscalls.patch
+# KDE#344007 ppc64 missing accept4 syscall
+Patch8: 	valgrind-3.10.1-ppc64-accept4.patch
+# KDE#344279 - syscall sendmmsg on arm64 (269) and ppc32/64 (349) unhandled
+# KDE#344295 - syscall recvmmsg on arm64 (243) and ppc32/64 (343) unhandled
+# KDE#344318 - socketcall should wrap recvmmsg and sendmmsg
+Patch9: 	valgrind-3.10.1-send-recv-mmsg.patch
+# Upstream valgrind svn r14530
+Patch10: 	valgrind-3.10.1-glibc-version-check.patch
+
+Buildroot: 	%{_tmppath}/%{name}-%{version}-root
+%if %{build_multilib}
+# Ensure glibc{,-devel} is installed for both multilib arches
+BuildRequires: 	/lib/libc.so.6 /usr/lib/libc.so /lib64/libc.so.6 /usr/lib64/libc.so
+%endif
+BuildRequires: 	glibc-devel >= 2.14
+%if %{build_openmpi}
+BuildRequires: openmpi-devel >= 1.3.3
+%endif
+
+# For %%build and %%check.
+# In case of a software collection, pick the matching gdb and binutils.
+BuildRequires: 	gdb
+BuildRequires: 	binutils
+
+# gdbserver_tests/filter_make_empty uses ps in test
+BuildRequires: 	procps
+
+ExclusiveArch: %{ix86} x86_64 ppc ppc64 ppc64le s390x armv7hl aarch64
+%ifarch %{ix86}
+%define valarch x86
+%define valsecarch %{nil}
+%endif
+%ifarch x86_64
+%define valarch amd64
+%define valsecarch x86
+%endif
+%ifarch ppc
+%define valarch ppc32
+%define valsecarch %{nil}
+%endif
+%ifarch ppc64
+  %define valarch ppc64be
+  %if %{build_multilib}
+    %define valsecarch ppc32
+  %else
+    %define valsecarch %{nil}
+  %endif
+%endif
+%ifarch ppc64le
+%define valarch ppc64le
+%define valsecarch %{nil}
+%endif
+%ifarch s390x
+%define valarch s390x
+%define valsecarch %{nil}
+%endif
+%ifarch armv7hl
+%define valarch arm
+%define valsecarch %{nil}
+%endif
+%ifarch aarch64
+%define valarch arm64
+%define valsecarch %{nil}
+%endif
+
+# Don't run dwz or generate minisymtab, valgrind doesn't handle compressed
+# DWARF very well and it might read its own vgpreload libraries. Generating
+# minisymtabs doesn't really work for the staticly linked tools.
+%define _find_debuginfo_dwz_opts %{nil}
+%undefine _include_minidebuginfo
 
 
 %description 
@@ -36,14 +130,27 @@ detect a lot of problems that are otherwise very hard to
 find/diagnose.
 
 %package devel
-Summary: Development files for valgrind
-Group: Development/Libraries
-Requires: valgrind = %{version}-%{release}
+Summary:	Development files for valgrind
+Summary(ja):	Valgrind の開発用ファイル
+Group:		Development/Libraries
+Requires: 	%{name} = %{version}-%{release}
+Provides: 	%{name}-static = %{version}-%{release}
 
 %description devel
 Header files and libraries for development of valgrind aware programs
 or valgrind plugins.
 
+%package openmpi
+Summary: 	OpenMPI support for valgrind
+Summary(ja): 	Valgrind の OpenMPI サポート
+Group: 		Development/Debuggers
+Requires: 	%{name} = %{version}-%{release}
+
+%description openmpi
+A wrapper library for debugging OpenMPI parallel programs with valgrind.
+See the section on Debugging MPI Parallel Programs with Valgrind in the
+Valgrind User Manual for details.
+
 
 %prep
 %setup -q -n %{name}-%{version}
@@ -57,15 +164,52 @@ or valgrind plugins.
 %patch8 -p1
 %patch9 -p1
 %patch10 -p1
-%patch11 -p1
-%patch12 -p1 -b .arm
 
 
 %build
-autoconf
-%configure
+CC=gcc
+%if %{build_multilib}
+# Ugly hack - libgcc 32-bit package might not be installed
+mkdir -p shared/libgcc/32
+ar r shared/libgcc/32/libgcc_s.a
+ar r shared/libgcc/libgcc_s_32.a
+CC="gcc -B `pwd`/shared/libgcc/"
+%endif
+
+%define mpiccpath %{_libdir}/openmpi/*/bin/mpicc
+
+# Filter out some flags that cause lots of valgrind test failures.
+# Also filter away -O2, valgrind adds it wherever suitable, but
+# not for tests which should be -O0, as they aren't meant to be
+# compiled with -O2 unless explicitely requested. Same for any -mcpu flag.
+# Ideally we will change this to only be done for the non-primary build
+# and the test suite.
+OPTFLAGS="`echo " %{optflags} " | sed 's/ -m\(64\|3[21]\) / /g;s/ -fexceptions / /g;s/ -fstack-protector / / g;s/ -Wp,-D_FORTIFY_SOURCE=2 / /g;s/ -O2 / /g;s/ -mcpu=\([a-z0-9]\+\) / /g;s/^ //;s/ $//'`"
+%configure CC="$CC" CFLAGS="$OPTFLAGS" CXXFLAGS="$OPTFLAGS" \
+%if %{build_openmpi}
+    --with-mpicc=%{mpiccpath} \
+%endif
+    GDB=%{_bindir}/gdb
+
 make %{?_smp_mflags}
 
+# Ensure there are no unexpected file descriptors open,
+# the testsuite otherwise fails.
+cat > close_fds.c <<EOF
+#include <stdlib.h>
+#include <unistd.h>
+int main (int argc, char *const argv[])
+{
+  int i, j = sysconf (_SC_OPEN_MAX);
+  if (j < 0)
+    exit (1);
+  for (i = 3; i < j; ++i)
+    close (i);
+  execvp (argv[1], argv + 1);
+  exit (1);
+}
+EOF
+gcc $RPM_OPT_FLAGS -o close_fds close_fds.c
 
 %install
 rm -rf $RPM_BUILD_ROOT
@@ -74,9 +218,64 @@ make install DESTDIR=$RPM_BUILD_ROOT
 rm -rf docs.installed
 mkdir docs.installed
 mv $RPM_BUILD_ROOT%{_datadir}/doc/%{name}/* docs.installed/
+rm -f docs.installed/*.ps
+
+%if "%{valsecarch}" != ""
+pushd $RPM_BUILD_ROOT%{_libdir}/valgrind/
+rm -f *-%{valsecarch}-* || :
+for i in *-%{valarch}-*; do
+    j=`echo $i | sed 's/-%{valarch}-/-%{valsecarch}-/'`
+    ln -sf ../../lib/valgrind/$j $j
+done
+popd
+%endif
 
 # remove unuse files
-rm $RPM_BUILD_ROOT%{_libdir}/%{name}/*.a
+rm -f $RPM_BUILD_ROOT%{_libdir}/valgrind/*.supp.in
+
+
+%ifarch %{ix86} x86_64
+# To avoid multilib clashes in between i?86 and x86_64,
+# tweak installed <valgrind/config.h> a little bit.
+for i in HAVE_PTHREAD_CREATE_GLIBC_2_0 HAVE_PTRACE_GETREGS ; do
+  sed -i -e 's,^\(#define '$i' 1\|/\* #undef '$i' \*/\)$,#ifdef __x86_64__\n# define '$i' 1\n#endif,' \
+      $RPM_BUILD_ROOT%{_includedir}/valgrind/config.h
+done
+%endif
+
+
+%check
+# Make sure a basic binary runs.
+./vg-in-place /bin/true
+
+# Make sure no extra CFLAGS leak through, the testsuite sets all flags
+# necessary. See also configure above.
+make %{?_smp_mflags} CFLAGS="" check || :
+
+echo ===============TESTING===================
+./close_fds make regtest || :
+
+# Make sure test failures show up in build.log
+# Gather up the diffs (at most the first 20 lines for each one)
+MAX_LINES=20
+diff_files=`find . -name '*.diff' | sort`
+if [ z"$diff_files" = z ] ; then
+   echo "Congratulations, all tests passed!" >> diffs
+else
+   for i in $diff_files ; do
+      echo "=================================================" >> diffs
+      echo $i                                                  >> diffs
+      echo "=================================================" >> diffs
+      if [ `wc -l < $i` -le $MAX_LINES ] ; then
+         cat $i                                                >> diffs
+      else
+         head -n $MAX_LINES $i                                 >> diffs
+         echo "<truncated beyond $MAX_LINES lines>"            >> diffs
+      fi
+   done
+fi
+cat diffs
+echo ===============END TESTING===============
 
 
 %clean
@@ -84,20 +283,34 @@ rm $RPM_BUILD_ROOT%{_libdir}/%{name}/*.a
 
 %files
 %defattr(-,root,root)
-%doc AUTHORS COPYING FAQ.txt NEWS README*
-%doc docs.installed/html docs.installed/valgrind_manual.{pdf,ps}
+%doc COPYING NEWS README_*
+%doc docs.installed/html docs.installed/*.pdf
 %{_bindir}/*
 %dir %{_libdir}/%{name}
-%{_libdir}/%{name}/*
+%{_libdir}/%{name}/*[^ao]
+%{_libdir}/%{name}/[^l]*o
 %{_mandir}/man1/*
 
 %files devel
 %defattr(-,root,root)
 %{_includedir}/%{name}
+%dir %{_libdir}/%{name}
+%{_libdir}/%{name}/*.a
 %{_libdir}/pkgconfig/%{name}.pc
 
+%if %{build_openmpi}
+%files openmpi
+%defattr(-,root,root)
+%dir %{_libdir}/%{name}
+%{_libdir}/%{name}/libmpiwrap*.so
+%endif
+
 
 %changelog
+* Mon Mar 16 2015 Ryoichi INAGAKI <ryo1@toki.waseda.jp> 3.10.1-1
+- updated valgrind to 3.10.1 based on fedora 3.10.1-6
+- replaced all Patches (from fedora)
+
 * Wed Apr 18 2012 Yoji TOYODA <bsyamato@sea.plala.or.jp> 3.7.0-1
 - updated valgrind to 3.7.0
 - replace all Patches (from fedora)