app-admin/cpulimit: add 2.8

Migrate to EAPI8, building and compilation fixes.

Closes: https://bugs.gentoo.org/686528
Signed-off-by: Azamat H. Hackimov <azamat.hackimov@gmail.com>
Closes: https://github.com/gentoo/gentoo/pull/29452
Signed-off-by: Conrad Kostecki <conikost@gentoo.org>
This commit is contained in:
Azamat H. Hackimov
2023-02-06 19:10:05 +03:00
committed by Conrad Kostecki
parent 0ad827ea7d
commit 0fe5e537a7
4 changed files with 65 additions and 0 deletions

View File

@@ -1 +1,2 @@
DIST cpulimit-2.4.tar.gz 24669 BLAKE2B e0fe0d6766e76e6e2a68dcdc553039400233daabbb14ce4a9dae46a7b694d2ecd660f4c1d13f417a74b12365c719780c732a03bd91c6384d1e7118d0fce521fb SHA512 008dc3fbdcbd8afd875a2a1ce03d609db595c6e110803140c676d3713ea60f4877a1bb8e7aa0e8b669dce31522ad81e2703f616341a0f4cbc69a6b01865b66d0
DIST cpulimit-2.8.tar.gz 24860 BLAKE2B 6d4002d2cbc46da9ce102da77b701e6a99c2e7d16e2e7989baa1e07ef335b126a8c717c4779d121aee1e580ebf057a16b4f83c1bc6a29c904a7532debc4c490a SHA512 aeb121739a5dc9f94c6ddb0905ed05eb7d146c9d0e71c34ba46aad798bda2c30b7ccc548338b4c468f9885f09d97a4565c00199c8df6af74dc9b6f23940c540e

View File

@@ -0,0 +1,28 @@
# Copyright 1999-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit toolchain-funcs
DESCRIPTION="Limits the CPU usage of a process"
HOMEPAGE="https://cpulimit.sourceforge.net"
SRC_URI="mirror://sourceforge/limitcpu/${P}.tar.gz"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 ~ppc ~riscv ~x86"
PATCHES=(
"${FILESDIR}/${P}-makefile.patch"
"${FILESDIR}/${P}-inline-func.patch" # Bug #686528
)
src_compile() {
emake CC=$(tc-getCC)
}
src_install() {
emake DESTDIR="${D}" PREFIX="${EPREFIX}/usr" install
dodoc CHANGELOG README
}

View File

@@ -0,0 +1,11 @@
--- a/cpulimit.c 2023-02-06 19:07:19.450894524 +0300
+++ b/cpulimit.c 2023-02-06 19:07:28.834337797 +0300
@@ -125,7 +125,7 @@
//return ta-tb in microseconds (no overflow checks!)
-inline long timediff(const struct timespec *ta,const struct timespec *tb) {
+static long timediff(const struct timespec *ta,const struct timespec *tb) {
unsigned long us = (ta->tv_sec-tb->tv_sec)*1000000 + (ta->tv_nsec/1000 - tb->tv_nsec/1000);
return us;
}

View File

@@ -0,0 +1,25 @@
--- a/Makefile 2023-02-06 18:47:21.311693323 +0300
+++ b/Makefile 2023-02-06 18:48:23.392517904 +0300
@@ -2,6 +2,7 @@
PREFIX?=/usr
CFLAGS?=-Wall -O2
CC?=clang
+DESTDIR=
all: cpulimit
@@ -21,10 +22,10 @@
$(MAKE) -C test
install: cpulimit
- mkdir -p ${PREFIX}/bin
- mkdir -p ${PREFIX}/share/man/man1
- cp cpulimit ${PREFIX}/bin
- cp cpulimit.1 ${PREFIX}/share/man/man1
+ mkdir -p ${DESTDIR}/${PREFIX}/bin
+ mkdir -p ${DESTDIR}/${PREFIX}/share/man/man1
+ cp cpulimit ${DESTDIR}/${PREFIX}/bin
+ cp cpulimit.1 ${DESTDIR}/${PREFIX}/share/man/man1
deinstall:
rm -f ${PREFIX}/bin/cpulimit