From 9f9405dc7b80a42eec6370052bd5aac329526cb8 Mon Sep 17 00:00:00 2001 From: Jakub Jirutka Date: Mon, 18 Dec 2023 16:47:45 +0100 Subject: [PATCH] testing/postgresql-pgmq: new aport --- testing/postgresql-pgmq/APKBUILD | 66 ++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 testing/postgresql-pgmq/APKBUILD diff --git a/testing/postgresql-pgmq/APKBUILD b/testing/postgresql-pgmq/APKBUILD new file mode 100644 index 00000000000..3b4d8d4fe75 --- /dev/null +++ b/testing/postgresql-pgmq/APKBUILD @@ -0,0 +1,66 @@ +# Contributor: Jakub Jirutka +# Maintainer: Jakub Jirutka +pkgname=postgresql-pgmq +pkgver=1.1.0 +pkgrel=0 +pkgdesc="A lightweight message queue, like AWS SQS and RSMQ, but on PostgreSQL" +url="https://github.com/tembo-io/pgmq" +# ppc64le,riscv64,s390x: fails to build due to ring crate (https://github.com/pgcentralfoundation/pgrx/pull/1442) +arch="all !ppc64le !riscv64 !s390x" +license="PostgreSQL" +makedepends=" + cargo + chrpath + jq + openssl-dev + postgresql + postgresql-dev + rustfmt + " +source="https://github.com/tembo-io/pgmq/archive/v$pkgver/postgresql-pgmq-$pkgver.tar.gz" +builddir="$srcdir/pgmq-$pkgver" +# check: tests tries to write to /usr/lib/... +# net: fetches crates in build phase +options="!check net" + +export PGRX_HOME="$srcdir/.pgrx" + +prepare() { + default_prepare + + cargo fetch --target="$CTARGET" --locked +} + +build() { + local pgver="$(pg_config --major-version)" + + # We must install it this way because cargo-pgrx and pgrx dependency + # versions in the project must be identical. :( + local pgrx_ver; pgrx_ver="$(cargo metadata --locked --format-version 1 \ + | jq -r '.packages[] | select(.name == "pgrx") | .version')" + # Use dev profile to speed-up compilation. + cargo install --locked --profile dev --bins --root target/tools "cargo-pgrx@$pgrx_ver" + + export PATH="$PWD/target/tools/bin:$PATH" + + cargo pgrx init --pg$pgver="$(which pg_config)" + + # TODO: Remove after >0.11.2 is released (https://github.com/pgcentralfoundation/pgrx/pull/1441). + [ -n "$RUSTFLAGS" ] && export RUSTFLAGS="$(echo $RUSTFLAGS)" || unset RUSTFLAGS + cargo pgrx package --verbose --out-dir="target/release/dist" + + # Remove RPATH. + # NOTE: CARGO_PROFILE_RELEASE_RPATH=false doesn't work here. + chrpath -d target/release/dist/usr/lib/postgresql*/*.so +} + +package() { + depends="postgresql$(pg_config --major-version)" + + mkdir -p "$pkgdir" + cp -r target/release/dist/* "$pkgdir"/ +} + +sha512sums=" +216f453c10021897fe567b55646e2b7e70b5b36cdb3d2b8d5171db1757e0333f201cb23ff49e7b3a510c61c64d3ac1aaf990c0c23bc6947d3734787357b84ed6 postgresql-pgmq-1.1.0.tar.gz +"