(unrelated to the thread on php-qa) Hi guys,
I had some free time yesterday and so commenced to tackle some issues in the current PHP build system which had bothered me for too long. I'm inlining an overview and a description of changes.. feel free to comment. - Sascha Experience IRCG http://schumann.cx/ http://schumann.cx/ircg PHP Build System V5 Overview - supports Makefile.ins during migration phase - not-really-portable Makefile includes have been eliminated - supports seperate build directories without VPATH by using explicit rules only - does not waste disk-space/CPU-time for building temporary libraries => especially noticeable on slower systems - slow recursive make replaced with one global Makefile - eases integration of proper dependencies - abandoning the "one library per directory" concept - improved integration of the CLI - several new targets build-modules: builds and copies dynamic modules into modules/ install-cli: installs the CLI only, so that the install-sapi target does only what its name says - finally abandoned automake (still requires aclocal at this time) The Reason For a New System It became more and more apparent that there is a severe need for addressing the portability concerns and improving the chance that your build is correct (how often have you been told to "make clean" after reconfiguring? When this is over, you won't need to anymore). If You Build PHP on a Unix System You, as a user of PHP, will notice no changes. Of course, the build system will be faster, look better and work smarter. If You Are Developing PHP Extension developers: Makefile.ins are abandoned. The files which are to be compiled are specified in the config.m4 now using the following macro: PHP_NEW_EXTENSION(foo, foo.c bar.c baz.cpp, $ext_shared) E.g. this enables the extension foo which consists of three source-code modules, two in C and one in C++. And dependending on the user's wishes, the extension will even be built as a dynamic module. The full syntax: PHP_NEW_EXTENSION(extname, sources [, shared [,sapi_class[, extra-cflags]]]) Please have a look at acinclude.m4 for the gory details and meanings of the other parameters. And that's basically it for the extension side. If you previously built sub-libraries for your module, add the source-code files of the sub-libs here as well. If you need to specify separate include directories, do it this way: PHP_NEW_EXTENSION(foo, foo.c mylib/bar.c mylib/gregor.c,,,-I@ext_srcdir@/lib) E.g. this builds the three files which are located relatively to the extension source directory and compiles all three files with the special include directive (@ext_srcdir@ is automatically replaced). Now, you need to tell the build system that you want to build files in a directory called $ext_builddir/lib: PHP_ADD_BUILD_DIR($ext_builddir/lib) Make sure to call this after PHP_NEW_EXTENSION, because $ext_builddir is only set by the latter. If you have a complex extension, you might to need add special Make rules. You can do this by calling PHP_ADD_MAKEFILE_FRAGMENT in your config.m4 after PHP_NEW_EXTENSION. This will read a file in the source-dir of your extension called Makefile.frag. In this file, $(builddir) and $(srcdir) will be substituted by the values which are correct for your extension and which are again determined by the PHP_NEW_EXTENSION macro. Make sure to prefix *all* relative paths correctly with either $(builddir) or $(subdir). Because the build system does not change the working directory anymore, we must use either absolute paths or relative ones to the top build-directory. Correct prefixing ensures that. SAPI developers: Instead of setting PHP_SAPI=foo, you will need to type PHP_SELECT_SAPI(foo, foo.c bar.c) I.e. specify the source-code files as above. *IMPORTANT*: _Before_ invoking that macro it is essential that you either call PHP_BUILD_SHARED, PHP_BUILD_STATIC or PHP_BUILD_PROGRAM. Otherwise the source-code files might be built wrongly. -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]