Replace using of Alien::Libxml2 with pkg-config

This commit is contained in:
Jitka Plesnikova 2020-11-30 16:08:42 +01:00
parent 1bac5e0601
commit 2b41f8b959
2 changed files with 56 additions and 3 deletions

View File

@ -0,0 +1,48 @@
diff -up XML-LibXML-2.0206/Makefile.PL.orig XML-LibXML-2.0206/Makefile.PL
--- XML-LibXML-2.0206/Makefile.PL.orig 2020-09-15 10:00:42.000000000 +0200
+++ XML-LibXML-2.0206/Makefile.PL 2020-11-30 15:54:20.965335954 +0100
@@ -17,15 +17,31 @@ use warnings;
require 5.008001;
-use Alien::Base::Wrapper qw( Alien::Libxml2 );
use ExtUtils::MakeMaker;
use Config;
my $SKIP_SAX_INSTALL = $ENV{SKIP_SAX_INSTALL};
+my $libs = '';
+my $inc = '';
+if (`xml2-config --modules 2>/dev/null`) {
+ $libs = `xml2-config --libs 2>/dev/null`;
+ $inc = `xml2-config --cflags 2>/dev/null`;
+}
+elsif (`pkg-config --modversion libcrypto 2>/dev/null`) {
+ $libs = `pkg-config --libs libxml-2.0 2>/dev/null`;
+ $inc = `pkg-config --cflags libxml-2.0 2>/dev/null`;
+}
+
+$libs =~ s/[\r\n]+/ /g;
+$inc =~ s/[\r\n]+/ /g;
+
+die "Could not determine location of libxml2 libs."
+ unless $libs =~ /^-/;
+die "Could not determine location of libxml2 headers."
+ unless $inc =~ /^-/;
+
my %ConfigReqs = (
- "Alien::Libxml2" => '0.14',
- "Alien::Base::Wrapper" => 0,
"Config" => 0,
"ExtUtils::MakeMaker" => 0,
);
@@ -71,7 +87,8 @@ my %prereqs = (
my %xsbuild = (
DEFINE => '-DHAVE_UTF8',
OBJECT => '$(O_FILES)',
- Alien::Base::Wrapper->mm_args,
+ LIBS => $libs,
+ INC => $inc,
);
my %WriteMakefileArgs = (

View File

@ -8,7 +8,7 @@ Name: perl-XML-LibXML
# it might not be needed anymore
# this module is maintained, the other is not
Version: 2.0206
Release: 1%{?dist}
Release: 2%{?dist}
Epoch: 1
Summary: Perl interface to the libxml2 library
License: (GPL+ or Artistic) and MIT
@ -17,6 +17,8 @@ Source0: https://cpan.metacpan.org/authors/id/S/SH/SHLOMIF/XML-LibXML-%{v
# Fix parsing ampersand entities in SAX interface, CPAN RT#131498,
# posted to the upstream.
Patch0: XML-LibXML-2.0202-Parse-an-ampersand-entity-in-SAX-interface.patch
# To reduce dependencies replace Alien::Libxml2 with pkg-config
Patch1: XML-LibXML-2.0206-Use-pkgconfig-instead-of-Alien-Libxml2.patch
BuildRequires: coreutils
BuildRequires: findutils
BuildRequires: glibc-common
@ -26,11 +28,10 @@ BuildRequires: make
BuildRequires: perl-devel
BuildRequires: perl-generators
BuildRequires: perl-interpreter
BuildRequires: perl(Alien::Base::Wrapper)
BuildRequires: perl(Alien::Libxml2) >= 0.14
BuildRequires: perl(ExtUtils::MakeMaker) >= 6.76
BuildRequires: perl(strict)
BuildRequires: perl(warnings)
BuildRequires: pkgconfig(libxml-2.0)
# Run-time
BuildRequires: perl(base)
BuildRequires: perl(Carp)
@ -93,6 +94,7 @@ validating XML parser and the high performance DOM implementation.
%prep
%setup -q -n XML-LibXML-%{version}
%patch0 -p1
%patch1 -p1
chmod -x *.c
for i in Changes; do
/usr/bin/iconv -f iso8859-1 -t utf-8 $i > $i.conv && /bin/mv -f $i.conv $i
@ -133,6 +135,9 @@ fi
%{_mandir}/man3/*.3*
%changelog
* Mon Nov 30 2020 Jitka Plesnikova <jplesnik@redhat.com> - 1:2.0206-2
- Replace using of Alien::Libxml2 with pkg-config
* Tue Sep 15 2020 Jitka Plesnikova <jplesnik@redhat.com> - 1:2.0206-1
- 2.0206 bump