Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

I'd like to seperate some *.c/*.h files in YAML::XS. Currently the CPAN distribution looks like this: https://metacpan.org/source/TINITA/YAML-LibYAML-0.77

In the LibYAML directory there are copied files from the libyaml sources plus the bindings to perl (perl_libyaml.{c,h}).
I'd like to separate the libyaml sources into their own directories to make it easy to remove/ignore them and use the installed system libyaml instead, if one wants to.
Here I put the files into LibYAML/src and LibYAML/include: https://github.com/ingydotnet/yaml-libyaml-pm/tree/seperate-libyaml-source/YAML-LibYAML-0.77
The problem is I don't know how to change LibYAML/Makefile.PL.
Currently I'm getting this error because apparently it can't find the yaml.h:

Can't load '.../yaml-libyaml-pm/YAML-LibYAML-0.77/blib/arch/auto/YAML/ +XS/LibYAML/LibYAML.so' for module YAML::XS::LibYAML: .../yaml-libyaml-pm/YAML-LibYAML-0.77/blib/ +arch/auto/YAML/XS/LibYAML/LibYAML.so: undefined symbol: yaml_sequence_start_event_initialize at .../perl-5.24.1/lib/5.24.1/x86 +_64-linux/DynaLoader.pm line 193, <CONFIG> line 1. at .../yaml-libyaml-pm/YAML-LibYAML-0.77/blib/lib/YAML/XS.pm line 20.
Any ideas/pointers on how to set this up?

To reproduce:
Clone the git repo:
git clone https://github.com/ingydotnet/yaml-libyaml-pm -b seperate-libyaml-source
and go into the directory YAML-LibYAML-0.77:
perl Makefile.PL make make test


edit:
Tux was working on it and came up with this:

use ExtUtils::MakeMaker; use strict; use Config; my $s = join " " => sort glob ("*.c"), glob ("src/*.c"), glob ("*.xs" +); (my $o = $s) =~ s{\.(?:c|xs)\b}{$Config::Config{_o}}g; (my $l = $o) =~ s{\bsrc/}{}g; my $DEFINE = $^O eq 'MSWin32' ? '-DHAVE_CONFIG_H -DYAML_DECLARE_EXPORT' : '-DHAVE_CONFIG_H'; WriteMakefile( NAME => 'YAML::XS::LibYAML', ABSTRACT_FROM => 'lib/YAML/XS/LibYAML.pm', AUTHOR => 'Ingy döt Net <ingy@cpan.org>', PREREQ_PM => {}, CCFLAGS => "-I. -Isrc -Iinclude $DEFINE", OBJECT => $o, LDFROM => $l, );

It's working for me, thanks Tux!
The only weird thing is that it is compiling again whenever one does make test. Does anyone have an idea?

In reply to Separating source files in YAML::XS by tinita

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (7)
As of 2024-04-25 14:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found