#!/bin/sh

set -uex
PATH="/usr/bin:/bin"
export PATH

DESTDIR="$1"
# copy source tree to tempdir to avoid pollution between the autopktests
cp -aT . "$DESTDIR"
cd "$DESTDIR"

# patch d/rules to stop right after building unbound (1st build)
patch --fuzz=0 -p1 <debian/tests/debian-rules.patch

make -f debian/rules clean
make -f debian/rules binary
