Date: Saturday, February 11, 2023 @ 13:52:01 Author: bgyorgy Revision: 1399812
upgpkg: cpulimit 1:0.2-3: Fix build, fix segfault by a patch from Fedora (FS#77145) Added: cpulimit/trunk/0000-fix-includes.patch Modified: cpulimit/trunk/PKGBUILD -------------------------+ 0000-fix-includes.patch | 67 ++++++++++++++++++++++++++++++++++++++++++++++ PKGBUILD | 23 +++++++-------- 2 files changed, 78 insertions(+), 12 deletions(-) Added: 0000-fix-includes.patch =================================================================== --- 0000-fix-includes.patch (rev 0) +++ 0000-fix-includes.patch 2023-02-11 13:52:01 UTC (rev 1399812) @@ -0,0 +1,67 @@ +diff -r -U4 cpulimit-f4d2682804931e7aea02a869137344bb5452a3cd--orig/src/cpulimit.c cpulimit-f4d2682804931e7aea02a869137344bb5452a3cd--patched/src/cpulimit.c +--- cpulimit-f4d2682804931e7aea02a869137344bb5452a3cd--orig/src/cpulimit.c 2015-06-17 08:46:59.000000000 +0200 ++++ cpulimit-f4d2682804931e7aea02a869137344bb5452a3cd--patched/src/cpulimit.c 2020-11-23 16:48:41.094970897 +0100 +@@ -25,8 +25,11 @@ + * + * Get the latest version at: http://github.com/opsengine/cpulimit + * + */ ++#ifdef __linux__ ++#define _GNU_SOURCE ++#endif + + #include <stdio.h> + #include <stdlib.h> + #include <unistd.h> +@@ -37,14 +40,19 @@ + #include <errno.h> + #include <string.h> + #include <sys/stat.h> + #include <sys/time.h> +-#include <sys/sysctl.h> + #include <sys/resource.h> + #include <sys/types.h> + #include <sys/wait.h> + +-#ifdef __APPLE__ || __FREEBSD__ ++#ifdef __linux__ ++#include <linux/sysctl.h> ++#else ++#include <sys/sysctl.h> ++#endif ++ ++#if defined(__APPLE__) || defined(__FREEBSD__) || defined(__linux__) + #include <libgen.h> + #endif + + #include "process_group.h" +diff -r -U4 cpulimit-f4d2682804931e7aea02a869137344bb5452a3cd--orig/src/process_group.c cpulimit-f4d2682804931e7aea02a869137344bb5452a3cd--patched/src/process_group.c +--- cpulimit-f4d2682804931e7aea02a869137344bb5452a3cd--orig/src/process_group.c 2015-06-17 08:46:59.000000000 +0200 ++++ cpulimit-f4d2682804931e7aea02a869137344bb5452a3cd--patched/src/process_group.c 2020-11-23 16:45:41.423515953 +0100 +@@ -24,8 +24,12 @@ + #include <limits.h> + #include <sys/time.h> + #include <signal.h> + ++#if defined(__APPLE__) || defined(__FREEBSD__) || defined(__linux__) ++#include <libgen.h> ++#endif ++ + #include <assert.h> + + #include "process_iterator.h" + #include "process_group.h" +diff -r -U4 cpulimit-f4d2682804931e7aea02a869137344bb5452a3cd--orig/tests/process_iterator_test.c cpulimit-f4d2682804931e7aea02a869137344bb5452a3cd--patched/tests/process_iterator_test.c +--- cpulimit-f4d2682804931e7aea02a869137344bb5452a3cd--orig/tests/process_iterator_test.c 2015-06-17 08:46:59.000000000 +0200 ++++ cpulimit-f4d2682804931e7aea02a869137344bb5452a3cd--patched/tests/process_iterator_test.c 2020-11-23 16:44:38.051362981 +0100 +@@ -27,9 +27,9 @@ + #include <time.h> + #include <signal.h> + #include <string.h> + +-#ifdef __APPLE__ || __FREEBSD__ ++#if defined(__APPLE__) || defined(__FREEBSD__) || defined(__linux__) + #include <libgen.h> + #endif + + #include <process_iterator.h> Modified: PKGBUILD =================================================================== --- PKGBUILD 2023-02-11 13:02:02 UTC (rev 1399811) +++ PKGBUILD 2023-02-11 13:52:01 UTC (rev 1399812) @@ -1,30 +1,29 @@ -# Maintainer: Balló György <ballogyor+arch at gmail dot com> +# Contributor: Balló György <ballogyor+arch at gmail dot com> # Contributor: Sergej Pupykin <[email protected]> pkgname=cpulimit pkgver=0.2 -pkgrel=2 +pkgrel=3 epoch=1 pkgdesc="Limit cpu usage of a process in percentage. Actually sends SIGSTOP/SIGCONT POSIX signals to processes" arch=('x86_64') -url="https://github.com/opsengine/cpulimit" +url='https://github.com/opsengine/cpulimit' license=('GPL') depends=('glibc') -source=($pkgname-$pkgver.tar.gz::https://github.com/opsengine/$pkgname/archive/v$pkgver.tar.gz) -sha256sums=('64312f9ac569ddcadb615593cd002c94b76e93a0d4625d3ce1abb49e08e2c2da') +source=("$pkgname-$pkgver.tar.gz::https://github.com/opsengine/$pkgname/archive/v$pkgver.tar.gz" + '0000-fix-includes.patch') +sha256sums=('64312f9ac569ddcadb615593cd002c94b76e93a0d4625d3ce1abb49e08e2c2da' + 'b3255614bf8b190cc8b4b80b287fee955096da801c9897c586fda732ff7c863b') prepare() { - cd $pkgname-$pkgver - sed -i 's/#ifdef __APPLE__ || __FREEBSD__/#if defined(__APPLE__) || defined(__FREEBSD__)/' \ - src/cpulimit.c tests/process_iterator_test.c + patch -d $pkgname-$pkgver -Np1 -i ../0000-fix-includes.patch + sed -i 's/$(CFLAGS)/$(CFLAGS) $(LDFLAGS)/' $pkgname-$pkgver/*/Makefile } build() { - cd $pkgname-$pkgver - make + make -C $pkgname-$pkgver } package() { - cd $pkgname-$pkgver - install -Dm755 src/cpulimit "$pkgdir/usr/bin/cpulimit" + install -Dm755 $pkgname-$pkgver/src/cpulimit "$pkgdir/usr/bin/cpulimit" }
