summaryrefslogtreecommitdiff
blob: 0349d6ede1d71b4e2156ef1b725b46a61100a4c2 (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
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=6

MY_PN="${PN/PEAR-/}"
MY_P="${MY_PN}-${PV}"

DESCRIPTION="Code Beautifier for PHP"
HOMEPAGE="https://pear.php.net/package/PHP_Beautifier"
SRC_URI="http://download.pear.php.net/package/${MY_P}.tgz"
LICENSE="PHP-3.01"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="cli examples"

# Require automagic dependencies unconditionally to avoid surprises.
RDEPEND="dev-lang/php:*[bzip2,cli?,tokenizer]
	dev-php/PEAR-Archive_Tar
	dev-php/PEAR-Log
	dev-php/PEAR-PEAR
	cli? ( dev-php/PEAR-Console_Getopt )"

S="${WORKDIR}/${MY_P}"

PATCHES=( "${FILESDIR}/use_default_error_reporting.patch" )

src_prepare() {
	default
	shopt -s globstar
	for file in scripts/php_beautifier **/*.php; do
		sed -i "s|@package_version@|${PV}|g" "${file}" || die
		sed -i "s|@php_bin@|${EPREFIX}/usr/bin/php|g" "${file}" || die
	done
	shopt -u globstar
}

src_install() {
	insinto /usr/share/php/PHP
	doins Beautifier.php
	doins -r Beautifier
	use examples && dodoc -r examples
	use cli && dobin scripts/php_beautifier
}