#! /bin/sh

# This script is used to inject the Varnish ABI into the provides.

set -x

if [ -x /usr/lib/rpm/redhat/find-provides ]; then
    /usr/lib/rpm/redhat/find-provides "$@"
elif [ -x /usr/lib/rpm/find-provides ]; then
    /usr/lib/rpm/find-provides "$@"
fi

cd $(dirname $0)/..

printf '#include "vcs_version.h"\nVCS_Version\n' \
        | cpp - -Iinclude | sed -e '/^"/!d' -e 's/\"//g' -e 's/^/varnishabi-strict-/'

printf '#include "vrt.h"\nvarnishabi- VRT_MAJOR_VERSION . VRT_MINOR_VERSION\n' \
	| cpp - -Iinclude \
	| sed -e '/^varnishabi-/!d' -e 's/U//g' -e 's/ //g'
