#!/bin/sh -e

tmp_dir=$PWD/tmp

(
cd libmd

./configure \
    --prefix=/ \
    --disable-shared

make
make DESTDIR="$tmp_dir" install
)

(
cd libbsd

export CFLAGS="$CFLAGS -I$tmp_dir/include"
export LIBS=$tmp_dir/lib/libmd.a

./configure \
    --prefix=/usr

make
make DESTDIR="$1" install
)