Hello community,
here is the log from the commit of package perl-ExtUtils-CppGuess for
openSUSE:Factory checked in at 2019-07-11 13:07:39
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/perl-ExtUtils-CppGuess (Old)
and /work/SRC/openSUSE:Factory/.perl-ExtUtils-CppGuess.new.4615 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-ExtUtils-CppGuess"
Thu Jul 11 13:07:39 2019 rev:7 rq:691012 version:0.19
Changes:
--------
---
/work/SRC/openSUSE:Factory/perl-ExtUtils-CppGuess/perl-ExtUtils-CppGuess.changes
2018-01-09 14:51:09.673517966 +0100
+++
/work/SRC/openSUSE:Factory/.perl-ExtUtils-CppGuess.new.4615/perl-ExtUtils-CppGuess.changes
2019-07-11 13:07:40.691015068 +0200
@@ -1,0 +2,33 @@
+Wed Apr 3 06:57:15 UTC 2019 - Stephan Kulow <[email protected]>
+
+- updated to 0.19
+ see /usr/share/doc/packages/perl-ExtUtils-CppGuess/Changes
+
+ 0.19 Mon 1 Apr 07:08:46 BST 2019
+ - support clang on Perl 5.14-16 with ExtUtils::ParseXS >= 3.04_01 (yes,
really)
+
+ 0.18 Sun 31 Mar 17:49:21 BST 2019
+ - improve clang detection
+
+ 0.17 Sat 30 Mar 16:03:52 GMT 2019
+ - support Sun Studio compiler family
+
+ 0.16 Sat 30 Mar 00:09:42 GMT 2019
+ - test output more if no clue about compiler
+
+ 0.15 Fri 29 Mar 22:42:00 GMT 2019
+ - iostream_fname, cpp_flavor_defs methods
+ - add which actual compiler to use to generated MB and EUMM flags
+ - make the test sensitive to whether to #include with a ".h"
+
+ 0.14 Mon 25 Mar 21:13:36 GMT 2019
+ - add is_clang, unify OS-based detection
+
+ 0.13 Mon Mar 25 02:57:02 2019 +0000
+ - repo tidied slightly
+ - use Travis
+ - add compiler_command, linker_flags
+ - test all known configurations
+ - inhale knowledge from Inline::CPP
+
+-------------------------------------------------------------------
Old:
----
ExtUtils-CppGuess-0.12.tar.gz
New:
----
ExtUtils-CppGuess-0.19.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ perl-ExtUtils-CppGuess.spec ++++++
--- /var/tmp/diff_new_pack.KAqG15/_old 2019-07-11 13:07:41.275014827 +0200
+++ /var/tmp/diff_new_pack.KAqG15/_new 2019-07-11 13:07:41.275014827 +0200
@@ -1,7 +1,7 @@
#
# spec file for package perl-ExtUtils-CppGuess
#
-# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -12,26 +12,30 @@
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
-# Please submit bugfixes or comments via http://bugs.opensuse.org/
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
Name: perl-ExtUtils-CppGuess
-Version: 0.12
+Version: 0.19
Release: 0
%define cpan_name ExtUtils-CppGuess
-Summary: Guess C++ Compiler and Flags
-License: Artistic-1.0 or GPL-1.0+
+Summary: Guess C++ compiler and flags
+License: Artistic-1.0 OR GPL-1.0-or-later
Group: Development/Libraries/Perl
-Url: http://search.cpan.org/dist/ExtUtils-CppGuess/
+Url: https://metacpan.org/release/%{cpan_name}
Source0:
https://cpan.metacpan.org/authors/id/E/ET/ETJ/%{cpan_name}-%{version}.tar.gz
Source1: cpanspec.yml
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: perl
BuildRequires: perl-macros
BuildRequires: perl(Capture::Tiny)
+BuildRequires: perl(ExtUtils::CBuilder) >= 0.280231
+BuildRequires: perl(ExtUtils::ParseXS) >= 3.35
BuildRequires: perl(Module::Build)
+BuildRequires: perl(Test::More) >= 0.88
Requires: perl(Capture::Tiny)
+Requires: perl(ExtUtils::ParseXS) >= 3.35
%{perl_requires}
# MANUAL BEGIN
BuildRequires: gcc-c++
@@ -48,11 +52,11 @@
%setup -q -n %{cpan_name}-%{version}
%build
-%{__perl} Makefile.PL INSTALLDIRS=vendor OPTIMIZE="%{optflags}"
-%{__make} %{?_smp_mflags}
+perl Makefile.PL INSTALLDIRS=vendor OPTIMIZE="%{optflags}"
+make %{?_smp_mflags}
%check
-%{__make} test
+make test
%install
%perl_make_install
++++++ ExtUtils-CppGuess-0.12.tar.gz -> ExtUtils-CppGuess-0.19.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/ExtUtils-CppGuess-0.12/Changes
new/ExtUtils-CppGuess-0.19/Changes
--- old/ExtUtils-CppGuess-0.12/Changes 2017-10-21 19:13:08.000000000 +0200
+++ new/ExtUtils-CppGuess-0.19/Changes 2019-04-01 08:09:52.000000000 +0200
@@ -1,5 +1,32 @@
Revision history for Perl extension ExtUtils::CppGuess.
+0.19 Mon 1 Apr 07:08:46 BST 2019
+ - support clang on Perl 5.14-16 with ExtUtils::ParseXS >= 3.04_01 (yes,
really)
+
+0.18 Sun 31 Mar 17:49:21 BST 2019
+ - improve clang detection
+
+0.17 Sat 30 Mar 16:03:52 GMT 2019
+ - support Sun Studio compiler family
+
+0.16 Sat 30 Mar 00:09:42 GMT 2019
+ - test output more if no clue about compiler
+
+0.15 Fri 29 Mar 22:42:00 GMT 2019
+ - iostream_fname, cpp_flavor_defs methods
+ - add which actual compiler to use to generated MB and EUMM flags
+ - make the test sensitive to whether to #include with a ".h"
+
+0.14 Mon 25 Mar 21:13:36 GMT 2019
+ - add is_clang, unify OS-based detection
+
+0.13 Mon Mar 25 02:57:02 2019 +0000
+ - repo tidied slightly
+ - use Travis
+ - add compiler_command, linker_flags
+ - test all known configurations
+ - inhale knowledge from Inline::CPP
+
0.12 Sat Oct 21 18:12:51 BST 2017
- Fix tests on 5.26 without '.' in @INC (kentfredric)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/ExtUtils-CppGuess-0.12/MANIFEST
new/ExtUtils-CppGuess-0.19/MANIFEST
--- old/ExtUtils-CppGuess-0.12/MANIFEST 2017-10-21 19:09:38.000000000 +0200
+++ new/ExtUtils-CppGuess-0.19/MANIFEST 2019-04-01 08:10:16.000000000 +0200
@@ -1,19 +1,24 @@
-Makefile.PL
Changes
+lib/ExtUtils/CppGuess.pm
+Makefile.PL
MANIFEST This list of files
+MANIFEST.SKIP
README
-META.json
-META.yml
-lib/ExtUtils/CppGuess.pm
+t/00-report-prereqs.t
t/001_load.t
+t/002_icpp.t
t/010_module_build.t
t/011_makemaker.t
+t/lib/Guess.pm
+t/lib/TestGuess.pm
t/lib/TestUtils.pm
t/module/Build.PL
t/module/CppGuessTest.xs
-t/module/MANIFEST
-t/module/Makefile.PL
t/module/lib/CppGuessTest.pm
+t/module/Makefile.PL
+t/module/MANIFEST
t/module/t/001_load.t
t/module/t/002_base.t
t/module/typemap
+META.yml Module YAML meta-data (added by
MakeMaker)
+META.json Module JSON meta-data (added by
MakeMaker)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/ExtUtils-CppGuess-0.12/MANIFEST.SKIP
new/ExtUtils-CppGuess-0.19/MANIFEST.SKIP
--- old/ExtUtils-CppGuess-0.12/MANIFEST.SKIP 1970-01-01 01:00:00.000000000
+0100
+++ new/ExtUtils-CppGuess-0.19/MANIFEST.SKIP 2019-04-01 05:34:02.000000000
+0200
@@ -0,0 +1,85 @@
+\.travis\.yml
+
+#!start included /opt/perl/modules/lib/perl5/ExtUtils/MANIFEST.SKIP
+# Avoid version control files.
+\bRCS\b
+\bCVS\b
+\bSCCS\b
+,v$
+\B\.svn\b
+\B\.git\b
+\B\.gitignore\b
+\b_darcs\b
+\B\.cvsignore$
+
+# Avoid VMS specific MakeMaker generated files
+\bDescrip.MMS$
+\bDESCRIP.MMS$
+\bdescrip.mms$
+
+# Avoid Makemaker generated and utility files.
+\bMANIFEST\.bak
+\bMakefile$
+\bblib/
+\bMakeMaker-\d
+\bpm_to_blib\.ts$
+\bpm_to_blib$
+\bblibdirs\.ts$ # 6.18 through 6.25 generated this
+
+# Avoid Module::Build generated and utility files.
+\bBuild$
+\b_build/
+\bBuild.bat$
+\bBuild.COM$
+\bBUILD.COM$
+\bbuild.com$
+
+# Avoid temp and backup files.
+~$
+\.old$
+\#$
+\b\.#
+\.bak$
+\.tmp$
+\.#
+\.rej$
+
+# Avoid OS-specific files/dirs
+# Mac OSX metadata
+\B\.DS_Store
+# Mac OSX SMB mount metadata files
+\B\._
+
+# Avoid Devel::Cover and Devel::CoverX::Covered files.
+\bcover_db\b
+\bcovered\b
+
+# Avoid MYMETA files
+^MYMETA\.
+#!end included /opt/perl/modules/lib/perl5/ExtUtils/MANIFEST.SKIP
+
+# Avoid configuration metadata file
+^MYMETA\.
+
+# Avoid Module::Build generated and utility files.
+\bBuild$
+\bBuild.bat$
+\b_build
+\bBuild.COM$
+\bBUILD.COM$
+\bbuild.com$
+
+# Avoid archives of this distribution
+\bExtUtils-CppGuess-[\d\.\_]+
+
+# Ignore test byproducts
+CppGuessTest\.bs
+CppGuessTest\.c
+CppGuessTest\.o
+CppGuessTest\.obj
+^t/module/lib/CppGuessTest.xs$
+^t/module/MYMETA\.
+^t/module_build/
+^t/makemaker/
+
+\.swp$
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/ExtUtils-CppGuess-0.12/META.json
new/ExtUtils-CppGuess-0.19/META.json
--- old/ExtUtils-CppGuess-0.12/META.json 2017-10-21 19:14:54.000000000
+0200
+++ new/ExtUtils-CppGuess-0.19/META.json 2019-04-01 08:10:16.000000000
+0200
@@ -4,7 +4,7 @@
"unknown"
],
"dynamic_config" : 1,
- "generated_by" : "ExtUtils::MakeMaker version 7.24, CPAN::Meta::Converter
version 2.150001",
+ "generated_by" : "ExtUtils::MakeMaker version 7.34, CPAN::Meta::Converter
version 2.150010",
"license" : [
"perl_5"
],
@@ -33,7 +33,10 @@
"runtime" : {
"requires" : {
"Capture::Tiny" : "0",
- "File::Basename" : "0"
+ "ExtUtils::ParseXS" : "3.35",
+ "File::Basename" : "0",
+ "File::Spec" : "0",
+ "File::Temp" : "0"
}
},
"test" : {
@@ -41,22 +44,26 @@
"Capture::Tiny" : "0",
"Cwd" : "0",
"Data::Dumper" : "0",
+ "ExtUtils::CBuilder" : "0.280231",
"ExtUtils::MakeMaker" : "0",
"ExtUtils::Manifest" : "0",
"Fatal" : "0",
- "File::Spec" : "0",
"Module::Build" : "0",
- "Test::More" : "0"
+ "Test::More" : "0.88"
}
}
},
"release_status" : "stable",
"resources" : {
+ "bugtracker" : {
+ "web" : "https://github.com/tsee/extutils-cppguess/issues"
+ },
"repository" : {
"type" : "git",
"url" : "git://github.com/tsee/extutils-cppguess",
"web" : "https://github.com/tsee/extutils-cppguess"
}
},
- "version" : "0.12"
+ "version" : "0.19",
+ "x_serialization_backend" : "JSON::PP version 4.00"
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/ExtUtils-CppGuess-0.12/META.yml
new/ExtUtils-CppGuess-0.19/META.yml
--- old/ExtUtils-CppGuess-0.12/META.yml 2017-10-21 19:14:54.000000000 +0200
+++ new/ExtUtils-CppGuess-0.19/META.yml 2019-04-01 08:10:16.000000000 +0200
@@ -6,16 +6,16 @@
Capture::Tiny: '0'
Cwd: '0'
Data::Dumper: '0'
+ ExtUtils::CBuilder: '0.280231'
ExtUtils::MakeMaker: '0'
ExtUtils::Manifest: '0'
Fatal: '0'
- File::Spec: '0'
Module::Build: '0'
- Test::More: '0'
+ Test::More: '0.88'
configure_requires:
ExtUtils::MakeMaker: '0'
dynamic_config: 1
-generated_by: 'ExtUtils::MakeMaker version 7.24, CPAN::Meta::Converter version
2.150001'
+generated_by: 'ExtUtils::MakeMaker version 7.34, CPAN::Meta::Converter version
2.150010'
license: perl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
@@ -27,7 +27,12 @@
- inc
requires:
Capture::Tiny: '0'
+ ExtUtils::ParseXS: '3.35'
File::Basename: '0'
+ File::Spec: '0'
+ File::Temp: '0'
resources:
+ bugtracker: https://github.com/tsee/extutils-cppguess/issues
repository: git://github.com/tsee/extutils-cppguess
-version: '0.12'
+version: '0.19'
+x_serialization_backend: 'CPAN::Meta::YAML version 0.018'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/ExtUtils-CppGuess-0.12/Makefile.PL
new/ExtUtils-CppGuess-0.19/Makefile.PL
--- old/ExtUtils-CppGuess-0.12/Makefile.PL 2015-04-11 17:28:54.000000000
+0200
+++ new/ExtUtils-CppGuess-0.19/Makefile.PL 2019-04-01 05:29:37.000000000
+0200
@@ -11,13 +11,16 @@
PREREQ_PM => {
'Capture::Tiny' => '0',
'File::Basename' => '0',
+ 'File::Spec' => '0',
+ 'File::Temp' => '0',
+ 'ExtUtils::ParseXS' => '3.35',
},
TEST_REQUIRES => {
'Capture::Tiny' => '0',
'Module::Build' => '0',
+ 'ExtUtils::CBuilder' => '0.280231',
'ExtUtils::MakeMaker' => '0',
- 'Test::More' => '0',
- 'File::Spec' => '0',
+ 'Test::More' => '0.88',
'ExtUtils::Manifest' => '0',
'Fatal' => '0',
'Cwd' => '0',
@@ -27,6 +30,7 @@
META_MERGE => {
"meta-spec" => { version => 2 },
resources => {
+ bugtracker => { web =>
'https://github.com/tsee/extutils-cppguess/issues' },
repository => {
type => 'git',
url => 'git://github.com/tsee/extutils-cppguess',
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/ExtUtils-CppGuess-0.12/lib/ExtUtils/CppGuess.pm
new/ExtUtils-CppGuess-0.19/lib/ExtUtils/CppGuess.pm
--- old/ExtUtils-CppGuess-0.12/lib/ExtUtils/CppGuess.pm 2017-10-21
19:12:42.000000000 +0200
+++ new/ExtUtils-CppGuess-0.19/lib/ExtUtils/CppGuess.pm 2019-04-01
08:08:05.000000000 +0200
@@ -58,6 +58,10 @@
extra_compiler_flags
extra_linker_flags
+ config => { cc => ... }, # as of 0.15
+
+Please note the above may have problems on Perl <= 5.8 with
+L<ExtUtils::CBuilder> <= 0.280230 due to a Perl RE issue.
=head2 makemaker_options
@@ -67,6 +71,7 @@
CCFLAGS
dynamic_lib => { OTHERLDFLAGS => ... }
+ CC # as of 0.15
If you specify the extra compiler or linker flags in the
constructor, they'll be merged into C<CCFLAGS> or
@@ -80,6 +85,14 @@
Returns true if the detected compiler is in the MS VC family.
+=head2 is_clang
+
+Returns true if the detected compiler is in the Clang family.
+
+=head2 is_sunstudio
+
+Returns true if the detected compiler is in the Sun Studio family.
+
=head2 add_extra_compiler_flags
Takes a string as argument that is added to the string of extra compiler
@@ -90,6 +103,52 @@
Takes a string as argument that is added to the string of extra linker
flags.
+=head2 compiler_command
+
+Returns the string that can be passed to C<system> to execute the compiler.
+Will include the flags returned as the Module::Build
+C<extra_compiler_flags>.
+
+Added in 0.13.
+
+=head2 linker_flags
+
+The same as returned as the Module::Build C<extra_linker_flags>.
+
+Added in 0.13.
+
+=head2 iostream_fname
+
+Returns the filename to C<#include> to get iostream capability.
+
+This can be used a bit creatively to be portable in one's XS files,
+as the tests for this module need to be:
+
+ # in Makefile.PL:
+ $guess->add_extra_compiler_flags(
+ '-DINCLUDE_DOT=' .
+ ($guess->iostream_fname =~ /\./ ? 1 : 0)
+ );
+
+ // in your .xs file:
+ #if INCLUDE_DOT
+ #include <string.h>
+ #else
+ #include <string>
+ #endif
+
+Added in 0.15.
+
+=head2 cpp_flavor_defs
+
+Returns the text for a header that C<#define>s
+C<__INLINE_CPP_STANDARD_HEADERS> and C<__INLINE_CPP_NAMESPACE_STD> if
+the standard headers and namespace are available. This is determined by
+trying to compile C++ with C<< #define <iostream> >> - if it succeeds,
+the symbols will be defined, else commented.
+
+Added in 0.15.
+
=head1 AUTHOR
Mattia Barbon <[email protected]>
@@ -110,8 +169,10 @@
use Config ();
use File::Basename qw();
use Capture::Tiny 'capture_merged';
+use File::Spec::Functions qw(catfile);
+use File::Temp qw(tempdir);
-our $VERSION = '0.12';
+our $VERSION = '0.19';
sub new {
my( $class, %args ) = @_;
@@ -119,7 +180,12 @@
# Allow override of default %Config::Config; useful in testing.
if( ! exists $self->{config} || ! defined $self->{config} ) {
- $self->{config} = \%Config::Config;
+ if ($ExtUtils::MakeMaker::Config::VERSION) {
+ # tricksy hobbitses are overriding Config, go with it
+ $self->{config} = \%ExtUtils::MakeMaker::Config::Config;
+ } else {
+ $self->{config} = \%Config::Config;
+ }
}
# Allow a 'cc' %args. If not supplied, pull from {config}, or $Config{cc}.
@@ -138,6 +204,14 @@
: $^O;
}
+ # Set up osvers.
+ if( ! exists $self->{osvers} || ! defined $self->{osvers} ) {
+ $self->{osvers}
+ = exists $self->{config}{osvers} && defined $self->{config}{osvers}
+ ? $self->{config}{osvers}
+ : '';
+ }
+
return $self;
}
@@ -149,49 +223,86 @@
sub _config { shift->{config} }
sub _cc { shift->{cc} }
sub _os { shift->{os} }
+sub _osvers { shift->{osvers} }
-
+# This is IBM's "how to compile on" list with lots of compilers:
+#
https://www.ibm.com/support/knowledgecenter/en/SS4PJT_5.2.0/com.ibm.help.cd52.unix.doc/com.ibm.help.cdunix_user.doc/CDU_Compiling_Custom_Programs.html
sub guess_compiler {
- my $self = shift;
-
- return $self->{guess} if $self->{guess};
-
- if( $self->_os =~ /^mswin/i ) {
- $self->_guess_win32() or return;
- } else {
- $self->_guess_unix() or return;
- }
- return $self->{guess};
+ my $self = shift;
+ return $self->{guess} if $self->{guess};
+ my $c_compiler = $self->_cc;
+# $c_compiler = $Config::Config{cc} if not defined $c_compiler;
+ my %guess;
+ if ($self->{os} eq 'freebsd' && $self->{osvers} =~ /^(\d+)/ && $1 >= 10) {
+ $self->{is_clang} = 1; # special-case override
+ %guess = (
+ compiler_command => 'clang++',
+ extra_lflags => '-lc++',
+ );
+ } elsif( $self->_cc_is_sunstudio( $c_compiler ) ) {
+ %guess = (
+ compiler_command => 'CC',
+ extra_cflags => '',
+ extra_lflags => '',
+ );
+ } elsif( $self->_cc_is_clang( $c_compiler ) ) {
+ %guess = (
+ compiler_command => 'clang++',
+ extra_cflags => '-xc++',
+ extra_lflags => '-lstdc++',
+ );
+ } elsif( $self->_cc_is_gcc( $c_compiler ) ) {
+ %guess = (
+ compiler_command => 'g++',
+ extra_cflags => '-xc++',
+ extra_lflags => '-lstdc++',
+ );
+ } elsif ( $self->_cc_is_msvc( $c_compiler ) ) {
+ %guess = (
+ compiler_command => 'cl',
+ extra_cflags => '-TP -EHsc',
+ extra_lflags => 'msvcprt.lib',
+ );
+ } else {
+ my $v1 = `$c_compiler -v`;
+ my $v2 = `$c_compiler -V`;
+ my $v3 = `$c_compiler --version`;
+ my $os = $self->_os;
+ die <<EOF;
+Unable to determine a C++ compiler for '$c_compiler' on $os
+Version attempts:
+-v: '$v1'
+-V: '$v2'
+--version: '$v3'
+EOF
+ }
+ $guess{extra_lflags} .= ' -lgcc_s'
+ if $self->_os eq 'netbsd' and
+ $guess{compiler_command} =~ /g\+\+/i and
+ $guess{extra_lflags} !~ /-lgcc_s/;
+ $self->{guess} = \%guess;
}
-
sub _get_cflags {
- my $self = shift;
-
- $self->guess_compiler or die;
-
- my $cflags = ' ' . $self->_config->{ccflags};
- $cflags .= ' ' . $self->{guess}{extra_cflags};
- $cflags .= ' ' . $self->{extra_compiler_flags}
- if defined $self->{extra_compiler_flags};
-
- return $cflags;
+ my $self = shift;
+ $self->guess_compiler or die;
+ join ' ', '', map _trim_whitespace($_), grep defined && length,
+ $self->_config->{ccflags},
+ $self->{guess}{extra_cflags},
+ $self->{extra_compiler_flags},
+ ($self->is_clang ? '-Wno-reserved-user-defined-literal' : ()),
+ ;
}
-
sub _get_lflags {
- my $self = shift;
-
- $self->guess_compiler || die;
-
- my $lflags = $self->{guess}{extra_lflags};
- $lflags .= ' ' . $self->{extra_linker_flags}
- if defined $self->{extra_linker_flags};
-
- return $lflags;
+ my $self = shift;
+ $self->guess_compiler || die;
+ join ' ', '', map _trim_whitespace($_), grep defined && length,
+ $self->{guess}{extra_lflags},
+ $self->{extra_linker_flags},
+ ;
}
-
sub makemaker_options {
my $self = shift;
@@ -201,6 +312,7 @@
return (
CCFLAGS => $cflags,
dynamic_lib => { OTHERLDFLAGS => $lflags },
+ CC => $self->{guess}{compiler_command},
);
}
@@ -214,52 +326,10 @@
return (
extra_compiler_flags => $cflags,
extra_linker_flags => $lflags,
+ config => { cc => $self->{guess}{compiler_command} },
);
}
-
-sub _guess_win32 {
- my $self = shift;
- my $c_compiler = $self->_cc;
-# $c_compiler = $Config::Config{cc} if not defined $c_compiler;
-
- if( $self->_cc_is_gcc( $c_compiler ) ) {
- $self->{guess} = {
- extra_cflags => ' -xc++ ',
- extra_lflags => ' -lstdc++ ',
- };
- } elsif( $self->_cc_is_msvc( $c_compiler ) ) {
- $self->{guess} = {
- extra_cflags => ' -TP -EHsc ',
- extra_lflags => ' msvcprt.lib ',
- };
- } else {
- die "Unable to determine a C++ compiler for '$c_compiler'";
- }
-
- return 1;
-}
-
-
-sub _guess_unix {
- my $self = shift;
- my $c_compiler = $self->_cc;
-# $c_compiler = $Config::Config{cc} if not defined $c_compiler;
-
- if( !$self->_cc_is_gcc( $c_compiler ) ) {
- die "Unable to determine a C++ compiler for '$c_compiler'";
- }
-
- $self->{guess} = {
- extra_cflags => ' -xc++ ',
- extra_lflags => ' -lstdc++ ',
- };
- $self->{guess}{extra_lflags} .= ' -lgcc_s'
- if $self->_os eq 'netbsd' && $self->{guess}{extra_lflags} !~ /-lgcc_s/;
-
- return 1;
-}
-
# originally from Alien::wxWidgets::Utility
# Why was this hanging around outside of all functions, and without any other
# use of $quotes?
@@ -267,10 +337,8 @@
sub _capture {
my @cmd = @_;
-
my $out = capture_merged { system(@cmd) };
$out = '' if not defined $out;
-
return $out;
}
@@ -284,7 +352,6 @@
}
};
$out = '' if not defined $out;
-
return $out;
}
@@ -296,10 +363,8 @@
return $self->{is_msvc};
}
-
sub _cc_is_gcc {
my( $self, $cc ) = @_;
-
$self->{is_gcc} = 0;
my $cc_version = _capture( "$cc --version" );
if (
@@ -307,13 +372,39 @@
|| scalar( _capture( "$cc" ) =~ m/\bgcc\b/i ) # 2.95
|| scalar(_capture_empty_stdin("$cc -dM -E -") =~ /__GNUC__/) # more or
less universal?
|| scalar($cc_version =~ m/\bcc\b.*Free Software Foundation/si) # some
4.x?
+ || $cc eq 'gcc' # because why would they lie?
) {
$self->{is_gcc} = 1;
}
-
return $self->{is_gcc};
}
+sub _cc_is_clang {
+ my( $self, $cc ) = @_;
+ $self->{is_clang} = 0;
+ my $cc_version = _capture( "$cc --version" );
+ if (
+ $cc_version =~ m/\Aclang/i
+ || $cc eq 'clang' # because why would they lie?
+ || (($self->_config->{gccversion} || '') =~ /Clang/),
+ ) {
+ $self->{is_clang} = 1;
+ }
+ return $self->{is_clang};
+}
+
+sub _cc_is_sunstudio {
+ my( $self, $cc ) = @_;
+ $self->{is_sunstudio} = 0;
+ my $cc_version = _capture( "$cc -V" );
+ if (
+ $cc_version =~ m/Sun C/i
+ || $cc =~ /SUNWspro/ # because why would they lie?
+ ) {
+ $self->{is_sunstudio} = 1;
+ }
+ return $self->{is_sunstudio};
+}
sub is_gcc {
my $self = shift;
@@ -323,29 +414,102 @@
sub is_msvc {
my $self = shift;
+ $self->guess_compiler || die;
+ return $self->{is_msvc};
+}
+sub is_clang {
+ my $self = shift;
$self->guess_compiler || die;
+ return $self->{is_clang};
+}
- return $self->{is_msvc};
+sub is_sunstudio {
+ my $self = shift;
+ $self->guess_compiler || die;
+ return $self->{is_sunstudio};
}
sub add_extra_compiler_flags {
my( $self, $string ) = @_;
$self->{extra_compiler_flags}
- = defined($self->{extra_compiler_flags})
- ? $self->{extra_compiler_flags} . ' ' . $string
- : $string;
+ = join ' ', map _trim_whitespace($_), grep defined && length,
+ $self->{extra_compiler_flags}, $string;
}
-
sub add_extra_linker_flags {
my( $self, $string ) = @_;
$self->{extra_linker_flags}
- = defined($self->{extra_linker_flags})
- ? $self->{extra_linker_flags} . ' ' . $string
- : $string;
+ = join ' ', map _trim_whitespace($_), grep defined && length,
+ $self->{extra_linker_flags}, $string;
}
+sub compiler_command {
+ my( $self ) = @_;
+ $self->guess_compiler || die;
+ my $cc = $self->{guess}{compiler_command};
+ my $cflags = $self->_get_cflags;
+ join ' ', map _trim_whitespace($_), grep defined && length, $cc, $cflags;
+}
+
+sub _trim_whitespace {
+ my $string = shift;
+ $string =~ s/^\s+|\s+$//g;
+ return $string;
+}
+
+sub linker_flags {
+ my( $self ) = @_;
+ _trim_whitespace($self->_get_lflags);
+}
+
+sub _to_file {
+ my ($file, @data) = @_;
+ open my $fh, '>', $file
+ or die "open $file: $!\n";
+ print $fh @data or die "write $file: $!\n";
+ close $fh or die "close $file: $!\n";
+}
+
+my $test_cpp_filename = 'ilcpptest'; # '.cpp' appended via open.
+my $test_cpp = <<'END_TEST_CPP';
+#include <iostream>
+int main(){ return 0; }
+END_TEST_CPP
+
+# returns true if compile succeeded, false if failed
+sub _compile_no_h {
+ my( $self ) = @_;
+ return $self->{no_h_status} if defined $self->{no_h_status};
+ $self->guess_compiler || die;
+ my $dir = tempdir( CLEANUP => 1 );
+ my $file = catfile( $dir, qq{$test_cpp_filename.cpp} );
+ my $exe = catfile( $dir, qq{$test_cpp_filename.exe} );
+ _to_file $file, $test_cpp;
+ my $command = join ' ',
+ $self->compiler_command,
+ ($self->is_msvc ? qq{-Fe:} : qq{-o }) . $exe,
+ $file,
+ ;
+ my $result = system $command;
+ $self->{no_h_status} = ($result == 0);
+}
+
+sub iostream_fname {
+ my( $self ) = @_;
+ 'iostream' . ($self->_compile_no_h ? '' : '.h');
+}
+
+sub cpp_flavor_defs {
+ my( $self ) = @_;
+ my $comment = ($self->_compile_no_h ? '' : '//');
+ sprintf <<'END_FLAVOR_DEFINITIONS', $comment, $comment;
+
+%s#define __INLINE_CPP_STANDARD_HEADERS 1
+%s#define __INLINE_CPP_NAMESPACE_STD 1
+
+END_FLAVOR_DEFINITIONS
+}
1;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/ExtUtils-CppGuess-0.12/t/00-report-prereqs.t
new/ExtUtils-CppGuess-0.19/t/00-report-prereqs.t
--- old/ExtUtils-CppGuess-0.12/t/00-report-prereqs.t 1970-01-01
01:00:00.000000000 +0100
+++ new/ExtUtils-CppGuess-0.19/t/00-report-prereqs.t 2019-04-01
05:32:18.000000000 +0200
@@ -0,0 +1,187 @@
+#!perl
+
+use strict;
+use warnings;
+
+# This test was generated by Dist::Zilla::Plugin::Test::ReportPrereqs 0.020
+# THEN modified with more info by Ed J for PDL project
+
+use Test::More tests => 1;
+
+use ExtUtils::MakeMaker;
+use File::Spec;
+
+# from $version::LAX
+my $lax_version_re =
+ qr/(?: undef | (?: (?:[0-9]+) (?: \. | (?:\.[0-9]+) (?:_[0-9]+)? )?
+ |
+ (?:\.[0-9]+) (?:_[0-9]+)?
+ ) | (?:
+ v (?:[0-9]+) (?: (?:\.[0-9]+)+ (?:_[0-9]+)? )?
+ |
+ (?:[0-9]+)? (?:\.[0-9]+){2,} (?:_[0-9]+)?
+ )
+ )/x;
+
+# hide optional CPAN::Meta modules from prereq scanner
+# and check if they are available
+my $cpan_meta = "CPAN::Meta";
+my $cpan_meta_pre = "CPAN::Meta::Prereqs";
+my $HAS_CPAN_META = eval "require $cpan_meta; $cpan_meta->VERSION('2.120900')"
&& eval "require $cpan_meta_pre"; ## no critic
+
+# Verify requirements?
+my $DO_VERIFY_PREREQS = 1;
+
+sub _max {
+ my $max = shift;
+ $max = ( $_ > $max ) ? $_ : $max for @_;
+ return $max;
+}
+
+sub _merge_prereqs {
+ my ($collector, $prereqs) = @_;
+
+ # CPAN::Meta::Prereqs object
+ if (ref $collector eq $cpan_meta_pre) {
+ return $collector->with_merged_prereqs(
+ CPAN::Meta::Prereqs->new( $prereqs )
+ );
+ }
+
+ # Raw hashrefs
+ for my $phase ( keys %$prereqs ) {
+ for my $type ( keys %{ $prereqs->{$phase} } ) {
+ for my $module ( keys %{ $prereqs->{$phase}{$type} } ) {
+ $collector->{$phase}{$type}{$module} =
$prereqs->{$phase}{$type}{$module};
+ }
+ }
+ }
+
+ return $collector;
+}
+
+my @include = qw(
+
+);
+
+my @exclude = qw(
+
+);
+
+# Add static prereqs to the included modules list
+my $static_prereqs = do 't/00-report-prereqs.dd';
+
+# Merge all prereqs (either with ::Prereqs or a hashref)
+my $full_prereqs = _merge_prereqs(
+ ( $HAS_CPAN_META ? $cpan_meta_pre->new : {} ),
+ $static_prereqs
+);
+
+# Add dynamic prereqs to the included modules list (if we can)
+my ($source) = grep { -f } 'MYMETA.json', 'MYMETA.yml';
+if ( $source && $HAS_CPAN_META ) {
+ if ( my $meta = eval { CPAN::Meta->load_file($source) } ) {
+ $full_prereqs = _merge_prereqs($full_prereqs, $meta->prereqs);
+ }
+}
+else {
+ $source = 'static metadata';
+}
+
+my @full_reports;
+my @dep_errors;
+my $req_hash = $HAS_CPAN_META ? $full_prereqs->as_string_hash : $full_prereqs;
+
+# Add static includes into a fake section
+for my $mod (@include) {
+ $req_hash->{other}{modules}{$mod} = 0;
+}
+
+for my $phase ( qw(configure build test runtime develop other) ) {
+ next unless $req_hash->{$phase};
+ next if ($phase eq 'develop' and not $ENV{AUTHOR_TESTING});
+
+ for my $type ( qw(requires recommends suggests conflicts modules) ) {
+ next unless $req_hash->{$phase}{$type};
+
+ my $title = ucfirst($phase).' '.ucfirst($type);
+ my @reports = [qw/Module Want Have Where Howbig/];
+
+ for my $mod ( sort keys %{ $req_hash->{$phase}{$type} } ) {
+ next if $mod eq 'perl';
+ next if grep { $_ eq $mod } @exclude;
+
+ my $file = $mod;
+ $file =~ s{::}{/}g;
+ $file .= ".pm";
+ my ($prefix) = grep { -e File::Spec->catfile($_, $file) } @INC;
+
+ my $want = $req_hash->{$phase}{$type}{$mod};
+ $want = "undef" unless defined $want;
+ $want = "any" if !$want && $want == 0;
+
+ my $req_string = $want eq 'any' ? 'any version required' :
"version '$want' required";
+
+ if ($prefix) {
+ my $filename = File::Spec->catfile($prefix, $file);
+ my $have = MM->parse_version( $filename );
+ $have = "undef" unless defined $have;
+ push @reports, [$mod, $want, $have, $prefix, (-s $filename)];
+
+ if ( $DO_VERIFY_PREREQS && $HAS_CPAN_META && $type eq
'requires' ) {
+ if ( $have !~ /\A$lax_version_re\z/ ) {
+ push @dep_errors, "$mod version '$have' cannot be
parsed ($req_string)";
+ }
+ elsif ( ! $full_prereqs->requirements_for( $phase, $type
)->accepts_module( $mod => $have ) ) {
+ push @dep_errors, "$mod version '$have' is not in
required range '$want'";
+ }
+ }
+ }
+ else {
+ push @reports, [$mod, $want, "missing", '', 0];
+
+ if ( $DO_VERIFY_PREREQS && $type eq 'requires' ) {
+ push @dep_errors, "$mod is not installed ($req_string)";
+ }
+ }
+ }
+
+ if ( @reports ) {
+ push @full_reports, "=== $title ===\n\n";
+
+ my $ml = _max( map { length $_->[0] } @reports );
+ my $wl = _max( map { length $_->[1] } @reports );
+ my $hl = _max( map { length $_->[2] } @reports );
+ my $ll = _max( map { length $_->[3] } @reports ); # location
+ my $sl = _max( map { length $_->[4] } @reports ); # size
+
+ if ($type eq 'modules') {
+ splice @reports, 1, 0, ["-" x $ml, "", "-" x $hl, "-" x $ll,
"-" x $sl];
+ push @full_reports, map { sprintf(" %*s %*s\n", -$ml,
$_->[0], $hl, $_->[2]) } @reports;
+ }
+ else {
+ splice @reports, 1, 0, ["-" x $ml, "-" x $wl, "-" x $hl, "-" x
$ll, "-" x $sl];
+ push @full_reports, map { sprintf(" %*s %*s %*s %*s %*s\n",
-$ml, $_->[0], $wl, $_->[1], $hl, $_->[2], -$ll, $_->[3], $sl, $_->[4]) }
@reports;
+ }
+
+ push @full_reports, "\n";
+ }
+ }
+}
+
+if ( @full_reports ) {
+ diag "\nVersions for all modules listed in $source (including optional
ones):\n\n", @full_reports;
+}
+
+if ( @dep_errors ) {
+ diag join("\n",
+ "\n*** WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
***\n",
+ "The following REQUIRED prerequisites were not satisfied:\n",
+ @dep_errors,
+ "\n"
+ );
+}
+
+pass;
+
+# vim: ts=4 sts=4 sw=4 et:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/ExtUtils-CppGuess-0.12/t/001_load.t
new/ExtUtils-CppGuess-0.19/t/001_load.t
--- old/ExtUtils-CppGuess-0.12/t/001_load.t 2015-04-11 17:28:54.000000000
+0200
+++ new/ExtUtils-CppGuess-0.19/t/001_load.t 2019-03-30 16:56:54.000000000
+0100
@@ -1,9 +1,7 @@
-#!/usr/bin/perl -w
-
use strict;
use warnings;
use Data::Dumper;
-use Test::More tests => 2;
+use Test::More;
my $MODULE = 'ExtUtils::CppGuess';
use_ok($MODULE);
@@ -11,6 +9,24 @@
my $guess = $MODULE->new;
isa_ok $guess, $MODULE;
+$Data::Dumper::Indent = $Data::Dumper::Sortkeys = $Data::Dumper::Terse = 1;
+
diag 'EUMM:', Dumper { $guess->makemaker_options };
diag '---';
diag 'MB:', Dumper { $guess->module_build_options };
+
+diag '---';
+my $config = $guess->_config;
+diag 'Config:', Dumper {
+ map { $_=>$config->{$_} } grep /cc|ld/, keys %$config
+};
+
+for (qw(
+ is_sunstudio
+ is_msvc is_gcc is_clang compiler_command linker_flags
+ iostream_fname cpp_flavor_defs
+)) {
+ diag "Method: $_ = ", Dumper $guess->$_;
+}
+
+done_testing;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/ExtUtils-CppGuess-0.12/t/002_icpp.t
new/ExtUtils-CppGuess-0.19/t/002_icpp.t
--- old/ExtUtils-CppGuess-0.12/t/002_icpp.t 1970-01-01 01:00:00.000000000
+0100
+++ new/ExtUtils-CppGuess-0.19/t/002_icpp.t 2019-03-30 17:01:53.000000000
+0100
@@ -0,0 +1,96 @@
+use strict;
+use warnings;
+use Data::Dumper;
+use Test::More;
+use ExtUtils::CppGuess;
+
+my @DATA = (
+ [
+ { os => 'MSWin32', cc => 'cl', config => {ccflags => ''} },
+ {
+ is_sunstudio => 0,
+ is_msvc => 1, is_gcc => 0, is_clang => 0,
+ compiler_command => 'cl -TP -EHsc',
+ linker_flags => 'msvcprt.lib',
+ },
+ ],
+ [
+ { os => 'MSWin32', cc => 'gcc', config => {ccflags => ''} },
+ {
+ is_sunstudio => 0,
+ is_msvc => undef, is_gcc => 1, is_clang => 0,
+ compiler_command => 'g++ -xc++',
+ linker_flags => '-lstdc++',
+ },
+ ],
+ [
+ { os => 'freebsd', cc => 'gcc', config => {ccflags => ''}, osvers => 9 },
+ {
+ is_sunstudio => 0,
+ is_msvc => undef, is_gcc => 1, is_clang => 0,
+ compiler_command => 'g++ -xc++',
+ linker_flags => '-lstdc++',
+ },
+ ],
+ [
+ { os => 'freebsd', cc => 'gcc', config => {gccversion => 'Clang', ccflags
=> ''}, osvers => 10 },
+ {
+ is_sunstudio => undef,
+ is_msvc => undef, is_gcc => undef, is_clang => 1,
+ compiler_command => 'clang++ -Wno-reserved-user-defined-literal',
+ linker_flags => '-lc++',
+ },
+ ],
+ [
+ { os => 'netbsd', cc => 'gcc', config => {ccflags => ''} },
+ {
+ is_sunstudio => 0,
+ is_msvc => undef, is_gcc => 1, is_clang => 0,
+ compiler_command => 'g++ -xc++',
+ linker_flags => '-lstdc++ -lgcc_s',
+ },
+ ],
+ [
+ { os => 'linux', cc => 'clang', config => {gccversion => 'Clang', ccflags
=> ''} },
+ {
+ is_sunstudio => 0,
+ is_msvc => undef, is_gcc => undef, is_clang => 1,
+ compiler_command => 'clang++ -xc++ -Wno-reserved-user-defined-literal',
+ linker_flags => '-lstdc++',
+ },
+ ],
+ [
+ { os => 'linux', cc => 'gcc', config => {ccflags => ''} },
+ {
+ is_sunstudio => 0,
+ is_msvc => undef, is_gcc => 1, is_clang => 0,
+ compiler_command => 'g++ -xc++',
+ linker_flags => '-lstdc++',
+ },
+ ],
+ [
+ { os => 'linux', cc => '/opt/SUNWspro/bin/cc', config => {ccflags => ''} },
+ {
+ is_sunstudio => 1,
+ is_msvc => undef, is_gcc => undef, is_clang => undef,
+ compiler_command => 'CC',
+ linker_flags => '',
+ },
+ ],
+);
+my @METHODS = qw(
+ is_msvc is_gcc is_clang is_sunstudio
+ compiler_command linker_flags
+);
+$Data::Dumper::Indent = $Data::Dumper::Sortkeys = $Data::Dumper::Terse = 1;
+
+run_test(@$_) for @DATA;
+
+done_testing;
+
+sub run_test {
+ my ($args, $expect) = @_;
+ my $guess = ExtUtils::CppGuess->new(%$args);
+ my %got = map {$_ => $guess->$_} @METHODS;
+ is_deeply \%got, $expect or diag Dumper [ $args, \%got, $expect ];
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/ExtUtils-CppGuess-0.12/t/010_module_build.t
new/ExtUtils-CppGuess-0.19/t/010_module_build.t
--- old/ExtUtils-CppGuess-0.12/t/010_module_build.t 2017-10-21
19:10:34.000000000 +0200
+++ new/ExtUtils-CppGuess-0.19/t/010_module_build.t 2019-03-31
17:29:48.000000000 +0200
@@ -1,10 +1,16 @@
-#!/usr/bin/perl -w
-
use strict;
-use Test::More tests => 1;
+use Test::More;
+BEGIN {
+ plan skip_all => 'no Module::Build' if !eval { require Module::Build; 1 };
+ plan skip_all => 'no ExtUtils::CBuilder' if !eval { require
ExtUtils::CBuilder; 1 };
+ plan skip_all => 'perl 5.8.8 and EU::CBuilder bug if CC has "++"' if
$ExtUtils::CBuilder::VERSION <= 0.280230 and $] lt '5.010';
+}
use lib 't/lib';
use TestUtils;
+diag "Module::Build version: $Module::Build::VERSION";
+diag "ExtUtils::CBuilder version: $ExtUtils::CBuilder::VERSION";
+
my $separator = ( '=' x 40 . "\n" );
prepare_test( 't/module', 't/module_build' );
@@ -16,3 +22,5 @@
diag( "Build output\n", $separator, $build, $separator ) if $build;
diag( "Build test output\n", $separator, $test, $separator ) if $test;
}
+
+done_testing;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/ExtUtils-CppGuess-0.12/t/011_makemaker.t
new/ExtUtils-CppGuess-0.19/t/011_makemaker.t
--- old/ExtUtils-CppGuess-0.12/t/011_makemaker.t 2017-10-21
19:10:34.000000000 +0200
+++ new/ExtUtils-CppGuess-0.19/t/011_makemaker.t 2019-03-30
04:57:47.000000000 +0100
@@ -1,7 +1,5 @@
-#!/usr/bin/perl -w
-
use strict;
-use Test::More tests => 1;
+use Test::More;
use lib 't/lib';
use TestUtils;
@@ -16,3 +14,5 @@
diag( "make output\n", $separator, $build, $separator ) if $build;
diag( "make test output\n", $separator, $test, $separator ) if $test;
}
+
+done_testing;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/ExtUtils-CppGuess-0.12/t/lib/Guess.pm
new/ExtUtils-CppGuess-0.19/t/lib/Guess.pm
--- old/ExtUtils-CppGuess-0.12/t/lib/Guess.pm 1970-01-01 01:00:00.000000000
+0100
+++ new/ExtUtils-CppGuess-0.19/t/lib/Guess.pm 2019-03-24 19:00:16.000000000
+0100
@@ -0,0 +1,47 @@
+package Guess;
+
+use strict;
+use warnings;
+BEGIN{ use Config; }
+use ExtUtils::CppGuess;
+
+# Repackage results from ExtUtils::CppGuess into a form that is most useful
+# to Inline::CPP's Makefile.PL.
+
+sub new {
+ my( $class, $config ) = @_;
+ return bless { config => $config }, $class;
+}
+
+
+sub guess_compiler {
+ my $self = shift;
+ local %Config::Config = %{$self->{config}}; # Use our own configuration.
+
+ my( $cc_guess, $libs_guess, $guesser, %configuration );
+
+ $guesser = ExtUtils::CppGuess->new;
+ %configuration = $guesser->module_build_options;
+ if( $guesser->is_gcc ) {
+ $cc_guess = 'g++';
+ }
+ elsif ( $guesser->is_msvc ) {
+ $cc_guess = 'cl';
+ }
+
+ $cc_guess .= $configuration{extra_compiler_flags};
+ $libs_guess = $configuration{extra_linker_flags};
+
+ ( $cc_guess, $libs_guess )
+ = map { _trim_whitespace($_) } ( $cc_guess, $libs_guess );
+
+ return ( $cc_guess, $libs_guess );
+}
+
+sub _trim_whitespace {
+ my $string = shift;
+ $string =~ s/^\s+|\s+$//g;
+ return $string;
+}
+
+1;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/ExtUtils-CppGuess-0.12/t/lib/TestGuess.pm
new/ExtUtils-CppGuess-0.19/t/lib/TestGuess.pm
--- old/ExtUtils-CppGuess-0.12/t/lib/TestGuess.pm 1970-01-01
01:00:00.000000000 +0100
+++ new/ExtUtils-CppGuess-0.19/t/lib/TestGuess.pm 2019-03-24
19:00:16.000000000 +0100
@@ -0,0 +1,101 @@
+package TestGuess;
+
+use strict;
+use warnings;
+
+# This is the logic we used to keep in Makefile.PL that was used to make an
+# educated guess as to what compiler, compiler flags, standard libraries, and
+# linker flags to configure into Inline::CPP.
+
+# Inline::CPP shifted to using ExtUtils::CppGuess instead, but retains this
+# logic for testing purposes, as well as for working toward improving
+# ExtUtils::CppGuess.
+
+# my( $cc_guess, $libs_guess ) = guess_compiler();
+
+
+#============================================================================
+# Make an intelligent guess about what compiler to use
+#============================================================================
+
+sub new {
+ my( $class, $config ) = @_;
+ return bless { config => $config }, $class;
+}
+
+sub guess_compiler {
+ my $self = shift;
+
+ my( $cc_guess, $libs_guess );
+
+ if ( $self->{config}{osname} eq 'darwin' ) {
+ my $stdlib_query
+ = 'find /usr/lib/gcc -name "libstdc++*" | grep $( uname -p )';
+ my $stdcpp = `$stdlib_query`;
+ +$stdcpp =~ s/^(.*)\/[^\/]+$/$1/;
+ $cc_guess = 'g++';
+ $libs_guess = "-L$stdcpp -lstdc++";
+ }
+ elsif ( $self->{config}{osname} ne 'darwin'
+ and $self->{config}{gccversion}
+ and $self->{config}{cc} =~ m#\bgcc\b[^/]*$#
+ ) {
+ ( $cc_guess = $self->{config}{cc} ) =~ s[\bgcc\b([^/]*)$(?:)][g\+\+$1];
+ $libs_guess = '-lstdc++';
+ }
+ elsif ( $self->{config}{osname} =~ m/^MSWin/ ) {
+ $cc_guess = 'cl -TP -EHsc';
+ $libs_guess = 'MSVCIRT.LIB';
+ }
+ elsif ( $self->{config}{osname} eq 'linux' ) {
+ $cc_guess = 'g++';
+ $libs_guess = '-lstdc++';
+ }
+# Dragonfly patch is just a hunch... (still doesn't work)
+ elsif ( $self->{config}{osname} eq 'netbsd' || $self->{config}{osname} eq
'dragonfly' ) {
+ $cc_guess = 'g++';
+ $libs_guess = '-lstdc++ -lgcc_s';
+ }
+ elsif ( $self->{config}{osname} eq 'cygwin' ) {
+ $cc_guess = 'g++';
+ $libs_guess = '-lstdc++';
+ }
+ elsif ( $self->{config}{osname} eq 'solaris'
+ || $self->{config}{osname} eq 'SunOS' ) {
+ if ( $self->{config}{cc} eq 'gcc'
+ || ( exists( $self->{config}{gccversion} ) &&
$self->{config}{gccversion} > 0 ) )
+ {
+ $cc_guess = 'g++';
+ $libs_guess = '-lstdc++';
+ }
+ else {
+ $cc_guess = 'CC';
+ $libs_guess = '-lCrun';
+ }
+ }
+ # MirBSD: Still problematic.
+ elsif ( $self->{config}{osname} eq 'mirbsd' ) {
+ my $stdlib_query
+ = 'find /usr/lib/gcc -name "libstdc++*" | grep $( uname -p ) | head -1';
+ my $stdcpp = `$stdlib_query`;
+ +$stdcpp =~ s/^(.*)\/[^\/]+$/$1/;
+ $cc_guess = 'g++';
+ $libs_guess = "-L$stdcpp -lstdc++ -lc -lgcc_s";
+ }
+ elsif( $self->{config}{osname} eq 'freebsd'
+ and $self->{config}{osvers} =~ /^(\d+)/
+ and $1 >= 10
+ ){
+ $cc_guess = 'clang++';
+ $libs_guess = '-lc++';
+ }
+ # Sane defaults for other (probably unix-like) operating systems
+ else {
+ $cc_guess = 'g++';
+ $libs_guess = '-lstdc++';
+ }
+
+ return( $cc_guess, $libs_guess );
+}
+
+1;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/ExtUtils-CppGuess-0.12/t/module/Build.PL
new/ExtUtils-CppGuess-0.19/t/module/Build.PL
--- old/ExtUtils-CppGuess-0.12/t/module/Build.PL 2015-04-11
17:28:54.000000000 +0200
+++ new/ExtUtils-CppGuess-0.19/t/module/Build.PL 2019-04-01
08:04:53.000000000 +0200
@@ -4,8 +4,22 @@
use blib '../..';
use Module::Build;
use ExtUtils::CppGuess;
+use ExtUtils::ParseXS;
my $guess = ExtUtils::CppGuess->new;
+$guess->add_extra_compiler_flags(
+ '-DINCLUDE_DOT=' .
+ ($guess->iostream_fname =~ /\./ ? 1 : 0)
+);
+
+# broken on 5.14, on EUPXS 3.04_01 to 3.35
+if ($ExtUtils::ParseXS::VERSION > 3.04) {
+ if ($] lt '5.016000') {
+ $guess->add_extra_compiler_flags('-DCLANG_WORKAROUND_514');
+ } elsif ($] lt '5.018000') {
+ $guess->add_extra_compiler_flags('-DCLANG_WORKAROUND_516');
+ }
+}
my $build = Module::Build->new
( module_name => 'CppGuessTest',
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/ExtUtils-CppGuess-0.12/t/module/CppGuessTest.xs
new/ExtUtils-CppGuess-0.19/t/module/CppGuessTest.xs
--- old/ExtUtils-CppGuess-0.12/t/module/CppGuessTest.xs 2015-04-11
17:28:54.000000000 +0200
+++ new/ExtUtils-CppGuess-0.19/t/module/CppGuessTest.xs 2019-04-01
08:04:31.000000000 +0200
@@ -6,14 +6,33 @@
#include <sys/vnode.h>
#endif
+#if INCLUDE_DOT
+#include <string.h>
+#else
#include <string>
+#endif
typedef std::string std__string;
+extern "C" {
#include <config.h>
+#ifdef __clang__
+# ifdef CLANG_WORKAROUND_514
+ /* perl.h before 5.18 or so blow up on clang with dVAR on EU::PXS >=
3.04_01 - this works around */
+# undef HASATTRIBUTE_UNUSED
+# endif
+#endif
#include <EXTERN.h>
#include <perl.h>
+#ifdef __clang__
+# ifdef CLANG_WORKAROUND_516
+ /* perl.h before 5.18 or so blow up on clang with dVAR on EU::PXS >=
3.04_01 - this works around */
+# undef dNOOP
+# define dNOOP /*EMPTY*/(void)0
+# endif
+#endif
#include <XSUB.h>
+}
// Perl likes to pollute your namespace
#undef bool
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/ExtUtils-CppGuess-0.12/t/module/Makefile.PL
new/ExtUtils-CppGuess-0.19/t/module/Makefile.PL
--- old/ExtUtils-CppGuess-0.12/t/module/Makefile.PL 2015-01-15
03:45:58.000000000 +0100
+++ new/ExtUtils-CppGuess-0.19/t/module/Makefile.PL 2019-04-01
08:04:31.000000000 +0200
@@ -4,9 +4,24 @@
use blib '../..';
use ExtUtils::MakeMaker;
use ExtUtils::CppGuess;
+use ExtUtils::ParseXS;
my $guess = ExtUtils::CppGuess->new;
+# broken on 5.14, on EUPXS 3.04_01 to 3.35
+if ($ExtUtils::ParseXS::VERSION > 3.04) {
+ if ($] lt '5.016000') {
+ $guess->add_extra_compiler_flags('-DCLANG_WORKAROUND_514');
+ } elsif ($] lt '5.018000') {
+ $guess->add_extra_compiler_flags('-DCLANG_WORKAROUND_516');
+ }
+}
+
+$guess->add_extra_compiler_flags(
+ '-DINCLUDE_DOT=' .
+ ($guess->iostream_fname =~ /\./ ? 1 : 0)
+);
+
WriteMakefile
( NAME => 'CppGuessTest',
VERSION_FROM => 'lib/CppGuessTest.pm',
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/ExtUtils-CppGuess-0.12/t/module/t/001_load.t
new/ExtUtils-CppGuess-0.19/t/module/t/001_load.t
--- old/ExtUtils-CppGuess-0.12/t/module/t/001_load.t 2015-01-15
03:45:58.000000000 +0100
+++ new/ExtUtils-CppGuess-0.19/t/module/t/001_load.t 2019-03-30
04:57:47.000000000 +0100
@@ -1,5 +1,3 @@
-#!/usr/bin/perl -w
-
use strict;
use Test::More tests => 1;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/ExtUtils-CppGuess-0.12/t/module/t/002_base.t
new/ExtUtils-CppGuess-0.19/t/module/t/002_base.t
--- old/ExtUtils-CppGuess-0.12/t/module/t/002_base.t 2015-01-15
03:45:58.000000000 +0100
+++ new/ExtUtils-CppGuess-0.19/t/module/t/002_base.t 2019-03-30
04:57:47.000000000 +0100
@@ -1,5 +1,3 @@
-#!/usr/bin/perl -w
-
use strict;
use Test::More tests => 2;