Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package perl-ExtUtils-CppGuess for
openSUSE:Factory checked in at 2021-06-02 22:11:51
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/perl-ExtUtils-CppGuess (Old)
and /work/SRC/openSUSE:Factory/.perl-ExtUtils-CppGuess.new.1898 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-ExtUtils-CppGuess"
Wed Jun 2 22:11:51 2021 rev:10 rq:896699 version:0.23
Changes:
--------
---
/work/SRC/openSUSE:Factory/perl-ExtUtils-CppGuess/perl-ExtUtils-CppGuess.changes
2020-01-25 13:25:32.416072844 +0100
+++
/work/SRC/openSUSE:Factory/.perl-ExtUtils-CppGuess.new.1898/perl-ExtUtils-CppGuess.changes
2021-06-02 22:12:17.808144700 +0200
@@ -1,0 +2,14 @@
+Tue Jun 1 03:06:30 UTC 2021 - Tina M??ller <[email protected]>
+
+- updated to 0.23
+ see /usr/share/doc/packages/perl-ExtUtils-CppGuess/Changes
+
+ 0.23 2021-05-31
+ - added CI - thanks @zmughal
+ - now recognises MacOS clang - thanks @xenu
+
+ 0.22 2021-05-29
+ - Add C++ standard support flag detection - thanks @zmughal!
+ See <https://github.com/tsee/extutils-cppguess/pull/24>.
+
+-------------------------------------------------------------------
Old:
----
ExtUtils-CppGuess-0.21.tar.gz
New:
----
ExtUtils-CppGuess-0.23.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ perl-ExtUtils-CppGuess.spec ++++++
--- /var/tmp/diff_new_pack.NtCscY/_old 2021-06-02 22:12:18.608142722 +0200
+++ /var/tmp/diff_new_pack.NtCscY/_new 2021-06-02 22:12:18.612142712 +0200
@@ -1,7 +1,7 @@
#
# spec file for package perl-ExtUtils-CppGuess
#
-# Copyright (c) 2020 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2021 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -16,17 +16,15 @@
#
+%define cpan_name ExtUtils-CppGuess
Name: perl-ExtUtils-CppGuess
-Version: 0.21
+Version: 0.23
Release: 0
-%define cpan_name ExtUtils-CppGuess
Summary: Guess C++ compiler and flags
License: Artistic-1.0 OR GPL-1.0-or-later
-Group: Development/Libraries/Perl
-Url: https://metacpan.org/release/%{cpan_name}
+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)
@@ -49,11 +47,11 @@
to ExtUtils::MakeMaker's 'WriteMakefile' function.
%prep
-%setup -q -n %{cpan_name}-%{version}
+%autosetup -n %{cpan_name}-%{version}
%build
perl Makefile.PL INSTALLDIRS=vendor OPTIMIZE="%{optflags}"
-make %{?_smp_mflags}
+%make_build
%check
make test
@@ -64,7 +62,6 @@
%perl_gen_filelist
%files -f %{name}.files
-%defattr(-,root,root,755)
%doc Changes README
%changelog
++++++ ExtUtils-CppGuess-0.21.tar.gz -> ExtUtils-CppGuess-0.23.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/ExtUtils-CppGuess-0.21/Changes
new/ExtUtils-CppGuess-0.23/Changes
--- old/ExtUtils-CppGuess-0.21/Changes 2020-01-23 16:24:44.000000000 +0100
+++ new/ExtUtils-CppGuess-0.23/Changes 2021-06-01 00:06:48.000000000 +0200
@@ -1,3 +1,11 @@
+0.23 2021-05-31
+- added CI - thanks @zmughal
+- now recognises MacOS clang - thanks @xenu
+
+0.22 2021-05-29
+- Add C++ standard support flag detection - thanks @zmughal!
+ See <https://github.com/tsee/extutils-cppguess/pull/24>.
+
0.21 2020-01-23
- no give $Config{ccflags} in Module::Build as add not replace - thanks @xenu
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/ExtUtils-CppGuess-0.21/MANIFEST
new/ExtUtils-CppGuess-0.23/MANIFEST
--- old/ExtUtils-CppGuess-0.21/MANIFEST 2020-01-23 16:25:32.000000000 +0100
+++ new/ExtUtils-CppGuess-0.23/MANIFEST 2021-06-01 00:07:25.000000000 +0200
@@ -7,6 +7,7 @@
t/00-report-prereqs.t
t/001_load.t
t/002_icpp.t
+t/003_standard_flag.t
t/010_module_build.t
t/011_makemaker.t
t/lib/Guess.pm
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/ExtUtils-CppGuess-0.21/META.json
new/ExtUtils-CppGuess-0.23/META.json
--- old/ExtUtils-CppGuess-0.21/META.json 2020-01-23 16:25:32.000000000
+0100
+++ new/ExtUtils-CppGuess-0.23/META.json 2021-06-01 00:07:25.000000000
+0200
@@ -4,7 +4,7 @@
"unknown"
],
"dynamic_config" : 1,
- "generated_by" : "ExtUtils::MakeMaker version 7.36, CPAN::Meta::Converter
version 2.150010",
+ "generated_by" : "ExtUtils::MakeMaker version 7.44, CPAN::Meta::Converter
version 2.150010",
"license" : [
"perl_5"
],
@@ -64,6 +64,6 @@
"web" : "https://github.com/tsee/extutils-cppguess"
}
},
- "version" : "0.21",
- "x_serialization_backend" : "JSON::PP version 4.00"
+ "version" : "0.23",
+ "x_serialization_backend" : "JSON::PP version 4.04"
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/ExtUtils-CppGuess-0.21/META.yml
new/ExtUtils-CppGuess-0.23/META.yml
--- old/ExtUtils-CppGuess-0.21/META.yml 2020-01-23 16:25:32.000000000 +0100
+++ new/ExtUtils-CppGuess-0.23/META.yml 2021-06-01 00:07:25.000000000 +0200
@@ -15,7 +15,7 @@
configure_requires:
ExtUtils::MakeMaker: '0'
dynamic_config: 1
-generated_by: 'ExtUtils::MakeMaker version 7.36, CPAN::Meta::Converter version
2.150010'
+generated_by: 'ExtUtils::MakeMaker version 7.44, CPAN::Meta::Converter version
2.150010'
license: perl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
@@ -34,5 +34,5 @@
resources:
bugtracker: https://github.com/tsee/extutils-cppguess/issues
repository: git://github.com/tsee/extutils-cppguess
-version: '0.21'
+version: '0.23'
x_serialization_backend: 'CPAN::Meta::YAML version 0.018'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/ExtUtils-CppGuess-0.21/lib/ExtUtils/CppGuess.pm
new/ExtUtils-CppGuess-0.23/lib/ExtUtils/CppGuess.pm
--- old/ExtUtils-CppGuess-0.21/lib/ExtUtils/CppGuess.pm 2020-01-23
16:24:53.000000000 +0100
+++ new/ExtUtils-CppGuess-0.23/lib/ExtUtils/CppGuess.pm 2021-06-01
00:05:41.000000000 +0200
@@ -149,6 +149,29 @@
Added in 0.15.
+=head2 cpp_standard_flag
+
+ $guess->cpp_standard_flag( $standard_name )
+
+Given a string C<$standard_name> that is currently one of
+
+=over
+
+=item * C<< C++98 >>
+
+=item * C<< C++11 >>
+
+=item * C<< C++14 >>
+
+=item * C<< C++17 >>
+
+=back
+
+returns a string with a flag that can be used to tell the compiler to support
+that version of the C++ standard or dies if version is not supported.
+
+Added in version v0.22.
+
=head1 AUTHOR
Mattia Barbon <[email protected]>
@@ -172,7 +195,7 @@
use File::Spec::Functions qw(catfile);
use File::Temp qw(tempdir);
-our $VERSION = '0.21';
+our $VERSION = '0.23';
sub new {
my( $class, %args ) = @_;
@@ -389,9 +412,9 @@
$self->{is_clang} = 0;
my $cc_version = _capture( "$cc --version" );
if (
- $cc_version =~ m/\Aclang/i
+ $cc_version =~ m/\A(?:clang|apple llvm)/i
|| $cc eq 'clang' # because why would they lie?
- || (($self->_config->{gccversion} || '') =~ /Clang/),
+ || (($self->_config->{gccversion} || '') =~ /Clang|Apple LLVM/),
) {
$self->{is_clang} = 1;
}
@@ -483,22 +506,30 @@
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;
+# Compile the given code and returns true on success.
+#
+# Can optionally be given compiler flags.
+sub _can_compile_code {
+ my( $self, $cpp_code, $compiler_flags ) = @_;
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;
+ _to_file $file, $cpp_code;
my $command = join ' ',
$self->compiler_command,
+ @{ defined $compiler_flags ? $compiler_flags : [] },
($self->is_msvc ? qq{-Fe:} : qq{-o }) . $exe,
$file,
;
- my $result = system $command;
- $self->{no_h_status} = ($result == 0);
+ return 0 == system $command;
+}
+
+# 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;
+ $self->{no_h_status} = $self->_can_compile_code( $test_cpp );
}
sub iostream_fname {
@@ -517,4 +548,70 @@
END_FLAVOR_DEFINITIONS
}
+# Listed in order by year.
+our @CPP_STANDARDS = (
+ 'C++98',
+ 'C++11',
+ 'C++14',
+ 'C++17',
+);
+# Hash of flags for each compiler:
+#
+# Structure
+# Hash:
+# - key: <detected compiler name string>
+# - value:
+# Hash:
+# - key: <C++ standard name string>
+# - value:
+# ArrayRef[Str]
+# <list of alternative flags, in preferred order>
+our $CPP_STANDARD_FLAGS = {
+ is_gcc => {
+ 'C++98' => [ "-std=c++98" ],
+ 'C++11' => [ "-std=c++11", "-std=c++0x" ],
+ 'C++14' => [ "-std=c++14", "-std=c++1y" ],
+ 'C++17' => [ "-std=c++17", "-std=c++1z" ],
+ },
+ is_clang => {
+ 'C++98' => [ "-std=c++98", ],
+ 'C++11' => [ "-std=c++11", ],
+ 'C++14' => [ "-std=c++14", "-std=c++1y" ],
+ 'C++17' => [ "-std=c++17", "-std=c++1z" ],
+ },
+ is_msvc => {
+ # Newer MSVC set C++14 as minimum version.
+ 'C++98' => [ "" ],
+ 'C++11' => [ "" ],
+ 'C++14' => [ "-std:c++14" ],
+ 'C++17' => [ "-std:c++17" ],
+ },
+ is_sunstudio => {
+ 'C++98' => [ "" ],
+ 'C++11' => [ "-std=c++11", "-std=c++0x" ],
+ 'C++14' => [ "-std=c++14" ],
+ # No mention of C++17 for Oracle Developer Studio 12.6.
+ },
+};
+
+sub cpp_standard_flag {
+ my ($self, $standard_name) = @_;
+
+ $self->guess_compiler || die;
+ my ($detected_compiler) = grep { $self->{$_} } keys %$CPP_STANDARD_FLAGS;
+
+ die "Unknown standard '$standard_name' for compiler '$detected_compiler'"
+ unless exists $CPP_STANDARD_FLAGS->{$detected_compiler}{$standard_name};
+
+ my $test_flags = $CPP_STANDARD_FLAGS->{$detected_compiler}{$standard_name};
+
+ for my $flag (@$test_flags) {
+ return $flag if $self->_can_compile_code( <<EOF, [ $flag ] );
+int main(){ return 0; }
+EOF
+ }
+
+ die "Compiler '$detected_compiler' does not support any flags for standard
'$standard_name'";
+}
+
1;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/ExtUtils-CppGuess-0.21/t/003_standard_flag.t
new/ExtUtils-CppGuess-0.23/t/003_standard_flag.t
--- old/ExtUtils-CppGuess-0.21/t/003_standard_flag.t 1970-01-01
01:00:00.000000000 +0100
+++ new/ExtUtils-CppGuess-0.23/t/003_standard_flag.t 2021-06-01
00:05:20.000000000 +0200
@@ -0,0 +1,46 @@
+use strict;
+use warnings;
+use Test::More;
+use ExtUtils::CppGuess;
+
+my $guess = ExtUtils::CppGuess->new;
+
+plan skip_all => "Test currently only supports GCC and Clang"
+ unless $guess->is_gcc || $guess->is_clang;
+
+subtest "Test argument C++11" => sub {
+ my $flag = eval {
+ $guess->cpp_standard_flag('C++11');
+ };
+ if( $@ =~ /does not support any flags for standard/ ) {
+ plan skip_all => "Skipping: $@";
+ }
+ like $flag, qr/\Q-std=c++\E(11|0x)/, 'correct flag';
+};
+
+subtest "Test non-C++ standard" => sub {
+ my $flag = eval {
+ # The flag `-std=c11` is a valid compiler flag,
+ # but not for C++.
+ $guess->cpp_standard_flag('C11');
+ };
+ ok $@ =~ /Unknown standard/, 'C11 is not a C++ standard';
+};
+
+subtest "Test compiler failure to support known version" => sub {
+ # NOTE Monkey-patching data here.
+ local $ExtUtils::CppGuess::CPP_STANDARD_FLAGS;
+ for my $compiler ( qw(is_gcc is_clang) ) {
+ $ExtUtils::CppGuess::CPP_STANDARD_FLAGS
+ ->{$compiler}{'C++unreal'} = [ '-std=c++unreal' ];
+ }
+
+ my $flag = eval {
+ # This will try to use the fake C++unreal flag, but fail.
+ $guess->cpp_standard_flag('C++unreal');
+ };
+
+ ok $@ =~ /does not support/, 'Fake version is not supported by
compiler';
+};
+
+done_testing;