summaryrefslogtreecommitdiff
blob: fd7a16649f1f84b1e45e51e3e2c4904088b5c08d (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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-db/c-jdbc/c-jdbc-1.0.4-r1.ebuild,v 1.12 2006/11/28 04:25:04 nichoj Exp $

inherit java-pkg eutils

DESCRIPTION="Transparent Database Clustering Middleware"
HOMEPAGE="http://c-jdbc.objectweb.org"
SRC_URI="http://download.forge.objectweb.org/${PN}/${P}-src.tar.gz"
LICENSE="LGPL-2.1"
SLOT="1"
KEYWORDS="~amd64 ~x86"
IUSE="doc jikes examples"
RDEPEND=">=virtual/jre-1.3
	dev-java/ant
	=dev-java/commons-cli-1*
	=dev-java/crimson-1*
	=dev-java/dom4j-1*
	=dev-java/dtdparser-1.21*
	=dev-java/jaxen-1.1*
	=dev-java/jcommon-0.9*
	>=dev-java/jdepend-2.6
	>=dev-java/jdbc2-stdext-2.0
	>=dev-java/jgroups-2.2.7
	=dev-java/jfreechart-0.9.21*
	>=dev-java/kunststoff-2.0.2
	>=dev-java/log4j-1.2.8
	=dev-java/mx4j-3.0*
	=dev-java/jakarta-regexp-1.3*
	>=dev-java/xalan-2.5.2
	dev-java/xml-commons
	=dev-db/octopus-3.0*"
DEPEND=">=virtual/jdk-1.3
	${RDEPEND}
	jikes? ( >=dev-java/jikes-1.21 )"

S=${WORKDIR}/${P}-src

pkg_setup() {
	java-pkg_pkg_setup

	# add a user for cjdbc
	enewgroup cjdbc
	enewuser cjdbc -1 /bin/sh /dev/null cjdbc
}

src_unpack() {
	unpack ${A}

	cd ${S}
	epatch ${FILESDIR}/${P}-gentoo.patch

	rm -f 3rdparty/*/lib/*.jar
	cd ${S}/lib

	rm -f *.jar */*.jar

	java-pkg_jar-from commons-cli-1
	java-pkg_jar-from crimson-1
	java-pkg_jar-from dtdparser-1.21
	java-pkg_jar-from jakarta-regexp-1.3
	java-pkg_jar-from jaxen-1.1
	java-pkg_jar-from jcommon
	java-pkg_jar-from jdbc2-stdext
	java-pkg_jar-from jfreechart
	java-pkg_jar-from kunststoff-2.0
	java-pkg_jar-from log4j
	java-pkg_jar-from jgroups
	java-pkg_jar-from dom4j-1

	cd ${S}/lib/jmx
	java-pkg_jar-from mx4j-3.0
	java-pkg_jar-from xalan
	java-pkg_jar-from xml-commons xml-apis.jar

	cd ${S}/lib/other
	java-pkg_jar-from jdepend

	cd ${S}/lib/octopus
	java-pkg_jar-from octopus-3.0
}

src_compile() {
	local antflags="jar"
	use doc && antflags="${antflags} javadoc"
	use jikes && antflags="${antflags} -Dbuild.compiler=jikes"
	ant ${antflags} || die "compilation failed"
}

src_install() {
	# install the jar file
	java-pkg_dojar build/jar/*.jar
	dodoc README.txt doc/HISTORY.txt doc/LICENSE.txt

	# install the controller config under /etc
	dodir /etc/c-jdbc
	cp -r config/controller/* ${D}/etc/c-jdbc
	rm -rf config/controller config/izpack

	# install the startup scripts
	newbin ${FILESDIR}/console.sh cjdbc-console
	newsbin ${FILESDIR}/controller.sh cjdbc-controller

	# init script und conf.d file
	dodir /etc/init.d
	cp ${FILESDIR}/cjdbc-init ${D}/etc/init.d/cjdbc

	dodir /etc/conf.d
	cp ${FILESDIR}/cjdbc-conf ${D}/etc/conf.d/cjdbc

	# directories which we need
	mv lib/jmx/xsl xsl
	local dir="config xml xsl"
	for i in ${dir}
	do
		cp -r ${i} ${D}usr/share/${PN}-${SLOT}
	done

	# an environment file to set the home directory
	dodir /etc/env.d/
	echo "CJDBC_HOME=/usr/share/${PN}-${SLOT}" > ${D}etc/env.d/20cjdbc

	# we need a log directory
	dodir /var/log/c-jdbc
	touch ${D}/var/log/c-jdbc/cjdbc.log
	touch ${D}/var/log/c-jdbc/request.log
	fperms 775 /var/log/c-jdbc/cjdbc.log
	fperms 775 /var/log/c-jdbc/request.log
	fowners cjdbc:cjdbc /var/log/c-jdbc/cjdbc.log
	fowners cjdbc:cjdbc /var/log/c-jdbc/request.log


	# install the documentation and examples (depends on use-flags)
	if use doc; then
		java-pkg_dohtml -r build/doc/api/*
	fi
	if use examples; then
		dodir /usr/share/doc/${PF}/examples
		cp -r doc/examples/* ${D}usr/share/doc/${PF}/examples
	fi
}

pkg_postinst() {
	ewarn ""
	ewarn "Default config was placed in /etc/c-jdbc/controller.xml."
	ewarn "Edit this one to fit your needs or specify another filename"
	ewarn "in /etc/conf.d/cjdbc."
	ewarn ""
}