develooper Front page | perl.perl5.porters | Postings from February 2009

Re: merging make_ext and make_ext_cross

Thread Previous | Thread Next
From:
Craig A. Berry
Date:
February 6, 2009 20:58
Subject:
Re: merging make_ext and make_ext_cross
Message ID:
c9ab31fc0902062057o7c808fc7p961377f373974886@mail.gmail.com
On Fri, Feb 6, 2009 at 3:16 PM, Nicholas Clark <nick@ccl4.org> wrote:
> On Fri, Jan 30, 2009 at 07:47:49PM -0600, Craig A. Berry wrote:
>
>> On that note, I've had a quick look at porting make_ext.pl to VMS.  It
>> wouldn't be that difficult and I'm happy to add the DCL bits if you'd
>> rather not mess with it.  The hard part is calling it from the
>
> If you could, it would be very useful. I think that descrip_mms.template
> would need to change something like this, invoking
>
>  $(MINIPERL) make_ext.pl "--perl=$(MINIPERL_EXE)" "MAKE=$(MMS)" "--build-all"

Yes, that looks about right.

> with a new --perl option to pass in the path to miniperl (assuming that it's
> better to keep the option of having the makefile set the location of miniperl),
> but I don't know how to write the VMS system() invocations inside make_ext.pl

Those may not need anything more than passing the arguments through a
_quote_args routine, found in t/test.pl, various of the Test::xxx
family, Module::Build::Platform::VMS, and probably somewhere in
MakeMaker).

> (Or exactly how to munge the paths to work out the number of '-' for the
> directory specs to find lib in -I). So:

Hmm.  Where exactly do we need path munging?  Is that only when
generating the DCL that will be a fallback for doing clean-up?  I
thought we weren't going to need that since we delete miniperl later
than is done elsewhere.

> --- a/vms/descrip_mms.template
> +++ b/vms/descrip_mms.template
> @@ -565,8 +565,8 @@ unidatafiles.ts : $(MINIPERL_EXE) [.lib]Config.pm [.lib.unicore]mktables
>        $(MINIPERL) $(MMS$SOURCE)
>        @ Rename/Log XSLoader.pm [.ext.DynaLoader]
>
> -dynext : $(LIBPREREQ) $(DBG)perlshr$(E) preplibrary makeppport
> -       @make_ext "$(MINIPERL_EXE)" "$(MMS)"
> +dynext : $(LIBPREREQ) $(DBG)perlshr$(E) preplibrary makeppport $(MINIPERL_EXE)
> +       $(MINIPERL) make_ext.pl "--perl=$(MINIPERL_EXE)" "MAKE=$(MMS)" "--build-all"
>
>  [.lib]lib.pm : [.lib]lib_pm.PL
>        $(MINIPERL) $(MMS$SOURCE)
> @@ -1836,7 +1836,7 @@ tidy : cleanlis
>        - If F$Search("[.lib.pods]*.com;-1").nes."" Then Purge/NoConfirm/Log [.lib.pods]*.com
>
>  clean : tidy cleantest cleanup_unpacked_files
> -       - @make_ext "$(MINIPERL_EXE)" "$(MMS)" clean
> +       - $(MINIPERL) make_ext.pl "--perl=$(MINIPERL_EXE)" "MAKE=$(MMS)" "--build-all" "--target=clean"
>        - If F$Search("*.Opt").nes."" Then Delete/NoConfirm/Log *.Opt;*/Exclude=PerlShr_*.Opt
>        - If F$Search("[...]*$(O);*") .nes."" Then Delete/NoConfirm/Log [...]*$(O);*
>        - If F$Search(F$Parse("Sys$Disk:[]","$(SOCKH)")).nes."" Then Delete/NoConfirm/Log $(SOCKH);*
> @@ -1862,7 +1862,7 @@ clean : tidy cleantest cleanup_unpacked_files
>        - If F$Search("git_version.h").nes."" Then Delete/NoConfirm/Log git_version.h;*
>
>  realclean : clean
> -       - @make_ext "$(MINIPERL_EXE)" "$(MMS)" realclean
> +       - $(MINIPERL) make_ext.pl "--perl=$(MINIPERL_EXE)" "MAKE=$(MMS)" "--build-all" "--target=realclean"
>        - $(MINIPERL) mkppport "--clean"
>        - If F$Search("*$(OLB)").nes."" Then Delete/NoConfirm/Log *$(OLB);*
>        - If F$Search("*.Opt").nes."" Then Delete/NoConfirm/Log *.Opt;*
> @@ -1873,7 +1873,6 @@ realclean : clean
>        - If F$Search("[.lib.unicore]Properties.").nes."" Then Delete/NoConfirm/Log [.lib.unicore]Properties.;*
>        - $(MINIPERL) -e "use File::Path; rmtree(\@ARGV,1,0);" $(unidatadirs)
>        - If F$Search("Descrip.MMS").nes."" Then Delete/NoConfirm/Log Descrip.MMS;*
> -       - If F$Search("make_ext.Com").nes."" Then Delete/NoConfirm/Log make_ext.Com;*
>        - If F$Search("extra_pods.Com").nes."" Then Delete/NoConfirm/Log extra_pods.Com;*
>        - If F$Search("extra.pods").nes."" Then Delete/NoConfirm/Log extra.pods;*
>        - $(MINIPERL) -e "use File::Path; rmtree(['lib/auto','lib/VMS','lib/$(ARCH)'],1,0);"

This makes sense except we can also excise the chunk from
configure.com that generates make_ext.com; that can be left for after
we know everything is debugged and working.

> The second thing is that I've committed changes to Configure and
> win32/FindExt.pm to ignore ext/VMS*, and to cope with having directories in
> ext named as ext/Data-Dumper/ rather than ext/Data/Dumper
>
> I asked my colleague at work how to do tr!-!/! in DCL (which is all that it
> needs), and without access to VMS (dear HP, please bring Testdrive back) he
> gave me a loop which I think would integrate into configure.com like this:
>
> diff --git a/configure.com b/configure.com
> index c8e3e5e..4e11358 100644
> --- a/configure.com
> +++ b/configure.com
> @@ -2731,6 +2731,23 @@ $   IF F$EXTRACT(0,7,xxx) .EQS. "Encode/" THEN goto ext_loop  ! sub extension -
>  $   IF xxx .EQS. "B/C" THEN goto ext_loop  ! sub extension - omit
>  $   IF F$EXTRACT(0,8,line) .EQS. "vms/ext/" THEN -
>       xxx = "VMS/" + F$EXTRACT(8,line_len - 20,line)
> +$
> +$! (extspec = xxx) =~ tr!-!/!
> +$   extspec = ""
> +$   idx = 0
> +$ replace:
> +$   before = F$ELEMENT(idx, "-", xxx)
> +$   IF before .EQS. "-" THEN goto end_replace
> +$   IF extspec .NES. ""
> +$   THEN
> +$      extspec = extspec + "/"
> +$   ENDIF
> +$   extspec = extspec + before
> +$   idx = idx + 1
> +$   goto replace
> +$
> +$ end_replace:
> +$
>  $   known_extensions = known_extensions + " ''extspec'"
>  $   goto ext_loop
>  $end_ext:
>
>
> (hmm, should there be some more C<DELETE/SYMBOL>s afterwards to clean up?)

Deleting symbols when you're done with them is good citizenship, but
other than that this looks like perfectly good DCL and will likely get
the right thing into $Config{known_extensions}.  Testing will tell.
It appears that we do not currently populate $Config{nonxs_extensions}
but we may want to fix that since there will be more of them now.

> If you're able to get the VMS configure system to use make_ext.pl, and to cope
> with the "flat" format of ext/Data-Dumper, then it opens the path to the next
> steps in my plan:
>
> http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2009-01/msg00898.html
>
>
> 5: Rename the directories in ext/ to that format, so that ext/ is flat, with
>   all extensions at the top level
> 6: Simplify all the ext scanning code - no need to recurse directories, no
>   need to limit the depth to 10 to avoid infinite symlink loops, no need for
>   special cases for ext/threads/shared and ext/Hash/Util
>
> At this point there is a one to one mapping between extensions and directories
> in ext. Every directory there is an extension. So
>
> 7: Add logic to make_ext.pl to write a Makefile.PL automatically for any
>   directory in ext/ that doesn't have one. (and clean it up at the end)
> 8: Start moving dual life modules from lib/ to ext/
>
> (I should add that for step 8, I envisage laying each out in ext/ identically
> to how its CPAN distribution is laid out. Which should reduce the insanity)

If there's anything that has a Makefile.PL and does not need to have
its directory structure flattened, it could, as far as I know, be
moved before we get make_ext.pl working on VMS (but hopefully that
won't be long in any case).

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About