On Sat, Aug 15, 2015 at 04:51:23PM +0200, Patrice Dumas wrote: > On Fri, Aug 14, 2015 at 10:12:07PM +0000, Karl Berry wrote: > > I'm not sure what the Makefile.PL is doing there; > > > > As I understood it, it was for the sake of making a texi2any Perl module > > that could be uploaded to CPAN and installed in the normal CPAN way. (I > > don't believe that has actually happened yet, but that was the theory.) > > But with the XS module, it is probable that it does not work anymore, > probably some changes are needed for XS packages. I'll check if it > still works without change.
I checked and unsurprisingly it didn't work. I tried to build the .xs file from the tp/Makefile.PL, but I did not succeed, and information in internet and in the MakeMaker documentation is scarce and nobody seems to build .xs files from subdirectories. I had a bit more success building recursively XSParagraph after updating the XSParagraph Makefile.PL. Not complete success, though. I then tried to build XSParagraph as a standalone module first, from within tp/Texinfo/Convert/XSParagraph, with the idea that if this works, building it as part of tp/Makefile.PL could be possible. The gnulib files do not build, but I think that they are not mandatory and that we probably cannot rely on gnulib for a standalone module. ldd on the .so file do not show anything suspect. The undefined symbols seem to be either from libc or perl, which I guess are loaded somehow when using xs files. I modified XSParagraph.pm to load the .so file, but it didn't work fully: Running Mkbootstrap for XSParagraph () chmod 644 XSParagraph.bs PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" t/*.t t/XSParagraph.t .. 1/1 # Failed test 'use XSParagraph;' # at t/XSParagraph.t line 12. # Tried to use 'XSParagraph'. # Error: Invalid version format (non-numeric data) at # /home/dumas/src/texinfo/tp/Texinfo/Convert/XSParagraph/blib/lib/XSParagraph.pm # line 195. # BEGIN failed--compilation aborted at # /home/dumas/src/texinfo/tp/Texinfo/Convert/XSParagraph/blib/lib/XSParagraph.pm # line 215. # Compilation failed in require at t/XSParagraph.t line 12. # BEGIN failed--compilation aborted at t/XSParagraph.t line 12. Perl: here 1 Undefined subroutine &XSParagraph::set_state called at t/XSParagraph.t line 23. # Looks like you failed 1 test of 1. # Looks like your test exited with 255 just after 1. t/XSParagraph.t .. Dubious, test returned 255 (wstat 65280, 0xff00) Failed 1/1 subtests I attach the preliminary patch I used to test. To test, I do, starting with the Makefile generated by configure: export TEXINFO_XS=module make clean perl Makefile.PL make make test "perl Makefile.PL" overrides the Makefile created by configure, which can be redone by ./config.status Is this a possibility to build a standalone module worth more investigation? -- Pat
Index: Makefile.PL =================================================================== --- Makefile.PL (révision 6530) +++ Makefile.PL (copie de travail) @@ -4,17 +4,16 @@ # the contents of the Makefile that is written. WriteMakefile( NAME => 'XSParagraph', - VERSION_FROM => 'lib/XSParagraph.pm', # finds $VERSION + VERSION_FROM => 'XSParagraph.pm', # finds $VERSION PREREQ_PM => {}, # e.g., Module::Name => 1.1 ($] >= 5.005 ? ## Add these new keywords supported since 5.005 - (ABSTRACT_FROM => 'lib/XSParagraph.pm', # retrieve abstract from module - AUTHOR => 'A. U. Thor <g...@slackware.lan>') : ()), + (AUTHOR => 'Gavin Smith <gavinsmith0...@gmail.com>') : ()), LIBS => [''], # e.g., '-lm' DEFINE => '', # e.g., '-DHAVE_SOMETHING' INC => '-I.', # e.g., '-I. -I/usr/include/other' # Un-comment this if you add C files to link with later: - # OBJECT => '$(O_FILES)', # link all the C files too - 'MYEXTLIB' => 'mylib/libxspara.a', + OBJECT => '$(O_FILES)', # link all the C files too + #'MYEXTLIB' => 'mylib/libxspara.a', ); sub MY::postable { Index: XSParagraph.pm =================================================================== --- XSParagraph.pm (révision 6530) +++ XSParagraph.pm (copie de travail) @@ -105,6 +105,14 @@ goto FALLBACK; } +my $dlname = undef; +if ($TEXINFO_XS eq 'module') { + $dlname = "XSParagraph.so"; + push @DynaLoader::dl_library_path, "./blib/arch/auto/XSParagraph/"; + $TEXINFO_XS = 'debug'; + goto LOAD; +} + my ($libtool_dir, $libtool_archive) = _find_file("XSParagraph.la"); if (!$libtool_archive) { _fatal "XSParagraph: couldn't find Libtool archive file"; @@ -119,7 +127,6 @@ } # Look for the line in XSParagraph.la giving the name of the loadable object. -my $dlname = undef; while (my $line = <$fh>) { if ($line =~ /^\s*dlname\s*=\s*'([^']+)'\s$/) { $dlname = $1; @@ -135,6 +142,8 @@ push @DynaLoader::dl_library_path, $libtool_dir; push @DynaLoader::dl_library_path, "$libtool_dir/.libs"; +LOAD: + my $dlpath = DynaLoader::dl_findfile($dlname); if (!$dlpath) { _fatal "XSParagraph: couldn't find $dlname"; @@ -144,7 +153,7 @@ #print STDERR "loadable object is at $dlpath\n"; my $module = "Texinfo::Convert::XSParagraph::XSParagraph"; -our $VERSION = '6.0'; +our $VERSION = '6.0dev'; # Following steps under "bootstrap" in "man DynaLoader". #bootstrap XSParagraph $VERSION;