#
# 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
#

%patch% 01-load-64-bit-X11.patch

%hook-manifest%
# fix abstract we obtained from META.json
sed -i -e 's/Tk - Tk -/Tk -/g' Makefile
# two more license terms applies for this component
sed -i -e $'/^license/a\\\nlicense pTk/license.terms license=\'TCL\'\\\nlicense pTk/Tix.license license=\'MIT-Modern-Variant\'' "$DISTRIBUTION-PERLVER.p5m"

%include-3%
# With default "symlink" cloney mode tests fails
CLONEY_ARGS = CLONEY_MODE="hardlink"

# Testing needs an X server
TEST_REQUIRED_PACKAGES += x11/server/xvfb
COMPONENT_PRE_TEST_ACTION += /usr/bin/Xvfb :0 >/dev/null 2>&1 &
COMPONENT_TEST_ENV += DISPLAY=:0
COMPONENT_POST_TEST_ACTION += /usr/bin/pkill -x Xvfb ;

# Contains random address
COMPONENT_TEST_TRANSFORMS += "-e '/^Stack moved/d'"

# Optional test dependencies missing from metadata
TEST_REQUIRED_PACKAGES.perl += library/perl-5/test-pod