| 1 |
# A debhelper build system class for building PostgreSQL extension modules using PGXS |
| 2 |
# |
| 3 |
# Per PostgreSQL major version, a `build-$version` subdirectory is created. |
| 4 |
# |
| 5 |
# Copyright: © 2020 Christoph Berg |
| 6 |
# License: GPL-2+ |
| 7 |
|
| 8 |
package Debian::Debhelper::Buildsystem::pgxs; |
| 9 |
|
| 10 |
use strict; |
| 11 |
use warnings; |
| 12 |
use parent qw(Debian::Debhelper::Buildsystem); |
| 13 |
use Cwd; |
| 14 |
use Debian::Debhelper::Dh_Lib; |
| 15 |
use Debian::Debhelper::pgxs; |
| 16 |
|
| 17 |
sub DESCRIPTION { |
| 18 |
"PGXS (PostgreSQL extensions), building in subdirectory per PostgreSQL version" |
| 19 |
} |
| 20 |
|
| 21 |
sub check_auto_buildable { |
| 22 |
my $this=shift; |
| 23 |
unless (-e $this->get_sourcepath("debian/pgversions")) { |
| 24 |
error("debian/pgversions is required to build with PGXS"); |
| 25 |
} |
| 26 |
return (-e $this->get_sourcepath("Makefile")) ? 1 : 0; |
| 27 |
} |
| 28 |
|
| 29 |
sub new { |
| 30 |
my $class=shift; |
| 31 |
my $this=$class->SUPER::new(@_); |
| 32 |
$this->enforce_in_source_building(); |
| 33 |
return $this; |
| 34 |
} |
| 35 |
|
| 36 |
sub build { |
| 37 |
my $this=shift; |
| 38 |
$this->doit_in_sourcedir(qw(pg_buildext build build-%v)); |
| 39 |
} |
| 40 |
|
| 41 |
sub install { |
| 42 |
my $this=shift; |
| 43 |
my $pattern = package_pattern(); |
| 44 |
$this->doit_in_sourcedir(qw(pg_buildext install build-%v), $pattern); |
| 45 |
} |
| 46 |
|
| 47 |
sub test { |
| 48 |
my $this=shift; |
| 49 |
verbose_print("Postponing tests to install stage"); |
| 50 |
} |
| 51 |
|
| 52 |
sub clean { |
| 53 |
my $this=shift; |
| 54 |
my $pattern = package_pattern(); |
| 55 |
$this->doit_in_sourcedir(qw(pg_buildext clean build-%v), $pattern); |
| 56 |
} |
| 57 |
|
| 58 |
1; |