From: Leandro H. <so...@le...> - 2011-03-31 15:55:13
|
On Thu, Mar 31, 2011 at 4:42 PM, Vadim Zeitlin <vz...@ze...> wrote: > On Thu, 31 Mar 2011 16:06:38 +0200 Leandro Hermida < > so...@le...> wrote: > > LH> I've discussed the SWIG Perl module build process with various people > on > LH> PerlMonks.org and they recommended a more robust and appropriate > solution to > LH> building Perl modules in SWIG which is to generate a Makefile.PL and > use > LH> ExtUtils::MakeMaker to do the build process. > > This is strange because ExtUtils::MakeMaker is almost certainly not the > best choice for doing it right now (as opposed to 15 years ago). A more > recent well known and better (even according to the ExtUtils::MakeMaker > maintainer himself) alternative is Module::Build and there are others: > Module::Install and, especially, the latest (AFAIK) one: Dist::Zilla. > I apologize but you are not correct here, just because something is older doesn't mean it's not the most widely used still and perfectly suitable to do the job. Most Perl CPAN distributions today use ExtUtils::MakeMaker still over Module::Build or Module::Install, just pay attention to the output when you are installing your distros via CPAN.pm, CPANPLUS, cpanminus, whatever. Yes you are right in terms of building Dist::Zilla is very much the same as the others, but it doesn't do any installation and is not really intended for the purpose we are talking about here. Dist::Zilla is a toolkit if you are a CPAN author and want to setup and build your distribution for *upload* to CPAN, this is what its main purpose is. I also think its total overkill for Perl SWIG needs. Please read my thread on PerlMonks http://www.perlmonks.org/?node_id=895499where all the recommendations made were to use ExtUtils::MakeMaker for the purpose of building Perl modules for SWIG. And I do agree with them it suits the job perfectly and does the exact same job as the other distros mentioned. Yes there are some advantages in cetain situations to using Module::Build (pure Perl, no system make needed, easier to do custom extensions) and Module::Install (which is simply a wrapper around ExtUtils::MakeMaker :) with some additional features and different syntax in Makefile.PL) but from what I see none of those features are really needed for Perl SWIG. I'd probably use Dist::Zilla myself for any new project right now as a lot > of people I respect in Perl community recommend it but even if you disagree > with these recommendations you should at least realize that EU::MM is very > far from being an undisputed standard for Perl modules development. > ExtUtils::MM is one of the standards for building *and* installing, the other two being Module::Build and Module::Install but ExtUtils::MM is still the most used on CPAN. LH> Now the recommendation is to have SWIG auto-generate the Makefile.PL > LH> and a couple other necessary files during the swig -perl example.i > LH> command. > > I don't think it's reasonable to expect SWIG to do it. It doesn't generate > ant files for Java, for example, why should it generate Makefile.PL for > Perl? And at least ant _is_ the standard for Java while if you decide to > generate Makefile.PL you really have no justification for not generating > the files for the other Perl build frameworks. > > Using the tutorial as an example this is how ridiculously simple the ExtUtils::MM Makefile.PL is: use ExtUtils::MakeMaker; WriteMakefile( NAME => 'example', C => ['example.c', 'example_wrap.c'], OBJECT => 'swig_example.o swig_example_wrap.o', ); That's all you need to build everything properly with automatic detection of the exact compilation and linking commands for your Perl installation, environment, OS, etc. Plus if you want you get installation of your SWIG code into your Perl tree with a couple more options. I really don't think this is too much to ask SWIG to auto-generate as part of its Perl process. If one prefers a Module::Build Build.PL file or a Module::Install Makefile.PL they too are super short and simple. In terms of SWIG there is absolutely no difference between the three, no one does better than the other and their build commands are exactly the same. > LH> What I need to provide for you is a representative SWIG Perl module > LH> Makefile.PL and the other necessary files and show what parts can be > LH> variable for the SWIG auto-generate process to know what to do. Does > this > LH> sound like a good idea you all of you? > > I think my point of view should be clear by now :-) > > LH> BTW the updated commands I provided earlier are still good and correct > for > LH> the "quick start tutorial" as they fix what was there before and > manually do > LH> the same thing that ExtUtils::MakeMaker actually does in a gcc compiler > LH> environment. > > The quick start tutorial is good for what it is, I think. The > documentation should mention that any real project should use one of the > full-featured Perl build systems but that's about as far as SWIG should go. > > I disagree, I think if one wants and auto-generated Makefile.PL or Build.PL then SWIG should be able to provide it because it is so easy. > Regards, > VZ > |