# A debhelper build system class for building PostgreSQL extension modules using PGXS # # Copyright: © 2020 Christoph Berg # License: GPL-2+ package Debian::Debhelper::pgxs; use strict; use warnings; use Exporter 'import'; our @EXPORT = qw(package_pattern); =head1 package_pattern() From C, look for the package name containing the B placeholder, and return it in the format suitable for passing to B, i.e. with B replaced by B<%v>. For B it will return B. Errors out if more than one package with the B placeholder is found. =cut sub package_pattern () { open F, "debian/control.in" or die "debian/control.in: $!"; my $pattern; while () { if (/^Package: (.*)PGVERSION(.*)/) { die "More than one Package with PGVERSION placeholder found in debian/control.in, cannot build with dh --buildsystem=pgxs. Use pg_buildext manually." if ($pattern); $pattern = "$1%v$2"; } } close F; return $pattern; } 1;