| 1 |
#!/usr/bin/perl |
| 2 |
# |
| 3 |
# Copyright (C) 2009-2018 Red Hat, Inc. |
| 4 |
# Copyright (C) 2009 Daniel P. Berrange |
| 5 |
# |
| 6 |
# This program is free software; You can redistribute it and/or modify |
| 7 |
# it under the GNU General Public License as published by the Free |
| 8 |
# Software Foundation; either version 2, or (at your option) any |
| 9 |
# later version |
| 10 |
# |
| 11 |
# The file "LICENSE" distributed along with this file provides full |
| 12 |
# details of the terms and conditions |
| 13 |
# |
| 14 |
|
| 15 |
use Module::Build; |
| 16 |
|
| 17 |
use strict; |
| 18 |
use warnings; |
| 19 |
|
| 20 |
my $libvirtver = "12.7.0"; |
| 21 |
my $stat = system "pkg-config --atleast-version=$libvirtver libvirt"; |
| 22 |
die "cannot run pkg-config to check libvirt version" if $stat == -1; |
| 23 |
die "libvirt >= $libvirtver is required\n" unless $stat == 0; |
| 24 |
|
| 25 |
my $LIBVIRT_LIBS = `pkg-config --libs libvirt`; |
| 26 |
my $LIBVIRT_CFLAGS = `pkg-config --cflags libvirt`; |
| 27 |
|
| 28 |
my $GCC_CFLAGS = ""; |
| 29 |
if ($ENV{TEST_MAINTAINER}) { |
| 30 |
$GCC_CFLAGS = qq( |
| 31 |
-W -Waddress -Wall -Warray-bounds -Wattributes |
| 32 |
-Wbuiltin-macro-redefined -Wcast-align |
| 33 |
-Wchar-subscripts -Wclobbered -Wcomment -Wcomments |
| 34 |
-Wcoverage-mismatch -Wcpp -Wdeprecated-declarations |
| 35 |
-Wdisabled-optimization -Wdiv-by-zero -Wdouble-promotion |
| 36 |
-Wempty-body -Wendif-labels -Wextra -Wformat-contains-nul |
| 37 |
-Wformat-extra-args -Wformat-security -Wformat-y2k |
| 38 |
-Wformat-zero-length -Wformat=2 -Wfree-nonheap-object |
| 39 |
-Wignored-qualifiers -Wimplicit -Wimplicit-function-declaration |
| 40 |
-Wimplicit-int -Winit-self -Wint-to-pointer-cast |
| 41 |
-Winvalid-memory-model -Winvalid-pch -Wjump-misses-init |
| 42 |
-Wlogical-op -Wmain -Wmaybe-uninitialized -Wmissing-braces |
| 43 |
-Wmissing-declarations -Wmissing-field-initializers |
| 44 |
-Wmissing-format-attribute -Wmissing-include-dirs |
| 45 |
-Wmissing-noreturn -Wmissing-parameter-type |
| 46 |
-Wmultichar -Wnarrowing -Wnonnull |
| 47 |
-Wnormalized=nfc -Wold-style-declaration -Wold-style-definition |
| 48 |
-Woverflow -Woverride-init -Wpacked-bitfield-compat -Wparentheses |
| 49 |
-Wpointer-arith -Wpointer-sign -Wpointer-to-int-cast -Wpragmas |
| 50 |
-Wreturn-type -Wsequence-point -Wno-shadow -Wstrict-aliasing |
| 51 |
-Wstrict-prototypes -Wsuggest-attribute=const |
| 52 |
-Wsuggest-attribute=noreturn -Wsuggest-attribute=pure -Wswitch |
| 53 |
-Wsync-nand -Wtrampolines -Wtrigraphs -Wtype-limits -Wuninitialized |
| 54 |
-Wunknown-pragmas -Wunused -Wunused-but-set-parameter |
| 55 |
-Wunused-but-set-variable -Wunused-function -Wunused-label |
| 56 |
-Wunused-local-typedefs -Wno-unused-parameter -Wunused-result |
| 57 |
-Wunused-value -Wunused-variable -Wvariadic-macros |
| 58 |
-Wvector-operation-performance -Wvolatile-register-var |
| 59 |
-Wwrite-strings -Wno-sign-compare -Wjump-misses-init |
| 60 |
-Wno-format-nonliteral -Wframe-larger-than=8192 |
| 61 |
-Wno-suggest-attribute=pure -Wno-suggest-attribute=const |
| 62 |
-Wno-cast-function-type |
| 63 |
); |
| 64 |
} |
| 65 |
|
| 66 |
my $b = Module::Build->new( |
| 67 |
module_name => "Sys::Virt", |
| 68 |
license => 'gpl', |
| 69 |
configure_requires => { |
| 70 |
'Module::Build' => 0, |
| 71 |
}, |
| 72 |
create_makefile_pl => 'small', |
| 73 |
dist_author => 'Daniel Berrange <[email protected]>', |
| 74 |
dist_abstract => 'libvirt Perl API', |
| 75 |
requires => { |
| 76 |
'perl' => '5.16.0', |
| 77 |
}, |
| 78 |
extra_compiler_flags => $GCC_CFLAGS . $LIBVIRT_CFLAGS, |
| 79 |
extra_linker_flags => $LIBVIRT_LIBS, |
| 80 |
build_requires => { |
| 81 |
'ExtUtils::CBuilder' => 0, |
| 82 |
'Sys::Hostname' => 0, |
| 83 |
'Test::CPAN::Changes' => 0, |
| 84 |
'Test::More' => 0, |
| 85 |
'Test::Pod' => 0, |
| 86 |
'Test::Pod::Coverage' => 0, |
| 87 |
'Time::HiRes' => 0, |
| 88 |
'XML::XPath' => 0, |
| 89 |
'XML::XPath::XMLParser' => 0, |
| 90 |
}, |
| 91 |
script_files => [], |
| 92 |
meta_add => { |
| 93 |
resources => { |
| 94 |
license => "http://www.gnu.org/licenses/gpl.html", |
| 95 |
homepage => "http://libvirt.org/", |
| 96 |
repository => "https://gitlab.com/libvirt/libvirt-perl", |
| 97 |
MailingList => "http://www.redhat.com/mailman/listinfo/libvir-list", |
| 98 |
}, |
| 99 |
}, |
| 100 |
PL_files => { 'perl-Sys-Virt.spec.PL' => 'perl-Sys-Virt.spec' }, |
| 101 |
); |
| 102 |
$b->create_build_script; |