Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
daoswald committed Mar 3, 2012
2 parents 111418c + 249f1a9 commit 7e71640
Show file tree
Hide file tree
Showing 33 changed files with 651 additions and 447 deletions.
627 changes: 334 additions & 293 deletions CPP.pm

Large diffs are not rendered by default.

23 changes: 22 additions & 1 deletion Changes
@@ -1,8 +1,29 @@
Revision history for Perl extension Inline::CPP.
0.34_004 ----------------------------
- Code formatting cleanup in CPP.pm and grammar.pm.
- All code now passes Perl::Critic level 5, including test suite.
- New NetBSD patch from Chris Smith targeting better install success on
that platform.
- CPP.pm and grammar.pm are *mostly* Perl::Critic level 4 compliant.
0.34_003 Fri Feb 24 08:28:00 PST 2012
- Add (untested) code to Makefile.PL to deal with NetBSD so that
we can get a clean NetBSD install. EXPERIMENTAL in this version.
- Add check to CPP.pm to avoid a noisy warning about undefined value
when user code includes a subroutine with 'void' as param list.
(Note: This does NOT add 'void' as a valid param list type.)
- POD refinements.
0.34_002 Thur Feb 16 12:00:00 PST 2012
- Patch to Makefile.PL provided by smoke tester Steven Schubiger which
allows module to successfully install on MirBSD systems. Thanks!
- Patch to Makefile.PL by Dave Oswald to allow successful install for
Darwin OS by setting proper default libraries.
0.34_001 Thur Feb 09 23:22:00 PST 2012
- Patched Makefile.PL (as suggested by sisyphus) to better detect proper
Solaris compiler (targeting Solaris 2.11 bug).
0.34 Mon Feb 06 22:32:00 PST 2012
- Carry all updates current in 0.33_010(Dev) to 0.34(Stable) for release
to CPAN.
- Set minimum version for Inline and Inline::C dependency to 0.50 to
- Set minimum version for Inline and Inline::C dependency to 0.50 to
take advantage of Inline patch that resolves the issue where smoke
testers were unable to locate Parse::RecDescent dependency.
- POD revisions.
Expand Down
7 changes: 5 additions & 2 deletions MANIFEST
Expand Up @@ -5,6 +5,7 @@ MANIFEST.SKIP
Makefile.PL
README
TESTED
TODO Developer's TODO list.
grammar/grammar.pm
grammar/Makefile.PL
grammar/t/01nherit.t
Expand All @@ -24,9 +25,11 @@ grammar/t/14const.t
grammar/t/15stvar.t
grammar/t/16varlst.t
grammar/t/17memberarray.t
grammar/t/18voidparam.t
lib/Inline/CPP.pod
t/00load_prereqs.t
t/01basic.t
t/02prefix.t
META.yml Module YAML meta-data (added by MakeMaker)
META.json Module JSON meta-data (added by MakeMaker)
t/03pod.t
META.yml Module YAML meta-data (added by MakeMaker)
META.json Module JSON meta-data (added by MakeMaker)
4 changes: 2 additions & 2 deletions META.json
Expand Up @@ -38,6 +38,6 @@
}
}
},
"release_status" : "stable",
"version" : "0.34"
"release_status" : "testing",
"version" : "0.34_004"
}
4 changes: 2 additions & 2 deletions META.yml
@@ -1,5 +1,5 @@
---
abstract: 'Write Perl subroutines and classes in C++.'
abstract: Write Perl subroutines and classes in C++.
author:
- 'David Oswald <davido@cpan.org>'
build_requires:
Expand All @@ -21,4 +21,4 @@ requires:
Inline: 0.50
Inline::C: 0.50
Parse::RecDescent: 0
version: 0.34
version: 0.34_004
112 changes: 72 additions & 40 deletions Makefile.PL
@@ -1,6 +1,15 @@
use ExtUtils::MakeMaker;
use Config;

use strict;

# We're using bareword file handles and two arg open for backward
# compatibility in Makefile.PL. Here we disable those tests in Perl::Critic.

## no critic (bareword file handle)
## no critic (two-argument open)


my %PREREQ_PM = (
'Inline' => '0.50',
'Inline::C' => '0.50',
Expand All @@ -21,16 +30,18 @@ int main(){
END_TEST_CPP



#============================================================================
# We'll do our own prerequisite checking, since MakeMaker does it
# in a way that always fails: 'use Inline::C 0.33' will never work.
#============================================================================
for (sort keys %PREREQ_PM) {
## no critic (eval)
eval "require $_";
my $have = eval ${"${$_}::VERSION"};
# We eval version numbers to normalize _xxx dev numbering.
my $have = eval 'no strict q/refs/; ${"${_}::VERSION"}';
use strict q/refs/;
my $want = eval $PREREQ_PM{$_};
warn "Warning: prerequisite $_ version $PREREQ_PM{$_} not found"
warn "Warning: prerequisite $_ version $PREREQ_PM{$_} not found."
if $@ or $have < $want;
}

Expand All @@ -39,58 +50,77 @@ for (sort keys %PREREQ_PM) {
#============================================================================
my $cc_guess;
my $libs_guess;
if ($Config{gccversion} and $Config{cc} =~ m#\bgcc\b[^/]*$# ) {
($cc_guess = $Config{cc}) =~ s[\bgcc\b([^/]*)$(?:)][g\+\+$1];

if ($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 (
$Config{osname} ne 'darwin' and
$Config{gccversion} and
$Config{cc} =~ m#\bgcc\b[^/]*$#
) {
($cc_guess = $Config{cc}) =~ s[\bgcc\b([^/]*)$(?:)][g\+\+$1];
$libs_guess = '-lstdc++';
}
elsif ($Config{osname} =~ /^MSWin/) {
$cc_guess = 'cl -TP -EHsc';
elsif ($Config{osname} =~ m/^MSWin/) {
$cc_guess = 'cl -TP -EHsc';
$libs_guess = 'MSVCIRT.LIB';
}
elsif ($Config{osname} eq 'linux') {
$cc_guess = 'g++';
$cc_guess = 'g++';
$libs_guess = '-lstdc++';
}
# NetBSD patch...
elsif( $Config{osname} eq 'netbsd' ) {
$cc_guess = 'g++';
$libs_guess = '-lstdc++ -lgcc_s';
}
elsif ($Config{osname} eq 'cygwin') {
$cc_guess = 'g++';
$cc_guess = 'g++';
$libs_guess = '-lstdc++';
}
elsif ($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 ($Config{osname} eq 'solaris' or $Config{osname} eq 'SunOS') {
if ($Config{cc} eq 'gcc') {
$cc_guess = 'g++';
if (
$Config{cc} eq 'gcc' ||
( exists( $Config{gccversion} ) && $Config{gccversion} > 0 )
) {
$cc_guess = 'g++';
$libs_guess = '-lstdc++';
}
else {
$cc_guess = 'CC';
$cc_guess = 'CC';
$libs_guess ='-lCrun';
}
}
elsif ($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";
}
# Sane defaults for other (probably unix-like) operating systems
else {
$cc_guess = 'g++';
$cc_guess = 'g++';
$libs_guess = '-lstdc++';
}

print "This will configure and build Inline::C++.\n";

my $cpp_compiler = prompt(
"What default C++ compiler would you like to use?",
$cc_guess
"What default C++ compiler would you like to use?",
$cc_guess
);

my $libs = prompt(
"What default libraries would you like to include?",
$libs_guess
my $libs = prompt(
"What default libraries would you like to include?",
$libs_guess
);

#============================================================================
Expand All @@ -104,29 +134,31 @@ close TESTCPP

# Compile our test C++ program that includes the <iostream> header.
my $result;
if( $cpp_compiler =~ /^cl/ ) {
if( $cpp_compiler =~ m/^cl/ ) {
# MS compilers don't support -o (or -o is deprecated for them).
$result = system(
qq{$cpp_compiler -Fe:$test_cpp_filename.exe } .
qq{$test_cpp_filename.cpp}
);
} else {
}
else {
$result = system(
qq{$cpp_compiler -o $test_cpp_filename.exe } .
qq{$test_cpp_filename.cpp}
);
}

my $iostream_fname_style = 'iostream';
my $namespace_std = "#define __INLINE_CPP_NAMESPACE_STD 1\n";
my $standard_headers = "#define __INLINE_CPP_STANDARD_HEADERS 1\n";
my $namespace_std = "#define __INLINE_CPP_NAMESPACE_STD 1\n";
my $standard_headers = "#define __INLINE_CPP_STANDARD_HEADERS 1\n";
if( $result != 0 ) {
# Compiling with <iostream> failed, so we'll assume .h headers.
print "Detected <iostream.h> style headers. ('.h' needed.)\n";
$iostream_fname_style = 'iostream.h';
$namespace_std = "// $namespace_std";
$standard_headers = "// $standard_headers";
} else {
$namespace_std = "// $namespace_std";
$standard_headers = "// $standard_headers";
}
else {
# Compiling with <iostream> passed, so we'll assume Standard headers.
print "Detected <iostream> style headers. ('.h' not needed.)\n";
unlink "$test_cpp_filename.exe" or warn $!; # Unlink the executable.
Expand All @@ -136,7 +168,7 @@ unlink "$test_cpp_filename.cpp" or warn $!; # Unlink the test source.


# Apply the defaults:
open CPP, "CPP.pm";
open CPP, "CPP.pm" or die "Can't read from CPP.pm for configuration!\n$!";
my @lines = <CPP>;
close CPP;

Expand All @@ -162,16 +194,16 @@ for (@lines) {

}

open CPP, ">CPP.pm" or die "Can't write to CPP.pm!";
print CPP @lines;
close CPP or die "Can't close CPP.pm after output!";
open CPP, ">CPP.pm" or die "Can't write to CPP.pm for configuration!\n$!";
print CPP @lines;
close CPP or die "Can't close CPP.pm after config output!\n$!";


WriteMakefile(
NAME => 'Inline::CPP',
AUTHOR => 'David Oswald <davido@cpan.org>',
VERSION_FROM => 'CPP.pm',
ABSTRACT_FROM => 'lib/Inline/CPP.pod',
ABSTRACT_FROM => 'lib/Inline/CPP.pod',
PREREQ_PM => \%PREREQ_PM,
clean => {
FILES => '_Inline/ grammar/_Inline'
Expand Down
16 changes: 10 additions & 6 deletions README
Expand Up @@ -33,10 +33,11 @@ When run, this complete program prints:
-----------------------------------------------------------------------------
FEATURES:

Inline::CPP version 0.34 is a stable release. There have been numerous bug
fixes since 0.33, mostly targeting installation and smoke test success.
Please refer to the Changes file in this distribution for a description of the
revisions since the previous stable release.
Inline::CPP version 0.34_004 adds a patch based on research from Chris Smith
that should improve install success for NetBSD. Additionally, all code is now
Perl::Critic level 5 compliant. CPP.pm and grammar.pm are *mostly* level 4
compliant as well. This includes the test suite and Makefile.PL. There has
also been a lot of code cleanup.

-----------------------------------------------------------------------------
INSTALLATION:
Expand All @@ -54,8 +55,8 @@ make install
(On ActivePerl for MSWin32, use nmake instead of make.)
(On Strawberry Perl you may use dmake instead.)

As Makefile.PL runs you will be prompted for what C++ compiler and library to
use. Accepting the default should work in nearly every case (and if it
As Makefile.PL runs you will be prompted for what C++ compiler and library to
use. Accepting the default should work in nearly every case (and if it
doesn't, let me know).

-----------------------------------------------------------------------------
Expand All @@ -70,6 +71,9 @@ INFORMATION:
The Inline mailing list is inline@perl.org. Send mail to
inline-subscribe@perl.org to subscribe.

This module's development is under version control with Git, hosted on Github
at https://github.com/daoswald/Inline-CPP

Please send questions and comments to "David Oswald" <DAVIDO@cpan.org>

Copyright (c) 2003 - 2012, Neil Watkiss, David Oswald. All Rights Reserved.
5 changes: 3 additions & 2 deletions TESTED
Expand Up @@ -8,8 +8,9 @@ please have a look at the test matrix here:

http://www.cpantesters.org/distro/I/Inline-CPP.html



If you experience difficulty installing on your system, please do get in
touch with David Oswald <davido@cpan.org>. Your input might be just what's
needed to improve the install experience for others.


This list will be kept as-is for historical reasons, but do refer to the
Expand Down
12 changes: 12 additions & 0 deletions TODO
@@ -0,0 +1,12 @@
------------------------------------------------------------------------------
*.................... TO-DO LIST FOR Inline::CPP ..........................*
------------------------------------------------------------------------------

***** In no particular order *****

Test Suite Expansion / Rewrite

Multi-dimensional arrays as member functions.
( Currently only single dimensional. )

The NetBSD install issue.

0 comments on commit 7e71640

Please sign in to comment.