summaryrefslogtreecommitdiff
blob: 8db56419ed3e23e87f0b2c62bd725709438342e9 (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
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-php/php-core/php-core-4.3.4-r2.ebuild,v 1.3 2004/06/25 01:23:36 agriffis Exp $

PHPSAPI="cli"
inherit php-2 eutils

IUSE="${IUSE} readline"
DESCRIPTION="PHP core package"
SLOT="0"
KEYWORDS="~x86 ~ppc ~sparc ~alpha ~hppa ~amd64"

DEPEND_EXTRA="readline? ( >=sys-libs/ncurses-5.1 >=sys-libs/readline-4.1 )
	ncurses? ( >=sys-libs/ncurses-5.1 )
	>=virtual/php-4.3.4
	~virtual/php-${PV}"
DEPEND="${DEPEND} ${DEPEND_EXTRA}"
RDEPEND="${RDEPEND} ${DEPEND_EXTRA}"

src_compile() {
	if has_version 'dev-php/php' && [ -x '/usr/bin/php' ]; then
		# Ok, so we can cheat and not have to build all of it...
		cp /usr/bin/php ${S}/sapi/cli/php
		PHP_SKIP_MAKE=1
		einfo "You have dev-php/php installed, so we're cheating and using it"
		einfo "instead of rebuilding the CLI SAPI to make PEAR packages."
		einfo "configure will still be run to build the required Makefiles."
	else
		ewarn "Since you don't have dev-php/php installed, we need to build"
		ewarn "the PHP CLI interpreter to make the PEAR packages."
	fi

	# the rest of this should be identical to dev-php/php
	myconf="${myconf} `use_with readline readline /usr`"
	# Readline and Ncurses are CLI PHP only
	# readline needs ncurses
	use ncurses || use readline \
		&& myconf="${myconf} --with-ncurses=/usr" \
		|| myconf="${myconf} --without-ncurses"

	myconf="${myconf} \
		--disable-cgi \
		--enable-cli"

	php_src_compile
}


src_install() {
	# make sure the possibly faked PHP is in place and new enough to avoid build storms
	touch ${S}/sapi/cli/php
	PHP_INSTALLTARGETS="install-programs install-pear install-build install-headers"
	PHP_SKIP_BUILD=1
	php_src_install
	#rm -rf ${D}/etc/php4 ${D}/etc/php
}

pkg_postinst() {
	einfo "This is a limited build to provide PEAR and build utilities"
	einfo
	pear config-set cache_dir /tmp/pear/cache
	einfo "The PEAR cache dir was set to /tmp/pear/cache, run:"
	einfo "pear config-set cache_dir <your_dir_of_choice>"
	einfo "if you wish to change it."
}

pkg_preinst() {
	#php_pkg_preinst
	:
}