By default, Compress::Zlib builds exactly the way I want. By bundling the zlib C library, the normal:

perl Makefile.PL make make test make install

just works and the resulting Zlib.so (Zlib.dll on Windows) contains the zlib C code -- and so is independent of any zlib library that happens to be installed on the target system, works even if zlib is not installed on the target system, and can be installed without requiring root permissions.

I'd like to do the same thing with XML::Parser (and its companion C expat library) but, being a MakeMaker novice, I'm struggling.

I started by installing the expat C library. I then installed XML::Parser with:

perl Makefile.PL EXPATLIBPATH=/usr/local/lib EXPATINCPATH=/usr/local/i +nclude make make test make install
All tests passed. So far, so good. Now, as a test, I removed the expat C library from /usr/local/lib and XML::Parser failed on AIX and Solaris. Curiously, it continued to work fine on Linux.

What I want is to ensure the expat C code gets stuffed into Expat.so (just as the zlib C code gets stuffed into Zlib.so). I was able to achieve that by crudely changing this section of code in Expat/Makefile.PL:

WriteMakefile( NAME => 'XML::Parser::Expat', C => ['Expat.c'], LIBS => $libs, XSPROTOARG => '-noprototypes', VERSION_FROM => 'Expat.pm', @extras );
from:
LIBS => $libs,
to:
OBJECT => "Expat.o /usr/local/lib/libexpat.a",
Anyone know a better way to do it?


In reply to Building XML::Parser and expat standalone by eyepopslikeamosquito

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.