#!/bin/sh

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

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