#!/bin/bash

set -e
set -x

pushd /tmp
export PKG_CONFIG_PATH=/tmp/hidapi/pc:$PKG_CONFIG_PATH
git clone git://github.com/signal11/hidapi.git
cd hidapi
./bootstrap && ./configure && make && sudo make install
sudo ldconfig
popd

autoreconf -i
./configure
make syntax-check

if [ "x$ARCH" != "x" ]; then
    make dist
    make -f windows.mk ${ARCH}bit VERSION=$version EXTRA=""
else
    make check
fi
