-X, --omit-XS Omit the XS portion (implies both -c and -f).
-a, --gen-accessors Generate get/set accessors for struct and union members
(used with -x).
- -b, --compat-version Specify a perl version to be backwards compatibile with.
+ -b, --compat-version Specify a perl version to be backwards compatible with.
-c, --omit-constant Omit the constant() function and specialised AUTOLOAD
from the XS file.
-d, --debugging Turn on debugging messages.
}
else {
@paths = (File::Spec->curdir(), $Config{usrinc},
- (split ' ', $Config{locincpth}), '/usr/include');
+ (split / +/, $Config{locincpth} // ""), '/usr/include');
}
foreach my $path_h (@path_h) {
$name ||= $path_h;
$rest =~ s!/\*.*?(\*/|\n)|//.*!!g; # Remove comments
$rest =~ s/^\s+//;
$rest =~ s/\s+$//;
+ if ($rest eq '') {
+ print("Skip empty $def\n") if $opt_d;
+ next defines;
+ }
# Cannot do: (-1) and ((LHANDLE)3) are OK:
#print("Skip non-wordy $def => $rest\n"),
# next defines if $rest =~ /[^\w\$]/;
}
else {
# Work from miniperl too - on "normal" systems
- my $SEEK_SET = eval 'use Fcntl qw/SEEK_SET/; SEEK_SET' or 0;
+ my $SEEK_SET = eval 'use Fcntl qw/SEEK_SET/; SEEK_SET' || 0;
seek CH, 0, $SEEK_SET;
my $src = do { local $/; <CH> };
close CH;
}
warn "Scanning $filename for functions...\n";
my @styles = $Config{gccversion} ? qw(C++ C9X GNU) : qw(C++ C9X);
- $c = new C::Scan 'filename' => $filename, 'filename_filter' => $filter,
- 'add_cppflags' => $addflags, 'c_styles' => \@styles;
+ $c = C::Scan->new('filename' => $filename, 'filename_filter' => $filter,
+ 'add_cppflags' => $addflags, 'c_styles' => \@styles);
$c->set('includeDirs' => ["$Config::Config{archlib}/CORE", $cwd]);
$c->get('keywords')->{'__restrict'} = 1;
warn "Writing $ext$modpname/$modfname.xs\n";
print XS <<"END";
+#define PERL_NO_GET_CONTEXT
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
# my \$buffer = $name->new();
# my \$obj = \$buffer->_to_ptr();
#
-#This exersizes the following two methods, and an additional class
+#This exercises the following two methods, and an additional class
#C<$name>, the internal representation of which is a reference to a
#packed string with the C structure. Keep in mind that \$buffer should
#better survive longer than \$obj.
sub normalize_type { # Second arg: do not strip const's before \*
my $type = shift;
my $do_keep_deep_const = shift;
- # If $do_keep_deep_const this is heuristical only
+ # If $do_keep_deep_const this is heuristic only
my $keep_deep_const = ($do_keep_deep_const ? '\b(?![^(,)]*\*)' : '');
my $ignore_mods
= "(?:\\b(?:(?:__const__|const)$keep_deep_const|static|inline|__inline__)\\b\\s*)*";
$prereq_pm .= q%'Test' => 0, %;
}
-if ( $compat_version < 5.006 and !$opt_X and $use_xsloader)
+if (!$opt_X and $use_xsloader)
{
$prereq_pm .= q%'XSLoader' => 0, %;
}
# the contents of the Makefile that is written.
WriteMakefile(
NAME => '$module',
- VERSION_FROM => '$modpmname', # finds \$VERSION
+ VERSION_FROM => '$modpmname', # finds \$VERSION, requires EU::MM from perl >= 5.5
PREREQ_PM => {$prereq_pm}, # e.g., Module::Name => 1.1
- (\$] >= 5.005 ? ## Add these new keywords supported since 5.005
- (ABSTRACT_FROM => '$modpmname', # retrieve abstract from module
- AUTHOR => '$author <$email>') : ()),
+ ABSTRACT_FROM => '$modpmname', # retrieve abstract from module
+ AUTHOR => '$author <$email>',
+ #LICENSE => 'perl',
+ #Value must be from legacy list of licenses here
+ #http://search.cpan.org/perldoc?Module%3A%3ABuild%3A%3AAPI
END
if (!$opt_X) { # print C stuff, unless XS is disabled
$opt_F = '' unless defined $opt_F;
close(PL) || die "Can't close $ext$modpname/Makefile.PL: $!\n";
# Create a simple README since this is a CPAN requirement
-# and it doesnt hurt to have one
+# and it doesn't hurt to have one
warn "Writing $ext$modpname/README\n";
open(RM, ">README") || die "Can't create $ext$modpname/README:$!\n";
my $thisyear = (gmtime)[5] + 1900;
open EX, ">$testfile" or die "Can't create $ext$modpname/$testfile: $!\n";
print EX <<_END_;
-# Before `make install' is performed this script should be runnable with
-# `make test'. After `make install' it should work as `perl $modpname.t'
+# Before 'make install' is performed this script should be runnable with
+# 'make test'. After 'make install' it should work as 'perl $modpname.t'
#########################
# change 'tests => $tests' to 'tests => last_test_to_print';
+use strict;
+use warnings;
+
_END_
my $test_mod = 'Test::More';