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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (hide annotations) (download)
Wed Oct 19 21:45:45 2011 UTC (6 years, 9 months ago) by blueness
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +1 -1 lines
FILE REMOVED
Remove deprecated versions

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

  ViewVC Help
Powered by ViewVC 1.1.20