commit:     8c4b6858a198135640c9128d64f1cf865ae420b6
Author:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Thu Dec 22 00:08:44 2016 +0000
Commit:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Thu Dec 22 00:56:12 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8c4b6858

dev-php/twig: add twig-1.29.0 with support for building the C extension.

A few versions of Twig have been released since the version we have in
the tree, so the first goal of the new ebuild is simply to bring our
tree to parity with upstream.

But the new ebuild also adds a feature, the ability to build the C
extension for Twig. In older versions of PHP, the C implementation
provides improved performance over the pure-PHP implementation. The
only "older version" we support is php:5.6, so the C extension is only
built when the user's PHP_TARGETS contains "php5-6". The extension
will only be built with USE=extension; otherwise users who did not
want the extension would be required to add "php5-6" to PHP_TARGETS in
order to appease our eclass.

Upstream does not currently support building the extension against
php:7.0 or php:7.1, but the performance improvement is not so great
with those versions of PHP anyway.

Gentoo-Bug: 566468
Gentoo-Bug: 566470
Suggested-by: Dennis Schridde

Package-Manager: portage-2.3.0

 dev-php/twig/Manifest           |  1 +
 dev-php/twig/metadata.xml       |  7 ++++-
 dev-php/twig/twig-1.29.0.ebuild | 60 +++++++++++++++++++++++++++++++++++++++++
 3 files changed, 67 insertions(+), 1 deletion(-)

diff --git a/dev-php/twig/Manifest b/dev-php/twig/Manifest
index 0b88ab6..fc83a66 100644
--- a/dev-php/twig/Manifest
+++ b/dev-php/twig/Manifest
@@ -1 +1,2 @@
 DIST Twig-1.20.0.tgz 93341 SHA256 
8f41a64e548d7819daf7c4471a52ab0143836b8edeeba774152973e1f74af5a7 SHA512 
de033a85e1952ce6b2fdf7f27d19757b2de9ad3112aff794bbe7786d37f9e693e1cfb2754b2768e2d7d902df988929bbf2ac8f4a4d3f0c8e21fac12e7b94d4dd
 WHIRLPOOL 
0fe61486952df23516e347b5177ac59766b054caa173d679239be25ad0edb5fb0b1d0acfd0023b0ca62e7c5514131e270514c1808b5e24875935c94e120351b3
+DIST twig-1.29.0.tar.gz 240051 SHA256 
ca9823ae05a1d4225d0197590735116984da4473173db52a7d590a572a9b054e SHA512 
ba6fabb5d8be89f045763ed491ca78e2df4af34f3903271b1f974ecb444d96c1ccd6dff983e900a9b482629b50f59c62d2172089bd30f7ffe80fd83fc10c97ff
 WHIRLPOOL 
3f212cd794e75f022e7a4f3e2730dd322baa9e91ca0dfba41da7b5a39d02285d76b377eb18ba11210a77eca00b1fbc1d6a086fdaec90925a08d752434a92b3cf

diff --git a/dev-php/twig/metadata.xml b/dev-php/twig/metadata.xml
index d768205..dabafbf 100644
--- a/dev-php/twig/metadata.xml
+++ b/dev-php/twig/metadata.xml
@@ -9,4 +9,9 @@
     <email>php-b...@gentoo.org</email>
     <name>PHP</name>
   </maintainer>
-  </pkgmetadata>
+  <use>
+    <flag name="extension">
+      Build the C extension (only for php-5.6.x).
+    </flag>
+  </use>
+</pkgmetadata>

diff --git a/dev-php/twig/twig-1.29.0.ebuild b/dev-php/twig/twig-1.29.0.ebuild
new file mode 100644
index 00000000..0cfa0e1
--- /dev/null
+++ b/dev-php/twig/twig-1.29.0.ebuild
@@ -0,0 +1,60 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=6
+
+MY_PN="Twig"
+USE_PHP="php5-6"
+S="${WORKDIR}/${MY_PN}-${PV}"
+PHP_EXT_S="${S}/ext/${PN}"
+PHP_EXT_NAME="${PN}"
+PHP_EXT_OPTIONAL_USE="extension"
+
+inherit php-ext-source-r3
+
+DESCRIPTION="PHP templating engine with syntax similar to Django"
+HOMEPAGE="http://twig.sensiolabs.org/";
+SRC_URI="https://github.com/twigphp/${MY_PN}/archive/v${PV}.tar.gz
+       -> ${P}.tar.gz"
+LICENSE="BSD"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="doc extension test"
+
+DEPEND="test? ( dev-php/phpunit )"
+
+src_prepare(){
+       # We need to call eapply_user ourselves, just in case the user's
+       # PHP_TARGETS is essentially empty (does not contain "php5-6"). In
+       # that case the eclass src_prepare does nothing.
+       eapply_user
+       php-ext-source-r3_src_prepare
+}
+
+src_install(){
+       php-ext-source-r3_src_install
+
+       cd "${S}" || die
+       # The autoloader requires the 'T' in "Twig" capitalized.
+       insinto "/usr/share/php/${MY_PN}"
+       doins -r lib/"${MY_PN}"/*
+
+       dodoc README.rst CHANGELOG
+       # This installs the reStructuredText source documents. There's got
+       # to be some way to turn them into HTML using Sphinx, but upstream
+       # doesn't provide for it.
+       use doc && dodoc -r doc
+}
+
+src_test(){
+       phpunit --bootstrap test/bootstrap.php || die "test suite failed"
+}
+
+pkg_postinst(){
+       elog "${PN} has been installed in /usr/share/php/${MY_PN}/."
+       elog "To use it in a script, require('${MY_PN}/Autoloader.php'),"
+       elog "and then run \"Twig_Autoloader::register();\". Most of"
+       elog "the examples in the documentation should work without"
+       elog "further modification."
+}

Reply via email to