Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 23844
Collapse All | Expand All

(-)/usr/portage/eclass/php-ext.eclass (-13 / +71 lines)
Lines 32-37 Link Here
32
		=sys-devel/m4-1.4
32
		=sys-devel/m4-1.4
33
		>=sys-devel/libtool-1.4.3"
33
		>=sys-devel/libtool-1.4.3"
34
34
35
php-ext_buildinilist () {
36
	# work out the list of .ini files to edit/add to
37
38
	if [ -z "${PHPSAPILIST}" ]; then
39
		PHPSAPILIST="apache1 apache2 cli"
40
	fi
41
	
42
	PHPINIFILELIST=""
43
44
	for x in ${PHPSAPILIST} ; do
45
		if [ -f /etc/php/${x}-php4/php.ini ]; then
46
			PHPINIFILELIST="${PHPINIFILELIST} /etc/php/${x}-php4/php.ini"
47
		fi
48
	done
49
	
50
	if [[ ${PHPINIFILELIST} = "" ]]; then
51
		msg="No PHP ini files found for this extension"
52
		eerror ${msg}
53
		die ${msg}
54
	fi
55
56
#	einfo "php.ini files found in $PHPINIFILELIST"
57
}
58
35
php-ext_src_compile() {
59
php-ext_src_compile() {
36
	#phpize creates configure out of config.m4
60
	#phpize creates configure out of config.m4
37
	phpize
61
	phpize
Lines 50-68 Link Here
50
74
51
php-ext_pkg_postinst() {
75
php-ext_pkg_postinst() {
52
	if [ "$PHP_EXT_INI" = "yes" ] ; then
76
	if [ "$PHP_EXT_INI" = "yes" ] ; then
53
		if [ `grep ${EXT_DIR}/${PHP_EXT_NAME}.so /etc/php4/php.ini` ] ; then
77
		php-ext_buildinilist
54
			einfo "No changes made to php.ini"
78
		php-ext_addextension "${EXT_DIR}/${PHP_EXT_NAME}.so"
55
		else
79
	fi
56
			if [ "$PHP_EXT_ZENDEXT" = "yes" ] ; then
80
}
57
				echo zend_extension=${EXT_DIR}/${PHP_EXT_NAME}.so >> /etc/php4/php.ini
81
58
			else
82
php-ext_extension_is_present () {
59
				echo extension=${EXT_DIR}/${PHP_EXT_NAME}.so >> /etc/php4/php.ini
83
	grep "^$1=$2" $3 > /dev/null 2>&1
60
			fi
84
}
61
		
85
62
			einfo "${PHP_EXT_NAME} has been added to php.ini"
86
php-ext_addextensiontoinifile () {
63
			einfo "Please check phpinfo() output to verify that ${PHP_EXT_NAME} is loaded."
87
	php-ext_extension_is_present $1 $2 $3 && return
64
		fi
88
89
	einfo "Extension added to $3"
90
	echo "$1=$2" >> $3
91
}
92
93
php-ext_addextension () {
94
	if [ "${PHP_EXT_ZENDEXT}" = "yes" ]; then
95
		ext="zend_extension"
65
	else
96
	else
66
		einfo "No changes made to php.ini"
97
		ext="extension"
67
	fi
98
	fi
99
100
	for x in ${PHPINIFILELIST} ; do
101
		php-ext_addextensiontoinifile "$ext" "$1" "$x"
102
	done
103
}
104
	
105
php-ext_setting_is_present () {
106
	grep "^$1=" $2 > /dev/null 2>&1
68
}
107
}
108
109
# $1 - setting name
110
# $2 - setting value
111
# $3 - file to add to
112
113
php-ext_addtoinifile () {
114
	php-ext_setting_is_present $1 $3 && return
115
116
	einfo "Added '$1=$2' to $3"
117
	echo "$1=$2" >> $3
118
}
119
120
php-ext_addtoinifiles () {
121
	for x in ${PHPINIFILELIST} ; do
122
		php-ext_addtoinifile $1 $2 $x
123
	done
124
}
125
	
126

Return to bug 23844