valgrind-vl.spec 13 KB

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