Gentoo Archives: gentoo-commits

From: Matthias Maier <tamiko@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/dev/tamiko:master commit in: sys-apps/likwid/files/, sys-apps/likwid/
Date: Thu, 31 Oct 2019 04:49:30
Message-Id: 1572497272.b509733e3a93ec709fcc15e85afcf0fea67f89c9.tamiko@gentoo
1 commit: b509733e3a93ec709fcc15e85afcf0fea67f89c9
2 Author: Matthias Maier <tamiko <AT> gentoo <DOT> org>
3 AuthorDate: Thu Oct 31 04:47:52 2019 +0000
4 Commit: Matthias Maier <tamiko <AT> gentoo <DOT> org>
5 CommitDate: Thu Oct 31 04:47:52 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/dev/tamiko.git/commit/?id=b509733e
7
8 sys-apps/likwid: add package and use bundled lua
9
10 Package-Manager: Portage-2.3.78, Repoman-2.3.17
11 Signed-off-by: Matthias Maier <tamiko <AT> gentoo.org>
12
13 sys-apps/likwid/Manifest | 1 +
14 .../likwid/files/likwid-4.3.1-fix-gnustack.patch | 32 +++++
15 sys-apps/likwid/likwid-4.3.4-r50.ebuild | 151 +++++++++++++++++++++
16 sys-apps/likwid/metadata.xml | 11 ++
17 4 files changed, 195 insertions(+)
18
19 diff --git a/sys-apps/likwid/Manifest b/sys-apps/likwid/Manifest
20 new file mode 100644
21 index 0000000..4b7da33
22 --- /dev/null
23 +++ b/sys-apps/likwid/Manifest
24 @@ -0,0 +1 @@
25 +DIST likwid-4.3.4.tar.gz 1584829 SHA256 5c0d1c66b25dac8292a02232f06454067f031a238f010c62f40ef913c6609a83 SHA512 f1ee930a98d160728078a81a2cdc798ec62ac484545ced937131e6a6443e5ac23b8e597d31c7b1b9f67c1169e1c662c366cf1098158cb467d9f7ff12946b08a2 WHIRLPOOL 956070af7bd2893bfe8bbd994d44ba783795916f3f70e0253501e798b2cc4880a77a541c4089749decd4fd4ba14e7170c3404096b334377ac6caa322d1ed8aaa
26
27 diff --git a/sys-apps/likwid/files/likwid-4.3.1-fix-gnustack.patch b/sys-apps/likwid/files/likwid-4.3.1-fix-gnustack.patch
28 new file mode 100644
29 index 0000000..c543a6c
30 --- /dev/null
31 +++ b/sys-apps/likwid/files/likwid-4.3.1-fix-gnustack.patch
32 @@ -0,0 +1,32 @@
33 +--- likwid-likwid-4.3.1/bench/Makefile.org 2018-02-26 14:03:17.706837535 +0800
34 ++++ likwid-likwid-4.3.1/bench/Makefile 2018-02-26 14:04:19.427195208 +0800
35 +@@ -115,6 +115,7 @@
36 + $(BUILD_DIR)/%.o: $(BUILD_DIR)/%.pas
37 + @echo "===> ASSEMBLE $@"
38 + $(Q)$(PAS) -i $(PASFLAGS) -o $(BUILD_DIR)/$*.s $< '$(DEFINES)'
39 ++ @cat ../fix_gnustack.txt >> $(BUILD_DIR)/$*.s
40 + $(Q)$(AS) $(ASFLAGS) $(BUILD_DIR)/$*.s -o $@
41 +
42 + ifeq ($(findstring $(MAKECMDGOALS),clean),)
43 +
44 +diff --git a/fix_gnustack.txt b/fix_gnustack.txt
45 +new file mode 100644
46 +index 0000000..965af94
47 +--- /dev/null
48 ++++ likwid-likwid-4.1.1/fix_gnustack.txt
49 +@@ -0,0 +1,3 @@
50 ++#if defined(__linux__) && defined(__ELF__)
51 ++.section .note.GNU-stack,"",%progbits
52 ++#endif
53 +
54 +--- likwid-likwid-4.3.1/src/loadData.S.org 2018-02-26 14:06:16.418872121 +0800
55 ++++ likwid-likwid-4.3.1/src/loadData.S 2018-02-26 14:19:03.281289307 +0800
56 +@@ -41,4 +41,6 @@
57 + #endif
58 + .size _loadData, .-_loadData
59 +
60 +-
61 ++#if defined(__linux__) && defined(__ELF__)
62 ++.section .note.GNU-stack,"",%progbits
63 ++#endif
64 +
65
66 diff --git a/sys-apps/likwid/likwid-4.3.4-r50.ebuild b/sys-apps/likwid/likwid-4.3.4-r50.ebuild
67 new file mode 100644
68 index 0000000..59693e7
69 --- /dev/null
70 +++ b/sys-apps/likwid/likwid-4.3.4-r50.ebuild
71 @@ -0,0 +1,151 @@
72 +# Copyright 1999-2019 Gentoo Authors
73 +# Distributed under the terms of the GNU General Public License v2
74 +
75 +EAPI=6
76 +
77 +FORTRAN_NEEDED=fortran
78 +#PYTHON_COMPAT=( python3_{5,6,7} )
79 +
80 +# 4.3.4 will need python-single-r1
81 +inherit fcaps fortran-2 linux-info toolchain-funcs
82 +
83 +DESCRIPTION="A performance-oriented tool suite for x86 multicore environments"
84 +HOMEPAGE="https://github.com/rrze-likwid/likwid"
85 +SRC_URI="https://ftp.fau.de/pub/likwid/${P}.tar.gz"
86 +
87 +LICENSE="GPL-3+ BSD MIT"
88 +
89 +SLOT="0"
90 +KEYWORDS="~amd64" # upstream partial support exists for x86 arm arm64
91 +IUSE="fortran" # ${PYTHON_REQUIRED_USE}
92 +
93 +CDEPEND="dev-lang/perl"
94 +
95 +# filter/json uses Python3
96 +RDEPEND="${CDEPEND}"
97 +
98 +DEPEND="${CDEPEND}"
99 +
100 +CONFIG_CHECK="~X86_MSR"
101 +
102 +FILECAPS=(
103 + -M 755 cap_sys_rawio+ep usr/sbin/likwid-accessD
104 + --
105 + -M 755 cap_sys_rawio+ep usr/sbin/likwid-setFreq
106 +)
107 +
108 +PATCHES=(
109 + "${FILESDIR}/${PN}-4.3.1-fix-gnustack.patch"
110 +)
111 +
112 +pkg_setup() {
113 + fortran-2_pkg_setup
114 +}
115 +
116 +src_prepare() {
117 + # Ensure we build with a non executable stack
118 + sed \
119 + -e '/^SHARED_CFLAGS/s/$/ -Wa,--noexecstack/' \
120 + -i make/include_{GCC*,CLANG}.mk \
121 + || die "Failed to set nonexecstack"
122 +
123 + # Make the install targets respect Q= for being quiet or not
124 + # MUCH easier for debugging
125 + sed -r \
126 + -e '/^install/,/^[a-z]/{/^\t@/{ s/@/$(Q)/; }}' \
127 + -i \
128 + Makefile || die "Failed to sed Makefile"
129 +
130 + sed -i \
131 + -e '/^\.NOTPARALLEL:/d' \
132 + Makefile \
133 + bench/Makefile \
134 + ext/hwloc/Makefile || die "Failed to re-enable parallel"
135 +
136 + default
137 +}
138 +
139 +export_emake_opts() {
140 + # Warning: this build system uses PREFIX in a way that differs from
141 + # autoconf! It's more like:
142 + # PREFIX=$(DESTDIR)$(INSTALLED_PREFIX)
143 + # it's not 100% like that, because parts of the Makefiles are inconsistent.
144 + # this is the same solution used in the upstream RPM specs
145 + # these variables are uppercase so they match what's put into Make.
146 + local INSTALLED_PREFIX=/usr
147 + local INSTALLED_LIBPREFIX=/usr/$(get_libdir) # upstream is '$(INSTALLED_PREFIX)/lib'
148 + local INSTALLED_MANPREFIX=/usr/share/man # upstream has it as used but undefined variable.
149 + # If the build is too loud, pass 'Q=@'
150 + src_compile_opts=(
151 + "Q="
152 + "INSTALLED_PREFIX=${INSTALLED_PREFIX}"
153 + "INSTALLED_LIBPREFIX=${INSTALLED_LIBPREFIX}"
154 + "INSTALLED_MANPREFIX=${INSTALLED_MANPREFIX}"
155 + "PREFIX=${INSTALLED_PREFIX}"
156 + "LIBPREFIX=${INSTALLED_LIBPREFIX}"
157 + "MANPREFIX=${INSTALLED_MANPREFIX}"
158 + "CC=$(tc-getCC)"
159 + "ANSI_CFLAGS=${CFLAGS}"
160 + "INSTRUMENT_BENCH=true"
161 + "FORTRAN_INTERFACE=$(usex fortran likwid.mod false)"
162 + "FC=$(usex fortran "${FC}" false)"
163 + "FCFLAGS=-J ./ -fsyntax-only" # needed for building correctly
164 + )
165 + src_install_opts=(
166 + "PREFIX=${D}${INSTALLED_PREFIX}"
167 + "LIBPREFIX=${D}${INSTALLED_LIBPREFIX}"
168 + "MANPREFIX=${D}${INSTALLED_MANPREFIX}"
169 + )
170 +}
171 +
172 +src_compile() {
173 + export_emake_opts
174 + emake \
175 + "${src_compile_opts[@]}" \
176 + || die 'emake failed'
177 +}
178 +
179 +src_install () {
180 + export_emake_opts
181 + emake \
182 + "${src_compile_opts[@]}" \
183 + "${src_install_opts[@]}" \
184 + DESTDIR="${D}" \
185 + install || die 'emake install failed'
186 +
187 + use fortran && doheader likwid.mod
188 +
189 + # Fix Python filter added shortly after 4.3.3
190 + #python_fix_shebang "${D}"/usr/share/likwid/filter/
191 +
192 + # Do NOT use 'doman'! The upstream 'make install' target does a sed as it's
193 + # generating the final manpage to the real install dir; and the copies in
194 + # ${S} are unmodified.
195 + dodoc README.md CHANGELOG doc/logo.png
196 + dodoc doc/*.txt
197 + dodoc doc/*.md
198 + dodoc -r doc/applications doc/archs
199 + # Fix upstream partial doc install
200 + rm -rf "${D}"/usr/share/likwid/docs || die
201 + ln -sf "/usr/share/doc/${PF}" "${D}"/usr/share/likwid/docs || die
202 +}
203 +
204 +pkg_preinst() {
205 + # This is now a symlink, but used to be a plain directory
206 + OLDDOCDIR=/usr/share/likwid/docs
207 + if [[ ! -L "${OLDDOCDIR}" && -d "${OLDDOCDIR}" ]]; then
208 + einfo "Cleaning up old docdir at ${OLDDOCDIR}"
209 + rm -rf "${OLDDOCDIR}" || die
210 + fi
211 +}
212 +
213 +pkg_postinst() {
214 + fcaps_pkg_postinst
215 + einfo "If you get 'Cannot gather values from MSR_PLATFORM_INFO', then 'modprobe msr'!"
216 + einfo
217 + ewarn "To enable users to access performance counters it is necessary to"
218 + ewarn "change the access permissions to /dev/cpu/msr[0]* devices."
219 + ewarn "It can be accomplished by adding the following line to file"
220 + ewarn "/etc/udev/rules.d/99-myrules.rules: KERNEL==\"msr[0-9]*\" MODE=\"0666\""
221 + ewarn "Alternatively, assign the MSR files to a unique group and use mode 0660"
222 +}
223
224 diff --git a/sys-apps/likwid/metadata.xml b/sys-apps/likwid/metadata.xml
225 new file mode 100644
226 index 0000000..3a16425
227 --- /dev/null
228 +++ b/sys-apps/likwid/metadata.xml
229 @@ -0,0 +1,11 @@
230 +<?xml version="1.0" encoding="UTF-8"?>
231 +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
232 +<pkgmetadata>
233 + <maintainer type="person">
234 + <email>robbat2@g.o</email>
235 + <name>Robin H. Johnson</name>
236 + </maintainer>
237 + <upstream>
238 + <remote-id type="github">rrze-likwid/likwid</remote-id>
239 + </upstream>
240 +</pkgmetadata>