Since some months ago, the PHP 5.4 release candidates are available in Gentoo's ~arch. But the Xdebug extension isn't available for this builds. I don't know the reasons for that, maybe due to the fact that Xdebug 2.2 isn't officially released at this time!? Whatever, the development version compiles with PHP 5.4 and this tutorial show how to get it working.
As first we clone the Github repository.
If you follow the compile instructions in the README then you get an error message if you run the make command.
So we must execute some additional commands to get this working. Well, now lets change into the xdebug directory and run the following commands to compile the source code.
If the extension has compiled successfully, it's time to install the extension into Gentoo's extension dir.
To activate the extension for your PHP installation you must create an xdebug.ini in your PHP config directory. In this example, I will do this for the cli version of PHP 5.4.
As last we change into the ext-active directory and create a symlink to our newly created xdebug.ini.
If you run the php -v command in your terminal, you should get the following output.