.\" Automatically generated by Pod::Man 4.10 (Pod::Simple 3.35) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` . ds C' 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "PG_BUILDEXT 1" .TH PG_BUILDEXT 1 "2020-08-14" "Debian" "Debian PostgreSQL infrastructure" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" pg_buildext \- Build and install a PostgreSQL extension .SH "SYNOPSIS" .IX Header "SYNOPSIS" \&\fBpg_buildext\fR [\fIoptions\fR] \fIaction\fR [\fIsrc-dir\fR] [\fIarguments\fR] .SH "DESCRIPTION" .IX Header "DESCRIPTION" \&\fBpg_buildext\fR is a script that will build a PostgreSQL extension in a \f(CW\*(C`VPATH\*(C'\fR way, for potentially several PostgreSQL server versions in parallel. It builds for the intersection of versions known in \&\f(CW\*(C`debian/pgversions\*(C'\fR (versions supported by the package) and in \&\f(CW\*(C`/usr/share/postgresql\-common/supported\-versions\*(C'\fR (versions supported in this release). .SH "USAGE" .IX Header "USAGE" Packages using \fBpg_buildext\fR should be prepared to build binaries for PostgreSQL versions that are not present in Debian unstable, e.g. for older releases when building backports for Debian (old)stable (possibly including backports of newer PostgreSQL releases), or for all PostgreSQL releases when the package is built for \fBapt.postgresql.org\fR. .PP As the set of binary packages depends on the target PostgreSQL versions, \&\f(CW\*(C`debian/control\*(C'\fR is generated from a template in \f(CW\*(C`debian/control.in\*(C'\fR when \&\fBpg_buildext updatecontrol\fR is run. Occurrences of \fB\s-1PGVERSION\s0\fR in package sections are replaced by the target PostgreSQL version. Include \&\f(CW\*(C`/usr/share/postgresql\-common/pgxs_debian_control.mk\*(C'\fR in \f(CW\*(C`debian/rules\*(C'\fR to run a check at build time if updating debian/control is required. .PP As \fBpg_buildext\fR invokes \fBmake\fR for the \fBbuild\fR, \fBinstall\fR, and \fBclean\fR actions, invocations from \f(CW\*(C`debian/rules\*(C'\fR (which is a makefile) should be prefixed with \fB+\fR so the sub-makes can talk with the make jobserver. Additional makefile variables can be passed to \fBmake\fR via the \fB\-m\fR option. .PP Many extensions support \fBmake installcheck\fR testing using \fBpg_regress\fR. As this needs the package to be installed, it cannot be run at build time. Instead, the tests should be run using \fBautopkgtest\fR from \f(CW\*(C`debian/tests/*\*(C'\fR. .PP If \f(CW\*(C`debian/tests/control.in\*(C'\fR exists, occurrences of package names containing \&\fB\s-1PGVERSION\s0\fR are replaced by lists of package names with the target PostgreSQL versions filled in. (If no replacing is needed in \f(CW\*(C`debian/tests/control\*(C'\fR, it is fine to provide the tests control file directly.) .SH "OPTIONS" .IX Header "OPTIONS" .IP "\fB\-cio\fR \fIarg\fR" 4 .IX Item "-cio arg" .PD 0 .IP "\fB\-s\fR" 4 .IX Item "-s" .PD Passed to \fBpg_virtualenv\fR when running \fBinstallcheck\fR. .IP "\fB\-m\fR \fIarg\fR" 4 .IX Item "-m arg" Passed to \fBmake\fR. .SH "ACTIONS" .IX Header "ACTIONS" Most actions expect a directory name where to build the sources. It will get created for you if it does not exist. If the \fIbuild-dir\fR contains a \f(CW%v\fR sign, it will get replaced by the specific version of PostgreSQL being built against. (Usually this parameter is \f(CW\*(C`build\-%v\*(C'\fR.) .IP "\fBsupported-versions\fR" 4 .IX Item "supported-versions" Print effective list of supported versions, i.e. the intersection of the sets of versions supported by the system and the package. .IP "\fBcheckcontrol\fR" 4 .IX Item "checkcontrol" Check if \f(CW\*(C`debian/control\*(C'\fR needs updating from \f(CW\*(C`debian/control.in\*(C'\fR. This is invoked from \f(CW\*(C`/usr/share/postgresql\-common/pgxs_debian_control.mk\*(C'\fR. When building for a \fBbackports\fR or \fBpgdg\fR suite as determined by \&\f(CW\*(C`debian/changelog\*(C'\fR, this action also updates the control file. Otherwise, \&\fBupdatecontrol\fR needs to be run manually. .IP "\fBupdatecontrol\fR" 4 .IX Item "updatecontrol" Update \f(CW\*(C`debian/control\*(C'\fR from \f(CW\*(C`debian/control.in\*(C'\fR, and \f(CW\*(C`debian/tests/control\*(C'\fR from \f(CW\*(C`debian/tests/control.in\*(C'\fR if the latter exists. .IP "\fBconfigure\fR [\fIsrc-dir\fR] \fIbuild-dir\fR [\fIextra-configure-options\fR]" 4 .IX Item "configure [src-dir] build-dir [extra-configure-options]" For every supported version, call \fB../configure\fR from the \fIbuild-dir\fR directory. (Most PostgreSQL extensions do not have a configure script.) .IP "\fBbuild\fR [\fIsrc-dir\fR] \fIbuild-dir\fR [\fIextra-cflags\fR]" 4 .IX Item "build [src-dir] build-dir [extra-cflags]" Build the extension in the \fIbuild-dir\fR directory. .IP "\fBinstall\fR [\fIsrc-dir\fR] \fIbuild-dir\fR \fIpackage-pattern\fR" 4 .IX Item "install [src-dir] build-dir package-pattern" Invoke \fBmake install\fR from the \fIbuild-dir\fR directory. The third parameter specifies the package name to use. Most packages use \fBpostgresql\-%v\-pkgname\fR. Make will be called with DESTDIR="$(\s-1CURDIR\s0)/debian/\fIpackage\fR". .IP "\fBclean\fR [\fIsrc-dir\fR] \fIbuild-dir\fR" 4 .IX Item "clean [src-dir] build-dir" Clean the build directory. .IP "\fBloop\fR [\fIsrc-dir\fR] \fIpackage-pattern\fR" 4 .IX Item "loop [src-dir] package-pattern" As a variant to calling \fBbuild\fR and \fBinstall\fR separately for \s-1VPATH\s0 builds, loop over the supported PostgreSQL versions in the top source directory. This should be used if the package does not support \s-1VPATH\s0 builds. As it also invokes \&\fBmake install\fR, it should be placed were installation happens in debian/rules, rather than where build would normally be called. .IP "\fBinstallcheck\fR [\fIsrc-dir\fR] [\fIbuild-dir\fR]" 4 .IX Item "installcheck [src-dir] [build-dir]" Use \fBpg_virtualenv make installcheck\fR to run the extension regression tests. This is meant to be run from \f(CW\*(C`debian/tests/control\*(C'\fR using \fBautopkgtest\fR. If \&\fIbuild-dir\fR is omitted, the top source directory is used. .PP Sometimes it is desirable to run extra code per version before invoking the action, in that case the loop over supported versions needs to be in the calling script. To facilitate this mode, actions can also be called as \&\fIaction\fR\fB\-\fR\fIversion\fR. See the installcheck example below. .SH "SUPPORTED VERSIONS" .IX Header "SUPPORTED VERSIONS" \&\fBpg_buildext\fR reads \f(CW\*(C`debian/pgversions\*(C'\fR to decide which PostgreSQL to build modules/extensions for. This file contains one PostgreSQL version number per line, in the following formats: .IP "\fBall\fR" 4 .IX Item "all" Support all versions. This is recommended unless there are known incompatibilities. .IP "\fI\s-1NN\s0\fR" 4 .IX Item "NN" Support this version. .IP "\fI\s-1NN\s0\fR\fB+\fR" 4 .IX Item "NN+" Support this and all greater versions. .IP "\fB#\fR\fI...\fR" 4 .IX Item "#..." Comment. .PP For a version to be used, it must also be listed in the output of \&\f(CW\*(C`/usr/share/postgresql\-common/supported\-versions\*(C'\fR. See this file for how to configure the list of supported versions on your system. .SH "EXAMPLE" .IX Header "EXAMPLE" .IP "\fBdebian/control.in:\fR" 4 .IX Item "debian/control.in:" .Vb 2 \& Source: postgresql\-foobar \& Build\-Depends: debhelper, postgresql\-server\-dev\-all (>= 153~) \& \& Package: postgresql\-PGVERSION\-foobar \& Depends: ${misc:Depends}, ${shlibs:Depends}, postgresql\-PGVERSION .Ve .IP "\fBdebian/pgversions:\fR" 4 .IX Item "debian/pgversions:" .Vb 1 \& all \& \& # alternatives: \& #9.6 \& #11+ .Ve .IP "\fBdebian/rules:\fR" 4 .IX Item "debian/rules:" .Vb 1 \& #!/usr/bin/make \-f \& \& include /usr/share/postgresql\-common/pgxs_debian_control.mk \& \& # omit this if the package does not use autoconf \& override_dh_auto_configure: \& +pg_buildext configure build\-%v "\-\-libdir=/usr/lib/postgresql/%v/lib \-\-datadir=/usr/share/postgresql\-%v\-foobar" \& \& override_dh_auto_build: \& +pg_buildext build build\-%v \& \& override_dh_auto_test: \& # nothing to do here, see debian/tests/* instead \& \& override_dh_auto_install: \& +pg_buildext install build\-%v postgresql\-%v\-foobar \& \& override_dh_installdocs: \& dh_installdocs \-\-all README.* \& \& override_dh_auto_clean: \& +pg_buildext clean build\-%v \& \& %: \& dh $@ .Ve .IP "\fBdebian/tests/control:\fR" 4 .IX Item "debian/tests/control:" .Vb 3 \& Depends: @, postgresql\-server\-dev\-all \& Tests: installcheck \& Restrictions: allow\-stderr .Ve .IP "\fBdebian/tests/control.in:\fR (optional)" 4 .IX Item "debian/tests/control.in: (optional)" .Vb 3 \& Depends: @, postgresql\-contrib\-PGVERSION, postgresql\-PGVERSION\-bar \& Tests: installcheck \& Restrictions: allow\-stderr .Ve .IP "\fBdebian/tests/installcheck:\fR" 4 .IX Item "debian/tests/installcheck:" .Vb 3 \& #!/bin/sh \& pg_buildext installcheck \& # alternatively: pg_buildext installcheck build\-%v \& \& # Running extra code before invoking the actual action: \& set \-e \& for v in $(pg_buildext supported\-versions); do \& test \-L build\-$v/sql || ln \-s ../sql build\-$v/ \& test \-L build\-$v/expected || ln \-s ../expected build\-$v/ \& pg_buildext installcheck\-$v build\-$v \& done .Ve .SH "SOURCE DIRECTORY" .IX Header "SOURCE DIRECTORY" If the package source code is not in the top level directory (i.e. the directory which has \f(CW\*(C`debian/\*(C'\fR as subdirectory), use the \fIsrc-dir\fR argument, where \&\fIsrc-dir\fR must be an absolute path. Example: .PP .Vb 2 \& override_dh_auto_build: \& +pg_buildext build $(CURDIR)/postgresql\-module build\-%v .Ve .SH "COMPATIBILITY" .IX Header "COMPATIBILITY" \&\fBpg_buildext loop\fR was introduced in postgresql-server-dev-all (>= 141~). .PP The usage of \*(L"all\*(R" or \*(L"\s-1NN+\*(R"\s0 in debian/pgversions was introduced in postgresql-server-dev-all (>= 148~). .PP \&\fBpg_buildext installcheck\fR was introduced in postgresql-server-dev-all (>= 153~). .PP \&\fBPG_VIRTUALENV_UNSHARE=\-n\fR was introduced in postgresql-common (>= 170~). .PP Handling of \f(CW\*(C`debian/tests/control.in\*(C'\fR with \fB\s-1PGVERSION\s0\fR replacement was introduced in postgresql-common (>= 171~). .SH "SEE ALSO" .IX Header "SEE ALSO" \&\f(CW\*(C`/usr/share/postgresql\-common/supported\-versions\*(C'\fR, \fBautopkgtest\fR\|(1), \&\fBpg_virtualenv\fR\|(1). .SH "AUTHORS" .IX Header "AUTHORS" Dimitri Fontaine , with extensions by Christoph Berg .