1+ # Maintainer: Twyx22 <matt.sim62@gmail.com>
2+ # Contributor: memflux contributors
3+
4+ pkgname=memflux
5+ pkgver=1.1.1
6+ pkgrel=1
7+ pkgdesc=" Adaptive memory reclamation for Linux — reclaim dormant RAM without killing processes"
8+ arch=(' x86_64' )
9+ url=" https://github.com/Twyx22/memflux"
10+ license=(' MIT' )
11+ depends=(' glibc' ' systemd' ' zram-generator' )
12+ makedepends=(' cmake' ' gcc' ' clang' ' libbpf' ' libelf' ' linux-headers' )
13+ optdepends=(' bpftool: inspect eBPF maps' )
14+ provides=(' memflux' )
15+ conflicts=(' memflux-git' )
16+ backup=(' etc/memflux.conf' )
17+ source=(" $pkgname -$pkgver .tar.gz::$url /archive/refs/tags/v$pkgver .tar.gz" )
18+ # NOTE: GitHub release tarballs embed mtimes and are not byte-reproducible;
19+ # update this checksum on each version bump (makepkg prints the mismatch).
20+ sha256sums=(' 9e582036710a917a8e702dd9e9323bb9bce1176a5314f8d9c4c96a6ea1258c10' )
21+ install=memflux.install
22+
23+ prepare () {
24+ # the GitHub tarball extracts to "memflux" — rename for consistency
25+ rm -rf " $srcdir /$pkgname -$pkgver "
26+ mv " $srcdir /memflux" " $srcdir /$pkgname -$pkgver "
27+ }
28+
29+ build () {
30+ cd " $pkgname -$pkgver "
31+ cmake -S . -B build \
32+ -DCMAKE_BUILD_TYPE=Release \
33+ -DCMAKE_INSTALL_PREFIX=/usr \
34+ -DMEMFLUX_EBPF_PATH=/usr/lib/memflux/ebpf_access.bpf.o
35+ cmake --build build -j" $( nproc) "
36+ ctest --test-dir build --output-on-failure
37+ }
38+
39+ package () {
40+ cd " $pkgname -$pkgver "
41+
42+ install -Dm755 build/memfluxd " $pkgdir /usr/bin/memfluxd"
43+ install -Dm755 build/memfluxctl " $pkgdir /usr/bin/memfluxctl"
44+ install -Dm755 build/memflux-hog " $pkgdir /usr/bin/memflux-hog"
45+ install -Dm755 build/bench_alloc " $pkgdir /usr/bin/bench_alloc"
46+ install -Dm755 build/libmemflux-preload.so " $pkgdir /usr/lib/libmemflux-preload.so"
47+ install -Dm644 build/ebpf_access.bpf.o " $pkgdir /usr/lib/memflux/ebpf_access.bpf.o"
48+
49+ # config : /etc (backup-able)
50+ install -Dm644 config/memflux.conf " $pkgdir /etc/memflux.conf"
51+
52+ # systemd
53+ install -Dm644 config/memfluxd.service " $pkgdir /usr/lib/systemd/system/memfluxd.service"
54+ install -Dm644 packaging/memfluxd.tmpfiles " $pkgdir /usr/lib/tmpfiles.d/memfluxd.conf"
55+ install -Dm644 packaging/memflux.sysusers " $pkgdir /usr/lib/sysusers.d/memflux.conf"
56+
57+ # man page courte + docs
58+ install -Dm644 README.md " $pkgdir /usr/share/doc/memflux/README.md"
59+ install -Dm644 LICENSE " $pkgdir /usr/share/licenses/memflux/LICENSE"
60+ }
0 commit comments