################################################################################
#
# ebook.cygclass - functions for building Ebook documentation packages
#
# Part of cygport - Cygwin packaging application
# Copyright (C) 2006-2016 Yaakov Selkowitz
# Provided by the Cygwin Ports project <http://sourceware.org/cygwinports/>
#
# cygport is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# cygport 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.
#
# You should have received a copy of the GNU General Public License
# along with cygport.  If not, see <http://www.gnu.org/licenses/>.
#
################################################################################

#****h* Cygclasses/ebook.cygclass
#  DESCRIPTION
#  The HTML Help Books project converts manuals for the toolchain and other
#  common tools into several formats.
#
#  This cygclass creates packages from the HTML format documentation which
#  can then be viewed in DevHelp (GNOME's API documentation browser).
#****

ORIG_PN="${PN#ebook-}"

#****o* ebook.cygclass/CATEGORY (ebook)
#  DEFINITION
CATEGORY="Doc"
#****
#****o* ebook.cygclass/SUMMARY (ebook)
#  DEFINITION
SUMMARY="EBook ${ORIG_PN} documentation"
#****
#****o* ebook.cygclass/HOMEPAGE (ebook)
#  DEFINITION
HOMEPAGE="http://code.google.com/p/htmlhelp/"
#****
#****o* ebook.cygclass/SRC_URI (ebook)
#  DEFINITION
SRC_URI="http://htmlhelp.googlecode.com/files/${ORIG_PN}-${PV}.tgz"
#****

SRC_DIR="."

#****I* ebook.cygclass/ebook_install
#  SYNOPSIS
#  ebook_install
#  DESCRIPTION
#  Installs the documentation into DevHelp's books directory under $D.
#  NOTE
#  Must be run from the directory containing the 'book.devhelp' file.
#****
ebook_install() {
	if [ ! -e book.devhelp ]
	then
		error "book.devhelp: file not found"
	fi

	insinto /usr/share/devhelp/books/${ORIG_PN}
	newins book.devhelp ${ORIG_PN}.devhelp
	doins book/*
}

#****o* ebook.cygclass/src_compile (ebook)
#  DESCRIPTION
#  There is nothing to build, so this is empty.
#****
src_compile() { :; }

#****o* ebook.cygclass/src_install (ebook)
#  DEFINITION
src_install() {
	cd ${S}
	ebook_install
}
#****

readonly -f ebook_install
