Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 338040 - New ebuild: dev-lang/php-5.3.3-r1
Summary: New ebuild: dev-lang/php-5.3.3-r1
Status: RESOLVED FIXED
Alias: None
Product: Gentoo/Alt
Classification: Unclassified
Component: Prefix Support (show other bugs)
Hardware: All OS X
: High normal (vote)
Assignee: Gentoo Prefix
URL:
Whiteboard:
Keywords:
Depends on: 338684
Blocks: 338041
  Show dependency tree
 
Reported: 2010-09-19 15:11 UTC by nietonfir
Modified: 2010-12-11 10:55 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Complete dev-lang/php directory (php-5.3.3.tar.gz,31.51 KB, application/octet-stream)
2010-09-19 15:17 UTC, nietonfir
Details
Ebuild changes (ebuild.diff,717 bytes, text/plain)
2010-09-19 15:17 UTC, nietonfir
Details
Eblits changes (eblits.diff,23.26 KB, text/plain)
2010-09-19 15:19 UTC, nietonfir
Details
Complete dev-lang/php directory (php-5.3.3-r1.tar.gz,31.55 KB, application/octet-stream)
2010-09-20 11:33 UTC, nietonfir
Details
correctly installs shared extensions (src_install-v1.eblit,5.24 KB, text/plain)
2010-09-25 21:34 UTC, nietonfir
Details
adds proper ${EPREFIX}/usr paths to some use flags (src_configure-v1.eblit,11.11 KB, text/plain)
2010-09-25 21:36 UTC, nietonfir
Details
Patch to src_configure-v1.eblit that was needed on my box to make it compile (php.diff,2.44 KB, patch)
2010-09-25 22:34 UTC, Dirk Tilger
Details | Diff
adds proper ${EPREFIX}/usr paths to some use flags (src_configure-v1.eblit,11.15 KB, text/plain)
2010-09-25 23:36 UTC, nietonfir
Details
Patch to address heikos issue (php-xml.diff,543 bytes, patch)
2010-10-03 18:46 UTC, Dirk Tilger
Details | Diff
Patch to turn libphp5.so to libphp5.bundle (php-libphp-bundle.diff,2.39 KB, patch)
2010-10-03 18:51 UTC, Dirk Tilger
Details | Diff
File in ${FILESDIR} required to make attachment 249469 work correctly. (php-5.3.3-darwin-bundle.patch,330 bytes, patch)
2010-10-03 18:52 UTC, Dirk Tilger
Details | Diff
File in ${FILESDIR} required to make attachment 249469 work correctly. (php-5.3.3-darwin-install-it.patch,632 bytes, patch)
2010-10-03 18:52 UTC, Dirk Tilger
Details | Diff
Some essential offsets. Probably still more needed. (php-eblits-src_configure_v1.patch,3.40 KB, patch)
2010-10-05 15:38 UTC, Heiko
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description nietonfir 2010-09-19 15:11:46 UTC
php-5.3.3-r1 compiles, installs and runs just fine on ~x64-macos.

Changes to the original files:
* prefix inheritance added to the ebuild
* eblits have been eprefixified by hand as ecopy failed because of the eblit path in 'files/', so they might contain some errors/mistakes.
* Two patches in ${FILESDIR} where eprefixified with @GENTOO_PORTAGE_EPREFIX@ (20php5-envd, php-fpm.init)
* Some configure paths have been added (eg iconv, gettext)
* iconv extension inclusion was changed from 'without' to 'with' as building used to fail. (And was 'with' in php5_2-sapi.eclass…)

Included upstream patches:
* http://bugs.php.net/bug.php?id=52413 > php-5.3.3-ulong-osx.patch

Tested USE-Flags:
apache2 bzip2 calendar cgi cli crypt ctype curl curlwrappers exif fileinfo filter ftp gd hash iconv json mysql mysqli nls pdo phar posix readline session simplexml soap sockets sqlite3 ssl tokenizer truetype unicode xml xmlreader xmlrpc xmlwriter xsl zip zlib

Kudos to heiko_ from #gentoo-prefix.
Comment 1 nietonfir 2010-09-19 15:17:01 UTC
Created attachment 248000 [details]
Complete dev-lang/php directory

I hope you don't mind that format, but it's easier than adding >10 files... ;)
Comment 2 nietonfir 2010-09-19 15:17:55 UTC
Created attachment 248001 [details]
Ebuild changes

Diff of the original ebuild VS eprefix ebuild.
Comment 3 nietonfir 2010-09-19 15:19:09 UTC
Created attachment 248003 [details]
Eblits changes

Contains the changes made to the eblits files as diff. Maybe someone could look over those and find some mistakes…
Comment 4 nietonfir 2010-09-20 11:33:11 UTC
Created attachment 248120 [details]
Complete dev-lang/php directory

Changes:
* Moved the ulong-osx.patch from the src_prepare-v1.eblit eblit to ebuilds' src_prepare() (thx heiko)
* Added "${EPREFIX}/usr" to sharedmem extensions in src_configure-v1.eblit
* Fixed a double prefix error in line 30 src_install-v1.eblit
* builds on ~x86-macos! ;)
* New tested (and working) USE-flags: gd-external pcntl sharedext sharedmem
Comment 5 Fabian Groffen gentoo-dev 2010-09-21 19:21:44 UTC
thanks, committed your work
Comment 6 nietonfir 2010-09-25 21:29:07 UTC
reopening for some more fixes
Comment 7 nietonfir 2010-09-25 21:34:54 UTC
Created attachment 248638 [details]
correctly installs shared extensions

Shared extensions got built but not installed on OS X. The hardcoded .so ending was changed to $(get_modname) where applicable. kudos to heiko_ and ABCD from #gentoo-prefix
Comment 8 nietonfir 2010-09-25 21:36:48 UTC
Created attachment 248639 [details]
adds proper ${EPREFIX}/usr paths to some use flags

With this configure the following use flags compile and install properly: gmp, spell, cdb, berkdb, gdbm, qdbm, imap
Comment 9 Dirk Tilger 2010-09-25 22:34:04 UTC
Created attachment 248642 [details, diff]
Patch to src_configure-v1.eblit that was needed on my box to make it compile

These modification were necessary to compile PHP over here. My USE flags are:

cat ${EPREFIX}/var/db/pkg/dev-lang/php-5.3.3-r1/USE 
apache2 bzip2 cli crypt ctype curl elibc_Darwin exif fileinfo filter ftp gd gdbm gmp hash iconv ipv6 json kernel_Darwin mysql pcntl pdo phar posix postgres prefix readline session sharedext sharedmem simplexml soap sockets spell ssl sysvipc tokenizer truetype unicode userland_GNU x86 x86-macos xml xmlreader xmlrpc xmlwriter zlib

Bug 195765 addressed the same issue for php-5.2. Maybe some prefixes can be taken from there. 
BTW: for pgsql I fed it the directory to pg_config as this should make it more portable.
Comment 10 nietonfir 2010-09-25 23:36:51 UTC
Created attachment 248644 [details]
adds proper ${EPREFIX}/usr paths to some use flags

(In reply to comment #9)
> Created an attachment (id=248642) [details]
> Patch to src_configure-v1.eblit that was needed on my box to make it compile
Thx, added.

> Bug 195765 addressed the same issue for php-5.2. Maybe some prefixes can be
> taken from there. 
All paths changes from the php5_2-sapi.eclass are already in the eblit.

> BTW: for pgsql I fed it the directory to pg_config as this should make it more
> portable.
Don't know about that one, but I didn't change it so... ;)

Thx!
Comment 11 Jeremy Olexa (darkside) (RETIRED) archtester gentoo-dev Security 2010-09-29 14:59:26 UTC
(In reply to comment #7)

(In reply to comment #10)

Committed, thx.
Comment 12 Fabian Groffen gentoo-dev 2010-10-02 19:27:42 UTC
ok,  heiko says this is not working, so heiko do your thing
Comment 13 Heiko 2010-10-02 19:28:49 UTC
(In reply to comment #12)
> ok,  heiko says this is not working, so heiko do your thing
> 

Sorry to shake the holy happy php world once more, but there are still issues.

When trying dev-lang/php-5.3.3 on ~amd64-linux the configure script errored out pretty early:
  checking whether to enable LIBXML support... yes
  checking libxml2 install dir... no
  checking for xml2-config path... 
  configure: error: xml2-config not found. Please check your libxml2 installation.

Interestingly I do have ${EPREFIX}/usr/bin/xml2-config, since libxml2 is a dep due to my 
  USE:  amd64 berkdb bzip2 cli crypt ctype elibc_glibc fileinfo filter gdbm hash iconv ipv6 json kernel_linux mysql mysqli phar posix prefix readline session simplexml ssl tokenizer unicode userland_GNU xml xmlreader xmlwriter zlib

After looking at things there're two problems coming together:
  a) configure invoking 'for i in $PHP_LIBXML_DIR /usr/local /usr; do'
  b) src-configure-v1.eblit issuing 'phpconfutils_extension_disable "libxml" "xml" 0'

So php's configure just looks in predefined paths plus the one given in --with-libxml=LIBXML_DIR. And the eblit defines how to react on the xml flag (by disabling the per default enabled libxml support). Unfortunately, that phpconfutils_extension_disable call doesn't allow for addition of "${EPREFIX}"/usr at the end like the enable versions do, without changing the eclass (and even if changing the eclass would be done, phpconfutils_extension_disable would need to return --with-libxml=..., which doesn't match the functions actual --enable/--disable purpose). Using phpconfutils_extension_with[out] doesn't work either, since there's only --disable-libxml and no --without-libxml in php's configure. phpconfutils_extension_enable doesn't allow for providing --with-libxml. That problem will probably be the case for other extensions as well.

I'm not quite sure how to handle the problem, except for introducing a new function phpconfutils_extension_with_or_disable or patching configure. Or maybe I'm just missing something and there's no problem at all?

For the other testers: You probably had luck with USE=xml, since your host has /usr/bin/xml2-config. The "cool" nature of prefix then makes the compiler and linker look in ${EPREFIX}/usr first, thus your binaries link against the correct libxml2 but were probably incorrectly configured.
Comment 14 Dirk Tilger 2010-10-03 18:46:14 UTC
Created attachment 249468 [details, diff]
Patch to address heikos issue

(In reply to comment #13)
> (In reply to comment #12)
> > ok,  heiko says this is not working, so heiko do your thing
> > 
> 
> I'm not quite sure how to handle the problem, except for introducing a new
> function phpconfutils_extension_with_or_disable or patching configure. Or maybe
> I'm just missing something and there's no problem at all?

While wondering why it didn't raise any issue on my system with similar effects I discovered I had xml2-config in /usr/bin. Nevertheless, otool revealed php was linked against libxml in $EPREFIX.

Here comes my bet at fixing the issue. It uses standard ebuild methods to pass the proper options to configure. I noticed in attachment 160956 [details, diff] that for PHP4.2 expat-dir was used, but I have my doubts whether this would work in the case where "xml" USE flag is not enabled.
Comment 15 Dirk Tilger 2010-10-03 18:51:22 UTC
Created attachment 249469 [details, diff]
Patch to turn libphp5.so to libphp5.bundle

While we're at it, here comes a patch to turn libphp5.so into libphp5.bundle. 

It came around as a side work of fixing something that someone before and faster then me ultimately had fixed already. It requires two more files to be put in $FILESDIR that I will attach separately.
Comment 16 Dirk Tilger 2010-10-03 18:52:24 UTC
Created attachment 249471 [details, diff]
File in ${FILESDIR} required to make attachment 249469 [details, diff] work correctly.
Comment 17 Dirk Tilger 2010-10-03 18:52:42 UTC
Created attachment 249473 [details, diff]
File in ${FILESDIR} required to make attachment 249469 [details, diff] work correctly.
Comment 18 nietonfir 2010-10-03 20:32:00 UTC
(In reply to comment #14)
> Created an attachment (id=249468) [details]
> Patch to address heikos issue
> 
> (In reply to comment #13)
> > (In reply to comment #12)
> > > ok,  heiko says this is not working, so heiko do your thing
> > > 
> > 
> > I'm not quite sure how to handle the problem, except for introducing a new
> > function phpconfutils_extension_with_or_disable or patching configure. Or maybe
> > I'm just missing something and there's no problem at all?
> 
> While wondering why it didn't raise any issue on my system with similar effects
> I discovered I had xml2-config in /usr/bin. Nevertheless, otool revealed php
> was linked against libxml in $EPREFIX.
> 
Meh, I was too slow this time. ;) Nevertheless, my original post:
(In reply to comment #13)
> (In reply to comment #12)
> > ok,  heiko says this is not working, so heiko do your thing
> > 
> 
> Sorry to shake the holy happy php world once more, but there are still issues.
<snip>
> I'm not quite sure how to handle the problem, except for introducing a new
> function phpconfutils_extension_with_or_disable or patching configure. Or maybe
> I'm just missing something and there's no problem at all?
> 
What about just adding this to the eblit:
if use xml ; then
        my_conf="${my_conf} --with-libxml-dir=${EPREFIX}/usr"
fi

With all the DEPEND and RDEPEND for different extensions depending on libxml it
all comes down to the xml use flag. By adding that line all is well:
--- (changed username to "me" to protect the innocent)
480 checking whether to enable LIBXML support... yes
481 checking libxml2 install dir... /Users/me/Gentoo/usr
482 checking for xml2-config path... /Users/me/Gentoo/usr/bin/xml2-config
483 checking whether libxml build works... yes
<snip>
526 checking for xml2-config path... (cached)
/Users/me/Gentoo/usr/bin/xml2-config
527 checking whether libxml build works... (cached) yes
<snip>
662 checking for xml2-config path... (cached)
/Users/me/Gentoo/usr/bin/xml2-config
663 checking whether libxml build works... (cached) yes
<snip>
723 checking for xml2-config path... (cached)
/Users/me/Gentoo/usr/bin/xml2-config
724 checking whether libxml build works... (cached) yes
---

I don't know if gentoo maintainers could live with that. Basically it would
only add some redundancy and that causes no harm. ;)
Comment 19 nietonfir 2010-10-03 21:15:27 UTC
(In reply to comment #15)
> Created an attachment (id=249469) [details]
> Patch to turn libphp5.so to libphp5.bundle
> 
> While we're at it, here comes a patch to turn libphp5.so into libphp5.bundle. 
> 
> It came around as a side work of fixing something that someone before and
> faster then me ultimately had fixed already. It requires two more files to be
> put in $FILESDIR that I will attach separately.
> 
Cool, thx a lot! I get the following "error", although the module finds its way to the correct dir nevertheless:
---
make -j3 INSTALL_ROOT=/Users/me/Gentoo/var/tmp/portage/dev-lang/php-5.3.3-r1/work/sapis/apache2/ install-sapi 
Installing PHP SAPI module:       apache2handler
/Users/me/Gentoo/usr/lib/apache2/build/instdso.sh SH_LIBTOOL='/Users/me/Gentoo/usr/bin/glibtool' libs/libphp5.bundle /Users/me/Gentoo/var/tmp/portage/dev-lang/php-5.3.3-r1/work/sapis/apache2//Users/me/Gentoo/usr/lib/apache2/modules
/Users/me/Gentoo/usr/bin/glibtool --mode=install cp libs/libphp5.bundle /Users/me/Gentoo/var/tmp/portage/dev-lang/php-5.3.3-r1/work/sapis/apache2//Users/me/Gentoo/usr/lib/apache2/modules/
glibtool: install: cp libs/libphp5.bundle /Users/me/Gentoo/var/tmp/portage/dev-lang/php-5.3.3-r1/work/sapis/apache2//Users/me/Gentoo/usr/lib/apache2/modules/libphp5.bundle
Warning!  dlname not found in /Users/me/Gentoo/var/tmp/portage/dev-lang/php-5.3.3-r1/work/sapis/apache2//Users/me/Gentoo/usr/lib/apache2/modules/libphp5.bundle.
Assuming installing a .so rather than a libtool archive.
chmod 755 /Users/me/Gentoo/var/tmp/portage/dev-lang/php-5.3.3-r1/work/sapis/apache2//Users/me/Gentoo/usr/lib/apache2/modules/libphp5.so
chmod: Zugriff auf „/Users/me/Gentoo/var/tmp/portage/dev-lang/php-5.3.3-r1/work/sapis/apache2//Users/me/Gentoo/usr/lib/apache2/modules/libphp5.so“ nicht möglich: No such file or directory
apxs:Error: Command failed with rc=65536
---
Any ideas?
Comment 20 Dirk Tilger 2010-10-04 20:25:07 UTC
(In reply to comment #19)
> Any ideas?

php built a .so and a .bundle. However, it would ignore the .bundle and install the .so. The patch makes the .bundle be used whenever .so was, so the .bundle get installed (try `find image -name '*.bundle'`).

Unless I forgot a modification I did to my system that makes it different than the others in this regard, the installation nevertheless continued successfully and a `emerge php` would get the php installed on my system properly.

When I get some time I'll dig into php again to get the error message fixed. If for some reason my patch broke your system I'll do it earlier. ;)
Comment 21 Heiko 2010-10-05 15:19:27 UTC
(In reply to comment #18)
> What about just adding this to the eblit:
> if use xml ; then
>         my_conf="${my_conf} --with-libxml-dir=${EPREFIX}/usr"
> fi
> 
> With all the DEPEND and RDEPEND for different extensions depending on libxml it
> [...] 
> I don't know if gentoo maintainers could live with that. Basically it would
> only add some redundancy and that causes no harm. ;)
> 

Well I didn't like that approach, since it avoids using phpconfutils splits the logic for that one extension into several pieces, so I just found that the openssl way would be nice:
    	phpconfutils_extension_disable "libxml"       "xml"              0
  +	phpconfutils_extension_with    "libxml-dir"   "xml"              0 "${EPREFIX}/usr"

;)

I found additional problems with the extenstions bz2, curl, iconv, xsl, zlib. Also I wonder why readline/libedit weren't offset'ed.

I'll attach a patch.
Comment 22 Heiko 2010-10-05 15:38:11 UTC
Created attachment 249649 [details, diff]
Some essential offsets. Probably still more needed.

Since I kinda lost overview this patch is based on rsync as of 'Mon Oct  4 20:10:51 UTC 2010' (timestamp content). Maybe we should just add the offset to phpconfutils_extension_with and phpconfutils_extension_enable calls and wait for things to break (like with the iconv offset).
Comment 23 Heiko 2010-10-05 15:42:33 UTC
Additionally USE=fpm is broken, since the patch doesn't apply:

 * Failed Patch: php-fpm-gentooified.patch !
 *  ( /Gentoo/usr/portage/dev-lang/php/files/php-fpm-gentooified.patch

patching file sapi/fpm/php-fpm.conf
Hunk #1 FAILED at 8.
Hunk #2 FAILED at 17.
Hunk #4 FAILED at 213.
3 out of 4 hunks FAILED -- saving rejects to file sapi/fpm/php-fpm.conf.rej

Actually I start to wonder what is not broken with php :)
Comment 24 Heiko 2010-10-05 15:48:24 UTC
(In reply to comment #23)
> Additionally USE=fpm is broken, since the patch doesn't apply:
> 

Ok, there's bug #331735 which has been fixed in gx86. Probably a sync from gx86 would be nice then.
Comment 25 Dirk Tilger 2010-10-06 14:44:10 UTC
(In reply to comment #21)
> (In reply to comment #18)
> > What about just adding this to the eblit:
> > if use xml ; then
> >         my_conf="${my_conf} --with-libxml-dir=${EPREFIX}/usr"
> > fi
[...]
> Well I didn't like that approach, since it avoids using phpconfutils splits the
> logic for that one extension into several pieces, so I just found that the
> openssl way would be nice:
>         phpconfutils_extension_disable "libxml"       "xml"              0
>   +     phpconfutils_extension_with    "libxml-dir"   "xml"              0
> "${EPREFIX}/usr"

There is already logic that does not use the phpconfutils in the src_configure eblit.

I just tested your approach with USE "apache2 bzip2 cli crypt ctype curl elibc_Darwin exif fileinfo filter ftp gd gdbm gmp hash iconv ipv6 json kernel_Darwin mysql pcntl pdo phar posix postgres prefix readline session sharedext sharedmem sockets spell ssl sysvipc tokenizer truetype unicode userland_GNU x86 x86-macos zlib" (copied from the ebuild output) and the configure script did not complain.

--without-libxml-dir got emitted as part of the configure parameters, however.
Comment 26 Jeremy Olexa (darkside) (RETIRED) archtester gentoo-dev Security 2010-11-24 20:36:02 UTC
confused about state of this bug. summary doesn't make sense, no updates for awhile. closing, please open NEW bugs.
Comment 27 Dirk Tilger 2010-12-11 10:55:30 UTC
(In reply to comment #26)
> confused about state of this bug. summary doesn't make sense, no updates for
> awhile. closing, please open NEW bugs.

The bug was abort version-bumping PHP in Gentoo-prefix. At least that's what I made of it.