valgrind-vl.spec 14 KB

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