valgrind-vl.spec 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434
  1. %bcond_with check
  2. # Only arches that are supported upstream as multilib and that the distro
  3. # has multilib builds for should set build_multilib 1. In practice that
  4. # is only x86_64 and ppc64 (but not in fedora 21 and later, and never
  5. # for ppc64le).
  6. %global build_multilib 0
  7. %ifarch x86_64 ppc64
  8. %global build_multilib 1
  9. %endif
  10. # Vine Linux doesn't have openmpi package
  11. #ifarch %{ix86} x86_64 ppc ppc64 ppc64le %{arm} aarch64
  12. #global build_openmpi 1
  13. #else
  14. %global build_openmpi 0
  15. #endif
  16. %global run_full_regtest 0
  17. %global build_tools_devel 0
  18. # Don't run dwz or generate minisymtab, valgrind doesn't handle compressed
  19. # DWARF very well and it might read its own vgpreload libraries. Generating
  20. # minisymtabs doesn't really work for the staticly linked tools.
  21. %define _find_debuginfo_dwz_opts %{nil}
  22. %undefine _include_minidebuginfo
  23. Summary: Tool for finding memory management bugs in programs
  24. Summary(ja): プログラムのメモリ管理バグを発見するためのツール
  25. Name: valgrind
  26. Version: 3.17.0
  27. Release: 2%{?_dist_release}
  28. Group: programming
  29. Vendor: Project Vine
  30. Distribution: Vine Linux
  31. License: GPLv2+
  32. URL: https://valgrind.org/
  33. Source0: https://sourceware.org/pub/valgrind/%{name}-%{version}.tar.bz2
  34. # Needs investigation and pushing upstream
  35. Patch1: valgrind-3.9.0-cachegrind-improvements.patch
  36. # KDE#211352 - helgrind races in helgrind's own mythread_wrapper
  37. Patch2: valgrind-3.9.0-helgrind-race-supp.patch
  38. # Make ld.so supressions slightly less specific.
  39. Patch3: valgrind-3.9.0-ldso-supp.patch
  40. # Add some stack-protector
  41. Patch4: valgrind-3.16.0-some-stack-protector.patch
  42. # Add some -Wl,z,now.
  43. Patch5: valgrind-3.16.0-some-Wl-z-now.patch
  44. BuildRoot: %{_tmppath}/%{name}-%{version}-root
  45. %if %{build_multilib}
  46. # Ensure glibc{,-devel} is installed for both multilib arches
  47. BuildRequires: compat32-glibc-devel
  48. %endif
  49. BuildRequires: glibc-devel >= 2.14
  50. %if %{build_openmpi}
  51. BuildRequires: openmpi-devel >= 1.3.3
  52. %endif
  53. # For %%build and %%check.
  54. # In case of a software collection, pick the matching gdb and binutils.
  55. BuildRequires: gdb
  56. BuildRequires: binutils
  57. # gdbserver_tests/filter_make_empty uses ps in test
  58. BuildRequires: procps
  59. ExclusiveArch: %{ix86} x86_64 ppc ppc64 ppc64le s390x armv7hl aarch64
  60. %ifarch %{ix86}
  61. %define valarch x86
  62. %define valsecarch %{nil}
  63. %endif
  64. %ifarch x86_64
  65. %define valarch amd64
  66. %define valsecarch x86
  67. %endif
  68. %ifarch ppc
  69. %define valarch ppc32
  70. %define valsecarch %{nil}
  71. %endif
  72. %ifarch ppc64
  73. %define valarch ppc64be
  74. %if %{build_multilib}
  75. %define valsecarch ppc32
  76. %else
  77. %define valsecarch %{nil}
  78. %endif
  79. %endif
  80. %ifarch ppc64le
  81. %define valarch ppc64le
  82. %define valsecarch %{nil}
  83. %endif
  84. %ifarch s390x
  85. %define valarch s390x
  86. %define valsecarch %{nil}
  87. %endif
  88. %ifarch armv7hl
  89. %define valarch arm
  90. %define valsecarch %{nil}
  91. %endif
  92. %ifarch aarch64
  93. %define valarch arm64
  94. %define valsecarch %{nil}
  95. %endif
  96. # Don't run dwz or generate minisymtab, valgrind doesn't handle compressed
  97. # DWARF very well and it might read its own vgpreload libraries. Generating
  98. # minisymtabs doesn't really work for the staticly linked tools.
  99. %define _find_debuginfo_dwz_opts %{nil}
  100. %undefine _include_minidebuginfo
  101. %description
  102. Valgrind is a tool to help you find memory-management problems in your
  103. programs. When a program is run under Valgrind's supervision, all
  104. reads and writes of memory are checked, and calls to
  105. malloc/new/free/delete are intercepted. As a result, Valgrind can
  106. detect a lot of problems that are otherwise very hard to
  107. find/diagnose.
  108. %package devel
  109. Summary: Development files for valgrind
  110. Summary(ja): Valgrind の開発用ファイル
  111. Group: programming
  112. Requires: %{name} = %{version}-%{release}
  113. Provides: %{name}-static = %{version}-%{release}
  114. %description devel
  115. Header files and libraries for development of valgrind aware programs
  116. or valgrind plugins.
  117. %package openmpi
  118. Summary: OpenMPI support for valgrind
  119. Summary(ja): Valgrind の OpenMPI サポート
  120. Group: programming
  121. Requires: %{name} = %{version}-%{release}
  122. %description openmpi
  123. A wrapper library for debugging OpenMPI parallel programs with valgrind.
  124. See the section on Debugging MPI Parallel Programs with Valgrind in the
  125. Valgrind User Manual for details.
  126. %debug_package
  127. %prep
  128. %setup -q -n %{name}-%{version}
  129. %autopatch -p1
  130. # Some patches (might) touch Makefile.am or configure.ac files.
  131. # Just always autoreconf so we don't need patches to prebuild files.
  132. ./autogen.sh
  133. %build
  134. # LTO triggers undefined symbols in valgrind. Valgrind has a --enable-lto
  135. # configure time option, but that doesn't seem to help.
  136. # Disable LTO for now.
  137. %define _lto_cflags %{nil}
  138. CC=gcc
  139. %if %{build_multilib}
  140. # Ugly hack - libgcc 32-bit package might not be installed
  141. mkdir -p shared/libgcc/32
  142. ar r shared/libgcc/32/libgcc_s.a
  143. ar r shared/libgcc/libgcc_s_32.a
  144. CC="gcc -B `pwd`/shared/libgcc/"
  145. %endif
  146. # Old openmpi-devel has version depended paths for mpicc.
  147. %if %{build_openmpi}
  148. %if 0%{?fedora} >= 13 || 0%{?rhel} >= 6
  149. %define mpiccpath %{!?scl:%{_libdir}}%{?scl:%{_root_libdir}}/openmpi/bin/mpicc
  150. %else
  151. %define mpiccpath %{!?scl:%{_libdir}}%{?scl:%{_root_libdir}}/openmpi/*/bin/mpicc
  152. %endif
  153. %else
  154. # We explicitly don't want the libmpi wrapper. So make sure that configure
  155. # doesn't pick some random mpi compiler that happens to be installed.
  156. %define mpiccpath /bin/false
  157. %endif
  158. # Filter out some flags that cause lots of valgrind test failures.
  159. # Also filter away -O2, valgrind adds it wherever suitable, but
  160. # not for tests which should be -O0, as they aren't meant to be
  161. # compiled with -O2 unless explicitely requested. Same for any -mcpu flag.
  162. # Ideally we will change this to only be done for the non-primary build
  163. # and the test suite. Also disable strict symbol checks because the
  164. # vg_preload library will use hidden/undefined symbols from glibc
  165. # like __libc_freeres.
  166. %undefine _hardened_build
  167. %undefine _strict_symbol_defs_build
  168. CFLAGS="`echo " %{optflags} " | sed 's/ -fstack-protector\([-a-z]*\) / / g;s/ -O2 / /g;'`"
  169. LDFLAGS="`echo " %{build_ldflags} " | sed 's/ -Wl,-z,now / / g;'`"
  170. export CFLAGS
  171. export LDFLAGS
  172. %configure CC="$CC" CFLAGS="$OPTFLAGS" CXXFLAGS="$OPTFLAGS" \
  173. --with-mpicc=%{mpiccpath} \
  174. GDB=%{_bindir}/gdb
  175. make %{?_smp_mflags}
  176. %install
  177. rm -rf $RPM_BUILD_ROOT
  178. make DESTDIR=$RPM_BUILD_ROOT install
  179. rm -rf docs/installed
  180. mkdir docs/installed
  181. mv $RPM_BUILD_ROOT%{_datadir}/doc/valgrind/* docs/installed/
  182. rm -f docs/installed/*.ps
  183. # We want the MPI wrapper installed under the openmpi libdir so the script
  184. # generating the MPI library requires picks them up and sets up the right
  185. # openmpi libmpi.so requires. Install symlinks in the original/upstream
  186. # location for backwards compatibility.
  187. %if %{build_openmpi}
  188. pushd $RPM_BUILD_ROOT%{_libdir}
  189. mkdir -p openmpi/valgrind
  190. cd valgrind
  191. mv libmpiwrap-%{valarch}-linux.so ../openmpi/valgrind/
  192. ln -s ../openmpi/valgrind/libmpiwrap-%{valarch}-linux.so
  193. popd
  194. %endif
  195. %if "%{valsecarch}" != ""
  196. pushd $RPM_BUILD_ROOT%{_libdir}/valgrind/
  197. rm -f *-%{valsecarch}-* || :
  198. for i in *-%{valarch}-*; do
  199. j=`echo $i | sed 's/-%{valarch}-/-%{valsecarch}-/'`
  200. ln -sf ../../lib/valgrind/$j $j
  201. done
  202. popd
  203. %endif
  204. %if %{build_tools_devel}
  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 HAVE_AS_AMD64_FXSAVE64 \
  209. ; do
  210. sed -i -e 's,^\(#define '$i' 1\|/\* #undef '$i' \*/\)$,#ifdef __x86_64__\n# define '$i' 1\n#endif,' \
  211. $RPM_BUILD_ROOT%{_includedir}/valgrind/config.h
  212. done
  213. %endif
  214. %else
  215. # Remove files we aren't going to package.
  216. # See tools-devel files.
  217. rm $RPM_BUILD_ROOT%{_includedir}/valgrind/config.h
  218. rm $RPM_BUILD_ROOT%{_includedir}/valgrind/libvex*h
  219. rm $RPM_BUILD_ROOT%{_includedir}/valgrind/pub_tool_*h
  220. rm -rf $RPM_BUILD_ROOT%{_includedir}/valgrind/vki
  221. rm $RPM_BUILD_ROOT%{_libdir}/valgrind/*.a
  222. %endif
  223. # We don't want debuginfo generated for the vgpreload libraries.
  224. # Turn off execute bit so they aren't included in the debuginfo.list.
  225. # We'll turn the execute bit on again in %%files.
  226. chmod 644 $RPM_BUILD_ROOT%{_libexecdir}/valgrind/vgpreload*-*-*so
  227. %if %{with check}
  228. %check
  229. # Make sure a basic binary runs. There should be no errors.
  230. ./vg-in-place --error-exitcode=1 /bin/true --help
  231. # Build the test files with the software collection compiler if available.
  232. %{?scl:PATH=%{_bindir}${PATH:+:${PATH}}}
  233. # Make sure no extra CFLAGS, CXXFLAGS or LDFLAGS leak through,
  234. # the testsuite sets all flags necessary. See also configure above.
  235. make %{?_smp_mflags} CFLAGS="" CXXFLAGS="" LDFLAGS="" check
  236. # Workaround https://bugzilla.redhat.com/show_bug.cgi?id=1434601
  237. # for gdbserver tests.
  238. export PYTHONCOERCECLOCALE=0
  239. echo ===============TESTING===================
  240. %if 0%{?run_full_regtest}
  241. make regtest || :
  242. %else
  243. make nonexp-regtest || :
  244. %endif
  245. # Make sure test failures show up in build.log
  246. # Gather up the diffs (at most the first 20 lines for each one)
  247. MAX_LINES=20
  248. diff_files=`find */tests -name '*.diff*' | sort`
  249. if [ z"$diff_files" = z ] ; then
  250. echo "Congratulations, all tests passed!" >> diffs
  251. else
  252. for i in $diff_files ; do
  253. echo "=================================================" >> diffs
  254. echo $i >> diffs
  255. echo "=================================================" >> diffs
  256. if [ `wc -l < $i` -le $MAX_LINES ] ; then
  257. cat $i >> diffs
  258. else
  259. head -n $MAX_LINES $i >> diffs
  260. echo "<truncated beyond $MAX_LINES lines>" >> diffs
  261. fi
  262. done
  263. fi
  264. cat diffs
  265. echo ===============END TESTING===============
  266. %endif
  267. %clean
  268. [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf ${RPM_BUILD_ROOT}
  269. %files
  270. %defattr(-,root,root)
  271. %license COPYING
  272. %doc NEWS README_*
  273. %doc docs/installed/html docs/installed/*.pdf
  274. %{_bindir}/*
  275. %dir %{_libexecdir}/%{name}
  276. # Install everything in the libdir except the .so.
  277. # The vgpreload so files might need file mode adjustment.
  278. %{_libexecdir}/valgrind/*[^o]
  279. # Turn on executable bit again for vgpreload libraries.
  280. # Was disabled in %%install to prevent debuginfo stripping.
  281. %attr(0755,root,root) %{_libexecdir}/valgrind/vgpreload*-*-*so
  282. %{_mandir}/man1/*
  283. %files devel
  284. %defattr(-,root,root)
  285. %dir %{_includedir}/valgrind
  286. %{_includedir}/valgrind/valgrind.h
  287. %{_includedir}/valgrind/callgrind.h
  288. %{_includedir}/valgrind/drd.h
  289. %{_includedir}/valgrind/helgrind.h
  290. %{_includedir}/valgrind/memcheck.h
  291. %{_includedir}/valgrind/dhat.h
  292. %{_libdir}/pkgconfig/valgrind.pc
  293. %if %{build_tools_devel}
  294. %files tools-devel
  295. %{_includedir}/valgrind/config.h
  296. %{_includedir}/valgrind/libvex*h
  297. %{_includedir}/valgrind/pub_tool_*h
  298. %{_includedir}/valgrind/vki
  299. %dir %{_libdir}/valgrind
  300. %{_libdir}/valgrind/*.a
  301. %endif
  302. %if %{build_openmpi}
  303. %files openmpi
  304. %defattr(-,root,root)
  305. %dir %{_libdir}/valgrind
  306. %{_libdir}/openmpi/valgrind/libmpiwrap*.so
  307. %{_libdir}/valgrind/libmpiwrap*.so
  308. %endif
  309. %changelog
  310. * Thu Aug 05 2021 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 3.17.0-2
  311. - rebuilt with current environment.
  312. * Sat Apr 10 2021 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 3.17.0-1
  313. - new upstream release.
  314. - dropped Patch4, 7-10.
  315. - renumbered patches.
  316. * Wed Feb 10 2021 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 3.16.1-2
  317. - rebuilt with current environment.
  318. * Wed Aug 19 2020 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 3.16.1-1
  319. - new upstream release.
  320. - dropped Patch4-35.
  321. - import Patch4-10 from rawhide.
  322. * Tue Jan 22 2019 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 3.14.0-1
  323. - dropped Patch4-19.
  324. - import Patch4-35 from rawhide.
  325. * Fri Dec 22 2017 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 3.13.0-1
  326. - updated to 3.13.0.
  327. - replaced all Patches (from rawhide).
  328. * Mon Mar 16 2015 Ryoichi INAGAKI <ryo1@toki.waseda.jp> 3.10.1-1
  329. - updated valgrind to 3.10.1 based on fedora 3.10.1-6
  330. - replaced all Patches (from fedora)
  331. * Wed Apr 18 2012 Yoji TOYODA <bsyamato@sea.plala.or.jp> 3.7.0-1
  332. - updated valgrind to 3.7.0
  333. - replace all Patches (from fedora)
  334. * Thu Nov 11 2010 Shu KONNO <owa@bg.wakwak.com> 3.6.0-1
  335. - updated valgrind to 3.6.0
  336. - updated BR: glibc-devel <= 2.12
  337. - added BR: gcc <= 4.5
  338. - added RQ: glibc <= 2.12
  339. * Tue Oct 05 2010 Shu KONNO <owa@bg.wakwak.com> 3.5.0-1
  340. - updated valgrind to 3.5.0
  341. - added BR: glibc-devel >= 2.11
  342. - split %{name}-devel
  343. - added patches (from fedora core 12)
  344. - valgrind-3.5.0-cachegrind-improvements.patch
  345. - valgrind-3.5.0-openat.patch
  346. - valgrind-3.5.0-glibc-2.10.1.patch
  347. - valgrind-3.5.0-ifunc.patch
  348. - valgrind-3.5.0-inotify-init1.patch
  349. - valgrind-3.5.0-mmap-mprotect.patch
  350. - valgrind-3.5.0-dwarf3.patch
  351. - valgrind-3.5.0-pr40659.patch
  352. - valgrind-3.5.0-helgrind-race-supp.patch
  353. - valgrind-3.5.0-ppc-tests.patch
  354. - valgrind-3.5.0-amd64-loopnel.patch
  355. - valgrind-3.5.0-ppc-dwarf3.patch
  356. - valgrind-3.5.0-amd64-adcsbb.patch
  357. - valgrind-3.5.0-syscalls.patch
  358. - valgrind-3.5.0-preadv.patch
  359. - valgrind-3.5.0-glibc-2.11.patch
  360. * Sun Apr 19 2009 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 3.4.1-1vl5
  361. - new upstream release
  362. - changed Group to Development/Tools
  363. * Sun Aug 24 2008 Shu KONNO <owa@bg.wakwak.com> 3.3.1-1vl5
  364. - packaged new