summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 7c655cb7e15d1e264742de6c426d18e8ca8e3381 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# Maintainer: Patryk Kowalczyk < patryk at kowalczyk dot ws>
# Contributor: Xiao-Long Chen <chenxiaolong@cxl.epac.to>

_author="Daniel P. Berrange"
_perlmod="sys-virt"
_cpanname='Sys-Virt'
pkgname=perl-${_perlmod}
pkgver=3.0.0
pkgrel=3
pkgdesc="Represent and manage a libvirt hypervisor connection"
arch=('i686' 'x86_64')
url="http://search.cpan.org/dist/Sys-Virt/"
license=('GPL' 'PerlArtistic')
depends=('libvirt')
makedepends=('perl-test-pod-coverage' 'perl-xml-xpath')
source=("http://www.cpan.org/authors/id/D/DA/DANBERR/${_cpanname}-${pkgver}.tar.gz")
md5sums=('2d5673dd8929957513f951a63a0ae2b1')

build() {
  cd ${_cpanname}-${pkgver}

  # From Fedora spec file - generation of spec file causes make to segfault
  sed -i -e '/Sys-Virt\.spec/d' Makefile.PL
  sed -i -e '/\.spec\.PL$/d' MANIFEST
  rm -f *.spec.PL

  # Install module in vendor directories.
  PERL_MM_USE_DEFAULT=1 perl Makefile.PL INSTALLDIRS=vendor
  export MAKEFLAGS='-j1'
  make
}

_perl_depends() {
# template start; name=perl-binary-module-dependency; version=1;
if [[ $(find "$pkgdir/usr/lib/perl5/" -name "*.so") ]]; then
	_perlver_min=$(perl -e '$v = $^V->{version}; print $v->[0].".".($v->[1]);')
	_perlver_max=$(perl -e '$v = $^V->{version}; print $v->[0].".".($v->[1]+1);')
	depends+=("perl>=$_perlver_min" "perl<$_perlver_max")
fi
# template end;
}

package() {
  cd ${_cpanname}-${pkgver}
  make PERL_MM_USE_DEFAULT=1 DESTDIR="${pkgdir}/" install

  # From Fedora RPM spec file - remove empty '.packlist' and '*.bs' files
  find "${pkgdir}" -type f \( -name .packlist -o -name '*.bs' -o -name perllocal.pod -empty \) | xargs rm -vf
  rm -fr "${pkgdir}/usr/lib/perl5/core_perl"
  _perl_depends
}