aports/community/pgexporter/APKBUILD
2025-04-28 19:56:06 +00:00

92 lines
3.1 KiB
Text

# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=pgexporter
pkgver=0.6.1
pkgrel=0
pkgdesc="Prometheus exporter for PostgreSQL"
url="https://pgexporter.github.io"
arch="all"
license="BSD-3-Clause"
makedepends="
bzip2-dev
cmake
cmd:rst2man
libev-dev
lz4-dev
openssl-dev
samurai
yaml-dev
zlib-dev
zstd-dev
"
pkgusers="pgexporter"
pkggroups="pgexporter"
install="$pkgname.pre-install"
subpackages="
$pkgname-dev
$pkgname-doc
$pkgname-openrc
$pkgname-bash-completion
$pkgname-zsh-completion
"
source="https://github.com/pgexporter/pgexporter/releases/download/$pkgver/pgexporter-$pkgver.tar.gz
fix-stdout-buffering.patch
default-config.patch
no-doxygen.patch
$pkgname.initd
$pkgname.confd
bin-wrapper.in
"
options="!check" # no tests provided
build() {
local crossopts=
if [ "$CBUILD" != "$CHOST" ]; then
crossopts="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
fi
cmake -B build -G Ninja -Wno-dev \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr \
$crossopts
cmake --build build
}
package() {
DESTDIR="$pkgdir" cmake --install build
install -D -m644 contrib/shell_comp/pgexporter_comp.zsh \
"$pkgdir"/usr/share/zsh/site-functions/_$pkgname
install -D -m644 contrib/shell_comp/pgexporter_comp.bash \
"$pkgdir"/usr/share/bash-completion/completions/$pkgname
cd "$pkgdir"
# pgexporter-{admin,cli} cannot be run as root (and they should always be run
# as the pgexporter user), so replace them on PATH with a wrapper that execs
# the command with su(1) if run as root.
mkdir -p usr/libexec
local cmd; for cmd in pgexporter-admin pgexporter-cli; do
mv usr/bin/$cmd usr/libexec/
sed "s|^COMMAND=.*|COMMAND='/usr/libexec/$cmd'|" "$srcdir"/bin-wrapper.in \
| install -m755 /dev/stdin usr/bin/$cmd
done
install -d -m755 -o pgexporter -g pgexporter etc/$pkgname
install -d -m750 -o pgexporter -g pgexporter var/lib/$pkgname
install -D -m644 "$builddir"/doc/etc/pgexporter.conf -t etc/pgexporter/
install -D -m755 "$srcdir"/$pkgname.initd etc/init.d/$pkgname
install -D -m644 "$srcdir"/$pkgname.confd etc/conf.d/$pkgname
}
sha512sums="
cadfbd1c71b204d6666f2a525050ed586c5835e9f327c91f96545d69361995f1789ad09259779098f7945eb3efd84029f568b703ad2bfcee845d03e408552383 pgexporter-0.6.1.tar.gz
d5f0179e50a0eb8aa778ec5a487d9fd6db7c5782385e82b48cc644fd175c28c07942c03e185c6ab526b02c3a5a5778d12a32ea138055b4bae799e0f4ec164a79 fix-stdout-buffering.patch
fe9a787be2c20d691a9faec5e993ff374a1d2b9081669e54782ad02b702df3325cf1cfeb57a041fbeb5f7e260d506495f8d30be2f276f3976fc64fb599cbbe64 default-config.patch
db9e668662d8ec631590bdbd9c68578e76e0d2b9c3a4f2a91eb8b5e5ac9f64d445bf141e407ce27cd81d078e40e80564432f09ed6f05c16abb6cce0e2025844f no-doxygen.patch
acf0cde661cc11c1b5903d2ceb8bd88f155495c1d053ea28c14a026f2aba29e6fce90371bf829216375bc34a027b61ca4049724d292e1207901589254ef9786d pgexporter.initd
5195f0a77d3e194cfb2c52aeea70ee327efc16ac55ae613b0b44e90241d2327dfc4056ee209972608063ae3634595af21b41bb1e5b901b1d48f26467e05ecc2d pgexporter.confd
76d3786c01576291bfcb4e6d3ca39cce0946222138a7892ff3fe9069e3155c81f9e2e5e6323af3ba8c801b30be41e04a5eede81216e73d5833396fcc49d2fc97 bin-wrapper.in
"