Alien-Libxml2

 view release on metacpan or  search on metacpan

alienfile  view on Meta::CPAN

  /*
   * xmlRead should fail, but having this call ensures
   * that the we have access to the symbols in -lxml2
   * (LIBXML_DOTTED_VERSION below is in the header file)
   */
  doc = xmlReadFile("foo.xml", NULL, 0);
  printf("xml version = '%s'\n", LIBXML_DOTTED_VERSION);
}
EOF

my @try_flags = (
  { cflags => '',                             libs => '-lxml2' },
  { cflags => '-I/usr/include/libxml2',       libs => '-lxml2' },
  { cflags => '-I/usr/local/include/libxml2', libs => '-lxml2' },
);

plugin 'Probe::Vcpkg' => 'libxml2';

probe [
  ['xml2-config', '--version' => \'%{.install.my_version}'],
  ['xml2-config', '--cflags'  => \'%{.install.my_cflags}'],
  ['xml2-config', '--libs'    => \'%{.install.my_libs}'],
];

plugin 'PkgConfig' => 'libxml-2.0';

plugin 'Probe::CBuilder' => (
  cflags  => $_->{cflags},
  libs    => $_->{libs},
  program => $test_program,
  version => qr{xml version = '(.*?)'},
) for @try_flags;
plugin 'PkgConfig::MakeStatic' => ();

my %bad_versions = map { $_ => 1 } (
  # known bad versions
  # may have some extras, and may be incomplete.
  # but probably sufficient.
  # computed using maint/tags-to-versions.pl and the git repository
  # for libxml2.
  '2.0.0',
  '2.1.0','2.1.1',

alienfile  view on Meta::CPAN

      'cscript configure.js prefix=%{.install.prefix} iconv=no compiler=msvc static=yes',
      'nmake -f Makefile.msvc',
      'nmake -f Makefile.msvc install',
    ];

    plugin 'Gather::IsolateDynamic';

    gather sub {
      my($build) = @_;
      my $prefix = $build->runtime_prop->{prefix};
      $build->runtime_prop->{cflags} = "-I$prefix/include/libxml2";
      $build->runtime_prop->{libs}   = "-L$prefix/lib libxml2_a.lib";
    };
  }
  else
  {
    plugin 'Build::Autoconf' => ();

    build [
      '%{configure} --prefix=%{.install.autoconf_prefix} --without-python --disable-shared --enable-static',
      '%{make}',

alienfile  view on Meta::CPAN

};

sys {

  meta->after_hook(
    gather_system => sub {
      my($build) = @_;
      return if defined $build->runtime_prop->{libs};
      if($build->install_prop->{my_libs})
      {
        $build->runtime_prop->{$_} = $build->install_prop->{"my_$_"} for qw( version cflags libs );
      }
    },
  );

};

dist.ini  view on Meta::CPAN


workflow = linux
workflow = macos-share
workflow = macos-system
workflow = windows-share
workflow = windows-system

diag_preamble = | $post_diag = sub {
diag_preamble = |   require Alien::Libxml2;
diag_preamble = |   diag "version        = ", Alien::Libxml2->config('version');
diag_preamble = |   diag "cflags         = ", Alien::Libxml2->cflags;
diag_preamble = |   diag "cflags_static  = ", Alien::Libxml2->cflags_static;
diag_preamble = |   diag "libs           = ", Alien::Libxml2->libs;
diag_preamble = |   diag "libs_static    = ", Alien::Libxml2->libs_static;
diag_preamble = |   diag "bin_dir        = ", $_ for Alien::Libxml2->bin_dir;
diag_preamble = | };

[AlienBuild]
:version = 0.11

[RemovePrereqs]
; comes with Perl

t/00_diag.t  view on Meta::CPAN

  Alien::Build::Plugin::Probe::Vcpkg
  ExtUtils::CBuilder
  ExtUtils::MakeMaker
  Test2::V0
  Test::Alien
);

$post_diag = sub {
  require Alien::Libxml2;
  diag "version        = ", Alien::Libxml2->config('version');
  diag "cflags         = ", Alien::Libxml2->cflags;
  diag "cflags_static  = ", Alien::Libxml2->cflags_static;
  diag "libs           = ", Alien::Libxml2->libs;
  diag "libs_static    = ", Alien::Libxml2->libs_static;
  diag "bin_dir        = ", $_ for Alien::Libxml2->bin_dir;
};

my @modules = sort keys %modules;

sub spacer ()
{
  diag '';

t/c/test.c  view on Meta::CPAN

#include <libxml/parser.h>
#include <libxml/tree.h>

/*
 * C version of the test can be used to see verify if alien is doing something wonky
 * compile and run with pkg-config:
 * cc `pkg-config --cflags libxml-2.0` t/c/test.c `pkg-config --libs libxml-2.0` && ./a.out
 * compile and run with xml2-config:
 * cc `xml2-config --cflags` t/c/test.c  `xml2-config --libs` && ./a.out
 */

int
main(int argc, char *argv[])
{
  xmlDoc *doc = NULL;
  xmlNode *root_element = NULL;
  const char *filename = "corpus/basic.xml";
  doc = xmlReadFile(filename, NULL, 0);
  if(doc == NULL)



( run in 2.481 seconds using v1.01-cache-2.11-cpan-94b05bcf43c )