Files
postgresql/recipe.sh
T

61 lines
2.4 KiB
Bash

# This is the recipe.sh script. It is executed by BPM in a temporary directory when compiling a source package
# BPM Expects the source code to be extracted into the automatically created 'source' directory which can be accessed using $BPM_SOURCE
# BPM Expects the output files to be present in the automatically created 'output' directory which can be accessed using $BPM_OUTPUT
# The prepare function is executed in the root of the temp directory
# This function is used for putting downloaded files to the correct location or applying patches
prepare() {
# Fix typo in sgml file
sed -i -e 's/"app-pgchecksums "/"app-pgchecksums"/' "$BPM_SOURCE"/doc/src/sgml/ref/pg_combinebackup.sgml
# Change server socket location from /tmp to /run/postgresql
sed -i -e '/DEFAULT_PGSOCKET_DIR/s@/tmp@/run/postgresql@' "$BPM_SOURCE"/src/include/pg_config_manual.h
}
# The build function is executed in the source directory
# This function is used to compile the source code
build() {
./configure --prefix=/usr \
--sysconfdir=/etc \
--mandir=/usr/share/man \
--datadir=/usr/share/postgresql \
--disable-rpath \
--enable-nls \
--enable-tap-tests \
--with-gssapi \
--with-icu \
--with-ldap \
--with-libxml \
--with-libxslt \
--with-llvm \
--with-lz4 \
--with-openssl \
--with-pam \
--with-perl \
--with-python \
--with-readline \
--with-system-tzdata=/usr/share/zoneinfo \
--without-systemd \
--with-tcl \
--with-uuid=e2fs \
--with-zstd
make
}
# The package function is executed in the source directory
# This function is used to move the compiled files into the output directory
package() {
make DESTDIR="$BPM_OUTPUT" install install-docs
make -C contrib DESTDIR="$BPM_OUTPUT" install
# Install esvm service
install -Dm755 "$BPM_WORKDIR"/postgresql.sh "$BPM_OUTPUT"/etc/esvm/scripts/postgresql.sh
install -Dm644 "$BPM_WORKDIR"/postgresql.esv "$BPM_OUTPUT"/etc/esvm/services/postgresql.esv
# Install sysusers file
install -Dm644 "$BPM_WORKDIR"/sysusers "$BPM_OUTPUT"/usr/lib/sysusers.d/postgresql.conf
# Install package license
install -Dm644 "$BPM_SOURCE"/COPYRIGHT "$BPM_OUTPUT"/usr/share/licenses/postgresql/COPYRIGHT
}