Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Inline CPAN distribution.


Subject: [PATCH] Using Inline in a distribution with multiple modules
Date: Tue, 20 May 2014 17:42:54 -0500
To: bug-inline [...] rt.cpan.org
From: Jason McCarver <slam [...] parasite.cc>
I'm working on a distribution which has multiple modules using Inline. Something like the following Foo Foo::Bar - uses Inline Foo::Bar::Baz - uses Inline I couldn't figure out how to make Inline::MakeMaker work in this scenario, so I've patched it to do what I think is correct. The only problem I have now is that it fails if I do a make -j n where n > 1, but I think that's a different problem so I thought I'd submit this patch first. With this patch Inline::MakeMaker will work as it does now (with a slight change behind the scenes). I've added a parameter that is passed to Inline::MakeMaker in its argument hash, %args, 'INLINE_MODULES' which is a reference to an array of modules that use Inline and should be included in the generated Makefile. diff -r 8a9bc8d83cc9 -r e52ea446fd77 Inline.pm --- a/Inline.pm Thu May 15 07:03:36 2014 -0500 +++ b/Inline.pm Thu May 15 07:14:25 2014 -0500 @@ -515,12 +515,12 @@ sub load { my $o = shift; if ($o->{CONFIG}{_INSTALL_}) { - my $inline = "$o->{API}{modfname}.inl"; + my $inline = $o->{API}{modinlname}; open INLINE, "> $inline" or croak M24_open_for_output_failed($inline); print INLINE "*** AUTOGENERATED by Inline.pm ***\n\n"; print INLINE "This file satisfies the make dependency for "; - print INLINE "$o->{API}{modfname}.pm\n"; + print INLINE "$o->{API}{module}\n"; close INLINE; return; } @@ -983,6 +983,7 @@ sub install { my @modparts = split(/::/,$o->{API}{module}); $o->{API}{modfname} = $modparts[-1]; $o->{API}{modpname} = File::Spec->catdir(@modparts); + $o->{API}{modinlname} = join('-',@modparts).'.inl'; $o->{API}{suffix} = $o->{INLINE}{ILSM_suffix}; $o->{API}{build_dir} = File::Spec->catdir($o->{INLINE}{DIRECTORY},'build', $o->{API}{modpname}); diff -r 8a9bc8d83cc9 -r e52ea446fd77 lib/Inline/MakeMaker.pm --- a/lib/Inline/MakeMaker.pm Thu May 15 07:03:36 2014 -0500 +++ b/lib/Inline/MakeMaker.pm Thu May 15 07:14:25 2014 -0500 @@ -23,8 +23,24 @@ sub WriteMakefile { my %args = @_; my $name = $args{NAME} or croak "Inline::MakeMaker::WriteMakefile requires the NAME parameter\n"; - my $object = (split(/::/, $name))[-1]; my $version = ''; + my @objects; + + if (defined $args{INLINE_MODULES}) { + croak <<END unless ref($args{INLINE_MODULES}) eq 'ARRAY'; +Inline::MakeMaker::WriteMakefile: INLINE_MODULES must be a reference to an +array of modules +END + @objects = @{$args{INLINE_MODULES}}; + + # Don't pass this on to ExtUtils::MakeMaker, it will complain + delete $args{INLINE_MODULES} if defined $args{INLINE_MODULES}; + } else { + @objects = $name; + } + + my @obj_rules; + map { s/::/-/g; s/$/.inl/ } (@obj_rules = @objects); croak <<END unless (defined $args{VERSION} or defined $args{VERSION_FROM}); Inline::MakeMaker::WriteMakefile requires either the VERSION or VERSION_FROM @@ -43,7 +59,7 @@ Must be of the form '#.##'. (For instanc END # Provide a convenience rule to clean up Inline's messes - $args{clean} = { FILES => "_Inline $object.inl" } + $args{clean} = { FILES => "_Inline ".join(' ', @obj_rules) } unless defined $args{clean}; # Add Inline to the dependencies $args{PREREQ_PM}{Inline} = '0.44' unless defined $args{PREREQ_PM}{Inline}; @@ -58,10 +74,17 @@ END # --- MakeMaker inline section: -$object.inl : \$(TO_INST_PM) - \$(PERL) -Mblib -MInline=NOISY,_INSTALL_ -M$name -e1 $version \$(INST_ARCHLIB) +MAKEFILE + for (0..$#objects) { + print MAKEFILE <<MAKEFILE; +$obj_rules[$_]: \$(TO_INST_PM) + \$(PERL) -Mblib -MInline=NOISY,_INSTALL_ -M$objects[$_] -e1 $version \$(INST_ARCHLIB) +MAKEFILE + } -pure_all :: $object.inl +print MAKEFILE "\npure_all :: ",join(' ',@obj_rules),"\n"; + +print MAKEFILE <<MAKEFILE; # The End is here. MAKEFILE diff -r e52ea446fd77 -r 8afe37491d63 Inline.pod --- a/Inline.pod Thu May 15 07:14:25 2014 -0500 +++ b/Inline.pod Tue May 20 17:36:39 2014 -0500 @@ -921,6 +921,16 @@ to use Inline::MakeMaker; +If you have multiple modules in your distribution that use Inline, you +can make Inline::MakeMaker aware of them by adding an C<INLINE_MODULES> +parameter to the arguments you pass to Inline::MakeMaker. This parameter +must be a reference to an array of module names. For example: + + INLINE_MODULES => [qw( Foo::Bar Foo::Bar::Baz )], + +By doing this Inline::MakeMaker will make sure these get built and installed +properly. + And, in order that the module build work correctly in the cpan shell, add the following directive to the Makefile.PL's WriteMakefile():
Subject: Re: [rt.cpan.org #95809] [PATCH] Using Inline in a distribution with multiple modules
Date: Wed, 21 May 2014 21:39:54 +1000
To: <bug-Inline [...] rt.cpan.org>, <inline [...] perl.org>
From: <sisyphus1 [...] optusnet.com.au>
Show quoted text
----Original Message----- From: Jason McCarver via RT
> I'm working on a distribution which has multiple modules using Inline. > Something like the following > > Foo > Foo::Bar - uses Inline >Foo::Bar::Baz - uses Inline > > I couldn't figure out how to make Inline::MakeMaker work in this scenario, > so I've patched it to do what I think is correct.
Hi Jason, To achieve a better understanding of the issue, I created a distro (attached) that matches the description provided. That is, it's a distro named 'Foo' that contains a Foo.pm (pure perl), a Foo/Bar/Bar.pm (which uses Inline) and a Foo/Bar/Baz/Baz.pm (which uses Inline) .... along with a MANIFEST, test scripts, and Makefiles.PL. It builds and tests fine for me .... what modifications need to be made to it in order that the Inline::MakeMaker problems alluded to above become evident ? Cheers, Rob
Download Foo.tar.gz
application/x-gzip 950b

Message body not shown because it is not plain text.

Subject: Re: [rt.cpan.org #95809] [PATCH] Using Inline in a distribution with multiple modules
Date: Sat, 24 May 2014 22:56:52 +1000
To: <bug-Inline [...] rt.cpan.org>, <inline [...] perl.org>
From: <sisyphus1 [...] optusnet.com.au>
From: sisyphus1@optusnet.com.au via RT Show quoted text
> To achieve a better understanding of the issue, I created a distro > (attached) that matches the description provided.
In the absence of any further feedback, I then altered the Foo distro so that: Foo uses Inline Foo loads Foo::Bar (which uses Inline) Foo also loads Foo::Bar::Baz (which uses Inline) This distro (attached as Foo-2.tar.gz) also builds and tests fine for me. I then changed it slightly so that: Foo uses Inline Foo loads Foo::Bar (which uses Inline) Foo::Bar uses Foo::Bar::Baz (which uses Inline) This distro (attached as Foo-3.tar.gz) also builds and tests fine for me. I don't doubt that the patches provided by the OP fix *something*. But I'm certainly not going to apply them until someone enlightens me as to exactly what it is that those patches fix. Cheers, Rob
Download Foo-2.tar.gz
application/x-gzip 1009b

Message body not shown because it is not plain text.

Download Foo-3.tar.gz
application/x-gzip 1k

Message body not shown because it is not plain text.

Subject: Re: [rt.cpan.org #95809] [PATCH] Using Inline in a distribution with multiple modules
Date: Sat, 24 May 2014 19:20:55 -0500
To: bug-Inline [...] rt.cpan.org
From: Jason McCarver <slam [...] parasite.cc>
Rob, I must apologize ... I am working on a response but I just haven't had/made the time. I hope to rectify that soon! Thanks, Jason On Sat, 24 May 2014 08:57:52 -0400 "sisyphus1@optusnet.com.au via RT" <bug-Inline@rt.cpan.org> wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=95809 > > > From: sisyphus1@optusnet.com.au via RT >
> > To achieve a better understanding of the issue, I created a distro > > (attached) that matches the description provided.
> > In the absence of any further feedback, I then altered the Foo distro so > that: > > Foo uses Inline > Foo loads Foo::Bar (which uses Inline) > Foo also loads Foo::Bar::Baz (which uses Inline) > > This distro (attached as Foo-2.tar.gz) also builds and tests fine for me. > > I then changed it slightly so that: > > Foo uses Inline > Foo loads Foo::Bar (which uses Inline) > Foo::Bar uses Foo::Bar::Baz (which uses Inline) > > This distro (attached as Foo-3.tar.gz) also builds and tests fine for me. > > I don't doubt that the patches provided by the OP fix *something*. But I'm > certainly not going to apply them until someone enlightens me as to exactly > what it is that those patches fix. > > Cheers, > Rob >
Subject: Re: [rt.cpan.org #95809] [PATCH] Using Inline in a distribution with multiple modules
Date: Sun, 25 May 2014 14:49:38 -0500
To: bug-Inline [...] rt.cpan.org
From: Jason McCarver <slam [...] parasite.cc>
Rob, I've attached Foo.tar.gz which has an example of how to use Inline::MakeMaker with the new patch. I noticed that in your Foo.tar.gz that you originally built each module had its own Makefile.PL, like each was its own distribution. For what I'm working on I have a single distribution containing multiple modules that use Inline. I have changed the structure of my attached Foo distribution to mimic this. There is just one top level Makefile.PL and still the Foo::Bar and Foo::Bar::Baz modules using Inline. What I wanted (and I originally thought Inline::MakeMaker would do) is to compile all modules in the distribution that use Inline during the course of 'perl Makefile.PL; make'. Then when 'make install' was run that the compiled code would be installed along side the rest of the distribution. From what I could tell this only works for a single module, the one named in the Makefile.PL. My patch addresses this by generating rules to compile all modules in the 'INLINE_MODULES' argument to Inline::MakeMaker. Hopefully this makes sense and that my attachment will help clear up what I'm thinking. Then again, maybe I'm completely off base here as this was my first encounter with Inline and I may be missing something obvious! Thanks for your time (and patience), Jason
Download Foo.tar.gz
application/gzip 1k

Message body not shown because it is not plain text.

Subject: Re: [rt.cpan.org #95809] [PATCH] Using Inline in a distribution with multiple modules
Date: Mon, 26 May 2014 20:02:20 +1000
To: <bug-Inline [...] rt.cpan.org>, <inline [...] perl.org>
From: <sisyphus1 [...] optusnet.com.au>
Show quoted text
-----Original Message----- From: Jason McCarver via RT
> I noticed that in your Foo.tar.gz that you originally built each module > had its own Makefile.PL, like each was its own distribution. For what I'm > working on I have a single distribution containing multiple modules that > use Inline. I have changed the structure of my attached Foo distribution > to mimic this.
AFAIK, both structures should give the same end result. Turns out that while the structure I was using successfully builds and installs, it doesn't actually install the compiled libraries - so it's inadequate on that score. (This also should be fixed.) Although I prefer to avoid the layout you're wanting to use, it's certainly used by plenty of (ie most) source distros on CPAN. It's therefore valid - and ought to be better accommodated. Better still if we can fix things so that it "simply works" without any need for additional config options. In fact I'm hoping we can fix it without any need for additional documentation, too - but that remains to be seen. In the meantime we have your patches, to which I'll gladly resort if I don't come up with anything better. Thanks for raising this, and for the patches !! Cheers, Rob
Subject: Re: [rt.cpan.org #95809] [PATCH] Using Inline in a distribution with multiple modules
Date: Mon, 26 May 2014 22:19:26 +1000
To: <bug-Inline [...] rt.cpan.org>, <inline [...] perl.org>
From: <sisyphus1 [...] optusnet.com.au>
Show quoted text
-----Original Message----- From: sisyphus1@optusnet.com.au via RT
> Turns out that while the structure I was using successfully builds and > installs, it doesn't actually install the compiled libraries - so it's > inadequate on that score. (This also should be fixed.)
My mistake. Nothing to be fixed wrt that structure - it works perfectly so long as you set it up correctly (ie as per modules/Math::Simple demo in the Inline source). Attached Foo-4.tar.gz builds, tests, and installs fine - and there's no compilation to be done after 'make install' has been run. Points to watch: 1) that the Makefiles.PL use Inline::MakeMaker (not ExtUtils::MakeMaker); 2) that the pm files contain the correct 'NAME' and 'VERSION' Config options; 3) that the version number is of the form of x.xx. Can now move on to the actual issue that is the subject of this bug report. Cheers, Rob
Subject: Re: [rt.cpan.org #95809] [PATCH] Using Inline in a distribution with multiple modules
Date: Mon, 26 May 2014 07:26:40 -0500
To: bug-Inline [...] rt.cpan.org
From: Jason McCarver <slam [...] parasite.cc>
On Mon, 26 May 2014 06:03:10 -0400 "sisyphus1@optusnet.com.au via RT" <bug-Inline@rt.cpan.org> wrote: Show quoted text
> Better still if we can fix things so that it "simply works" without any need > for additional config options.
I agree that it would be much better without the additional config options. I may try to look at that too, although I'm new to working on MakeMaker so I'm not exactly sure how one would go about making this work. I'm more than happy to try to help if I'm not getting in the way. Show quoted text
> In fact I'm hoping we can fix it without any need for additional > documentation, too - but that remains to be seen. In the meantime we have > your patches, to which I'll gladly resort if I don't come up with anything > better.
Show quoted text
> Thanks for raising this, and for the patches !!
I also agree that not having to add any documentation would be ideal. Thank you for being receptive! Show quoted text
> Although I prefer to avoid the layout you're wanting to use, it's certainly > used by plenty of (ie most) source distros on CPAN.
So just out of curiosity (and this may not be the proper forum) why do you prefer your layout? I'm pretty new to module authoring so I'm always open to inpu. Jason
Subject: Re: [rt.cpan.org #95809] [PATCH] Using Inline in a distribution with multiple modules
Date: Mon, 26 May 2014 08:56:25 -0500
To: bug-Inline [...] rt.cpan.org
From: Jason McCarver <slam [...] parasite.cc>
On Mon, 26 May 2014 08:20:04 -0400 "sisyphus1@optusnet.com.au via RT" <bug-Inline@rt.cpan.org> wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=95809 > > > -----Original Message----- > From: sisyphus1@optusnet.com.au via RT
Show quoted text
> Attached Foo-4.tar.gz builds, tests, and installs fine - and there's no > compilation to be done after 'make install' has been run.
I don't see the Foo-4.tar.gz attachement? Neither in my email or via the web. Jason
Subject: Re: [rt.cpan.org #95809] [PATCH] Using Inline in a distribution with multiple modules
Date: Tue, 27 May 2014 10:16:08 +1000
To: <bug-Inline [...] rt.cpan.org>, <inline [...] perl.org>
From: <sisyphus1 [...] optusnet.com.au>
Show quoted text
-----Original Message----- From: Jason McCarver via RT
> I don't see the Foo-4.tar.gz attachement? Neither in my email or via the > web.
Don't worry - you're not going blind. (I'm just going mad ;-) I've now attached it as Foo-fixed.tar.gz. It's essentially the Foo distro that you sent, except that the layout has been changed to the one that I would normally use. I've also had to alter the top level Makefile.PL and, of course, insert the 2 extra Makefiles.PL. I don't think I made any other changes. It should build, test, and install successfully - and install as per your expectations. Incidentally, it only takes for Foo.pm to "use Foo::Bar;" and "use Foo::Bar::Baz;" and the version *you* sent would also build and install as desired. (Though in that case, every time I run 'dmake', 'dmake test' and 'dmake install' the C code recompiles - but it results in a correct install in the end.) It's the fact that Foo.pm neither uses Inline, nor uses both of the other modules, that's providing the stumbling block. (Or does Foo.pm still need to load the other 2 modules even if it uses Inline ? ... not sure now; I'd need to check on that.) The distro you sent is tantalisingly close to working .... just can't quite nail it, and don't yet know whether that's because I'm not being smart enough or because it is simply un-nailable without using your patch (or something similar). I'll look again tonight. Cheers, Rob
Download Foo-fixed.tar.gz
application/x-gzip 964b

Message body not shown because it is not plain text.

Subject: Re: [rt.cpan.org #95809] [PATCH] Using Inline in a distribution with multiple modules
Date: Tue, 27 May 2014 10:34:37 +1000
To: <bug-Inline [...] rt.cpan.org>, <inline [...] perl.org>
From: <sisyphus1 [...] optusnet.com.au>
Show quoted text
-----Original Message----- From: Jason McCarver via RT
> So just out of curiosity (and this may not be the proper forum) why do you > prefer your layout?
That's the layout I've always used, and it has never given me any trouble. (That's pretty much the full extent of my reasoning ;-) I also think the additional Makefiles.PL can only provide additional flexibility, as we're seeing here. According to my (admittedly unreliable) memory, the layout I use dates back a long way, whereas the layout you're using is relatively recent. I don't know why the "newer" layout became popular - I'll have to find out. Perhaps then things might be a little clearer. Cheers, Rob
Subject: Re: [rt.cpan.org #95809] [PATCH] Using Inline in a distribution with multiple modules
Date: Tue, 27 May 2014 09:15:45 -0500
To: bug-Inline [...] rt.cpan.org
From: Jason McCarver <slam [...] parasite.cc>
On Mon, 26 May 2014 20:17:11 -0400 "sisyphus1@optusnet.com.au via RT" <bug-Inline@rt.cpan.org> wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=95809 > > > -----Original Message----- > From: Jason McCarver via RT
Show quoted text
> Incidentally, it only takes for Foo.pm to "use Foo::Bar;" and "use > Foo::Bar::Baz;" and the version *you* sent would also build and install as > desired. (Though in that case, every time I run 'dmake', 'dmake test' and > 'dmake install' the C code recompiles - but it results in a correct install > in the end.)
Yes that makes sense since the XS gets built/compiled when the module is initially 'use'ed. Show quoted text
> The distro you sent is tantalisingly close to working ....
Please forgive the following rambling .. it's more of a stream of conscience and less than fully thought out :) I think the underlying problem here is how does Inline::MakeMaker know which modules need to be 'use'ed as part of the make process. The way it works without the patch is by relying on the fact that Inline::MakeMaker is being used in place of ExtUtils::MakeMaker. I believe I::MM currently makes the following assumptions: - There is one perl module per Makefile.PL (the layout you prefer I believe) - That module needs to be 'use'ed during 'make' For your layout these assumptions are fine. This basically means that the programmer is explicitly telling I::MM which modules to process by using I::MM instead of ExtUtils::MakeMaker But for the layout I'm using that doesn't work so then it's back to how does I::MM know which modules need to be 'use'ed. My attempt at a solution was to force the programmer to explicitly tell I::MM by way of the INLINE_MODULES argument. I do agree it would be better to not have to do that. However I believe that would mean one of the following would need to be done: - shotgun approach and 'use' all modules in the distribution (seems ugly, possibly error-prone) - scan all modules somehow to find the ones that are using 'Inline' and just 'use' them during the 'make' process. Also error-prone. It seems like the second of those might be doable but I'm not sure how ugly that would be :) And of course I could be way off here, still trying to learn as I go with Inline. Jason
Subject: Re: [rt.cpan.org #95809] [PATCH] Using Inline in a distribution with multiple modules
Date: Wed, 28 May 2014 19:54:25 +1000
To: <bug-Inline [...] rt.cpan.org>, <inline [...] perl.org>
From: <sisyphus1 [...] optusnet.com.au>
Show quoted text
-----Original Message----- From: Jason McCarver via RT
> .......... so then it's back to how does I::MM know which modules need to > be 'use'ed. My attempt at a > solution was to force the programmer to explicitly tell I::MM by way of > the INLINE_MODULES argument. I do agree it would be better to not have > to do that. However I believe that would mean one of the following > would need to be done: > - shotgun approach and 'use' all modules in the distribution (seems ugly, > possibly error-prone)
When I build the Foo.tar.gz source that you provided against Inline-0.55 (having first removed the "INLINE_MODULES => [qw(Foo::Bar Foo::Bar::Baz)]," entry in the Makefile.PL), at the make stage the following commands get run: ########################### C:\_32\pscrpt\Foo-broken>dmake cp lib/Foo/Bar/Baz.pm blib\lib\Foo\Bar\Baz.pm cp lib/Foo.pm blib\lib\Foo.pm cp lib/Foo/Bar.pm blib\lib\Foo\Bar.pm C:\MinGW\Perl516\bin\perl.exe -Mblib -MInline=NOISY,_INSTALL_ -MFoo -e1 2.01 blib\arch ########################### The commands we really want to be run there are: ########################### C:\_32\pscrpt\Foo-broken>dmake cp lib/Foo/Bar/Baz.pm blib\lib\Foo\Bar\Baz.pm cp lib/Foo.pm blib\lib\Foo.pm cp lib/Foo/Bar.pm blib\lib\Foo\Bar.pm C:\MinGW\Perl516\bin\perl.exe -Mblib -MInline=NOISY,_INSTALL_ -MFoo -e1 2.01 blib\arch C:\MinGW\Perl516\bin\perl.exe -Mblib -MInline=NOISY,_INSTALL_ -MFoo::Bar -e1 2.01 blib\arch C:\MinGW\Perl516\bin\perl.exe -Mblib -MInline=NOISY,_INSTALL_ -MFoo::Bar::Baz -e1 2.01 blib\arch ########################### In fact, the "C:\MinGW\Perl516\bin\perl.exe -Mblib -MInline=NOISY,_INSTALL_ -MFoo -e1 2.01 blib\arch" command is not needed - but it doesn't do any harm. (Foo.pm does not use Inline, not does it use a module that uses Inline, so nothing gets installed as a result of running that command.) Therefore, instead of the generated Makefile terminating with the following (generated by Inline::MakeMaker): ########################### # Well, not quite. Inline::MakeMaker is adding this: # --- MakeMaker inline section: Foo.inl : $(TO_INST_PM) $(PERL) -Mblib -MInline=NOISY,_INSTALL_ -MFoo -e1 2.01 $(INST_ARCHLIB) pure_all :: Foo.inl # The End is here. ########################### we want it to terminate with: ########################### # Well, not quite. Inline::MakeMaker is adding this: # --- MakeMaker inline section: Foo.inl : $(TO_INST_PM) $(PERL) -Mblib -MInline=NOISY,_INSTALL_ -MFoo -e1 2.01 $(INST_ARCHLIB) pure_all :: Foo.inl Bar.inl : $(TO_INST_PM) $(PERL) -Mblib -MInline=NOISY,_INSTALL_ -MFoo::Bar -e1 2.01 $(INST_ARCHLIB) pure_all :: Bar.inl Baz.inl : $(TO_INST_PM) $(PERL) -Mblib -MInline=NOISY,_INSTALL_ -MFoo::Bar::Baz -e1 2.01 $(INST_ARCHLIB) pure_all :: Baz.inl # The End is here. ########################### And I think it would be straightforward to get Inline::MakeMaker to do this. I::MM simply has to recurse through the ./lib folder and create the relevant entry in the Makefile for every pm file it finds (irrespective of whether that pm file actually uses Inline). I think this corresponds to your "shotgun" approach. I don't think it's ugly. For sure it's an unnecessary step for the modules that don't use Inline but (for those modules) it does no harm other than to consume a fraction of a second during the make stage. It becomes (possibly) error prone when someone wants to bundle something like: Foo Foo::Bar Foo::lib::Bar but I'd quite happily wait to cross that bridge if and when we come to it. OTOH, it would require no new config options and no change to any documentation. All we need to do is to have I::MM loop recursively through the ./lib directory (if such a directory exists). What do you think ? I'll probably be without an internet connection from Thursday night until Monday night, but I'll take my laptop with me and test out a proof of concept regarding this proposal over that period. Cheers, Rob
Subject: Re: [rt.cpan.org #95809] [PATCH] Using Inline in a distribution with multiple modules
Date: Sat, 31 May 2014 16:58:07 -0500
To: bug-Inline [...] rt.cpan.org
From: Jason McCarver <slam [...] parasite.cc>
On Wed, 28 May 2014 05:55:23 -0400 "sisyphus1@optusnet.com.au via RT" <bug-Inline@rt.cpan.org> wrote: Show quoted text
> And I think it would be straightforward to get Inline::MakeMaker to do this. > I::MM simply has to recurse through the ./lib folder and create the relevant > entry in the Makefile for every pm file it finds (irrespective of whether > that pm file actually uses Inline). > > I think this corresponds to your "shotgun" approach. > I don't think it's ugly. For sure it's an unnecessary step for the modules > that don't use Inline but (for those modules) it does no harm other than to > consume a fraction of a second during the make stage.
Ok, so you talked me into the "shotgun" approach :) After digging a bit I found that ExtUtils::MakeMaker was already locating all modules to be installed and placing that list in $mm->{PM} (where $mm is the returned object from the call to ExtUtils::MakeMaker::WriteMakefile). There is another attribute, $mm->{PMLIBDIRS} that contains a list of directories those modules reside in. I added some code to use those two lists to generate the rules to add to the makefile without having to scan for modules ourselves. Let me know what you think. It worked for my single-Makefile.PL distribution and for your Foo-fixed distribution. This method requires no additional config options nor documentation. Thanks, Jason

Message body is not shown because sender requested not to inline it.

Subject: Re: [rt.cpan.org #95809] [PATCH] Using Inline in a distribution with multiple modules
Date: Mon, 2 Jun 2014 22:35:07 +1000
To: <bug-Inline [...] rt.cpan.org>, <inline [...] perl.org>
From: <sisyphus1 [...] optusnet.com.au>
Show quoted text
-----Original Message----- From: Jason McCarver via RT
> After digging a bit I found that ExtUtils::MakeMaker was already locating > all modules to be installed and placing that list in $mm->{PM} (where $mm > is the returned object from the call to > ExtUtils::MakeMaker::WriteMakefile).
I didn't know that. (You already know more about Inline than I do.)
> There is another attribute, $mm->{PMLIBDIRS} that contains a list of > directories those modules reside in. I added some code to use those two > lists to generate the rules to add to the makefile without having to scan > for modules ourselves.
Didn't know that, either. Yours is therefore probably a smarter solution than the one I envisaged. Mine is a solution that hacks (solely) I::MM to recurse thru the 'lib' directory and locate all of the *.pm files (using File::Find). However, with your patch, for the distro you provided, I'm getting: ############################## C:\_32\pscrpt\Foo-broken>perl Makefile.PL Checking if your kit is complete... Looks good Writing Makefile for Foo Writing MYMETA.yml and MYMETA.json C:\_32\pscrpt\Foo-broken>dmake cp lib/Foo/Bar/Baz.pm blib\lib\Foo\Bar\Baz.pm cp lib/Foo.pm blib\lib\Foo.pm cp lib/Foo/Bar.pm blib\lib\Foo\Bar.pm C:\MinGW\Perl516\bin\perl.exe -Mblib -MInline=NOISY,_INSTALL_ -MFoo::Bar::Baz -e1 2.01 blib\arch validate Stage Starting Build Preprocess Stage get_maps Stage Finished Build Preprocess Stage Starting Build Parse Stage Finished Build Parse Stage Starting Build Glue 1 Stage Finished Build Glue 1 Stage Starting Build Glue 2 Stage Finished Build Glue 2 Stage Starting Build Glue 3 Stage Finished Build Glue 3 Stage Starting Build Compile Stage Starting "perl Makefile.PL" Stage Finished "perl Makefile.PL" Stage Starting "make" Stage Finished "make" Stage Starting "make install" Stage Finished "make install" Stage Starting Cleaning Up Stage Finished Cleaning Up Stage Finished Build Compile Stage Can't open for output. at C:\_32\pscrpt\Foo-broken\blib\lib/Foo/Bar/Baz.pm line 9. BEGIN failed--compilation aborted at C:\_32\pscrpt\Foo-broken\blib\lib/Foo/Bar/Baz.pm line 15. Compilation failed in require. BEGIN failed--compilation aborted. dmake: Error code 255, while making 'Foo-Bar-Baz.inl' C:\_32\pscrpt\Foo-broken> ############################## This might just be *my* mistake ... I might have messed something up. (I don't think so but.) I'll have to check again tomorrow night. What version of perl are you running ? Cheers, Rob
Subject: Re: [rt.cpan.org #95809] [PATCH] Using Inline in a distribution with multiple modules
Date: Mon, 2 Jun 2014 20:18:20 -0500
To: bug-Inline [...] rt.cpan.org
From: Jason McCarver <trueability.com [...] parasite.cc>
On Mon, 2 Jun 2014 08:35:55 -0400 "sisyphus1@optusnet.com.au via RT" <bug-Inline@rt.cpan.org> wrote: Show quoted text
> I didn't know that. (You already know more about Inline than I do.)
All I know is just from what I've seen while digging around, trying to get an understanding of how the MakeMaker stuff works :) Show quoted text
> > There is another attribute, $mm->{PMLIBDIRS} that contains a list > > of directories those modules reside in. I added some code to use > > those two lists to generate the rules to add to the makefile > > without having to scan for modules ourselves.
> > Didn't know that, either. > Yours is therefore probably a smarter solution than the one I > envisaged. Mine is a solution that hacks (solely) I::MM to recurse > thru the 'lib' directory and locate all of the *.pm files (using > File::Find).
My hope was that if we could use what EU::MM already located that we would support the same code as EU:MM. It appears to me that one can change the PMLIBDIRS in the Makefile.PL and so assuming 'lib' is the only directory that would contain modules is a bad assumption. Obviously I'd like to stay away from assumptions where I can! Show quoted text
> > However, with your patch, for the distro you provided, I'm getting: > > ############################## > C:\_32\pscrpt\Foo-broken>perl Makefile.PL > Checking if your kit is complete... > Looks good > Writing Makefile for Foo > Writing MYMETA.yml and MYMETA.json > > C:\_32\pscrpt\Foo-broken>dmake > cp lib/Foo/Bar/Baz.pm blib\lib\Foo\Bar\Baz.pm > cp lib/Foo.pm blib\lib\Foo.pm > cp lib/Foo/Bar.pm blib\lib\Foo\Bar.pm > C:\MinGW\Perl516\bin\perl.exe -Mblib -MInline=NOISY,_INSTALL_ > -MFoo::Bar::Baz -e1 2.01 blib\arch > validate Stage > Starting Build Preprocess Stage > get_maps Stage > Finished Build Preprocess Stage > > Starting Build Parse Stage > Finished Build Parse Stage > > Starting Build Glue 1 Stage > Finished Build Glue 1 Stage > > Starting Build Glue 2 Stage > Finished Build Glue 2 Stage > > Starting Build Glue 3 Stage > Finished Build Glue 3 Stage > > Starting Build Compile Stage > Starting "perl Makefile.PL" Stage > Finished "perl Makefile.PL" Stage > > Starting "make" Stage > Finished "make" Stage > > Starting "make install" Stage > Finished "make install" Stage > > Starting Cleaning Up Stage > Finished Cleaning Up Stage > > Finished Build Compile Stage > > Can't open for output. > > > at C:\_32\pscrpt\Foo-broken\blib\lib/Foo/Bar/Baz.pm line 9. > BEGIN failed--compilation aborted at > C:\_32\pscrpt\Foo-broken\blib\lib/Foo/Bar/Baz.pm line 15. > Compilation failed in require. > BEGIN failed--compilation aborted. > dmake: Error code 255, while making 'Foo-Bar-Baz.inl' > > C:\_32\pscrpt\Foo-broken> > ############################## > > This might just be *my* mistake ... I might have messed something up. > (I don't think so but.) > I'll have to check again tomorrow night. > > What version of perl are you running ?
Hrm that's strange.. I don't see that but at this point I have enough versions of various distributions that I'm not sure if I'm testing against the same thing you are! I tried to replicate that error but it seems to work for me. I'm running perl 5.18.1 under gentoo linux (custom perl compile, not using the gentoo package). You? So to try to make sure we're on the same page, I've uploaded a couple things (see below for link). I'd like to get the distribution you're testing against and maybe the Inline source you're using that is failing so I can see if I can make it happen too. http://cac.parasite.cc/~slam/Inline In that directory you will find a few things: Foo-fixed.tar.gz - this was one you attached that is working with the patch Foo-mjm.tar.gz - this (I belive) is the one I initially submitted to you, and it is working with the patch for me Inline-mjm.tar.gz - this is the source I'm using that I built the patch from. This is a snapshot of the mercurial repo I'm using Inline-mjm/ - directory of Inline-mjm.tar.gz extracted I've also made available the mercurial repo I'm using: http://cac.parasite.cc:8000 it has two branches" 'default' which is the baseline Inline-0.55 code I started with 'mjm' which is the branch with my changes applied you can clone the repo via: hg clone http://cac.parasite.cc:8000 Inline if you do that and wnat to see my code, you'll need to change to the mjm branch hg update -C mjm If you send me what you're testing with I'll try it out too and hopefully I can reproduce the error so I can fix it! Thanks, Jason
Subject: Re: [rt.cpan.org #95809] [PATCH] Using Inline in a distribution with multiple modules
Date: Tue, 3 Jun 2014 18:28:52 +1000
To: <bug-Inline [...] rt.cpan.org>, <inline [...] perl.org>
From: <sisyphus1 [...] optusnet.com.au>
Show quoted text
-----Original Message----- From: Jason McCarver via RT Kept getting a gateway timeout error. I'll install mercurial and check it out that way (when I get a chance). For the Foo distro I'm currently using: http://www.sisyphusion.tk/scratch/Foo-broken.tar.gz For the Inline version I'm using: http://www.sisyphusion.tk/scratch/Inline-0.55-patched.tar.gz (I believe it's just Inline-0.55 with your most recent patch applied.) And with those Foo and Inline versions, I'm getting the "Can't open for output." error mentioned in my previous post. I'm on MS Windows 7 and my make flavour is 'dmake'. I've tested on both 5.16.0 and 5.18.0 - same error. Cheers, Rob
Subject: Re: [rt.cpan.org #95809] [PATCH] Using Inline in a distribution with multiple modules
Date: Tue, 3 Jun 2014 07:36:11 -0500
To: bug-Inline [...] rt.cpan.org
From: Jason McCarver <slam [...] parasite.cc>
On Tue, 3 Jun 2014 04:36:36 -0400 "sisyphus1@optusnet.com.au via RT" <bug-Inline@rt.cpan.org> wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=95809 > > > -----Original Message----- > From: Jason McCarver via RT > > > Kept getting a gateway timeout error. > I'll install mercurial and check it out that way (when I get a > chance).
I had to fix a broken DNS record for that server last night, hopefully that was the problem and if so it should work soon (2014-06-03 8:00pm CST, 2014-06-04 1:00am UTC). Show quoted text
> > For the Foo distro I'm currently using: > http://www.sisyphusion.tk/scratch/Foo-broken.tar.gz > > For the Inline version I'm using: > http://www.sisyphusion.tk/scratch/Inline-0.55-patched.tar.gz > > (I believe it's just Inline-0.55 with your most recent patch applied.) > > And with those Foo and Inline versions, I'm getting the "Can't open > for output." error mentioned in my previous post. > > I'm on MS Windows 7 and my make flavour is 'dmake'. I've tested on > both 5.16.0 and 5.18.0 - same error.
I'll give yours a try tonight and see if I can replicate the problem. I do have a windows 7 machine (I've never installed perl on windows though) so maybe I can try it there too. Jason
Subject: Re: [rt.cpan.org #95809] [PATCH] Using Inline in a distribution with multiple modules
Date: Tue, 3 Jun 2014 21:37:03 -0500
To: bug-Inline [...] rt.cpan.org
From: Jason McCarver <slam [...] parasite.cc>
On Tue, 3 Jun 2014 04:36:36 -0400 "sisyphus1@optusnet.com.au via RT" <bug-Inline@rt.cpan.org> wrote: Ok, I when I run my patched version of Inline against your Foo-broken it works When I ran your Inline-0.55-patched against your Foo-broken I get the same error you do. So I diff'd your patched version and mine and there is a difference in Inline.pm: Here I'm diffing my patched Inline against yours --- Inline/Inline.pm 2014-05-31 14:51:53.391322710 -0500 +++ Inline-0.55-patched/Inline.pm 2014-06-03 21:29:20.420705471 -0500 @@ -914,6 +914,7 @@ my @modparts = split /::/, $module2; $o->{API}{modfname} = $modparts[-1]; $o->{API}{modpname} = File::Spec->catdir(@modparts); + $o->{API}{modinlname} = join('-',@modparts).'.inl'; $o->{API}{build_dir} = File::Spec->catdir($o->{INLINE}{DIRECTORY}, 'build',$o->{API}{modpname}); @@ -983,7 +984,6 @@ my @modparts = split(/::/,$o->{API}{module}); $o->{API}{modfname} = $modparts[-1]; $o->{API}{modpname} = File::Spec->catdir(@modparts); - $o->{API}{modinlname} = join('-',@modparts).'.inl'; $o->{API}{suffix} = $o->{INLINE}{ILSM_suffix}; $o->{API}{build_dir} = File::Spec->catdir($o->{INLINE}{DIRECTORY},'build', $o->{API}{modpname}); It looks like a line of the patch was applied to the wrong location in Inline.pm. I have attached the correct Inline.pm in case you still can't get to the links I sent. Hopefully we're getting close! :) Jason

Message body is not shown because sender requested not to inline it.

Subject: Re: [rt.cpan.org #95809] [PATCH] Using Inline in a distribution with multiple modules
Date: Wed, 4 Jun 2014 19:11:03 +1000
To: <bug-Inline [...] rt.cpan.org>, <inline [...] perl.org>
From: <sisyphus1 [...] optusnet.com.au>
Show quoted text
-----Original Message----- From: Jason McCarver via RT
> It looks like a line of the patch was applied to the wrong location in > Inline.pm.
Sorry 'bout that. Fixing it takes care of the problem.
> Hopefully we're getting close! :)
I think so. One thing I have noticed is that, for the distro we're looking at, if the Foo module loads (uses) Foo::Bar and Foo::Bar::Baz, then the Foo.inl target never gets met. This results in Inline compiling the C code for each of 'make', 'make test' and 'make install'. Just insert a: use Foo::Bar; use Foo::Bar::Baz; in Foo.pm, and rebuild - you should see what I mean. Not sure why Foo.inl never appears under that scenario ... haven't had time to even think about it. It doesn't matter greatly because 'make install' still installs exactly what we want it to install - and no future compilation occurs. Do you want to do anything about that aspect ? I'm not greatly fussed - if you don't want to do anything about it, just let me know and I'll push out a new devel release (0.55_01) that includes the patches to Inline.pm and MakeMaker.pm that you've already provided. (It can always be addressed at a later stage.) But if you do want to do something about that (and presently have the time) then I'll wait for the additional patch before I release 0.55_01. Thanks for the work you've done !! Cheers, Rob
Subject: Re: [rt.cpan.org #95809] [PATCH] Using Inline in a distribution with multiple modules
Date: Wed, 04 Jun 2014 23:00:45 -0500
To: bug-Inline [...] rt.cpan.org
From: slam <slam [...] parasite.cc>
I think I'd like to look into that problem. May be over the weekend before I have a chance though. If you're wanting to release quickly that's fine too. Thank you for being so receptive and offering help!
Subject: Re: [rt.cpan.org #95809] [PATCH] Using Inline in a distribution with multiple modules
Date: Thu, 5 Jun 2014 17:54:33 +1000
To: <bug-Inline [...] rt.cpan.org>, <inline [...] perl.org>
From: <sisyphus1 [...] optusnet.com.au>
Show quoted text
-----Original Message----- From: Jason McCarver via RT
> I think I'd like to look into that problem. May be over the weekend > before I have a chance though.
I'm in no great hurry, so I'll wait until we get this sorted. (Sorry that I'm not being more helpful - I have a rather full schedule already for the next couple of weeks.) Cheers, Rob
Subject: Re: [rt.cpan.org #95809] [PATCH] Using Inline in a distribution with multiple modules
Date: Sun, 8 Jun 2014 23:18:07 +1000
To: <bug-Inline [...] rt.cpan.org>, <inline [...] perl.org>
From: <sisyphus1 [...] optusnet.com.au>
Show quoted text
-----Original Message----- From: Jason McCarver via RT
> I think I'd like to look into that problem. May be over the weekend > before I have a chance though.
I think there's another hiccup, too. Using the patched Inline-0.55, the demo module in modules/Math/Simple (in Inline-0.55 source) then fails to build as there's no "# --- MakeMaker inline section" written into the generated Makefile. It would be nice if we can get the behaviour we want for the "lib" layout without breaking that Math::Simple demo ;-) Cheers, Rob
Subject: Re: [rt.cpan.org #95809] [PATCH] Using Inline in a distribution with multiple modules
Date: Mon, 09 Jun 2014 21:45:09 -0500
To: bug-Inline [...] rt.cpan.org
From: slam <slam [...] parasite.cc>
Ok I'll check into that too :). Now I just have to find some time this week...
On Mon Jun 09 22:45:21 2014, slam@parasite.cc wrote: Show quoted text
> Ok I'll check into that too :). Now I just have to find some time this > week...
Hi Jason, The problem seems to be mostly fixed if, at line 55 of (your patched) lib/Inline/Makemaker.pm we change: if ($mm->{PMLIBDIRS} && $mm->{PM}) { to: if (@{$mm->{PMLIBDIRS}} && $mm->{PM}) { That at least allows both "layouts" to build and install as desired. On the perls I've just tested, an array reference is true even if the array being referenced is empty - hence the need for the alteration. However, that change doesn't fix the annoyance of having the compilation re-run during each of the make steps (which happens because the specified .inl target is not met). Incidentally, for a long time Inline has shipped with the demo module named Math::Simple-1.23. It was always packed into the source as: modules/Math/Simple/Changes modules/Math/Simple/Makefile.PL modules/Math/Simple/MANIFEST modules/Math/Simple/Simple.pl modules/Math/Simple/test.pl In git (https://github.com/ingydotnet/inline-pm), I've now rearranged that as the more usual: modules/Math-Simple-1.23/Changes modules/Math-Simple-1.23/Makefile.PL modules/Math-Simple-1.23/MANIFEST modules/Math-Simple-1.23/Simple.pl modules/Math-Simple-1.23/test.pl And I've also added a second demo which is essentially the same distro as the one we've been using as our reference. (I've changed the names of the modules from Foo, Foo::Bar, and Foo::Bar::Baz to Boo, Boo::Far and Boo::Far::Faz - other than that it's the same). So, in git, you'll also find: modules/Boo-2.01/lib/Boo.pm modules/Boo-2.01/lib/Boo/Far.pm modules/Boo-2.01/lib/Boo/Far/Faz.pm modules/Boo-2.01/Makefile.PL modules/Boo-2.01/MANIFEST modules/Boo-2.01/t/boo.t These files will, of course ship with future Inline releases as demos of the 2 layouts. Naturally, what we want is for both of those demos to build correctly out of the box. With the above alteration to your patched MakeMaker.pm I think they do that - except that Math-Simple-1.23 wants to recompile the C code at every 'make' step. Cheers, Rob
How about the attached version of lib/Inline/Makemaker.pm ? It seems to do things right for me on Windows. Cheers, Rob
Subject: MakeMaker.pm
package Inline::MakeMaker; $Inline::MakeMaker::VERSION = '0.55'; $Inline::MakeMaker::VERSION = eval $Inline::MakeMaker::VERSION; @EXPORT = qw(WriteMakefile WriteInlineMakefile); use strict; use base 'Exporter'; use ExtUtils::MakeMaker(); use Carp; sub WriteInlineMakefile { # warn <<END; # #Inline::MakeMaker::WriteInlineMakefile() is deprecated as of Inline-0.44. #Inline::MakeMaker::WriteMakefile() should be used instead. # #END goto &WriteMakefile; } sub WriteMakefile { my %args = @_; my $name = $args{NAME} or croak "Inline::MakeMaker::WriteMakefile requires the NAME parameter\n"; my $version = ''; croak <<END unless (defined $args{VERSION} or defined $args{VERSION_FROM}); Inline::MakeMaker::WriteMakefile requires either the VERSION or VERSION_FROM parameter. END if (defined $args{VERSION}) { $version = $args{VERSION}; } else { $version = ExtUtils::MM_Unix->parse_version($args{VERSION_FROM}) or croak "Can't determine version for $name\n"; } croak <<END unless $version =~ /^\d\.\d\d$/; Invalid version '$version' for $name. Must be of the form '#.##'. (For instance '1.23') END # Provide a convenience rule to clean up Inline's messes $args{clean} = { FILES => "_Inline *.inl " } unless defined $args{clean}; # Add Inline to the dependencies $args{PREREQ_PM}{Inline} = '0.44' unless defined $args{PREREQ_PM}{Inline}; my $mm = &ExtUtils::MakeMaker::WriteMakefile(%args); my (@objects, @obj_rules); if (@{$mm->{PMLIBDIRS}} && $mm->{PM}) { #line 55 SIS alteration # Sort them longest first so we'll match subdirectories before their parents my @libdirs = sort { length($b) <=> length($a) } @{$mm->{PMLIBDIRS}}; for my $path (keys %{$mm->{PM}}) { for my $lib (@libdirs) { if (index($path,$lib) == 0) { my ($vol, $dirs, $file) = File::Spec->splitpath(substr($path, length($lib)+1)); my @dirs = File::Spec->splitdir($dirs); pop @dirs unless length($dirs[$#dirs]); $file =~ s/\.[^.]+$//; push @objects, join('::', @dirs, $file); push @obj_rules, join('-', @dirs, "$file.inl"); last; } croak "Failed to find module path for '$path'"; } } } else { # no modules found in PMLIBDIRS so assume we've just got $name to do @objects = $name; $name =~ s/::/-/g; @obj_rules = ("$name.inl"); #@obj_rules = (split(/::/, $name))[-1].'.inl'; } if (@objects) { open MAKEFILE, '>> Makefile' or croak "Inline::MakeMaker::WriteMakefile can't append to Makefile:\n$!"; print MAKEFILE <<MAKEFILE; # Well, not quite. Inline::MakeMaker is adding this: # --- MakeMaker inline section: MAKEFILE for (0..$#objects) { print MAKEFILE <<MAKEFILE; $obj_rules[$_]: \$(TO_INST_PM) \$(PERL) -Mblib -MInline=NOISY,_INSTALL_ -M$objects[$_] -e1 $version \$(INST_ARCHLIB) \$(PERL) -e "open WR, '>', '$obj_rules[$_]' unless -e '$obj_rules[$_]';" MAKEFILE } print MAKEFILE "\npure_all :: ",join(' ',@obj_rules),"\n"; print MAKEFILE <<MAKEFILE; # The End is here. MAKEFILE close MAKEFILE; } } 1;
Subject: Re: [rt.cpan.org #95809] [PATCH] Using Inline in a distribution with multiple modules
Date: Fri, 13 Jun 2014 14:17:45 -0500
To: bug-Inline [...] rt.cpan.org
From: Jason McCarver <slam [...] parasite.cc>
On Fri, 13 Jun 2014 06:29:44 -0400 "Sisyphus via RT" <bug-Inline@rt.cpan.org> wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=95809 > > > How about the attached version of lib/Inline/Makemaker.pm ? > > It seems to do things right for me on Windows.
It's funny, that's very close to what I had done a couple days ago but just hadn't had the time to submit to you. I've included your fix to checking the $mm->{PMLIBDIRS} array and attached my version. I believe yours will work too. Mine is slightly different, see which you like better. Neither (I believe) fix the issue of having something like Foo 'use'ing other modules that use Inline and then them being compiled multiple times. But after looking a bit I believe that one is going to be a challenge (at least for me!) to figure out... I'll have to dig into Inline some more. Unless some other bug pops up I'm thinking your or my latest code will probably work! Sorry for the delayed response. Life gets in the way sometimes :) Thanks, Jason
On Fri Jun 13 15:17:55 2014, slam@parasite.cc wrote: I've included your fix to Show quoted text
> checking the $mm->{PMLIBDIRS} array and attached my version.
I'd like to have a look at it but the attachment seems to have gone astray ;-) Show quoted text
> Neither (I believe) fix the issue of having something like Foo 'use'ing > other modules that use Inline and then them being compiled multiple > times.
Yes, some duplication of compilation still occurs - but, UIM, at least that now happens only for the first time that 'make' is run. Subsequent running of make commands (eg 'make test', 'make install') no longer execute the \$(PERL) -Mblib -MInline=NOISY,_INSTALL_ -M$name -e1 $version \$(INST_ARCHLIB) command because the target now exists. Still - I'm surprised that the duplication of the same compilation occurs (as I expected Inline to detect that such was unnecessary). Show quoted text
> But after looking a bit I believe that one is going to be a > challenge (at least for me!) to figure out... I'll have to dig into > Inline some more.
Presently, it's not clear to me either just what is entailed in fixing that up. But it doesn't really bother me, and I'm prepared to leave it alone until either someone complains or I have time to look into it properly. As far as I'm concerned it's right to go - and it's now just a question of which of the two MakeMaker.pm files we use. Cheers, Rob
Subject: Re: [rt.cpan.org #95809] [PATCH] Using Inline in a distribution with multiple modules
Date: Fri, 13 Jun 2014 21:01:17 -0500
To: bug-Inline [...] rt.cpan.org
From: Jason McCarver <slam [...] parasite.cc>
On Fri, 13 Jun 2014 20:57:33 -0400 "Sisyphus via RT" <bug-Inline@rt.cpan.org> wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=95809 > > > On Fri Jun 13 15:17:55 2014, slam@parasite.cc wrote: > I've included your fix to
> > checking the $mm->{PMLIBDIRS} array and attached my version.
> > I'd like to have a look at it but the attachment seems to have gone astray ;-)
That's because I'm an idiot and didn't actually attach it like I claimed to have done. I have done that now :) Show quoted text
>
> > Neither (I believe) fix the issue of having something like Foo 'use'ing > > other modules that use Inline and then them being compiled multiple > > times.
> > Yes, some duplication of compilation still occurs - but, UIM, at least that now happens only for the first time that 'make' is run. Subsequent running of make commands (eg 'make test', 'make install') no longer execute the > \$(PERL) -Mblib -MInline=NOISY,_INSTALL_ -M$name -e1 $version \$(INST_ARCHLIB) > command because the target now exists. > Still - I'm surprised that the duplication of the same compilation occurs (as I expected Inline to detect that such was unnecessary).
I thought it would detect it too but from what I could see it appears that it doesn't do that detection when it's in _INSTALL_ mode. Show quoted text
>
> > But after looking a bit I believe that one is going to be a > > challenge (at least for me!) to figure out... I'll have to dig into > > Inline some more.
> > Presently, it's not clear to me either just what is entailed in fixing that up. > But it doesn't really bother me, and I'm prepared to leave it alone until either someone complains or I have time to look into it properly. > As far as I'm concerned it's right to go - and it's now just a question of which of the two MakeMaker.pm files we use.
Sounds good to me. My change does also involve a change to Inline.pm as well but I didn't feel too bad about that since I was already changing it. My version of this fix is to add a bit to the generated rule in the makefile to call a routine in Inline.pm which will create the .inl file. That code was already in Inline.pm, I just moved it to its own sub and expect it to be called from perl snippet being executed by the -e command line argument in the makefile rule. Hopefully that'll make more sense when you have a look at it. Thanks, Jason
Download Inline-mjm-shogun-v3.tar.gz
application/gzip 267.4k

Message body not shown because it is not plain text.

Show quoted text
> Hopefully that'll make more sense when you have a look at it.
Looks good to me. Sub satisfy_makefile_dep() would perhaps be better placed in MakeMaker.pm but I don't see any imperative to move it there - especially since it's doing stuff that was already being done in Inline.pm (as you noted). I'll get Inline-0.55_01 out in the next week, and we'll see how it goes. Thanks for your work !! Cheers, Rob
Subject: Re: [rt.cpan.org #95809] [PATCH] Using Inline in a distribution with multiple modules
Date: Sun, 15 Jun 2014 16:55:15 -0500
To: bug-Inline [...] rt.cpan.org
From: Jason McCarver <slam [...] parasite.cc>
On Sun, 15 Jun 2014 00:25:16 -0400 "Sisyphus via RT" <bug-Inline@rt.cpan.org> wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=95809 > > > Sub satisfy_makefile_dep() would perhaps be better placed in MakeMaker.pm but I don't see any imperative to move it there - especially since it's doing stuff that was already being done in Inline.pm (as you noted).
I hadn't really thought about that. I guess I could see it in either place, but if it's moved to MakeMaker, then MakeMaker will have to be included in the command run by the generated Makefile which right now only includes Inline. I guess in that sense it made sense for it to remain in the Inline module since it's code that's being using when Inline is in _INSTALL_ mode, not while it's generating the Makefile when perl Makefile.PL is run. Or something. :) Show quoted text
> I'll get Inline-0.55_01 out in the next week, and we'll see how it goes. > > Thanks for your work !!
Sounds great! I enjoyed working with you on this, thanks for all the help and input... Jason
Inline-0.55_01, which contains the fix for this bug was released to CPAN on 19th June 2014. There's no testing of this specific bugfix in the test suite, though there are the 2 demo modules modules/Math-Simple-1.23 and modules/Boo-2.01 - both of which should build and test fine as a result of this bugfix. Math-Simple-1.23 has always built fine, but Boo-2.01 (added with this latest release) does not build correctly with earlier versions of Inline. Cheers, Rob
RT-Send-CC: sisyphus1 [...] optusnet.com.au, trueability.com [...] parasite.cc
On Sat Jun 21 00:21:40 2014, SISYPHUS wrote: Show quoted text
> There's no testing of this specific bugfix in the test suite, though > there are the 2 demo modules modules/Math-Simple-1.23 and modules/Boo- > 2.01 - both of which should build and test fine as a result of this > bugfix. > Math-Simple-1.23 has always built fine, but Boo-2.01 (added with this > latest release) does not build correctly with earlier versions of > Inline.
Forgive my ignorance, including of MakeMaker - would it be possible to make a test for the generality of building a module, by installing it into a temporary directory, probably under /tmp? This would probably require using something like SITE_INSTALL? If that's right, let me know (or correct me), and I'll knock something up.
Subject: Re: [rt.cpan.org #95809] [PATCH] Using Inline in a distribution with multiple modules
Date: Tue, 24 Jun 2014 01:05:53 +1000
To: <bug-Inline [...] rt.cpan.org>, <inline [...] perl.org>
From: <sisyphus1 [...] optusnet.com.au>
Show quoted text
-----Original Message----- From: Ed J via RT Sent: Monday, June 23, 2014 11:12 AM
> Forgive my ignorance, including of MakeMaker - would it be possible to > make a test for the generality of building a module, by installing it into > a temporary directory, probably under /tmp? This would probably require > using something like SITE_INSTALL? If that's right, let me know (or > correct me), and I'll knock something up.
There's now modules/Math-Simple-1.23 and modules/Boo-2.01 that ship with the Inline source. (They're laid out differently - which is the reason that there's *two* modules.) I'm thinking along the lines that the test could be constructed so that we: 1) cd to modules/Math-Simple-1.23; 2) check that 'perl -Mblib Makefile.PL INSTALL_BASE=../../_Inline_test' succeeds; 3) check that '$Config{make} test' succeeds; 4) check that '$Config{make} install' succeeds; 5) check that '$Config{make} realclean' succeeds; and do the same for modules/Boo-2.01. I was thinking that could be done via system commands, but I'm not sure if that's such a good idea given the odd configurations that some smokers seem to come up with. Anyway, then we can rely on 'make clean' to clean up the installed modules (since it already cleans up the _Inline_test directory). Trying to find the temporary directory seems messy to me - though File::Spec probably helps out. Since we already know that _Inline_test is writable, why not install the modules into there and let 'make clean' remove them ? I don't regard such tests as critical (obviously), but they would be a useful addition to the test suite , imo - irrespective of precisely *how* you choose to implement them. Cheers, Rob
Fixed as of Inline-0.55_01
Would still like to make a test for this - reopening.
RT-Send-CC: inline [...] perl.org, trueability.com [...] parasite.cc
Test contributed by neomorphic, in Inline::C/test/27inline_maker.t. Closing.