Gentoo Archives: gentoo-commits

From: Matthias Maier <tamiko@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-apps/likwid/
Date: Fri, 03 Jun 2022 04:30:03
Message-Id: 1654230591.1efac637754de80ed8bb6f397c16d44cfcc334c4.tamiko@gentoo
1 commit: 1efac637754de80ed8bb6f397c16d44cfcc334c4
2 Author: Matthias Maier <tamiko <AT> gentoo <DOT> org>
3 AuthorDate: Fri Jun 3 04:26:53 2022 +0000
4 Commit: Matthias Maier <tamiko <AT> gentoo <DOT> org>
5 CommitDate: Fri Jun 3 04:29:51 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1efac637
7
8 sys-apps/likwid: add 5.2.1
9
10 Closes: https://bugs.gentoo.org/800106
11 Closes: https://bugs.gentoo.org/808225
12 Closes: https://bugs.gentoo.org/822141
13 Closes: https://bugs.gentoo.org/828825
14 Signed-off-by: Matthias Maier <tamiko <AT> gentoo.org>
15
16 sys-apps/likwid/Manifest | 1 +
17 sys-apps/likwid/likwid-5.2.1.ebuild | 147 ++++++++++++++++++++++++++++++++++++
18 2 files changed, 148 insertions(+)
19
20 diff --git a/sys-apps/likwid/Manifest b/sys-apps/likwid/Manifest
21 index 16c593487b67..0ad4fd9fba92 100644
22 --- a/sys-apps/likwid/Manifest
23 +++ b/sys-apps/likwid/Manifest
24 @@ -1 +1,2 @@
25 DIST likwid-4.3.4.tar.gz 1584829 BLAKE2B dcd1c3a0c5e549dc3d22bb98120339521e270da55460f5af9f2fe04849af0fe1ac4d9b881883a4efc3695ceb087d1afad5bcc55b55543199d2c33b0f5012cc68 SHA512 f1ee930a98d160728078a81a2cdc798ec62ac484545ced937131e6a6443e5ac23b8e597d31c7b1b9f67c1169e1c662c366cf1098158cb467d9f7ff12946b08a2
26 +DIST likwid-5.2.1.tar.gz 2308041 BLAKE2B 1913212fb5157365a439757018ab58b4555e2b4401575ee05c784d038e13296644a7d0a89769599eef0444b13ed10f0357ad09b9cbae712f7d1fb9cca65fb1e3 SHA512 f096dcc071e976284c874aeb254dcb83c66ae808876a8c6be7b05e359d06800f1da25c01c072950c3493eb9ca10f6f9d81624feef61cc7a01f40fc0d003f98a7
27
28 diff --git a/sys-apps/likwid/likwid-5.2.1.ebuild b/sys-apps/likwid/likwid-5.2.1.ebuild
29 new file mode 100644
30 index 000000000000..ed2192fcf1bc
31 --- /dev/null
32 +++ b/sys-apps/likwid/likwid-5.2.1.ebuild
33 @@ -0,0 +1,147 @@
34 +# Copyright 1999-2022 Gentoo Authors
35 +# Distributed under the terms of the GNU General Public License v2
36 +
37 +EAPI=8
38 +
39 +FORTRAN_NEEDED=fortran
40 +
41 +inherit fcaps fortran-2 linux-info toolchain-funcs
42 +
43 +DESCRIPTION="A performance-oriented tool suite for x86 multicore environments"
44 +HOMEPAGE="https://github.com/rrze-likwid/likwid"
45 +SRC_URI="https://ftp.fau.de/pub/likwid/${P}.tar.gz"
46 +
47 +LICENSE="GPL-3+ BSD MIT"
48 +
49 +SLOT="0"
50 +KEYWORDS="~amd64" # upstream partial support exists for x86 arm arm64
51 +IUSE="fortran"
52 +
53 +CDEPEND="dev-lang/perl"
54 +
55 +RDEPEND="${CDEPEND}"
56 +DEPEND="${CDEPEND}"
57 +
58 +CONFIG_CHECK="~X86_MSR"
59 +
60 +FILECAPS=(
61 + -M 755 cap_sys_rawio+ep usr/sbin/likwid-accessD
62 + --
63 + -M 755 cap_sys_rawio+ep usr/sbin/likwid-setFreq
64 +)
65 +
66 +PATCHES=(
67 + "${FILESDIR}/${PN}-4.3.1-fix-gnustack.patch"
68 +)
69 +
70 +pkg_setup() {
71 + fortran-2_pkg_setup
72 +}
73 +
74 +src_prepare() {
75 + # Ensure we build with a non executable stack
76 + sed \
77 + -e '/^SHARED_CFLAGS/s/$/ -Wa,--noexecstack/' \
78 + -i make/include_{GCC*,CLANG}.mk \
79 + || die "Failed to set nonexecstack"
80 +
81 + # Make the install targets respect Q= for being quiet or not
82 + # MUCH easier for debugging
83 + sed -r \
84 + -e '/^install/,/^[a-z]/{/^\t@/{ s/@/$(Q)/; }}' \
85 + -i \
86 + Makefile || die "Failed to sed Makefile"
87 +
88 + sed -i \
89 + -e '/^\.NOTPARALLEL:/d' \
90 + Makefile \
91 + bench/Makefile \
92 + ext/hwloc/Makefile || die "Failed to re-enable parallel"
93 +
94 + default
95 +}
96 +
97 +export_emake_opts() {
98 + # Warning: this build system uses PREFIX in a way that differs from
99 + # autoconf! It's more like:
100 + # PREFIX=$(DESTDIR)$(INSTALLED_PREFIX)
101 + # it's not 100% like that, because parts of the Makefiles are inconsistent.
102 + # this is the same solution used in the upstream RPM specs
103 + # these variables are uppercase so they match what's put into Make.
104 + local INSTALLED_PREFIX=/usr
105 + local INSTALLED_LIBPREFIX=/usr/$(get_libdir) # upstream is '$(INSTALLED_PREFIX)/lib'
106 + local INSTALLED_MANPREFIX=/usr/share/man # upstream has it as used but undefined variable.
107 + # If the build is too loud, pass 'Q=@'
108 + src_compile_opts=(
109 + "Q="
110 + "INSTALLED_PREFIX=${INSTALLED_PREFIX}"
111 + "INSTALLED_LIBPREFIX=${INSTALLED_LIBPREFIX}"
112 + "INSTALLED_MANPREFIX=${INSTALLED_MANPREFIX}"
113 + "PREFIX=${INSTALLED_PREFIX}"
114 + "LIBPREFIX=${INSTALLED_LIBPREFIX}"
115 + "MANPREFIX=${INSTALLED_MANPREFIX}"
116 + "CC=$(tc-getCC)"
117 + "ANSI_CFLAGS=${CFLAGS}"
118 + "INSTRUMENT_BENCH=true"
119 + "FORTRAN_INTERFACE=$(usex fortran likwid.mod false)"
120 + "FC=$(usex fortran "${FC}" false)"
121 + "FCFLAGS=-J ./ -fsyntax-only" # needed for building correctly
122 + )
123 + src_install_opts=(
124 + "PREFIX=${D}${INSTALLED_PREFIX}"
125 + "LIBPREFIX=${D}${INSTALLED_LIBPREFIX}"
126 + "MANPREFIX=${D}${INSTALLED_MANPREFIX}"
127 + )
128 +}
129 +
130 +src_compile() {
131 + export_emake_opts
132 + emake \
133 + "${src_compile_opts[@]}" \
134 + || die 'emake failed'
135 +}
136 +
137 +src_install () {
138 + export_emake_opts
139 + emake \
140 + "${src_compile_opts[@]}" \
141 + "${src_install_opts[@]}" \
142 + DESTDIR="${D}" \
143 + install || die 'emake install failed'
144 +
145 + use fortran && doheader likwid.mod
146 +
147 + # Fix Python filter added shortly after 4.3.3
148 + #python_fix_shebang "${D}"/usr/share/likwid/filter/
149 +
150 + # Do NOT use 'doman'! The upstream 'make install' target does a sed as it's
151 + # generating the final manpage to the real install dir; and the copies in
152 + # ${S} are unmodified.
153 + dodoc README.md CHANGELOG
154 + dodoc doc/*.txt
155 + dodoc doc/*.md
156 + dodoc -r doc/applications doc/archs
157 + # Fix upstream partial doc install
158 + rm -rf "${D}"/usr/share/likwid/docs || die
159 + ln -sf "/usr/share/doc/${PF}" "${D}"/usr/share/likwid/docs || die
160 +}
161 +
162 +pkg_preinst() {
163 + # This is now a symlink, but used to be a plain directory
164 + OLDDOCDIR=/usr/share/likwid/docs
165 + if [[ ! -L "${OLDDOCDIR}" && -d "${OLDDOCDIR}" ]]; then
166 + einfo "Cleaning up old docdir at ${OLDDOCDIR}"
167 + rm -rf "${OLDDOCDIR}" || die
168 + fi
169 +}
170 +
171 +pkg_postinst() {
172 + fcaps_pkg_postinst
173 + einfo "If you get 'Cannot gather values from MSR_PLATFORM_INFO', then 'modprobe msr'!"
174 + einfo
175 + ewarn "To enable users to access performance counters it is necessary to"
176 + ewarn "change the access permissions to /dev/cpu/msr[0]* devices."
177 + ewarn "It can be accomplished by adding the following line to file"
178 + ewarn "/etc/udev/rules.d/99-myrules.rules: KERNEL==\"msr[0-9]*\" MODE=\"0666\""
179 + ewarn "Alternatively, assign the MSR files to a unique group and use mode 0660"
180 +}