####### this file is sourced not run
PKGVER=902.0
PKGBUILD=1
PKGARCH=noarch

### build a package out of ready-made directory
TARBALL= # none - internal copy
MD5SUM=  # none
SRC_URL= # none
BUNDLE=  # none

# build-time REQ: html-tidy xml2 pandoc gawk
SLACKREQ=  # none
SLACKDESC="fd-faq: fd-faq $PKGVER (Fatdog Help in HTML and MD formats)
fd-faq:
fd-faq: This package contains help documents for Fatdog, in HTML and Markdown format.
fd-faq: View markdown by running fatdog-help.sh. An internationalised version of
fd-faq: this help may be available for your language.
fd-faq:
fd-faq: Forum member L18L originally converted Fatdog64 HTML FAQS to markdown.
fd-faq: Since Fatdog64 900, markdown is automatically created from HTML sources.
fd-faq:
fd-faq:
fd-faq:
"
# don't create package - we do it ourselves here
PKG_NOMAKEPKG=yes

### nothing to download
unset -f pkg_download

###
pkg_prepare() {
	: nothing to prepare
}

### build
pkg_build() {
	P=/tmp/pkg OUT=/tmp/pkg-fd-faq

	# args: in_dir (html source) ; works in temp ${in_dir}_{html_pub,ihtml,md_pub}_out/
	$P/builder/build.sh $P/usr/share/doc/faqs &&

	# TODO consider wrapping html lines for package fatdog-doctoo

	# output faqs can be published online
	mkdir -p $OUT/usr/share/doc/faqs &&
	cp -a $P/usr/share/doc/faqs/. $OUT/usr/share/doc/faqs &&
	rm    $OUT/usr/share/doc/faqs/home.html &&
	cp -a $P/usr/share/doc/faqs_html_pub_out/. $OUT/usr/share/doc/faqs &&
	cp -a $P/usr/share/doc/home.html $OUT/usr/share/doc &&

	# output markdown faqs can be published online
	mkdir -p $OUT/usr/share/doc/fd-faq &&
	cp -a $P/usr/share/doc/fd-faq/. $OUT/usr/share/doc/fd-faq &&
	cp -a $P/usr/share/doc/faqs_md_pub_out/. $OUT/usr/share/doc/fd-faq &&

	install -m755 -Dt $OUT/usr/bin/ $P/usr/bin/fatdog-help.sh &&

	rm -r /tmp/pkg && mv $OUT $P
}

### package ready-made directory
pkg_package() {
	pkg_package_dir
}

# vim:ft=sh:

