valgrind-vl.spec 15 KB

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