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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (hide annotations) (download)
Thu Mar 10 15:04:58 2011 UTC (4 years, 3 months ago) by blueness
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +1 -1 lines
FILE REMOVED
Removed decprecated versions, bug #353431

(Portage version: 2.1.9.42/cvs/Linux x86_64)

1 blueness 1.1 # Copyright 1999-2011 Gentoo Foundation
2     # Distributed under the terms of the GNU General Public License v2
3 blueness 1.2 # $Header: /var/cvsroot/gentoo-x86/www-apps/moodle/moodle-2.0.1.ebuild,v 1.1 2011/01/08 23:21:15 blueness Exp $
4 blueness 1.1
5     EAPI="2"
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_52="ctype,curl,iconv,json,pcre,simplexml,spl,xml,zip"
30     PHP_OPTIONAL_FLAGS_52="gd,soap,ssl,tokenizer,xmlrpc"
31     PHP_FLAGS_52="${PHP_REQUIRED_FLAGS_52},${PHP_OPTIONAL_FLAGS_52}"
32    
33     PHP_REQUIRED_FLAGS_53="ctype,curl,iconv,json,simplexml,xml,zip"
34     PHP_OPTIONAL_FLAGS_53="gd,intl,soap,ssl,tokenizer,xmlrpc"
35     PHP_FLAGS_53="${PHP_REQUIRED_FLAGS_53},${PHP_OPTIONAL_FLAGS_53}"
36    
37     IUSE="${DB_TYPES} ${AUTHENTICATION_MODES} vhosts"
38    
39     # No forced dependency on
40     # mysql? ( virtual/mysql )
41     # postgres? ( dev-db/postgresql-server-7* )
42     # which may live on another server
43     DEPEND=""
44     RDEPEND="
45     || (
46     =dev-lang/php-5.2*[${DB_FLAGS},${AUTHENTICATION_FLAGS},${PHP_FLAGS_52}]
47     =dev-lang/php-5.3*[${DB_FLAGS},${AUTHENTICATION_FLAGS},${PHP_FLAGS_53}]
48     )
49     virtual/httpd-php
50     virtual/cron"
51    
52     pkg_setup() {
53     webapp_pkg_setup
54    
55     # How many dbs were selected? If one and only one, which one is it?
56     MYDB=""
57     DB_COUNT=0
58     for db in ${DB_TYPES}; do
59     if use ${db}; then
60     MYDB=${db}
61     DB_COUNT=$(($DB_COUNT+1))
62     fi
63     done
64    
65     if [[ ${DB_COUNT} -eq 0 ]]; then
66     eerror
67     eerror "\033[1;31m**************************************************\033[1;31m"
68     eerror "No database selected in your USE flags,"
69     eerror "You must select at least one."
70     eerror "\033[1;31m**************************************************\033[1;31m"
71     eerror
72     die
73     fi
74    
75     if [[ ${DB_COUNT} -gt 1 ]]; then
76     MYDB=""
77     ewarn
78     ewarn "\033[1;33m**************************************************\033[1;33m"
79     ewarn "Multiple databases selected in your USE flags,"
80     ewarn "You will have to choose your database manually."
81     ewarn "\033[1;33m**************************************************\033[1;33m"
82     ewarn
83     fi
84     }
85    
86     src_prepare() {
87     rm COPYING.txt
88     cp "${FILESDIR}"/config.php .
89    
90     # Moodle expect postgres7, not postgres
91     MYDB=${MYDB/postgres/postgres7}
92    
93     # Moodle expects mysql, not mysqli
94     MYDB=${MYDB/mysqli/mysql}
95    
96     if [[ ${DB_COUNT} -eq 1 ]] ; then
97     sed -i -e "s|mydb|${MYDB}|" config.php
98     fi
99     }
100    
101     src_install() {
102     webapp_src_preinst
103    
104     local MOODLEDATA="${MY_HOSTROOTDIR}"/moodle
105     dodir ${MOODLEDATA}
106     webapp_serverowned -R "${MOODLEDATA}"
107    
108     local MOODLEROOT="${MY_HTDOCSDIR}"
109     insinto ${MOODLEROOT} || die "Unable to insinto ${MOODLEROOT}"
110     doins -r *
111    
112     webapp_configfile "${MOODLEROOT}"/config.php
113    
114     if [[ ${DB_COUNT} -eq 1 ]]; then
115     webapp_postinst_txt en "${FILESDIR}"/postinstall-en.txt
116     else
117     webapp_postinst_txt en "${FILESDIR}"/postinstall-nodb-en.txt
118     fi
119    
120     webapp_src_install
121     }
122    
123     pkg_postinst() {
124     einfo
125     einfo "\033[1;32m**************************************************\033[1;32m"
126     einfo
127     einfo "To see the post install instructions, do"
128     einfo
129     einfo " webapp-config --show-postinst ${PN} ${PVR}"
130     einfo
131     einfo "\033[1;32m**************************************************\033[1;32m"
132     einfo
133     }

  ViewVC Help
Powered by ViewVC 1.1.20