#
# This file and its contents are supplied under the terms of the
# Common Development and Distribution License ("CDDL"), version 1.0.
# You may only use this file in accordance with the terms of version
# 1.0 of the CDDL.
#
# A full copy of the text of the CDDL should have accompanied this
# source.  A copy of the CDDL is also available via the Internet at
# http://www.illumos.org/license/CDDL.
#

#
# Copyright 2022 Marcel Telka
#

%hook-no-license%
(
	printf "%s\n" "$COPYRIGHT" | grep -v "^---"
	printf "\n\n--- LICENSES/artistic.txt -------------------------------------------------\n\n"
	cat "$SOURCE_DIR/LICENSES/artistic.txt"
	printf "\n\n--- LICENSES/gpl-2.0.txt --------------------------------------------------\n\n"
	cat "$SOURCE_DIR/LICENSES/gpl-2.0.txt"
) > "$DISTRIBUTION.license"
USE_DEFAULT_PERL_LICENSE=0

%include-2%
# Don't depend on host default pg_config
PATH = $(PG_BINDIR):$(PATH.illumos)
%include-3%
# force needed rpath
LD_OPTIONS += -R$(PG_LIBDIR)

# Make sure Postgres is always able to start (see README)
COMPONENT_TEST_ENV += DBDPG_TEMPDIR=/tmp

# Filter out line with Postgres version
COMPONENT_TEST_TRANSFORMS += '-e "/^Please wait, creating new database/d"'

# need pg_config at build time
REQUIRED_PACKAGES += $(PG_DEVELOPER_PKG)