likwid-4.1.1.ebuild 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. # Copyright 1999-2016 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=6
  4. FORTRAN_NEEDED=fortran
  5. inherit fcaps linux-info fortran-2
  6. DESCRIPTION="A performance-oriented tool suite for x86 multicore environments"
  7. HOMEPAGE="https://github.com/rrze-likwid/likwid"
  8. SRC_URI="https://github.com/RRZE-HPC/likwid/archive/likwid-4.1.1.tar.gz"
  9. LICENSE="GPL-3+"
  10. SLOT="0"
  11. KEYWORDS="~amd64"
  12. IUSE="fortran"
  13. RDEPEND="dev-lang/perl"
  14. DEPEND="${RDEPEND}
  15. fortran? ( sys-devel/gcc:*[fortran] )
  16. dev-lang/lua:0"
  17. CONFIG_CHECK="~X86_MSR"
  18. FILECAPS=(
  19. -M 755 cap_sys_rawio usr/sbin/likwid-accessD --
  20. -M 755 cap_sys_rawio usr/bin/likwid-{perfctr,bench,powermeter}
  21. )
  22. # See Bug 558402
  23. PATCHES=(
  24. "${FILESDIR}/${P}-Makefile.patch"
  25. "${FILESDIR}/${P}-fix-gnustack.patch"
  26. "${FILESDIR}/${P}-config.mk.patch"
  27. )
  28. S=${WORKDIR}/likwid-likwid-${PV}
  29. src_prepare() {
  30. # Set PREFIX path to include sandbox path
  31. sed -e 's:^PREFIX = .*:PREFIX = '${D}'/usr:' -i config.mk || die
  32. # Set the path to library directory.
  33. sed -e 's:$(get_libdir):'$(get_libdir)':' -i config.mk || die "Cannot set library path!"
  34. # Set correct LDFLAGS
  35. sed -e '/LIBS/aSHARED_LFLAGS += -Wl,-soname,$@' \
  36. -i make/include_GCC.mk || die
  37. # Insert date and version info man pages
  38. sed -e 's/<DATE>/21.08.2015/g' \
  39. -e "s/VERSION/${PV}/g" \
  40. -i doc/*.1 || die
  41. # Set path to the access daemon, once installed into the system
  42. sed -e "/exeprog/s|TOSTRING(ACCESSDAEMON)|\"/usr/sbin/likwid-accessD\"|" \
  43. -i src/access_client.c || die
  44. # Ensure we build with a non executable stack
  45. sed -e "s:CFLAGS += \$(SHARED_CFLAGS):CFLAGS += \$(SHARED_CFLAGS) -g -Wa,--noexecstack:" \
  46. -i make/config_defines.mk || die
  47. if use fortran; then
  48. # If fortran USE is enabled, enable the fortran interfaces
  49. sed -i 's:^FORTRAN_INTERFACE = false:FORTRAN_INTERFACE = likwid.mod:' config.mk || die
  50. # Set the correct fortrant compiler for GCC
  51. sed -i "s:^FC = ifort:FC = ${FC}:" make/include_GCC.mk || die
  52. # Set the correct FCFLAGS for gcc fortran
  53. sed -i '/^FCFLAGS/c\FCFLAGS = -J ./ -fsyntax-only' make/include_GCC.mk || die
  54. fi
  55. default
  56. }
  57. src_install () {
  58. default
  59. if use fortran; then
  60. insinto /usr/include
  61. doins likwid.mod
  62. fi
  63. doman doc/*.1
  64. }
  65. pkg_postinst() {
  66. fcaps_pkg_postinst
  67. ewarn "To enable users to access performance counters it is necessary to"
  68. ewarn "change the access permissions to /dev/cpu/msr[0]* devices."
  69. ewarn "It can be accomplished by adding the following line to file"
  70. ewarn "/etc/udev/rules.d/99-myrules.rules: KERNEL==\"msr[0-9]*\" MODE=\"0666\""
  71. }