More ReadGRIB: Makefile.PL hacking
I want to distribute a third party C program called wgrib.c with my module. The C code needs to be compiled on the target platform when the module is installed on the target platform. Then my Perl code will need to be able to use it. *this isn't done yet but so far...* I found some good hints from /perlXStut/
# First I added a directory named lib-wgrib/ and moved the C source there. # Then I added this to the generated Makefile.PL: WriteMakefile( [...] MYEXTLIB => 'lib-wgriblib$(LIB_EXT)/', ); sub MY::postamble { ' $(MYEXTLIB) : lib-wgrib/Makefile cd lib-wgrib && $ (MAKE) $ (PASSTHRU) '; } # in lib-wgrib/ I created another Makefile.PL: use 5.006; use ExtUtils::MakeMaker; WriteMakefile( NAME => 'Geo::ReadGRIB::lib-wgrib', SKIP => 'qw[all static static_lib dynamic dynamic_lib]', clean => {'Files' => 'liblib-wgrib$(LIB_EXT)'}, ); sub MY::const_cccmd { ' CCCMD = $(CC) and other stuf TBD... '; }
The trick here is that the MY:: subroutines override the standard libs that write sections of the Makefile created. You can see the names of these subs in the comments in the Makefile.
Still working...
[/items/Perl]
permanent link