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 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267
|
use 5.006002;
use ExtUtils::MakeMaker;
use Config;
my $define = '';
# https://gcc.gnu.org/onlinedocs/gcc-4.0.0/gcc/Warning-Options.html
if ($Config{gccversion} and $Config{gccversion} =~ /^(\d+\.\d+)\./) {
my $gccver = $1;
if ($] > 5.035004) {
$define = '-Wall -Wextra -W';
} elsif ($gccver >= 4.3) {
$define = '-Wall -Werror=declaration-after-statement -Wextra -W';
} elsif ($gccver >= 3.4) {
$define = '-Wall -Wdeclaration-after-statement -Wextra -W';
}
# -Wformat does not support the Windows specific "%I64u" format
# and will cause false warnings in compiling 'encode_sv'.
if($define && $^O =~/MSWin32/i) { $define .= ' -Wno-format' }
}
if ($] < 5.022 && $Config{d_setlocale} && $Config{usethreads}) {
if (-e "/usr/include/xlocale.h") {
$define .= " -DI_XLOCALE -DHAS_USELOCALE";
} else {
print "probe for xlocale.h... ";
open PROBE, "> tmp.c";
print PROBE <<'EOT'; close(PROBE);
#include <stdio.h>
#include <xlocale.h>
int main(int argc, char** argv, char** env) {
printf("found\n");
uselocale((locale_t)0);
return 0;
}
EOT
my $exe = "tmp$Config{exe_ext}";
my $cc_cmd = "$Config{cc} $Config{ccflags}" .
" -o $exe $Config{ldflags} tmp.c $Config{libs}";
my $rc = system($cc_cmd);
if ($rc) {
print "not found\n";
print "$cc_cmd\n";
} else {
$define .= " -DI_XLOCALE -DHAS_USELOCALE";
}
unlink("tmp.c", $exe, "tmp$Config{obj_ext}");
}
}
WriteMakefile(
dist => {
PREOP => 'pod2text XS.pm | tee README >$(DISTVNAME)/README; chmod -R u=rwX,go=rX . ;',
COMPRESS => 'gzip -9v',
SUFFIX => '.gz',
},
EXE_FILES => [ "bin/cpanel_json_xs" ],
VERSION_FROM => "XS.pm",
NAME => "Cpanel::JSON::XS",
CONFIGURE_REQUIRES => {
'Config' => 0,
'ExtUtils::MakeMaker' => 0,
},
PREREQ_PM => {
'overload' => 0,
'strict' => 0,
'warnings' => 0,
'Carp' => 0,
'Encode' => '1.9801',
'Exporter' => 0,
'Pod::Text' => '2.08',
'XSLoader' => 0,
},
TEST_REQUIRES => {
'charnames' => 0,
'lib' => 0,
'utf8' => 0,
'B' => 0,
'Config' => 0,
'Data::Dumper' => 0,
'Devel::Peek' => 0,
'POSIX' => 0,
'Test' => 0,
'Test::More' => 0,
'Tie::Array' => 0,
'Tie::Hash' => 0,
},
DEFINE => $define,
($] >= 5.005 ?
(ABSTRACT_FROM => 'XS.pm',
AUTHOR => 'Reini Urban <rurban@cpan.org>',
# ORIGINAL_AUTHOR => 'Marc Lehmann <schmorp@schmorp.de>'
) : ()),
($ExtUtils::MakeMaker::VERSION >= 6.3002 ?
('LICENSE' => 'perl', ) : ()),
($ExtUtils::MakeMaker::VERSION gt '6.46'
? ('META_MERGE' =>
{
'meta-spec' => {
version => 2,
},
dynamic_config => 0,
prereqs => {
runtime => {
requires => { # just the script, not the module
'Encode' => '1.9801',
},
recommends => {
'Math::BigInt' => 0,
'Math::BigFloat' => '1.16',
}
},
test => {
requires => {
'Encode' => '1.9801',
'Time::Piece' => 0,
},
suggests => {
'common::sense' => '3.5',
'Mojo::JSON' => '6.11',
'JSON' => 0,
'JSON::XS' => 0,
'JSON::PP' => 0,
'Test::LeakTrace' => 0,
'Test::MinimumVersion' => '0.008',
'Perl::MinimumVersion' => '1.20',
'Test::CPAN::Meta' => '0.12',
'Test::Pod' => '1.00',
'Test::Pod::Coverage' => '1.04',
'Test::Spelling' => 0,
'Pod::Spell::CommonMistakes' => 0,
'Test::CPAN::Changes' => '0.40',
'Test::CheckChanges' => '1.14',
'Class::XSAccessor' => 0,
'Text::CSV_XS' => 0,
'List::MoreUtils' => 0,
'Test::Kwalitee' => 0,
}
}
},
resources =>
{
license => [ 'http://dev.perl.org/licenses/' ],
bugtracker => { web => 'https://github.com/rurban/Cpanel-JSON-XS/issues' },
# Note: https://rt.cpan.org/Public/Dist/Display.html?Queue=Cpanel-JSON-XS is also observed
repository => { url => 'https://github.com/rurban/Cpanel-JSON-XS', type => 'git' },
},
x_contributors => [
'Ashley Willis <ashleyw@cpan.org>',
'Chip Salzenberg <chip@pobox.com>',
'Christopher J. Madsen <cjm@cjmweb.net>',
'Colin Kuskie <colink@perldreamer.com>',
'Daniel Dragan <bulk88@hotmail.com>',
'David Golden <xdg@xdg.me>',
'David Steinbrunner <dsteinbrunner@pobox.com>',
'E. Choroba <choroba@users.noreply.github.com>',
'Gianni Ceccarelli <gianni.ceccarelli@net-a-porter.com>',
'Gilmar Santos Jr <jgasjr@gmail.com>',
'Graham Knop <haarg@haarg.org>',
'James Rouzier <rouzier@gmail.com>',
'J. Nick Koston <nick@cpanel.net>',
'Karen Etheridge <ether@cpan.org>',
'Lubomir Rintel <lkundrak@v3.sk>',
'Lukas Mai <l.mai@web.de>',
'Matthew Horsfall <wolfsage@gmail.com>',
'Michael G. Schwern <schwern@pobox.com>',
'Pali <pali@cpan.org>',
'Patrick Cronin <PatrickCronin@users.noreply.github.com>',
'Quim Rovira <quim@rovira.cat>',
'Sergey Aleynikov <sergey.aleynikov@gmail.com>',
'Syohei Yoshida <syohex@gmail.com>',
'tevfik1903 <tevfik1903@users.noreply.github.com>',
],
}
) : ()),
SIGN => 1,
);
package MY;
sub test {
local $_ = shift->SUPER::test(@_);
eval { require common::sense; };
unless ($@) {
s/TEST_FILES = /TEST_FILES = -Mcommon::sense /;
}
$_
}
sub top_targets {
local $_ = shift->SUPER::top_targets(@_);
s/\$\(FIRST_MAKEFILE\) blibdirs/\$(FIRST_MAKEFILE\) blibdirs README/;
$_
}
sub depend {
"
README : \$(VERSION_FROM)
pod2text \$(VERSION_FROM) > README
release-test : xtest dist
if test \"\$(shell git rev-parse --abbrev-ref HEAD)\" != \"master\" || \\
test \"\$(shell git diff --raw)\" != \"\" || \\
test \"\$(shell git diff --cached --raw)\" != \"\" ; then \\
echo 'You are not on a clean master branch, aborting.'; \\
exit 1; \\
fi
if test \"\$(shell git ls --show-signature -n 1 | head -n2 | tail -n1 | cut -c1-5)\" != \"gpg: \" ; then \\
echo 'need git commit with -S'; \\
exit 1; \\
fi
if test \"\$(shell git ls --no-show-signature -n 1 | head -n5 | tail -n1 | cut -c5-11)\" != \"Release\" ; then \\
echo 'need git commit with -m Release'; \\
exit 1; \\
fi
echo -git tag -f \$(VERSION)
echo cpan-upload \$(DISTVNAME).tar\$(SUFFIX)
echo git push
echo git push --tags
release : xtest dist
if test \"\$(shell git rev-parse --abbrev-ref HEAD)\" != \"master\" || \\
test \"\$(shell git diff --raw)\" != \"\" || \\
test \"\$(shell git diff --cached --raw)\" != \"\" ; then \\
echo 'You are not on a clean master branch, aborting.'; \\
exit 1; \\
fi
if test \"\$(shell git ls --show-signature -n 1 | head -n2 | tail -n1 | cut -c1-5)\" != \"gpg: \" ; then \\
echo 'need git commit with -S'; \\
exit 1; \\
fi
if test \"\$(shell git ls --no-show-signature -n 1 | head -n5 | tail -n1 | cut -c5-11)\" != \"Release\" ; then \\
echo 'need git commit with -m Release'; \\
exit 1; \\
fi
-git tag -f \$(VERSION)
cpan-upload \$(DISTVNAME).tar\$(SUFFIX)
git push
git push --tags
xtest :: test
\$(MAKE) test TEST_FILES=xt/*.t
const-c.inc const-xs.inc : Makefile.PL
# versioned gcc needs overrides
GCOV = gcov
test_cover :: pure_all
\$(RM_RF) cover_db
+\$(PERLRUNINST) -S cover -test
test_coveralls :: pure_all
+\$(PERLRUNINST) -S cover -test -report coveralls
gcov : \$(BASEEXT).c.gcov \$(BASEEXT).gcov cover_db/\$(BASEEXT)-xs.html
\$(BASEEXT).c.gcov \$(BASEEXT).xs.gcov : \$(BASEEXT).xs
\$(MAKE) CCFLAGS=\"\$(CCFLAGS) -fprofile-arcs -ftest-coverage\" LDDLFLAGS=\"\$(LDDLFLAGS) -fprofile-arcs -ftest-coverage\"
\$(GCOV) \$(BASEEXT).c \$(BASEEXT).xs
cover_db/\$(BASEEXT)-xs.html : \$(BASEEXT).xs.gcov
PERL5OPT=-MDevel::Cover make test
-$^X -S gcov2perl \$(BASEEXT).c.gcov \$(BASEEXT).xs.gcov
$^X -S cover
gprof :
\$(MAKE) CCFLAGS=\"\$(CCFLAGS) -pg\" LDDLFLAGS=\"\$(LDDLFLAGS) -pg\"
"
}
|