#!/bin/bash
[% c("var/set_default_env") -%]
distdir=$(pwd)/dist
mkdir -p $distdir/[% project %]
tar xf [% project %]-[% c('version') %].tar.gz
cd [% project %]-[% c('version') %]
patch -p1 < ../0001-Make-code-work-with-OpenSSL-1.1.patch
patch -p1 < ../timestamping.patch

./autogen.sh
./configure --prefix=/[% project %]
make
make DESTDIR=$distdir install

cd $distdir
[% c('tar', {
        tar_src => [ project ],
        tar_args => '-czf ' _ dest_dir _ '/' _ c('filename'),
        }) %]
