# --- SDE-COPYRIGHT-NOTE-BEGIN ---
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
#
# Filename: package/.../clip/clip.conf
# Copyright (C) 2007 The OpenSDE Project
# Copyright (C) 2004 - 2006 The T2 SDE Project
# Copyright (C) 1998 - 2004 Clifford Wolf
#
# 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 ---


if [ $prefix_auto = 1 ] ; then
        prefix="opt/clip"
        set_confopt
fi
createdocs=0

export CLIPROOT=$root/$prefix
export BINDIR=$CLIPROOT/bin

clip_examples() {
	cd $builddir/$xsrcdir

	# install examples
	mkdir -p $docdir/example/clip/
	cp -dRvf example/* $docdir/example/clip/

	# and tools
	mkdir -p $docdir/example/prg/
	cp -dRvf prg/* $docdir/example/prg/

	# profile.d
	echo "export CLIPROOT=$CLIPROOT" > $root/etc/profile.d/clip
}

clip_patch() {
	local f
	# they release a patch.tgz to overwrite files of last release
	# for 'updating' to last stable build.

	if f="`match_source_file -p $1`"; then
		echo "Applying $f to CLIP."
		( cd ..; \
		  ln -sv ${xsrcdir##*/} $2; \
		  tar -v $taropt $f \
		)
	fi
}

hook_add preconf  9 'cd clip'

# patch
hook_add prepatch 5 'clip_patch clip-patch- clip-prg; \
		     clip_patch clip-doc- clip-doc'

# build & install cliplibs
hook_add postmake 5 'eval $MAKE -C ../cliplibs $makeopt all install'

# build & install docs
hook_add postmake 6 'eval $MAKE -C ../doc $makeopt txt html install-txt install-html'

# install examples
hook_add postdoc  5 'clip_examples'