summaryrefslogtreecommitdiff
blob: cc202e6617b69e33e5234868f38b67f3e18da87d (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
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/www-apps/otrs/otrs-1.2.4.ebuild,v 1.1 2004/08/26 10:16:17 rl03 Exp $

inherit webapp

S=${WORKDIR}/${PN}

IUSE="mysql postgres fastcgi apache2 ldap"

DESCRIPTION="OTRS is an Open source Ticket Request System"
HOMEPAGE="http://otrs.org/"
SRC_URI="ftp://ftp.gwdg.de/pub/misc/${PN}/${P}-01.tar.bz2
	http://otrs.behrsolutions.com/${P}-01.tar.bz2
	ftp://ftp.samurai.com/pub/${PN}/${P}-01.tar.bz2
	ftp://ftp.otrs.org/pub/${PN}/${P}-01.tar.bz2
	http://ftp.gwdg.de/pub/misc/${PN}/${P}-01.tar.bz2"

KEYWORDS="~x86"

DEPEND="
	=dev-lang/perl-5*
	dev-perl/Date-Pcalc
	dev-perl/DBI
	dev-perl/Email-Valid
	dev-perl/IO-stringy
	dev-perl/MIME-tools
	dev-perl/MailTools
	dev-perl/Net-DNS
	dev-perl/Authen-SASL
	dev-perl/GD
	dev-perl/GDTextUtil
	dev-perl/GDGraph
"

RDEPEND="
	${DEPEND}
	virtual/mta
	ldap? ( dev-perl/perl-ldap net-nds/openldap )
	mysql? ( =dev-db/mysql-4* dev-perl/DBD-mysql )
	postgres? ( dev-db/postgresql dev-perl/DBD-Pg )
	fastcgi? ( dev-perl/FCGI net-www/mod_fastcgi )
	apache2? ( >=net-www/apache-2 dev-perl/FCGI net-www/mod_fastcgi )
	!apache2? ( =net-www/apache-1* =dev-perl/libapreq-1* )
	"

LICENSE="GPL-2"

pkg_setup() {
	webapp_pkg_setup

	if use apache2; then
		ewarn "mod_perl2 isn't ready for prime time, fastcgi will be used instead"
		ewarn "If you really want mod_perl2, you can edit the ebuild and uncomment a few lines"
		ewarn "but if your OTRS breaks, you get to keep the pieces."
		ewarn
	fi
}

src_compile() {
	# check dependenices
	cp ${S}/Kernel/Config.pm.dist ${S}/Kernel/Config.pm
	cd ${S}/Kernel/Config/
	for foo in *.dist; do cp ${foo} `basename ${foo} .dist`; done

	cd ${S}
	if ! perl -cw bin/cgi-bin/index.pl 2>&1 | grep -q "syntax OK"; then die "Unresolved Perl dependencies"; fi
	if ! perl -cw bin/PostMaster.pl 2>&1 | grep -q "syntax OK"; then die "Unresolved Perl dependencies"; fi

	# remove configs so we don't accidentally overwrite existing configs
	rm -f ${S}/Kernel/Config.pm
	cd ${S}/Kernel/Config/
	for foo in *.dist; do rm -f `basename ${foo} .dist`; done
}

src_install() {
	webapp_src_preinst
	dodir ${MY_CGIBINDIR}/${PN}

	# install documentation
	rm -f COPYING
	for file in README* CHANGES CREDITS RELEASE UPGRADING INSTALL TODO; do
		dodoc ${file}; rm -f ${file}
	done

	cp -R Kernel ${D}/${MY_HOSTROOTDIR}
	cp -R bin/cgi-bin/*  ${D}/${MY_CGIBINDIR}/${PN}
	dodir /usr/bin
	cp bin/* ${D}/usr/bin

	dohtml doc/manual/en/html/*

	cp -R scripts  ${D}/${MY_HOSTROOTDIR}

	dodir var/otrs
	cp -R var/article var/cron var/pics var/sessions var/spool ${D}/var/otrs
	sed -i "s|\$HOME|/usr|g" ${D}/var/otrs/cron/*
	cp -R var/httpd/htdocs/*  ${D}/${MY_HTDOCSDIR}

	webapp_postinst_txt en ${FILESDIR}/postinstall-en.txt
	webapp_hook_script ${FILESDIR}/reconfig
	webapp_src_install
}