#!/bin/sh

# Copyright © 2015-2016 Jakub Wilk <jwilk@jwilk.net>
#
# This file is part of python-djvulibre.
#
# python-djvulibre is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 as published by
# the Free Software Foundation.
#
# python-djvulibre is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
# more details.

pkgs_base='
build-essential
libdjvulibre-dev
pkg-config
python-dev
cython
'
pkgs_tests='
python-nose
djvulibre-bin
ghostscript
'
pkgs="$pkgs_base"

usage()
{
    printf '%s [--tests]\n' "$0"
}

args=$(getopt -n "$0" -o 'h' --long 'help,tests' -- "$@")
if [ $? -ne 0 ]
then
    usage >&2
    exit 1
fi
opt_tests=
eval set -- "$args"
while true
do
    case "$1" in
        -h|--help) usage; exit 0;;
        --tests) opt_tests=y ; shift;;
        --) shift; break;;
        *) printf '%s: internal error (%s)\n' "$0" "$1" >&2; exit 1;;
    esac
done

[ "$opt_tests" ] && pkgs="$pkgs $pkgs_tests"

PS4='# '
set -e
(
    set -x
    # shellcheck disable=SC2086
    apt-get install $pkgs
)

# vim:ts=4 sts=4 sw=4 et
