Steve: Your Part 1 is very close to the Perl Cookbook section 12.18 Using h2xs to Make a Module with C Code.
I've started reading the various perldoc xs tutorials. Haven't seen any mention of bootstrap yet. James On Jan 16, 2016 6:33 AM, <stephen.cook...@sca-uk.com> wrote: > Hi People, > > I thought I'd start a new thread for The wxPerl wrap. Interestingly (and > I've > only just realised this) you can get a lot of information on wrapping just > by > reinstalling your wxPerl and redirecting the compiler output to a file, > something like this: > > cd ~ > rm -rf ~/wxPerl > svn co https://svn.code.sf.net/p/wxperl/code/wxPerl/trunk ~/wxPerl > cd ~/wxPerl > perl Makefile.PL > make 2>&1 | tee -a wxperl_install.txt ; > make install > cd ~ > > If you then inspect wxperl_install.txt you'll find all sorts of lovely > info eg > (and I'm using my favourite module wxMediaCtrl for this): > > make[2]: Entering directory `/home/image/wxPerl/ext/media' > cp lib/Wx/Media.pm ../../blib/lib/Wx/Media.pm > Running Mkbootstrap for Wx::Media () > chmod 644 "Media.bs" > "/usr/bin/perl" "/usr/local/share/perl/5.18.2/ExtUtils/xsubpp" > -noprototypes -nolinenumbers -typemap > "/usr/share/perl/5.18/ExtUtils/typemap" > -typemap "../../typemap" -typemap "typemap" Media.xs > Media.xsc && mv > Media.xsc Media.c > g++ -pthread -c -I. -I../.. > > -I/usr/local/lib/perl/5.18.2/Alien/wxWidgets/gtk_3_0_2_uni/lib/wx/include/gtk2-unicode-3.0 > -I/usr/local/lib/perl/5.18.2/Alien/wxWidgets/gtk_3_0_2_uni/include/wx-3.0 > -D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fstack-protector -fno-strict-aliasing > -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 > -g > -DVERSION=\"0.01\" -DXS_VERSION=\"0.01\" -fPIC > "-I/usr/lib/perl/5.18/CORE" > -DWXPL_EXT -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__ Media.c > rm -f ../../blib/arch/auto/Wx/Media/Media.so > > LD_RUN_PATH="/usr/local/lib/perl/5.18.2/Alien/wxWidgets/gtk_3_0_2_uni/lib" > g++ -shared -fstack-protector Media.o -o > ../../blib/arch/auto/Wx/Media/Media.so \ > -L/usr/local/lib/perl/5.18.2/Alien/wxWidgets/gtk_3_0_2_uni/lib > -lpthread > -lwx_gtk2u_media-3.0 -lwx_gtk2u_core-3.0 -lwx_baseu-3.0 \ > > chmod 755 ../../blib/arch/auto/Wx/Media/Media.so > "/usr/bin/perl" -MExtUtils::Command::MM -e 'cp_nonempty' -- Media.bs > ../../blib/arch/auto/Wx/Media/Media.bs 644 > make[2]: Leaving directory `/home/image/wxPerl/ext/media' > > So working through this we get: > > # Move to the directory and put the base module Media.pm in the right > place. > make[2]: Entering directory `/home/image/wxPerl/ext/media' > cp lib/Wx/Media.pm ../../blib/lib/Wx/Media.pm > # Media.pm has some code like this: > # package Wx::MediaCtrl; @ISA = qw(Wx::Control); > # package Wx::MediaEvent; @ISA = qw(Wx::NotifyEvent); > # And some MediaCtrl specific events like this: > # sub EVT_MEDIA_LOADED($$$) { $_[0]->Connect( $_[1], -1, > &Wx::wxEVT_MEDIA_LOADED, $_[2] ) }; > > # Not sure what this does: > Running Mkbootstrap for Wx::Media () > chmod 644 "Media.bs" > > # The we have the main part which creates Media.c using xsubpp and typemap > from > Media.xs > "/usr/bin/perl" "/usr/local/share/perl/5.18.2/ExtUtils/xsubpp" > -noprototypes -nolinenumbers -typemap > "/usr/share/perl/5.18/ExtUtils/typemap" > -typemap "../../typemap" -typemap "typemap" Media.xs > Media.xsc && mv > Media.xsc Media.c > > # And then we compile Media.c > > g++ -pthread -c -I. -I../.. > > -I/usr/local/lib/perl/5.18.2/Alien/wxWidgets/gtk_3_0_2_uni/lib/wx/include/gtk2-unicode-3.0 > -I/usr/local/lib/perl/5.18.2/Alien/wxWidgets/gtk_3_0_2_uni/include/wx-3.0 > -D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fstack-protector -fno-strict-aliasing > -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 > -g > -DVERSION=\"0.01\" -DXS_VERSION=\"0.01\" -fPIC > "-I/usr/lib/perl/5.18/CORE" > -DWXPL_EXT -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__ Media.c > > # We do some other automatic stuff here and I don't think we need to get > into it > yet. > > rm -f ../../blib/arch/auto/Wx/Media/Media.so > > LD_RUN_PATH="/usr/local/lib/perl/5.18.2/Alien/wxWidgets/gtk_3_0_2_uni/lib" > g++ -shared -fstack-protector Media.o -o > ../../blib/arch/auto/Wx/Media/Media.so \ > -L/usr/local/lib/perl/5.18.2/Alien/wxWidgets/gtk_3_0_2_uni/lib > -lpthread > -lwx_gtk2u_media-3.0 -lwx_gtk2u_core-3.0 -lwx_baseu-3.0 \ > > # And make it executable. > chmod 755 ../../blib/arch/auto/Wx/Media/Media.so > "/usr/bin/perl" -MExtUtils::Command::MM -e 'cp_nonempty' -- Media.bs > ../../blib/arch/auto/Wx/Media/Media.bs 644 > make[2]: Leaving directory `/home/image/wxPerl/ext/media' > > # There we have it. > > So in this case the two input files are Media.pm and Media.xs if we create > these > and then put an entry into typemap at the top level everything should work, > There is a lot of stuff on the wiki about how to do this and I'm going to > start > drilling down later. > > Please be free with your comments. > > Regards > > Steve. >