Add 'make postgres' Makefile target.

That would build postgres and install it into REPO_ROOT/tmp_install where pageserver
integration tests would be able to find it.
This commit is contained in:
Stas Kelvich
2021-03-22 17:56:00 +03:00
parent 22a0da114f
commit efe9fdbbe6
4 changed files with 78 additions and 3 deletions

34
Makefile Normal file
View File

@@ -0,0 +1,34 @@
#
# Purpose of this Makefile is to build and install postgres in a local directory
# so that zenith intergation tests would find pg binaries and support files.
#
# 'make postgres' would do following:
#
# 1) run out-of-source build of postgres in REPO_ROOT/tmp_install/build directory (I'm reusing
# tmp_install path here since it is already present in .gitignore)
#
# 2) installs postgres to REPO_ROOT/tmp_install/
#
# This Makefile is integrated with cargo build by the means of build.rs file (special file
# that cargo build would run if it is present) which will call `make postgres` if there is no
# tmp_install/bin/postgres binary.
#
../tmp_install/build/Makefile:
mkdir -p ../tmp_install/build && \
cd ../tmp_install/build && \
../../configure CFLAGS='-O0' --enable-debug --enable-cassert \
--enable-depend --with-libxml --prefix=/
pg-configure: ../tmp_install/build/Makefile
# this makefile would set env variables that would interfere with postgres build
# preventing it from finding autogenerated headers. Hence 'env -i'
pg-build: pg-configure
env -i make -j8 -C ../tmp_install/build
postgres: pg-build
mkdir -p ../tmp_install/log
env -i make -C ../tmp_install/build \
DESTDIR=/Users/stas/code/postgres/tmp_install install \
> /Users/stas/code/postgres/tmp_install/log/install.log 2>&1