%bcond check 1 Name: bkg_pg Version: 0.0.0 Release: 1%{?dist} Summary: PostgreSQL extension for finding mentions in chat text # Cumulative SPDX over bkg_pg (AGPL-3.0-or-later) and every statically-linked # crate; recompute with %%cargo_license_summary when the dep tree changes. License: AGPL-3.0-or-later AND Apache-2.0 AND (Apache-2.0 OR MIT) AND BSD-3-Clause AND ISC AND MIT AND (MIT OR Apache-2.0) AND (MIT OR Apache-2.0 OR LGPL-2.1-or-later) AND Unicode-3.0 AND (Unlicense OR MIT) AND Zlib URL: https://github.com/kalkin/monorepo # In-repo source (pg/mentions): builds/source-archive snapshots the tracked tree # into this tarball at srpm time — see the `source-dir` marker. Source0: %{name}-%{version}.tar.gz Source1: %{name}-%{version}-vendor.tar.xz ExclusiveArch: %{rust_arches} # cargo pgrx drives the whole build; pin it to the crate's pgrx (=0.18.0). BuildRequires: cargo-pgrx = 0.18.0 BuildRequires: cargo-rpm-macros >= 24 # pgrx-pg-sys generates bindings from the server headers via bindgen, then # formats them with rustfmt. BuildRequires: postgresql-server-devel BuildRequires: clang-devel BuildRequires: gcc BuildRequires: rustfmt Requires: postgresql-server %description bkg_pg exposes bkg_find_mentions(text, names text[]) as a PostgreSQL function that detects XMPP/IRC-style mentions of a set of names inside free text. It matches across punctuation and white space and recognizes Cyrillic transliterations of Latin nicks, using an Aho-Corasick automaton for linear-time multi-pattern search. Built in Rust with pgrx. %prep %autosetup -n %{name}-%{version} -p1 tar -xJf %{SOURCE1} %cargo_prep -v vendor %build # `package` builds the .so and generates the SQL against the given pg_config; it # needs neither a compiled PostgreSQL nor an initdb'd instance. Hand-write the # PGRX_HOME config that `cargo pgrx init` would otherwise produce (init would # also run the absent initdb), pointing pg18 at Fedora's pg_config. export PGRX_HOME="$PWD/.pgrx" mkdir -p "$PGRX_HOME" cat > "$PGRX_HOME/config.toml" <-pg18/, so install the three extension files from there. stage=$(echo target/release/%{name}-pg18) install -Dpm0755 "$stage"%{_libdir}/pgsql/%{name}.so \ %{buildroot}%{_libdir}/pgsql/%{name}.so install -Dpm0644 "$stage"%{_datadir}/pgsql/extension/%{name}.control \ %{buildroot}%{_datadir}/pgsql/extension/%{name}.control install -Dpm0644 "$stage"%{_datadir}/pgsql/extension/%{name}--%{version}.sql \ %{buildroot}%{_datadir}/pgsql/extension/%{name}--%{version}.sql %check %if %{with check} # No running server in the offline chroot: smoke-check the built artifacts only. test -f %{buildroot}%{_libdir}/pgsql/%{name}.so grep -q "default_version = '%{version}'" \ %{buildroot}%{_datadir}/pgsql/extension/%{name}.control %endif %files %license COPYING %license cargo-vendor.txt %doc README.md %{_libdir}/pgsql/%{name}.so %{_datadir}/pgsql/extension/%{name}.control %{_datadir}/pgsql/extension/%{name}--%{version}.sql %changelog * Tue Jun 30 2026 Bahtiar `kalkin-` Gadimov - 0.0.0-1 - Initial package of the in-repo pgrx extension pg/mentions