Skip to content

Make Builds for Developers

Andrew Pogrebnoi edited this page Dec 6, 2023 · 2 revisions

Building from sources

./configure
make USE_PGXS=1
sudo make USE_PGXS=1 install

Changes to the build scripts

We use autoconf for the make builds. So configure shouldn't be edited directly. Any changes instead should be made to configure.ac which must be processed with autoconf to produce a configure script. The whole sequence:

  1. Change configure.ac.
  2. Run autoconf to produce an updated configure.
  3. Run ./configure to create Makefile based on Makefile.in.
  4. make USE_PGXS=1 && sudo make USE_PGXS=1 install.

Changes to configure.ac

Currently, it only tries to find and link required libs. To add a new one, use REQUIRE_LIB(name, lib, testfn, include_file.h) function, for example:

REQUIRE_LIB(jsonc, json-c, json_object_get, json_object.h)
REQUIRE_LIB(libcurl, curl, curl_easy_setopt, curl/curl.h)

The resulting configure will try to define OS and find the respective include and lib paths for the lib. Then check for <include_file.h> and try to link the lib and check <testfn>. If successful it will extend PG_CPPFLAGS and SHLIB_LINK with proper include (-I) and lib (-L, -l) flags respectively in the generated Makefile.

REQUIRE_LIB also adds flags --with-<name>=<path> (e.g. --with-jsonc=<path>) to configure were user can set a non-standard path to the lib installed. Includes and libs will be located by the provided option in that case (-I<path>/include, -L<path>/lib).


See the autoconf documentation here https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.71/html_node/index.html

config.guess and config.sub

These two programs are needed by autoconf to compute the canonical triplets for the given build, host, or target architecture. These programs are updated regularly to support new architectures and fix probes broken by changes in new kernel versions.

!!! We should fetch the latest versions of these files from https://savannah.gnu.org/git/?group=config before making a release.

wget 'http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD' -O './config.guess'
wget 'http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD' -O './config.sub'

TODO: add this to the CI.

TODO: consider using Automake.

Then config.guess and config.sub can be updated with automake --add-missing. But up-to-date copies of these programs come with new versions of Automake. Hence we'd have to remember to update Automake. _Plus it requires Makefile.am to Makefile.in. This means additional redundant abstractions that also should be fitted into the PG's make infrastructure. _


Automake docs: https://www.gnu.org/software/automake/manual/automake.html

Clone this wiki locally