#!/bin/sh

cp -f config.mk Makefile patches.h st-flexipatch/
flexipatch-finalizer/flexipatch-finalizer.sh -r -d st-flexipatch -o st-final
for patch in patches/*.diff; do
	patch -d st-final <"$patch"
done
cp -f config.h st-final/
cd st-final || exit 1
make clean install DESTDIR="../pkg" PREFIX="/usr"
cd - || exit 1

xbps-create -A x86_64 \
	-n "st-dev-1.0.0_1" \
	-s "Test build of st" \
	pkg