summaryrefslogtreecommitdiff
path: root/app-benchmarks/ramspeed/ramspeed-3.5.0-r2.ebuild
blob: f7235482bd872272d4689081150df6b90a4545eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7

inherit flag-o-matic toolchain-funcs

MY_PN="ramsmp"
MY_P="${MY_PN}-${PV}"

DESCRIPTION="Benchmarking for memory and cache"
HOMEPAGE="http://www.alasir.com/software/ramspeed/"
SRC_URI="http://www.alasir.com/software/${PN}/${MY_P}.tar.gz"
S="${WORKDIR}/${MY_P}"

LICENSE="Alasir"
SLOT="0"
KEYWORDS="amd64 x86"
IUSE="cpu_flags_x86_sse pic"

src_configure() {
	local obj
	local arch_prefix=./

	use x86 && arch_prefix=i386/
	use amd64 && arch_prefix=amd64/

	tc-export CC AS

	# Fix the stack
	append-ldflags -Wl,-z,noexecstack
	obj=( ramsmp.o ${arch_prefix}{fltmark,fltmem,intmark,intmem}.o )

	use pic && append-ldflags -no-pie

	if use amd64; then
		sed -i \
			-e 's/call.*free/call\tfree@PLT/' \
			-e 's/call.*gettimeofday/call\tgettimeofday@PLT/' \
			-e 's/call.*malloc/call\tmalloc@PLT/' \
			${arch_prefix}/*.s || die
	fi

	use x86 && obj+=( ${arch_prefix}{cpuinfo/cpuinfo_main,cpuinfo/cpuinfo_ext}.o )

	if use cpu_flags_x86_sse; then
		use x86 && append-flags "-DLINUX -DI386_ASM"
		use amd64 && append-flags "-DLINUX -DAMD64_ASM"
		obj+=( ${arch_prefix}{mmxmark,mmxmem,ssemark,ssemem}.o )
	fi

	echo "ramsmp: ${obj[@]}" > Makefile || die
}

src_install() {
	dobin ramsmp
	dosym ramsmp /usr/bin/ramspeed
	dodoc HISTORY README
}