Click here to get back home

extutils::MakeMaker trying to portability build a shared lib

 HomeNewsGroups | Search | About
 comp.lang.perl.modules    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
extutils::MakeMaker trying to portability build a shared lib Andrew Torda 07-09-2007
Posted by Andrew Torda on July 9, 2007, 4:36 pm
Please log in for more thread options


I cannot see how to get MakeMaker to build a dynamic library for
me in the most portable manner.
I have a module which consists of a few dozen C files in two
directories.
For years, we have used a Makefile to build our library, then
MakeMaker/Makefile.PL to build the top level and link it all. The
problem is that we have to tweak all the options in our Makefile
manually. Do we compile with -fpic/-shared/nothing ? Do we link
to a .so or .a ? Do we have to ranlib the resulting library ?
I thought MakeMaker should have the machinery to sort this out,
but I am missing something. The top level Makefile.PL seems easy,

WriteMakefile(
'NAME' => 'Myname',
'DIR' => ['src'], # the first of the library directories
'INC' => '-Isrc',
'MYEXTLIB' => 'src/libmyname$(DLEXT)',
);
In the src directories with the C code, I have less luck
WriteMakefile(
NAME => 'libmyname',
OBJECT => '$(O_FILES)',
);
will build something, but puts them in
blib/arch/auto/libmyname/libmyname.so, but I want ./libmyname.so. In
one of the man pages, they use a postamble section like
sub MY::postamble {'
all :: dynamic
dynamic :: libmyname.$(DLEXT)
libmyname$(DLEXT): $(OFILES)
        $(AR) cr libmyname.$(DLEXT) $(O_FILES)
$(RANLIB) libmyname.$DLEXT)';
}

but this cannot be the correct approach. On some machines, we
have to use "ar", but on others "cc -shared". I am sure that
there is a MakeMaker rule to handle this for me, but I can't find
it. Even better, I would like to persuade MakeMaker not to bury
the libmyname.so in blib.
I know I am not the first to try this, but I couldn't find any
nice examples.
Failing this, is there an elegant approach to building perl
binary extensions using the FSF's autoconf ?
Many thanks for any suggestions.

Similar ThreadsPosted
ExtUtils::MakeMaker December 30, 2006, 9:06 am
ExtUtils::MakeMaker installation question January 15, 2005, 11:38 am
Setting file permissions in ExtUtils::MakeMaker January 25, 2005, 5:15 am
Passing Environment and ExtUtils::MakeMaker options to CPAN methods August 5, 2005, 8:42 am
Win32:Printer Windows x86 build with FreeImage.dll support build issues May 29, 2008, 2:58 pm
List of sample Build::Module Build.PL May 7, 2007, 6:49 pm
Invalid value for shared scalar June 14, 2005, 1:57 pm
ANNOUNCE: ExtUtils-ModuleMaker-0.43 and ExtUtils-ModuleMaker-PBP-0.08 October 1, 2005, 3:48 pm
ANNOUNCE: ExtUtils-ModuleMaker-0.43 and ExtUtils-ModuleMaker-PBP-0.08 October 1, 2005, 3:51 pm
Shared memory for data structures September 8, 2004, 11:13 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap