#!/bin/sh -e

# Fix an issue with reaping.
sed -i 's/signal(SIGINT, handler);/signal(SIGINT, handler);\nsignal(SIGCHLD, handler);/' hummingbird.c

make
make DESTDIR="$1" install

install -Dm755 usr/lib/hummingbird/* "$1/usr/lib/hummingbird"
install -Dm755 dist/kiss/* "$1/usr/lib/hummingbird"
ln -s hummingbird "$1/usr/bin/init"
