Hi, I'm currently writting an ebuild for a web-based application which use php. This application optionally need imagemagick php's wrappers : dev-php4/pecl-imagick or dev-php5/pecl-imagick So, I need an imagemagick USE flag on php merge : I modified current eclasses to add it. Please have a look at the attached patch. Tested with dev-lang/php-5.1.6-r2, seems to work fine. Thanks.
Created attachment 96583 [details, diff] add imagemagick USE flag to dev-lang/php
There is no need to modify the eclasses for this and add complexity to them for just an extension... Simply do DEPEND="dev-php5/pecl-imagick dev-php4/pecl-imagick" if you want to force both to be installed, or DEPEND="||( dev-php5/pecl-imagick dev-php4/pecl-imagick)" if it's enough that one of the two is installed. This is how it's done generally for webapps and other ebuilds that have such dependencies, it's not THE perfect solution, but it's the best we could come up with for now. ;) Best regards, CHTEKK.
(In reply to comment #2) > Simply do > DEPEND="dev-php5/pecl-imagick dev-php4/pecl-imagick" > if you want to force both to be installed Not possible : if php5 is here, it will force php4 to be installed. > or > DEPEND="||( dev-php5/pecl-imagick dev-php4/pecl-imagick)" > if it's enough that one of the two is installed. I didn't know this syntax, I tried it, but I don't understand how to apply it to resolve the following problem : - if the useflag pdf-preview is selected and : - if php4 is installed, dev-php4/pecl-imagick is required. - if php5 is installed, dev-php5/pecl-imagick is required. Currently, there's no way to do it from an ebuild, or I missed something... The only clean way I found was to modify theses eclasses, and to write in the ebuild : pkg_setup() { ... use pdf-preview && require_imagick ... } And it works perfectly. I reopen the bug, just to be certain that you'll see this message, but I promise to give up if you'll close it again. I'll try to search another (ugly) way. Anyway, thanks for your help.
(In reply to comment #3) As said above, use DEPEND="|| ( dev-php5/pecl-imagick dev-php4/pecl-imagick)" so that users get the extension installed for PHP5 by default (which is the version that will be installed by portage as default anyway). If they need both, then they need to emerge the other one manually. If they don't want PHP5, they should package.mask it, together w/ other things that may depend on it. We won't be adding functions to eclasses for one ebuild, sorry.
ok, thanks.