On 17/12/2012 02:48, Marvin Humphrey wrote:
Nick Wellnhofer pointed out off-list that a recent commit of mine made it
impossible to pass compiler flags on the command line via Module::Build's
`--extra_compiler_flags` param.

Hey, how did you find that comment on Github? It was mainly meant as note to myself ;)

(; Extending Charmonizer to handle
compilation might actually be the most elegant approach -- we've already
abstracted the compiler and the shell to an extent -- but heads may explode if
I propose writing build scripts in C so I'll save that for later. ;)

I've also been thinking in that direction when working on the C bindings. It sounds like a crazy idea, but that could be said about Charmonizer as a whole. OTOH, Charmonizer does its job very well, and using C is the only approach that really works cross-platform.

FWIW, here is the preliminary Makefile that I currently use in my work on the C bindings:

    http://s.apache.org/fBI

If you ignore the huge list of source files, it's actually quite simple.
So it doesn't sound like too much a stretch to generate it using C.

I also began to port this Makefile to Windows' nmake, and here are some observations:

* There is a small but usable subset of features that can be used with nmake as well as GNU make. So some parts of the Makefile can be shared verbatim.

* Rules for compiling and linking can be written in a cross-platform way using Makefile variables for all the separate parts of the commands.

* Path names can sometimes be problematic. Windows generally accepts the forward slash as directory separator, but there are always some cases where it doesn't work or needs a work-around.

* Windows is probably the first platform that will break because of overlong command lines (8K limit).

* External commands can be hard to emulate on Windows. Even something simple like "rm" can be much more complicated.

I made an initial attempt to put the bulk of the Makefile in a platform-independent file which then is included by platform-dependent Makefiles. This approach seems to work, but some of the corner cases need rather inelegant solutions. So I'd like to look into a way to generate Makefiles programmatically using parameters provided by Charmonizer.

In any case, I'm still planning to merge the chaz_compiler_flags branch into
master.  If the ability to pass extra_compiler_flags via the command line is
important, we can hack it back in; it just means a small setback with regards
to the the task of simplifying host build files.

Occasionally, I found it useful during development to pass compiler flags to Build.PL. It's also a nice feature for users with special compilation needs. But it shouldn't hold you back from merging the branch.

Nick

Reply via email to