summaryrefslogtreecommitdiff
blob: e3e22dfed0b680268870afef7668b79fd44ec4e9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# Copyright 1999-2003 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/ebook.eclass,v 1.12 2003/07/22 02:09:27 msterret Exp $
#
# Author Francisco Gimeno <kikov@fco-gimeno.com>
# Mantainer Jos� Alberto Su�rez L�pez <bass@gentoo.org>
# 
# Latest changes thanks to Kris Verbeeck
# The ebook eclass defines some default functions and variables to 
# install ebooks. 

ECLASS=ebook
INHERITED="$INHERITED $ECLASS"
HOMEPAGE="http://lidn.sourceforge.net"

SLOT="0"
LICENSE="OPL"
KEYWORDS="x86 ppc"

# ebook eclass user guide:
# -vars
#
#  EBOOKNAME: the main name of the book ( without versions ), i.e: gtk
#             Required
#  EBOOKVERSION: the version of the book, i.e: 1.2
#	      Required
#  SRC: the main file to download. Default: ${EBOOKNAME}-${EBOOKVERSION}
#  EBOOKDESTDIR: directory inside ${DEVHELPROOT}/books/${EBOOKDIR} where is 
#          installed the book. By default: ${EBOOKNAME}-${EBOOKVERSION} 
#          ( sometimes it is only ${EBOOKNAME} so you will need to modify it )
#  EBOOKSRCDIR: directory where is the unpacked book in html
#  BOOKDEVHELPFILE: book.devhelp is copied with the name  
#          ${EBOOKNAME}-${EBOOKVERSION} by default.
#  BOOKDESTDIR: directory to put into the ebook in html. By default: 
#	   ${EBOOKNAME}-${EBOOKVERSION}.
#  NOVERSION: if it's not empty, then, remove -${EBOOKVERSION} from all
#          vars...
#  DEVHELPROOT: usually usr/share/devhelp
if [ "${NOVERSION}" = "" ]; then
	_src="${EBOOKNAME}-${EBOOKVERSION}"
else
	_src="${EBOOKNAME}"
fi
_ebookdestdir="${_src}"
_ebooksrcdir="${_src}"
_ebookdevhelpfile="${_src}"    

if [ "${EBOOKEXT}" = "" ]; then
	ext="tar.gz"
else
	ext="${EBOOKEXT}"
fi

if [ "${SRC}" = "" ]; then
	SRC="${_src}"
fi
if [ "${SRC_URI}" = "" ]; then
	SRC_URI="http://lidn.sourceforge.net/books_download/${SRC}.${ext}"
fi    
    
# Default directory to install de ebook devhelped book
if [ "${DEVHELPROOT}" = "" ]; then
	DEVHELPROOT="usr/share/devhelp"
fi
if [ "${RDEPEND}" = "" ]; then
	# FIXME: newdepend sets both DEPEND and RDEPEND
	# this should be changed to newrdepend, but that doesn't exist right now.
	newdepend ">=dev-util/devhelp-0.6"
fi
if [ "${DESCRIPTION}" = "" ]; then
	DESCRIPTION="${P} ebook based in $ECLASS eclass"
fi
if [ "${EBOOKDESTDIR}" = "" ]; then
	EBOOKDESTDIR=${_ebookdestdir}
fi
if [ "${EBOOKSRCDIR}" = "" ]; then
	EBOOKSRCDIR=${_ebooksrcdir}
fi
if [ "${EBOOKDEVHELPFILE}" = "" ]; then
	EBOOKDEVHELPFILE=${_ebookdevhelpfile}".devhelp"
fi

S=${WORKDIR}
ebook_src_unpack() {
	debug-print-function $FUNCNAME $*
	unpack ${SRC}.${ext}
}

ebook_src_install() {
	debug-print-function $FUNCNAME $*
	
	dodir ${DEVHELPROOT}/books
	dodir ${DEVHELPROOT}/books/${EBOOKDESTDIR}
	echo EBOOKSRCDIR= ${EBOOKSRCDIR}
	cp ${S}/book.devhelp ${D}${DEVHELPROOT}/books/${EBOOKDESTDIR}/${EBOOKDEVHELPFILE}
	cp -R ${S}/book/* ${D}${DEVHELPROOT}/books/${EBOOKDESTDIR}
}

EXPORT_FUNCTIONS src_unpack src_install