valgrind-vl.spec 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352
  1. # Only arches that are supported upstream as multilib and that the distro
  2. # has multilib builds for should set build_multilib 1. In practice that
  3. # is only x86_64 and ppc64 (but not in fedora 21 and later, and never
  4. # for ppc64le).
  5. %global build_multilib 0
  6. %ifarch x86_64 ppc64
  7. %global build_multilib 1
  8. %endif
  9. # Vine Linux doesn't have openmpi package
  10. #ifarch %{ix86} x86_64 ppc ppc64 ppc64le %{arm} aarch64
  11. #global build_openmpi 1
  12. #else
  13. %global build_openmpi 0
  14. #endif
  15. # Don't run dwz or generate minisymtab, valgrind doesn't handle compressed
  16. # DWARF very well and it might read its own vgpreload libraries. Generating
  17. # minisymtabs doesn't really work for the staticly linked tools.
  18. %define _find_debuginfo_dwz_opts %{nil}
  19. %undefine _include_minidebuginfo
  20. Name: valgrind
  21. Version: 3.10.1
  22. Release: 1%{?_dist_release}
  23. Summary: Tool for finding memory management bugs in programs
  24. Summary(ja): プログラムのメモリ管理バグを発見するためのツール
  25. License: GPLv2+
  26. Group: Development/Debuggers
  27. URL: http://valgrind.org/
  28. Source0: http://valgrind.org/downloads/%{name}-%{version}.tar.bz2
  29. # Needs investigation and pushing upstream
  30. Patch1: valgrind-3.9.0-cachegrind-improvements.patch
  31. # KDE#211352 - helgrind races in helgrind's own mythread_wrapper
  32. Patch2: valgrind-3.9.0-helgrind-race-supp.patch
  33. # undef st_atime, st_mtime and st_ctime. Unknown why this is (still?) needed.
  34. Patch3: valgrind-3.9.0-stat_h.patch
  35. # Make ld.so supressions slightly less specific.
  36. Patch4: valgrind-3.9.0-ldso-supp.patch
  37. # KDE#342795 Internal glibc __GI_mempcpy call should be intercepted
  38. Patch5: valgrind-3.10.1-mempcpy.patch
  39. # KDE#343802 - s390x memcheck reports spurious conditional jump
  40. Patch6: valgrind-3.10-s390-spechelper.patch
  41. # KDE#342038, KDE#343732, KDE#343733, KDE#344007, KDE#344307
  42. # mbind, get_mempolicy, set_mempolicy, flock, setgid, msgget, msgctl,
  43. # msgrcv, msgsnd, accept4, mount, umount2
  44. Patch7: valgrind-3.10.1-aarch64-syscalls.patch
  45. # KDE#344007 ppc64 missing accept4 syscall
  46. Patch8: valgrind-3.10.1-ppc64-accept4.patch
  47. # KDE#344279 - syscall sendmmsg on arm64 (269) and ppc32/64 (349) unhandled
  48. # KDE#344295 - syscall recvmmsg on arm64 (243) and ppc32/64 (343) unhandled
  49. # KDE#344318 - socketcall should wrap recvmmsg and sendmmsg
  50. Patch9: valgrind-3.10.1-send-recv-mmsg.patch
  51. # Upstream valgrind svn r14530
  52. Patch10: valgrind-3.10.1-glibc-version-check.patch
  53. Buildroot: %{_tmppath}/%{name}-%{version}-root
  54. %if %{build_multilib}
  55. # Ensure glibc{,-devel} is installed for both multilib arches
  56. BuildRequires: /lib/libc.so.6 /usr/lib/libc.so /lib64/libc.so.6 /usr/lib64/libc.so
  57. %endif
  58. BuildRequires: glibc-devel >= 2.14
  59. %if %{build_openmpi}
  60. BuildRequires: openmpi-devel >= 1.3.3
  61. %endif
  62. # For %%build and %%check.
  63. # In case of a software collection, pick the matching gdb and binutils.
  64. BuildRequires: gdb
  65. BuildRequires: binutils
  66. # gdbserver_tests/filter_make_empty uses ps in test
  67. BuildRequires: procps
  68. ExclusiveArch: %{ix86} x86_64 ppc ppc64 ppc64le s390x armv7hl aarch64
  69. %ifarch %{ix86}
  70. %define valarch x86
  71. %define valsecarch %{nil}
  72. %endif
  73. %ifarch x86_64
  74. %define valarch amd64
  75. %define valsecarch x86
  76. %endif
  77. %ifarch ppc
  78. %define valarch ppc32
  79. %define valsecarch %{nil}
  80. %endif
  81. %ifarch ppc64
  82. %define valarch ppc64be
  83. %if %{build_multilib}
  84. %define valsecarch ppc32
  85. %else
  86. %define valsecarch %{nil}
  87. %endif
  88. %endif
  89. %ifarch ppc64le
  90. %define valarch ppc64le
  91. %define valsecarch %{nil}
  92. %endif
  93. %ifarch s390x
  94. %define valarch s390x
  95. %define valsecarch %{nil}
  96. %endif
  97. %ifarch armv7hl
  98. %define valarch arm
  99. %define valsecarch %{nil}
  100. %endif
  101. %ifarch aarch64
  102. %define valarch arm64
  103. %define valsecarch %{nil}
  104. %endif
  105. # Don't run dwz or generate minisymtab, valgrind doesn't handle compressed
  106. # DWARF very well and it might read its own vgpreload libraries. Generating
  107. # minisymtabs doesn't really work for the staticly linked tools.
  108. %define _find_debuginfo_dwz_opts %{nil}
  109. %undefine _include_minidebuginfo
  110. %description
  111. Valgrind is a tool to help you find memory-management problems in your
  112. programs. When a program is run under Valgrind's supervision, all
  113. reads and writes of memory are checked, and calls to
  114. malloc/new/free/delete are intercepted. As a result, Valgrind can
  115. detect a lot of problems that are otherwise very hard to
  116. find/diagnose.
  117. %package devel
  118. Summary: Development files for valgrind
  119. Summary(ja): Valgrind の開発用ファイル
  120. Group: Development/Libraries
  121. Requires: %{name} = %{version}-%{release}
  122. Provides: %{name}-static = %{version}-%{release}
  123. %description devel
  124. Header files and libraries for development of valgrind aware programs
  125. or valgrind plugins.
  126. %package openmpi
  127. Summary: OpenMPI support for valgrind
  128. Summary(ja): Valgrind の OpenMPI サポート
  129. Group: Development/Debuggers
  130. Requires: %{name} = %{version}-%{release}
  131. %description openmpi
  132. A wrapper library for debugging OpenMPI parallel programs with valgrind.
  133. See the section on Debugging MPI Parallel Programs with Valgrind in the
  134. Valgrind User Manual for details.
  135. %prep
  136. %setup -q -n %{name}-%{version}
  137. %patch1 -p1
  138. %patch2 -p1
  139. %patch3 -p1
  140. %patch4 -p1
  141. %patch5 -p1
  142. %patch6 -p1
  143. %patch7 -p1
  144. %patch8 -p1
  145. %patch9 -p1
  146. %patch10 -p1
  147. %build
  148. CC=gcc
  149. %if %{build_multilib}
  150. # Ugly hack - libgcc 32-bit package might not be installed
  151. mkdir -p shared/libgcc/32
  152. ar r shared/libgcc/32/libgcc_s.a
  153. ar r shared/libgcc/libgcc_s_32.a
  154. CC="gcc -B `pwd`/shared/libgcc/"
  155. %endif
  156. %define mpiccpath %{_libdir}/openmpi/*/bin/mpicc
  157. # Filter out some flags that cause lots of valgrind test failures.
  158. # Also filter away -O2, valgrind adds it wherever suitable, but
  159. # not for tests which should be -O0, as they aren't meant to be
  160. # compiled with -O2 unless explicitely requested. Same for any -mcpu flag.
  161. # Ideally we will change this to only be done for the non-primary build
  162. # and the test suite.
  163. 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/ $//'`"
  164. %configure CC="$CC" CFLAGS="$OPTFLAGS" CXXFLAGS="$OPTFLAGS" \
  165. %if %{build_openmpi}
  166. --with-mpicc=%{mpiccpath} \
  167. %endif
  168. GDB=%{_bindir}/gdb
  169. make %{?_smp_mflags}
  170. # Ensure there are no unexpected file descriptors open,
  171. # the testsuite otherwise fails.
  172. cat > close_fds.c <<EOF
  173. #include <stdlib.h>
  174. #include <unistd.h>
  175. int main (int argc, char *const argv[])
  176. {
  177. int i, j = sysconf (_SC_OPEN_MAX);
  178. if (j < 0)
  179. exit (1);
  180. for (i = 3; i < j; ++i)
  181. close (i);
  182. execvp (argv[1], argv + 1);
  183. exit (1);
  184. }
  185. EOF
  186. gcc $RPM_OPT_FLAGS -o close_fds close_fds.c
  187. %install
  188. rm -rf $RPM_BUILD_ROOT
  189. make install DESTDIR=$RPM_BUILD_ROOT
  190. rm -rf docs.installed
  191. mkdir docs.installed
  192. mv $RPM_BUILD_ROOT%{_datadir}/doc/%{name}/* docs.installed/
  193. rm -f docs.installed/*.ps
  194. %if "%{valsecarch}" != ""
  195. pushd $RPM_BUILD_ROOT%{_libdir}/valgrind/
  196. rm -f *-%{valsecarch}-* || :
  197. for i in *-%{valarch}-*; do
  198. j=`echo $i | sed 's/-%{valarch}-/-%{valsecarch}-/'`
  199. ln -sf ../../lib/valgrind/$j $j
  200. done
  201. popd
  202. %endif
  203. # remove unuse files
  204. rm -f $RPM_BUILD_ROOT%{_libdir}/valgrind/*.supp.in
  205. %ifarch %{ix86} x86_64
  206. # To avoid multilib clashes in between i?86 and x86_64,
  207. # tweak installed <valgrind/config.h> a little bit.
  208. for i in HAVE_PTHREAD_CREATE_GLIBC_2_0 HAVE_PTRACE_GETREGS ; do
  209. sed -i -e 's,^\(#define '$i' 1\|/\* #undef '$i' \*/\)$,#ifdef __x86_64__\n# define '$i' 1\n#endif,' \
  210. $RPM_BUILD_ROOT%{_includedir}/valgrind/config.h
  211. done
  212. %endif
  213. %check
  214. # Make sure a basic binary runs.
  215. ./vg-in-place /bin/true
  216. # Make sure no extra CFLAGS leak through, the testsuite sets all flags
  217. # necessary. See also configure above.
  218. make %{?_smp_mflags} CFLAGS="" check || :
  219. echo ===============TESTING===================
  220. ./close_fds make regtest || :
  221. # Make sure test failures show up in build.log
  222. # Gather up the diffs (at most the first 20 lines for each one)
  223. MAX_LINES=20
  224. diff_files=`find . -name '*.diff' | sort`
  225. if [ z"$diff_files" = z ] ; then
  226. echo "Congratulations, all tests passed!" >> diffs
  227. else
  228. for i in $diff_files ; do
  229. echo "=================================================" >> diffs
  230. echo $i >> diffs
  231. echo "=================================================" >> diffs
  232. if [ `wc -l < $i` -le $MAX_LINES ] ; then
  233. cat $i >> diffs
  234. else
  235. head -n $MAX_LINES $i >> diffs
  236. echo "<truncated beyond $MAX_LINES lines>" >> diffs
  237. fi
  238. done
  239. fi
  240. cat diffs
  241. echo ===============END TESTING===============
  242. %clean
  243. [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf ${RPM_BUILD_ROOT}
  244. %files
  245. %defattr(-,root,root)
  246. %doc COPYING NEWS README_*
  247. %doc docs.installed/html docs.installed/*.pdf
  248. %{_bindir}/*
  249. %dir %{_libdir}/%{name}
  250. %{_libdir}/%{name}/*[^ao]
  251. %{_libdir}/%{name}/[^l]*o
  252. %{_mandir}/man1/*
  253. %files devel
  254. %defattr(-,root,root)
  255. %{_includedir}/%{name}
  256. %dir %{_libdir}/%{name}
  257. %{_libdir}/%{name}/*.a
  258. %{_libdir}/pkgconfig/%{name}.pc
  259. %if %{build_openmpi}
  260. %files openmpi
  261. %defattr(-,root,root)
  262. %dir %{_libdir}/%{name}
  263. %{_libdir}/%{name}/libmpiwrap*.so
  264. %endif
  265. %changelog
  266. * Mon Mar 16 2015 Ryoichi INAGAKI <ryo1@toki.waseda.jp> 3.10.1-1
  267. - updated valgrind to 3.10.1 based on fedora 3.10.1-6
  268. - replaced all Patches (from fedora)
  269. * Wed Apr 18 2012 Yoji TOYODA <bsyamato@sea.plala.or.jp> 3.7.0-1
  270. - updated valgrind to 3.7.0
  271. - replace all Patches (from fedora)
  272. * Thu Nov 11 2010 Shu KONNO <owa@bg.wakwak.com> 3.6.0-1
  273. - updated valgrind to 3.6.0
  274. - updated BR: glibc-devel <= 2.12
  275. - added BR: gcc <= 4.5
  276. - added RQ: glibc <= 2.12
  277. * Tue Oct 05 2010 Shu KONNO <owa@bg.wakwak.com> 3.5.0-1
  278. - updated valgrind to 3.5.0
  279. - added BR: glibc-devel >= 2.11
  280. - split %{name}-devel
  281. - added patches (from fedora core 12)
  282. - valgrind-3.5.0-cachegrind-improvements.patch
  283. - valgrind-3.5.0-openat.patch
  284. - valgrind-3.5.0-glibc-2.10.1.patch
  285. - valgrind-3.5.0-ifunc.patch
  286. - valgrind-3.5.0-inotify-init1.patch
  287. - valgrind-3.5.0-mmap-mprotect.patch
  288. - valgrind-3.5.0-dwarf3.patch
  289. - valgrind-3.5.0-pr40659.patch
  290. - valgrind-3.5.0-helgrind-race-supp.patch
  291. - valgrind-3.5.0-ppc-tests.patch
  292. - valgrind-3.5.0-amd64-loopnel.patch
  293. - valgrind-3.5.0-ppc-dwarf3.patch
  294. - valgrind-3.5.0-amd64-adcsbb.patch
  295. - valgrind-3.5.0-syscalls.patch
  296. - valgrind-3.5.0-preadv.patch
  297. - valgrind-3.5.0-glibc-2.11.patch
  298. * Sun Apr 19 2009 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 3.4.1-1vl5
  299. - new upstream release
  300. - changed Group to Development/Tools
  301. * Sun Aug 24 2008 Shu KONNO <owa@bg.wakwak.com> 3.3.1-1vl5
  302. - packaged new