/[gentoo-x86]/www-apps/moodle/moodle-2.2.3.ebuild
Gentoo

Contents of /www-apps/moodle/moodle-2.2.3.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations) (download)
Wed Jul 11 22:56:50 2012 UTC (2 years, 3 months ago) by blueness
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +1 -1 lines
FILE REMOVED
Punt older versions

(Portage version: 2.1.10.65/cvs/Linux x86_64)

1 # Copyright 1999-2012 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/www-apps/moodle/moodle-2.2.3.ebuild,v 1.1 2012/05/16 02:11:08 blueness Exp $
4
5 EAPI="4"
6
7 inherit versionator webapp
8
9 AVC=( $(get_version_components) )
10 MY_BRANCH="stable${AVC[0]}${AVC[1]}"
11
12 DESCRIPTION="The Moodle Course Management System"
13 HOMEPAGE="http://moodle.org"
14 SRC_URI="http://download.moodle.org/${MY_BRANCH}/${P}.tgz"
15 S="${WORKDIR}/${PN}"
16
17 LICENSE="GPL-2"
18 KEYWORDS="~alpha ~amd64 ~hppa ~ia64 ~ppc ~ppc64 ~sparc ~x86"
19 #SLOT empty due to webapp
20
21 DB_FLAGS="mysqli?,postgres?"
22 DB_TYPES=${DB_FLAGS//\?/}
23 DB_TYPES=${DB_TYPES//,/ }
24
25 AUTHENTICATION_FLAGS="imap?,ldap?,odbc?"
26 AUTHENTICATION_MODES=${AUTHENTICATION_FLAGS//\?/}
27 AUTHENTICATION_MODES=${AUTHENTICATION_MODES//,/ }
28
29 PHP_REQUIRED_FLAGS_53="ctype,curl,iconv,json,session,simplexml,xml,zip"
30 PHP_OPTIONAL_FLAGS_53="gd,intl,soap,ssl,tokenizer,xmlrpc"
31 PHP_FLAGS_53="${PHP_REQUIRED_FLAGS_53},${PHP_OPTIONAL_FLAGS_53}"
32
33 IUSE="${DB_TYPES} ${AUTHENTICATION_MODES} vhosts"
34
35 # No forced dependency on
36 # mysql? ( virtual/mysql )
37 # postgres? ( dev-db/postgresql-server-7* )
38 # which may live on another server
39 DEPEND=""
40 RDEPEND="
41 =dev-lang/php-5.3*[${DB_FLAGS},${AUTHENTICATION_FLAGS},${PHP_FLAGS_53}]
42 virtual/httpd-php
43 virtual/cron"
44
45 pkg_setup() {
46 webapp_pkg_setup
47
48 # How many dbs were selected? If one and only one, which one is it?
49 MYDB=""
50 DB_COUNT=0
51 for db in ${DB_TYPES}; do
52 if use ${db}; then
53 MYDB=${db}
54 DB_COUNT=$(($DB_COUNT+1))
55 fi
56 done
57
58 if [[ ${DB_COUNT} -eq 0 ]]; then
59 eerror
60 eerror "\033[1;31m**************************************************\033[00m"
61 eerror "No database selected in your USE flags,"
62 eerror "You must select at least one."
63 eerror "\033[1;31m**************************************************\033[00m"
64 eerror
65 die
66 fi
67
68 if [[ ${DB_COUNT} -gt 1 ]]; then
69 MYDB=""
70 ewarn
71 ewarn "\033[1;33m**************************************************\033[00m"
72 ewarn "Multiple databases selected in your USE flags,"
73 ewarn "You will have to choose your database manually."
74 ewarn "\033[1;33m**************************************************\033[00m"
75 ewarn
76 fi
77 }
78
79 src_prepare() {
80 rm COPYING.txt
81 cp "${FILESDIR}"/config.php .
82
83 # Moodle expect postgres7, not postgres
84 MYDB=${MYDB/postgres/postgres7}
85
86 # Moodle expects mysql, not mysqli
87 MYDB=${MYDB/mysqli/mysql}
88
89 if [[ ${DB_COUNT} -eq 1 ]] ; then
90 sed -i -e "s|mydb|${MYDB}|" config.php
91 fi
92 }
93
94 src_install() {
95 webapp_src_preinst
96
97 local MOODLEDATA="${MY_HOSTROOTDIR}"/moodle
98 dodir ${MOODLEDATA}
99 webapp_serverowned -R "${MOODLEDATA}"
100
101 local MOODLEROOT="${MY_HTDOCSDIR}"
102 insinto ${MOODLEROOT}
103 doins -r *
104
105 webapp_configfile "${MOODLEROOT}"/config.php
106
107 if [[ ${DB_COUNT} -eq 1 ]]; then
108 webapp_postinst_txt en "${FILESDIR}"/postinstall-en.txt
109 else
110 webapp_postinst_txt en "${FILESDIR}"/postinstall-nodb-en.txt
111 fi
112
113 webapp_src_install
114 }
115
116 pkg_postinst() {
117 einfo
118 einfo "\033[1;32m**************************************************\033[00m"
119 einfo
120 einfo "To see the post install instructions, do"
121 einfo
122 einfo " webapp-config --show-postinst ${PN} ${PVR}"
123 einfo
124 einfo "\033[1;32m**************************************************\033[00m"
125 einfo
126 }

  ViewVC Help
Powered by ViewVC 1.1.20