r62576 - in /branches/upstream/libmath-bigint-gmp-perl/current: CHANGES GMP.xs MANIFEST MANIFEST.SKIP META.yml Makefile.PL SIGNATURE inc/ inc/Devel/ inc/Devel/CheckLib.pm lib/Math/BigInt/GMP.pm t/bigintpm.inc t/bigintpm.t t/threads.t typemap
gregoa at users.alioth.debian.org
gregoa at users.alioth.debian.org
Tue Sep 14 21:29:07 UTC 2010
Author: gregoa
Date: Tue Sep 14 21:28:49 2010
New Revision: 62576
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=62576
Log:
[svn-upgrade] new version libmath-bigint-gmp-perl (1.26)
Added:
branches/upstream/libmath-bigint-gmp-perl/current/inc/
branches/upstream/libmath-bigint-gmp-perl/current/inc/Devel/
branches/upstream/libmath-bigint-gmp-perl/current/inc/Devel/CheckLib.pm
branches/upstream/libmath-bigint-gmp-perl/current/t/threads.t
Modified:
branches/upstream/libmath-bigint-gmp-perl/current/CHANGES
branches/upstream/libmath-bigint-gmp-perl/current/GMP.xs
branches/upstream/libmath-bigint-gmp-perl/current/MANIFEST
branches/upstream/libmath-bigint-gmp-perl/current/MANIFEST.SKIP
branches/upstream/libmath-bigint-gmp-perl/current/META.yml
branches/upstream/libmath-bigint-gmp-perl/current/Makefile.PL
branches/upstream/libmath-bigint-gmp-perl/current/SIGNATURE
branches/upstream/libmath-bigint-gmp-perl/current/lib/Math/BigInt/GMP.pm
branches/upstream/libmath-bigint-gmp-perl/current/t/bigintpm.inc
branches/upstream/libmath-bigint-gmp-perl/current/t/bigintpm.t
branches/upstream/libmath-bigint-gmp-perl/current/typemap
Modified: branches/upstream/libmath-bigint-gmp-perl/current/CHANGES
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmath-bigint-gmp-perl/current/CHANGES?rev=62576&op=diff
==============================================================================
--- branches/upstream/libmath-bigint-gmp-perl/current/CHANGES (original)
+++ branches/upstream/libmath-bigint-gmp-perl/current/CHANGES Tue Sep 14 21:28:49 2010
@@ -1,3 +1,10 @@
+2010-09-14 v1.06 rafl 5558 tests DEVELOPMENT RELEASE
+ * Error out early if libgmp or gmp.h are missing.
+ * Clone Math::BigInt::GMP instances on thread cloning.
+ This should make the module threadsafe.
+
+2010-09-10 v1.25 rafl 5536 tests
+ * Fix tests with Math::BigInt >= 1.90 and depend on it.
2007-07-31 v1.24 Tels 5530 tests
* apply patch for warnings about ptr size mismatch under Cygwin (thanx Reini Urban!)
Modified: branches/upstream/libmath-bigint-gmp-perl/current/GMP.xs
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmath-bigint-gmp-perl/current/GMP.xs?rev=62576&op=diff
==============================================================================
--- branches/upstream/libmath-bigint-gmp-perl/current/GMP.xs (original)
+++ branches/upstream/libmath-bigint-gmp-perl/current/GMP.xs Tue Sep 14 21:28:49 2010
@@ -8,6 +8,86 @@
# define SvUOK(sv) SvIOK_UV(sv)
#endif
+#define NEW_GMP_MPZ_T RETVAL = malloc (sizeof(mpz_t));
+#define NEW_GMP_MPZ_T_INIT RETVAL = malloc (sizeof(mpz_t)); mpz_init(*RETVAL);
+#define GMP_GET_ARG_0 TEMP = mpz_from_sv(x);
+#define GMP_GET_ARG_1 TEMP_1 = mpz_from_sv(y);
+#define GMP_GET_ARGS_0_1 GMP_GET_ARG_0; GMP_GET_ARG_1;
+
+#ifdef USE_ITHREADS
+STATIC int
+dup_gmp_mpz (pTHX_ MAGIC *mg, CLONE_PARAMS *params)
+{
+ mpz_t *RETVAL;
+ PERL_UNUSED_ARG(params);
+ NEW_GMP_MPZ_T;
+ mpz_init_set(*RETVAL, *((mpz_t *)mg->mg_ptr));
+ mg->mg_ptr = (char *)RETVAL;
+ return 0;
+}
+#endif
+
+STATIC MGVTBL vtbl_gmp = {
+ NULL, /* get */
+ NULL, /* set */
+ NULL, /* len */
+ NULL, /* clear */
+ NULL, /* free */
+#ifdef MGf_COPY
+ NULL, /* copy */
+#endif
+#ifdef MGf_DUP
+# ifdef USE_ITHREADS
+ dup_gmp_mpz,
+# else
+ NULL, /* dup */
+# endif
+#endif
+#ifdef MGf_LOCAL
+ NULL, /* local */
+#endif
+};
+
+STATIC SV *
+sv_from_mpz (mpz_t *mpz)
+{
+ SV *sv = newSV(0);
+ SV *obj = newRV_noinc(sv);
+#ifdef USE_ITHREADS
+ MAGIC *mg;
+#endif
+
+ sv_bless(obj, gv_stashpvs("Math::BigInt::GMP", 0));
+
+#ifdef USE_ITHREADS
+ mg =
+#endif
+ sv_magicext(sv, NULL, PERL_MAGIC_ext, &vtbl_gmp, (void *)mpz, 0);
+
+#ifdef USE_ITHREADS
+ mg->mg_flags |= MGf_DUP;
+#endif
+
+ return obj;
+}
+
+mpz_t *
+mpz_from_sv (SV *sv)
+{
+ MAGIC *mg;
+
+ if (!sv_derived_from(sv, "Math::BigInt::GMP"))
+ croak("not of type Math::BigInt::GMP");
+
+ for (mg = SvMAGIC(SvRV(sv)); mg; mg = mg->mg_moremagic) {
+ if (mg->mg_type == PERL_MAGIC_ext && mg->mg_virtual == &vtbl_gmp) {
+ return (mpz_t *)mg->mg_ptr;
+ }
+ }
+
+ croak("failed to fetch mpz pointer");
+}
+
/*
Math::BigInt::GMP XS code, loosely based on Math::GMP, a Perl module for
high-speed arbitrary size integer calculations (C) 2000 James H. Turner
@@ -15,18 +95,6 @@
MODULE = Math::BigInt::GMP PACKAGE = Math::BigInt::GMP
PROTOTYPES: ENABLE
-
-#define NEW_GMP_MPZ_T RETVAL = malloc (sizeof(mpz_t));
-#define NEW_GMP_MPZ_T_INIT RETVAL = malloc (sizeof(mpz_t)); mpz_init(*RETVAL);
-#define GMP_GET_ARG_0 if (sv_derived_from(x, "Math::BigInt::GMP")) {\
- IV tmp = SvIV((SV*)SvRV(x));\
- TEMP = INT2PTR(mpz_t*, tmp);\
- } else { croak("x is not of type Math::BigInt::GMP"); }
-#define GMP_GET_ARG_1 if (sv_derived_from(y, "Math::BigInt::GMP")) {\
- IV tmp = SvIV((SV*)SvRV(y));\
- TEMP_1 = INT2PTR(mpz_t*, tmp);\
- } else { croak("y is not of type Math::BigInt::GMP"); }
-#define GMP_GET_ARGS_0_1 GMP_GET_ARG_0; GMP_GET_ARG_1;
##############################################################################
# _new()
@@ -406,7 +474,7 @@
sign = mpz_sgn (*RETVAL);
/* absolute result */
mpz_abs (*RETVAL, *RETVAL);
- PUSHs(sv_setref_pv(sv_newmortal(), "Math::BigInt::GMP", (void*)RETVAL));
+ PUSHs(sv_2mortal(sv_from_mpz(RETVAL)));
if (sign >= 0)
{
PUSHs ( &PL_sv_undef ); /* result is ok, keep it */
@@ -597,7 +665,7 @@
mpz_tdiv_qr(*TEMP, *rem, *TEMP, *TEMP_1);
EXTEND(SP, 2);
PUSHs( x );
- PUSHs(sv_setref_pv(sv_newmortal(), "Math::BigInt::GMP", (void*)rem));
+ PUSHs(sv_2mortal(sv_from_mpz(rem)));
}
else
{
Modified: branches/upstream/libmath-bigint-gmp-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmath-bigint-gmp-perl/current/MANIFEST?rev=62576&op=diff
==============================================================================
--- branches/upstream/libmath-bigint-gmp-perl/current/MANIFEST (original)
+++ branches/upstream/libmath-bigint-gmp-perl/current/MANIFEST Tue Sep 14 21:28:49 2010
@@ -5,23 +5,25 @@
CHANGES
CREDITS
GMP.xs
+inc/Devel/CheckLib.pm
INSTALL
lib/Math/BigInt/GMP.pm
LICENSE
Makefile.PL
-MANIFEST
+MANIFEST This list of files
MANIFEST.SKIP
-META.yml Module meta-data (added by MakeMaker)
+META.yml
README
-SIGNATURE
-t/bigfltpm.inc # actual tests
-t/bigfltpm.t # original test, but with Math::GMP
-t/bigintg.t # Math::GMP implementation of uint math core
-t/bigintpm.inc # actual tests
-t/bigintpm.t # original test, but with Math::GMP
+t/bigfltpm.inc
+t/bigfltpm.t
+t/bigintg.t
+t/bigintpm.inc
+t/bigintpm.t
t/biglog.t
t/bigroot.t
t/pod.t
t/pod_cov.t
+t/threads.t
TODO
typemap
+SIGNATURE Public-key signature (added by MakeMaker)
Modified: branches/upstream/libmath-bigint-gmp-perl/current/MANIFEST.SKIP
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmath-bigint-gmp-perl/current/MANIFEST.SKIP?rev=62576&op=diff
==============================================================================
--- branches/upstream/libmath-bigint-gmp-perl/current/MANIFEST.SKIP (original)
+++ branches/upstream/libmath-bigint-gmp-perl/current/MANIFEST.SKIP Tue Sep 14 21:28:49 2010
@@ -6,3 +6,4 @@
^Makefile.(old|bak)\z
.*\.patch\z
pm_to_blib
+\.git
Modified: branches/upstream/libmath-bigint-gmp-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmath-bigint-gmp-perl/current/META.yml?rev=62576&op=diff
==============================================================================
--- branches/upstream/libmath-bigint-gmp-perl/current/META.yml (original)
+++ branches/upstream/libmath-bigint-gmp-perl/current/META.yml Tue Sep 14 21:28:49 2010
@@ -1,12 +1,12 @@
---
name: Math-BigInt-GMP
author: Tels
-version: 1.24
+version: 1.26
version_from: lib/Math/BigInt/GMP.pm
license: perl
distribution_type: module
-generated_by: Math-BigInt-GMP version 1.24
+generated_by: Math-BigInt-GMP version 1.26
installdirs: site
requires:
- Math::BigInt: 1.87
+ Math::BigInt: 1.9
XSLoader: 0.02
Modified: branches/upstream/libmath-bigint-gmp-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmath-bigint-gmp-perl/current/Makefile.PL?rev=62576&op=diff
==============================================================================
--- branches/upstream/libmath-bigint-gmp-perl/current/Makefile.PL (original)
+++ branches/upstream/libmath-bigint-gmp-perl/current/Makefile.PL Tue Sep 14 21:28:49 2010
@@ -1,4 +1,6 @@
use ExtUtils::MakeMaker;
+use lib 'inc'; # load our bundled version of Devel::CheckLib
+use Devel::CheckLib;
#printf "Your OS is [%s]!\n---\n", $Config::Config{'osname'}; ### for testing purpose only
@@ -42,12 +44,15 @@
"metafile:\n$dump";
}
+check_lib_or_exit(lib => 'gmp', header => 'gmp.h', @ARGV);
+
WriteMakefile(
'NAME' => 'Math::BigInt::GMP',
'VERSION_FROM' => 'lib/Math/BigInt/GMP.pm',
'PREREQ_PM' => {
- Math::BigInt => 1.87,
+ Math::BigInt => 1.90,
XSLoader => 0.02,
- },
+ },
'LIBS' => ['-lgmp'],
+ 'SIGN' => 1,
);
Modified: branches/upstream/libmath-bigint-gmp-perl/current/SIGNATURE
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmath-bigint-gmp-perl/current/SIGNATURE?rev=62576&op=diff
==============================================================================
--- branches/upstream/libmath-bigint-gmp-perl/current/SIGNATURE (original)
+++ branches/upstream/libmath-bigint-gmp-perl/current/SIGNATURE Tue Sep 14 21:28:49 2010
@@ -1,5 +1,5 @@
This file contains message digests of all files listed in MANIFEST,
-signed via the Module::Signature module, version 0.54.
+signed via the Module::Signature module, version 0.66.
To verify the content in this distribution, first make sure you have
Module::Signature installed, then type:
@@ -15,39 +15,37 @@
Hash: SHA1
SHA1 70d6187d0152848c922dc4360fa6dd3a3dc35c62 BUGS
-SHA1 271b61ffaf1918eb85e45c4858226ccfbcb4862a CHANGES
+SHA1 6fd2ead704ecb3644c53e9233b20f479623c996e CHANGES
SHA1 dda5ca4f413031e9efcaa1600461d5e2adaa3a40 CREDITS
-SHA1 c677a382a0301544ac58c83a44e25a8d46b22452 GMP.xs
+SHA1 1566e65e25fdde8f02c28bda8d04372c9fcac7a8 GMP.xs
SHA1 fcb1ead705a964b5555ff355534cbcf8b4c176e5 INSTALL
SHA1 d6a6c30ee6d9ba6b9afab8bbf6a25e1b23c744e0 LICENSE
-SHA1 574a4f3bc668e1d2d05c189efa46850bd828c79b MANIFEST
-SHA1 3716b684ad7f66e9f75a5cfa0737098b41dc0730 MANIFEST.SKIP
-SHA1 072edad617c9e588799181b23239508d734e8cec META.yml
-SHA1 7d63c7c9dfc21bd36110f9874a5a0c5a6c313adf Makefile.PL
+SHA1 d92d036825f848456802a2100373b7e021c1e4ed MANIFEST
+SHA1 f3190cb30c8df53e0fd78658ff9a6132e031042e MANIFEST.SKIP
+SHA1 6e2929ced41261ad0ec01242f7d8deacbd921833 META.yml
+SHA1 32b33a1c160e1efbf82b1bf8765cde8455a32550 Makefile.PL
SHA1 e9de29b6e5e9a5e446231b5b12b644f6ed2caafc README
SHA1 acf3dd42f0d8a87dd02ef9f5f74b894423ffd4d8 TODO
SHA1 fd48d0d8750eb949e485d8136b5b424fe73e9775 build/README
SHA1 7bcc4113830721ad6e37a1ea79df94a6987c836d build/leak.pl
SHA1 ac25bda8a6eb9058a9e42a8943c3e11b9fed88dc build/leaktest
-SHA1 ff5fe9462852f64ddadd111b3a12a74a19c84f5c lib/Math/BigInt/GMP.pm
+SHA1 332c820b17158bafd87fb16c7e1401b29976952d inc/Devel/CheckLib.pm
+SHA1 463062389a2990c4a3079ffdfa351220fa3ed014 lib/Math/BigInt/GMP.pm
SHA1 b389295c7eb542fb89f55d37390a35ac582b5e6c t/bigfltpm.inc
SHA1 a6659404498c1d7b74e055769710e00bf425e355 t/bigfltpm.t
SHA1 0f8838bf47e9c21a95bc15db11f435836440525c t/bigintg.t
-SHA1 383a30546458b7a21e4f34aea66c2b813003c3db t/bigintpm.inc
-SHA1 9aaaaed58b9a32c0f44d3c531ee39ff1f0092f2c t/bigintpm.t
+SHA1 1d063362c7a32e4fb0bfc756751481b75881e4bf t/bigintpm.inc
+SHA1 a1b919d7ec294a89ceb738a17cb986689ff80c98 t/bigintpm.t
SHA1 b68535cf9a33efa949c80b166302a866fd13cff9 t/biglog.t
SHA1 7eda06bd6d27b4092ab7266b1659e3a6ed369b26 t/bigroot.t
SHA1 17935f6d2607dfd441f6f59d69d5aaf282a16bfc t/pod.t
SHA1 c7406b64a2eff28ca33248f647eee3199deb10dc t/pod_cov.t
-SHA1 af431c9de0cf037af2118a77c7110655fa3f427f typemap
+SHA1 808b09f78be228a7d6c91a3206ca5a10ca179c23 t/threads.t
+SHA1 d6074079ab439bd3485ed2a5d784996fcd9e717d typemap
-----BEGIN PGP SIGNATURE-----
-Version: GnuPG v1.4.2 (GNU/Linux)
+Version: GnuPG v1.4.10 (GNU/Linux)
-iQEVAwUBRq9VV3cLPEOTuEwVAQL8NQf/RSVGXcdNQqo3kgBv7S6mTXaigx2vXYlv
-rT828kebA4Kh2K+4+0Ye9Ol3utJG8gZgWToDhVn8xOcmEOxM5ZI/DncY5ipG3EgE
-ZZcbaQQ6K0jOlZPxBMUhA7TbWX+AjnyG5H/zAtuvneB+LHfbHy5F1rRgJOzgjkg+
-YZqcyYqmC2tHMpeZ5UZXPZujHLfTwlIH8hdt15fb9oiS6vGaky+e4iMSQM5LmRjD
-nXQN/yPwdQbNr/GB4333knl/WU5OBBcO4ynxvWMoHHZEECCTTPE+W7wj19Eogzl3
-D42zFB7NqUya8k+SEtAZ50BRGVjx0GJ6Yx8vRdwepmnZ4iOjhylUeg==
-=BeBy
+iEYEARECAAYFAkyPqXsACgkQdC8qQo5jWl52pACdHSTVHW9GW4gZI6IMwxbUT7Hw
+qmgAnRYTZ3a//CB+lkDxAd4MVqmDF500
+=embN
-----END PGP SIGNATURE-----
Added: branches/upstream/libmath-bigint-gmp-perl/current/inc/Devel/CheckLib.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmath-bigint-gmp-perl/current/inc/Devel/CheckLib.pm?rev=62576&op=file
==============================================================================
--- branches/upstream/libmath-bigint-gmp-perl/current/inc/Devel/CheckLib.pm (added)
+++ branches/upstream/libmath-bigint-gmp-perl/current/inc/Devel/CheckLib.pm Tue Sep 14 21:28:49 2010
@@ -1,0 +1,444 @@
+# $Id: CheckLib.pm,v 1.25 2008/10/27 12:16:23 drhyde Exp $
+
+package Devel::CheckLib;
+
+use strict;
+use vars qw($VERSION @ISA @EXPORT);
+$VERSION = '0.7';
+use Config;
+
+use File::Spec;
+use File::Temp;
+
+require Exporter;
+ at ISA = qw(Exporter);
+ at EXPORT = qw(assert_lib check_lib_or_exit check_lib);
+
+# localising prevents the warningness leaking out of this module
+local $^W = 1; # use warnings is a 5.6-ism
+
+_findcc(); # bomb out early if there's no compiler
+
+=head1 NAME
+
+Devel::CheckLib - check that a library is available
+
+=head1 DESCRIPTION
+
+Devel::CheckLib is a perl module that checks whether a particular C
+library and its headers are available.
+
+=head1 SYNOPSIS
+
+ use Devel::CheckLib;
+
+ check_lib_or_exit( lib => 'jpeg', header => 'jpeglib.h' );
+ check_lib_or_exit( lib => [ 'iconv', 'jpeg' ] );
+
+ # or prompt for path to library and then do this:
+ check_lib_or_exit( lib => 'jpeg', libpath => $additional_path );
+
+=head1 USING IT IN Makefile.PL or Build.PL
+
+If you want to use this from Makefile.PL or Build.PL, do
+not simply copy the module into your distribution as this may cause
+problems when PAUSE and search.cpan.org index the distro. Instead, use
+the use-devel-checklib script.
+
+=head1 HOW IT WORKS
+
+You pass named parameters to a function, describing to it how to build
+and link to the libraries.
+
+It works by trying to compile some code - which defaults to this:
+
+ int main(void) { return 0; }
+
+and linking it to the specified libraries. If something pops out the end
+which looks executable, it gets executed, and if main() returns 0 we know
+that it worked. That tiny program is
+built once for each library that you specify, and (without linking) once
+for each header file.
+
+If you want to check for the presence of particular functions in a
+library, or even that those functions return particular results, then
+you can pass your own function body for main() thus:
+
+ check_lib_or_exit(
+ function => 'foo();if(libversion() > 5) return 0; else return 1;'
+ incpath => ...
+ libpath => ...
+ lib => ...
+ header => ...
+ );
+
+In that case, it will fail to build if either foo() or libversion() don't
+exist, and main() will return the wrong value if libversion()'s return
+value isn't what you want.
+
+=head1 FUNCTIONS
+
+All of these take the same named parameters and are exported by default.
+To avoid exporting them, C<use Devel::CheckLib ()>.
+
+=head2 assert_lib
+
+This takes several named parameters, all of which are optional, and dies
+with an error message if any of the libraries listed can
+not be found. B<Note>: dying in a Makefile.PL or Build.PL may provoke
+a 'FAIL' report from CPAN Testers' automated smoke testers. Use
+C<check_lib_or_exit> instead.
+
+The named parameters are:
+
+=over
+
+=item lib
+
+Must be either a string with the name of a single
+library or a reference to an array of strings of library names. Depending
+on the compiler found, library names will be fed to the compiler either as
+C<-l> arguments or as C<.lib> file names. (E.g. C<-ljpeg> or C<jpeg.lib>)
+
+=item libpath
+
+a string or an array of strings
+representing additional paths to search for libraries.
+
+=item LIBS
+
+a C<ExtUtils::MakeMaker>-style space-seperated list of
+libraries (each preceded by '-l') and directories (preceded by '-L').
+
+This can also be supplied on the command-line.
+
+=back
+
+And libraries are no use without header files, so ...
+
+=over
+
+=item header
+
+Must be either a string with the name of a single
+header file or a reference to an array of strings of header file names.
+
+=item incpath
+
+a string or an array of strings
+representing additional paths to search for headers.
+
+=item INC
+
+a C<ExtUtils::MakeMaker>-style space-seperated list of
+incpaths, each preceded by '-I'.
+
+This can also be supplied on the command-line.
+
+=back
+
+=head2 check_lib_or_exit
+
+This behaves exactly the same as C<assert_lib()> except that instead of
+dieing, it warns (with exactly the same error message) and exits.
+This is intended for use in Makefile.PL / Build.PL
+when you might want to prompt the user for various paths and
+things before checking that what they've told you is sane.
+
+If any library or header is missing, it exits with an exit value of 0 to avoid
+causing a CPAN Testers 'FAIL' report. CPAN Testers should ignore this
+result -- which is what you want if an external library dependency is not
+available.
+
+=head2 check_lib
+
+This behaves exactly the same as C<assert_lib()> except that it is silent,
+returning false instead of dieing, or true otherwise.
+
+=cut
+
+sub check_lib_or_exit {
+ eval 'assert_lib(@_)';
+ if($@) {
+ warn $@;
+ exit;
+ }
+}
+
+sub check_lib {
+ eval 'assert_lib(@_)';
+ return $@ ? 0 : 1;
+}
+
+sub assert_lib {
+ my %args = @_;
+ my (@libs, @libpaths, @headers, @incpaths);
+
+ # FIXME: these four just SCREAM "refactor" at me
+ @libs = (ref($args{lib}) ? @{$args{lib}} : $args{lib})
+ if $args{lib};
+ @libpaths = (ref($args{libpath}) ? @{$args{libpath}} : $args{libpath})
+ if $args{libpath};
+ @headers = (ref($args{header}) ? @{$args{header}} : $args{header})
+ if $args{header};
+ @incpaths = (ref($args{incpath}) ? @{$args{incpath}} : $args{incpath})
+ if $args{incpath};
+
+ # work-a-like for Makefile.PL's LIBS and INC arguments
+ # if given as command-line argument, append to %args
+ for my $arg (@ARGV) {
+ for my $mm_attr_key qw(LIBS INC) {
+ if (my ($mm_attr_value) = $arg =~ /\A $mm_attr_key = (.*)/x) {
+ # it is tempting to put some \s* into the expression, but the
+ # MM command-line parser only accepts LIBS etc. followed by =,
+ # so we should not be any more lenient with whitespace than that
+ $args{$mm_attr_key} .= " $mm_attr_value";
+ }
+ }
+ }
+
+ # using special form of split to trim whitespace
+ if(defined($args{LIBS})) {
+ foreach my $arg (split(' ', $args{LIBS})) {
+ die("LIBS argument badly-formed: $arg\n") unless($arg =~ /^-l/i);
+ push @{$arg =~ /^-l/ ? \@libs : \@libpaths}, substr($arg, 2);
+ }
+ }
+ if(defined($args{INC})) {
+ foreach my $arg (split(' ', $args{INC})) {
+ die("INC argument badly-formed: $arg\n") unless($arg =~ /^-I/);
+ push @incpaths, substr($arg, 2);
+ }
+ }
+
+ my @cc = _findcc();
+ my @missing;
+ my @wrongresult;
+
+ # first figure out which headers we can't find ...
+ for my $header (@headers) {
+ my($ch, $cfile) = File::Temp::tempfile(
+ 'assertlibXXXXXXXX', SUFFIX => '.c'
+ );
+ print $ch qq{#include <$header>\nint main(void) { return 0; }\n};
+ close($ch);
+ my $exefile = File::Temp::mktemp( 'assertlibXXXXXXXX' ) . $Config{_exe};
+ my @sys_cmd;
+ # FIXME: re-factor - almost identical code later when linking
+ if ( $Config{cc} eq 'cl' ) { # Microsoft compiler
+ require Win32;
+ @sys_cmd = (
+ @cc,
+ $cfile,
+ "/Fe$exefile",
+ (map { '/I'.Win32::GetShortPathName($_) } @incpaths)
+ );
+ } elsif($Config{cc} =~ /bcc32(\.exe)?/) { # Borland
+ @sys_cmd = (
+ @cc,
+ (map { "-I$_" } @incpaths),
+ "-o$exefile",
+ $cfile
+ );
+ } else { # Unix-ish: gcc, Sun, AIX (gcc, cc), ...
+ @sys_cmd = (
+ @cc,
+ $cfile,
+ (map { "-I$_" } @incpaths),
+ "-o", "$exefile"
+ );
+ }
+ warn "# @sys_cmd\n" if $args{debug};
+ my $rv = $args{debug} ? system(@sys_cmd) : _quiet_system(@sys_cmd);
+ push @missing, $header if $rv != 0 || ! -x $exefile;
+ _cleanup_exe($exefile);
+ unlink $cfile;
+ }
+
+ # now do each library in turn with headers
+ my($ch, $cfile) = File::Temp::tempfile(
+ 'assertlibXXXXXXXX', SUFFIX => '.c'
+ );
+ print $ch qq{#include <$_>\n} foreach (@headers);
+ print $ch "int main(void) { ".($args{function} || 'return 0;')." }\n";
+ close($ch);
+ for my $lib ( @libs ) {
+ my $exefile = File::Temp::mktemp( 'assertlibXXXXXXXX' ) . $Config{_exe};
+ my @sys_cmd;
+ if ( $Config{cc} eq 'cl' ) { # Microsoft compiler
+ require Win32;
+ my @libpath = map {
+ q{/libpath:} . Win32::GetShortPathName($_)
+ } @libpaths;
+ # this is horribly sensitive to the order of arguments
+ @sys_cmd = (
+ @cc,
+ $cfile,
+ "${lib}.lib",
+ "/Fe$exefile",
+ (map { '/I'.Win32::GetShortPathName($_) } @incpaths),
+ "/link",
+ (map {'/libpath:'.Win32::GetShortPathName($_)} @libpaths),
+ );
+ } elsif($Config{cc} eq 'CC/DECC') { # VMS
+ } elsif($Config{cc} =~ /bcc32(\.exe)?/) { # Borland
+ @sys_cmd = (
+ @cc,
+ "-o$exefile",
+ "-l$lib",
+ (map { "-I$_" } @incpaths),
+ (map { "-L$_" } @libpaths),
+ $cfile);
+ } else { # Unix-ish
+ # gcc, Sun, AIX (gcc, cc)
+ @sys_cmd = (
+ @cc,
+ $cfile,
+ "-o", "$exefile",
+ "-l$lib",
+ (map { "-I$_" } @incpaths),
+ (map { "-L$_" } @libpaths)
+ );
+ }
+ warn "# @sys_cmd\n" if $args{debug};
+ my $rv = $args{debug} ? system(@sys_cmd) : _quiet_system(@sys_cmd);
+ push @missing, $lib if $rv != 0 || ! -x $exefile;
+ push @wrongresult, $lib if $rv == 0 && -x $exefile && system(File::Spec->rel2abs($exefile)) != 0;
+ _cleanup_exe($exefile);
+ }
+ unlink $cfile;
+
+ my $miss_string = join( q{, }, map { qq{'$_'} } @missing );
+ die("Can't link/include $miss_string\n") if @missing;
+ my $wrong_string = join( q{, }, map { qq{'$_'} } @wrongresult);
+ die("wrong result: $wrong_string\n") if @wrongresult;
+}
+
+sub _cleanup_exe {
+ my ($exefile) = @_;
+ my $ofile = $exefile;
+ $ofile =~ s/$Config{_exe}$/$Config{_o}/;
+ unlink $exefile if -f $exefile;
+ unlink $ofile if -f $ofile;
+ unlink "$exefile\.manifest" if -f "$exefile\.manifest";
+ return
+}
+
+sub _findcc {
+ my @paths = split(/$Config{path_sep}/, $ENV{PATH});
+ my @cc = split(/\s+/, $Config{cc});
+ return @cc if -x $cc[0];
+ foreach my $path (@paths) {
+ my $compiler = File::Spec->catfile($path, $cc[0]) . $Config{_exe};
+ return ($compiler, @cc[1 .. $#cc]) if -x $compiler;
+ }
+ die("Couldn't find your C compiler\n");
+}
+
+# code substantially borrowed from IPC::Run3
+sub _quiet_system {
+ my (@cmd) = @_;
+
+ # save handles
+ local *STDOUT_SAVE;
+ local *STDERR_SAVE;
+ open STDOUT_SAVE, ">&STDOUT" or die "CheckLib: $! saving STDOUT";
+ open STDERR_SAVE, ">&STDERR" or die "CheckLib: $! saving STDERR";
+
+ # redirect to nowhere
+ local *DEV_NULL;
+ open DEV_NULL, ">" . File::Spec->devnull
+ or die "CheckLib: $! opening handle to null device";
+ open STDOUT, ">&" . fileno DEV_NULL
+ or die "CheckLib: $! redirecting STDOUT to null handle";
+ open STDERR, ">&" . fileno DEV_NULL
+ or die "CheckLib: $! redirecting STDERR to null handle";
+
+ # run system command
+ my $rv = system(@cmd);
+
+ # restore handles
+ open STDOUT, ">&" . fileno STDOUT_SAVE
+ or die "CheckLib: $! restoring STDOUT handle";
+ open STDERR, ">&" . fileno STDERR_SAVE
+ or die "CheckLib: $! restoring STDERR handle";
+
+ return $rv;
+}
+
+=head1 PLATFORMS SUPPORTED
+
+You must have a C compiler installed. We check for C<$Config{cc}>,
+both literally as it is in Config.pm and also in the $PATH.
+
+It has been tested with varying degrees on rigourousness on:
+
+=over
+
+=item gcc (on Linux, *BSD, Mac OS X, Solaris, Cygwin)
+
+=item Sun's compiler tools on Solaris
+
+=item IBM's tools on AIX
+
+=item SGI's tools on Irix 6.5
+
+=item Microsoft's tools on Windows
+
+=item MinGW on Windows (with Strawberry Perl)
+
+=item Borland's tools on Windows
+
+=item QNX
+
+=back
+
+=head1 WARNINGS, BUGS and FEEDBACK
+
+This is a very early release intended primarily for feedback from
+people who have discussed it. The interface may change and it has
+not been adequately tested.
+
+Feedback is most welcome, including constructive criticism.
+Bug reports should be made using L<http://rt.cpan.org/> or by email.
+
+When submitting a bug report, please include the output from running:
+
+ perl -V
+ perl -MDevel::CheckLib -e0
+
+=head1 SEE ALSO
+
+L<Devel::CheckOS>
+
+L<Probe::Perl>
+
+=head1 AUTHORS
+
+David Cantrell E<lt>david at cantrell.org.ukE<gt>
+
+David Golden E<lt>dagolden at cpan.orgE<gt>
+
+Yasuhiro Matsumoto E<lt>mattn at cpan.orgE<gt>
+
+Thanks to the cpan-testers-discuss mailing list for prompting us to write it
+in the first place;
+
+to Chris Williams for help with Borland support;
+
+to Tony Cook for help with Microsoft compiler command-line options
+
+=head1 COPYRIGHT and LICENCE
+
+Copyright 2007 David Cantrell. Portions copyright 2007 David Golden.
+
+This module is free-as-in-speech software, and may be used, distributed,
+and modified under the same conditions as perl itself.
+
+=head1 CONSPIRACY
+
+This module is also free-as-in-mason software.
+
+=cut
+
+1;
Modified: branches/upstream/libmath-bigint-gmp-perl/current/lib/Math/BigInt/GMP.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmath-bigint-gmp-perl/current/lib/Math/BigInt/GMP.pm?rev=62576&op=diff
==============================================================================
--- branches/upstream/libmath-bigint-gmp-perl/current/lib/Math/BigInt/GMP.pm (original)
+++ branches/upstream/libmath-bigint-gmp-perl/current/lib/Math/BigInt/GMP.pm Tue Sep 14 21:28:49 2010
@@ -9,7 +9,7 @@
use vars qw/$VERSION/;
-$VERSION = '1.24';
+$VERSION = '1.26';
use XSLoader;
XSLoader::load "Math::BigInt::GMP", $VERSION;
Modified: branches/upstream/libmath-bigint-gmp-perl/current/t/bigintpm.inc
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmath-bigint-gmp-perl/current/t/bigintpm.inc?rev=62576&op=diff
==============================================================================
--- branches/upstream/libmath-bigint-gmp-perl/current/t/bigintpm.inc (original)
+++ branches/upstream/libmath-bigint-gmp-perl/current/t/bigintpm.inc Tue Sep 14 21:28:49 2010
@@ -2246,9 +2246,12 @@
1:-2:0
# 7 over 3 = 35
7:3:35
-7:6:1
+7:6:7
100:90:17310309456440
100:95:75287520
+2:0:1
+7:0:1
+2:1:2
&bround
$round_mode('trunc')
0:12:0
Modified: branches/upstream/libmath-bigint-gmp-perl/current/t/bigintpm.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmath-bigint-gmp-perl/current/t/bigintpm.t?rev=62576&op=diff
==============================================================================
--- branches/upstream/libmath-bigint-gmp-perl/current/t/bigintpm.t (original)
+++ branches/upstream/libmath-bigint-gmp-perl/current/t/bigintpm.t Tue Sep 14 21:28:49 2010
@@ -11,7 +11,7 @@
unshift @INC, $location; # to locate the testing files
unshift @INC, '../blib/arch';
chdir 't' if -d 't';
- plan tests => 3043;
+ plan tests => 3049;
}
use Math::BigInt lib => 'GMP';
Added: branches/upstream/libmath-bigint-gmp-perl/current/t/threads.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmath-bigint-gmp-perl/current/t/threads.t?rev=62576&op=file
==============================================================================
--- branches/upstream/libmath-bigint-gmp-perl/current/t/threads.t (added)
+++ branches/upstream/libmath-bigint-gmp-perl/current/t/threads.t Tue Sep 14 21:28:49 2010
@@ -1,0 +1,32 @@
+use strict;
+use warnings;
+
+use Test::More;
+
+use Config;
+
+BEGIN {
+ plan skip_all => 'Perl compiled without ithreads'
+ unless $Config{useithreads};
+ plan tests => 22;
+}
+
+use threads;
+
+use Math::BigInt lib => 'GMP';
+
+my @threads = map {
+ my $x = $_;
+ threads->create(sub {
+ (Math::BigInt->new($x))
+ });
+} 0 .. 19;
+
+my @ret = map {
+ $_->join
+} @threads;
+
+pass 'we survived our threads';
+
+is @ret, 20, 'got all the numbers we expected';
+is($ret[$_], $_, 'numbers look sane') for 0 .. 19;
Modified: branches/upstream/libmath-bigint-gmp-perl/current/typemap
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmath-bigint-gmp-perl/current/typemap?rev=62576&op=diff
==============================================================================
--- branches/upstream/libmath-bigint-gmp-perl/current/typemap (original)
+++ branches/upstream/libmath-bigint-gmp-perl/current/typemap Tue Sep 14 21:28:49 2010
@@ -2,13 +2,8 @@
INPUT
MPZ
- if (sv_derived_from($arg, \"Math::BigInt::GMP\")) {
- IV tmp = SvIV((SV*)SvRV($arg));
- $var = INT2PTR($type, tmp);
- }
- else
- croak(\"$var is not of type Math::BigInt::GMP\")
+ $var = mpz_from_sv($arg);
OUTPUT
MPZ
- sv_setref_pv($arg, \"Math::BigInt::GMP\", INT2PTR(void*, $var));
+ $arg = sv_from_mpz($var);
More information about the Pkg-perl-cvs-commits
mailing list