#!/bin/sh
if [ $# -ne 1 ]
then
  printf 'Usage: %s <poppler-source-directory>\n' "$0" >&2
  exit 1
fi
source_dir=$1
include_dir=$(pkg-config --cflags-only-I poppler-splash | sed -n -e '/^-I/ { s/^-I//; s/ .*//; p; q;}')
if [ "x$include_dir" = "x" ]
then
  printf 'Unable to determine destination directory\n' >&2
  exit 1
fi
cat <<EOF >&2
I will copy header files from $source_dir into $include_dir
Press enter to continue
EOF
read
mkdir -p "$include_dir/goo"
mkdir -p "$include_dir/splash"
cp "$source_dir/poppler/"*.h "$include_dir"
cp "$source_dir/goo/"*.h "$include_dir/goo"
cp "$source_dir/splash/"*.h "$include_dir/splash"
