# --- SDE-COPYRIGHT-NOTE-BEGIN ---
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
# 
# Filename: package/.../asciidoc/asciidoc.conf
# Copyright (C) 2007 The OpenSDE Project
# 
# More information can be found in the files COPYING and README.
# 
# This program 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; version 2 of the License. A copy of the
# GNU General Public License can be found in the file COPYING.
# --- SDE-COPYRIGHT-NOTE-END ---

makeopt=
makeinstopt=

sysconfdir=$sysconfdir/asciidoc

vim_confdir=
if pkginstalled vim; then
	pkgprefix -t vim
	vim_ver=$(pkgprefix ver vim | cut -d. -f'1,2' | tr -d '.' )
	vim_confdir=$root$(pkgprefix datadir vim)/vim/vim$vim_ver
fi

hook_add preconf 5 'asciidoc_prepare'
asciidoc_prepare() {
	sed -i	-e "s,^BINDIR=.*,BINDIR=$root$bindir," \
		-e "s,^MANDIR=.*,MANDIR=$root$mandir," \
		-e "s,^CONFDIR=.*,CONFDIR=$root$sysconfdir," \
		-e "s,^VIM_CONFDIR=.*,VIM_CONFDIR=$vim_confdir," \
		install.sh
}

hook_add postmake 5 './install.sh'

hook_add postmake 7 'asciidoc_doc'
asciidoc_doc() {
	cp -av examples doc $root$docdir

	rm $root$docdir/doc/{images,docbook-xsl.css}
	ln -snf $sysconfdir/images $root$docdir/doc
	ln -snf $sysconfdir/docbook-xsl.css $root$docdir/doc
}