Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Changed SWIG dependendence to optional, and set up things so that the…

… autogenerated XS code (*_wrap.c) is included in the distribution, but is not under source control.

Thanks to Eric Wilhelm for this removal of a barrier to entry. Now it is set up so that when a developer clones a git
repository, the autogenerated files will not be present and therefore the Build.PL script will attempt to generate them
from the SWIG interface files. But for people installing via CPAN, the *_wrap.c files will be present and therefore
end users will not be forced to have SWIG to install Math::GSL.
  • Loading branch information...
commit fd4538bb670a84b13d7b6529fd24b792d65d743e 1 parent 45a081e
Jonathan Leto authored
Showing with 94 additions and 49 deletions.
  1. +9 −35 Build.PL
  2. +5 −2 Deriv.i
  3. +63 −3 MANIFEST
  4. +1 −2  MANIFEST.SKIP
  5. +16 −7 t/Deriv.t
View
44 Build.PL
@@ -57,21 +57,19 @@ sub process_swig {
(my $file_base = $main_swig_file) =~ s/\.[^.]+$//;
my $c_file = "${file_base}_wrap.c";
- if ($p->{swig_installed}) {
# .swg -> .c
$self->add_to_cleanup($c_file);
# If any of the swig files that the main swig depends is newer
# then rebuild.
- foreach my $depends_on ($main_swig_file, @$deps_ref) {
- unless ($self->up_to_date($depends_on, $c_file)) {
- $self->compile_swig($main_swig_file, $c_file);
- # Only need to build $c_file once no matter how many
- # includes there are.
- last;
- }
- }
- }
+ foreach my $depends_on ($main_swig_file, @$deps_ref) {
+ unless ($self->up_to_date($depends_on, $c_file)) {
+ $self->compile_swig($main_swig_file, $c_file);
+ # Only need to build $c_file once no matter how many
+ # includes there are.
+ last;
+ }
+ }
# .c -> .o
my $obj_file = $self->compile_c($c_file);
@@ -304,28 +302,6 @@ if (defined $gv) {
exit 1;
}
-print "Checking for SWIG...";
-my $MIN_SWIG_VERSION = "1.3.30";
-my @swig_version = `swig -version 2>&1`;
-my $swig_installed = 0;
-if ($?) {
- my $errno = $? >> 8;
- print "I don't see SWIG installed. Please install SWIG from http://www.swig.org .\n";
- print "*** Output was:\n @swig_version\n" if @swig_version;
- exit 1;
-} else {
- $swig_installed = 1;
- chomp $swig_version[1];
- $swig_version[1] =~ s/[^\d\.]//g;
- my ($big,$med,$small)=split /\./, $swig_version[1];
- my ($big_min,$med_min,$small_min) = split /\./, $MIN_SWIG_VERSION;
- unless ( $big >= $big_min && $med >= $med_min && $small >= $small_min ){
- print qq{Found SWIG $swig_version[1] but $MIN_SWIG_VERSION is required\n};
- print "Please install a more recent SWIG from http://www.swig.org .\n";
- exit 1;
- }
- print qq{Found SWIG $swig_version[1] which seems recent enough, awesome!\n};
-}
my $ccflags = $gsl_pkgcfg{cflags};
@@ -364,8 +340,7 @@ my @Subsystems = sort qw/
DHT Interp ODEIV Vector
Deriv Linalg Permutation Spline
/;
-my $cleanup = qq{*.core Makefile Math-GSL-* tmp* *_wrap.c *.pm pod2ht*.tmp _build blib *.so *.orig } .
- join (" ", map { qq{lib/Math/GSL/$_.pm} } @Subsystems);
+my $cleanup = qq{*.core Makefile Math-GSL-* tmp* pod2ht*.tmp _build blib *.so *.orig };
my $builder = $class->new(
module_name => 'Math::GSL',
@@ -378,7 +353,6 @@ my $builder = $class->new(
extra_linker_flags => '-shared -I./lib -I../lib ' . $ldflags,
extra_compiler_flags=> q{-shared -Wall -fpic -Dbool=char } . $ccflags,
swig_flags => $swig_flags,
- swig_installed => $swig_installed,
license => 'gpl',
requires => {
'ExtUtils::PkgConfig' => '1.03',
View
7 Deriv.i
@@ -2,7 +2,10 @@
%include "typemaps.i"
%typemap(in) gsl_function * {
- printf("gsl_func \n");
+
+ fprintf(stderr,"gsl_func \n");
+ fprintf(stderr, "HAI %d\n", (int) $1->params );
+ fprintf(stderr, "HAI %d\n", (int) $1->function );
};
%typemap(in) void * {
@@ -12,7 +15,7 @@
%typemap(in) double (*)(double,void *) {
printf("function pointer * \n");
};
-%apply double * OUTPUT { double *result,double *abserr };
+//%apply double * OUTPUT { double *result,double *abserr };
%{
#include "gsl/gsl_math.h"
View
66 MANIFEST
@@ -1,6 +1,7 @@
BLAS.i
Block.i
BSpline.i
+callback.i
CBLAS.i
CDF.i
Changes
@@ -8,6 +9,7 @@ Chebyshev.i
Combination.i
Complex.i
Const.i
+core
Deriv.i
DHT.i
Diff.i
@@ -15,11 +17,12 @@ Eigen.i
Errno.i
examples/rng
examples/sf/bessel
-examples/sf/plot_bessel.gnuplot
+examples/sf/bessel.data
examples/sf/README
FFT.i
Fit.i
GSL.i
+gsl_typemaps.i
HACKING
Heapsort.i
Histogram.i
@@ -28,30 +31,84 @@ IEEEUtils.i
Integration.i
Interp.i
lib/Math/GSL.pm
+lib/Math/GSL/BLAS.pm
lib/Math/GSL/BLAS/Test.pm
+lib/Math/GSL/Block.pm
lib/Math/GSL/Block/Test.pm
+lib/Math/GSL/BSpline.pm
+lib/Math/GSL/CBLAS.pm
lib/Math/GSL/CBLAS/Test.pm
+lib/Math/GSL/CDF.pm
+lib/Math/GSL/Chebyshev.pm
+lib/Math/GSL/Combination.pm
+lib/Math/GSL/Complex.pm
lib/Math/GSL/Complex/Test.pm
+lib/Math/GSL/Const.pm
lib/Math/GSL/Const/Test.pm
+lib/Math/GSL/Deriv.pm
+lib/Math/GSL/DFT.pm
+lib/Math/GSL/DHT.pm
lib/Math/GSL/DHT/Test.pm
+lib/Math/GSL/Diff.pm
+lib/Math/GSL/Eigen.pm
lib/Math/GSL/Eigen/Test.pm
+lib/Math/GSL/Errno.pm
+lib/Math/GSL/FFT.pm
lib/Math/GSL/FFT/Test.pm
+lib/Math/GSL/Fit.pm
+lib/Math/GSL/Fit/Test.pm
+lib/Math/GSL/Heapsort.pm
+lib/Math/GSL/Histogram.pm
lib/Math/GSL/Histogram/Test.pm
+lib/Math/GSL/Histogram2D.pm
+lib/Math/GSL/IEEEUtils.pm
+lib/Math/GSL/Integration.pm
+lib/Math/GSL/Interp.pm
+lib/Math/GSL/Interp/Test.pm
+lib/Math/GSL/Linalg.pm
lib/Math/GSL/Linalg/Test.pm
+lib/Math/GSL/Machine.pm
+lib/Math/GSL/Matrix.pm
lib/Math/GSL/Matrix/Test.pm
+lib/Math/GSL/Min.pm
lib/Math/GSL/Min/Test.pm
+lib/Math/GSL/Mode.pm
+lib/Math/GSL/Monte.pm
+lib/Math/GSL/Multifit.pm
+lib/Math/GSL/Multifit/Test.pm
+lib/Math/GSL/Multimin.pm
+lib/Math/GSL/Multiroots.pm
+lib/Math/GSL/NTuple.pm
+lib/Math/GSL/ODEIV.pm
lib/Math/GSL/ODEIV/Test.pm
+lib/Math/GSL/Permutation.pm
lib/Math/GSL/Permutation/Test.pm
+lib/Math/GSL/Poly.pm
lib/Math/GSL/Poly/Test.pm
+lib/Math/GSL/PowInt.pm
+lib/Math/GSL/QRNG.pm
lib/Math/GSL/QRNG/Test.pm
+lib/Math/GSL/Randist.pm
lib/Math/GSL/Randist/Test.pm
+lib/Math/GSL/RNG.pm
lib/Math/GSL/RNG/Test.pm
+lib/Math/GSL/Roots.pm
lib/Math/GSL/Roots/Test.pm
+lib/Math/GSL/SF.pm
lib/Math/GSL/SF/Test.pm
+lib/Math/GSL/Siman.pm
+lib/Math/GSL/Sort.pm
lib/Math/GSL/Sort/Test.pm
+lib/Math/GSL/Spline.pm
+lib/Math/GSL/Statistics.pm
+lib/Math/GSL/Sum.pm
+lib/Math/GSL/Sys.pm
lib/Math/GSL/Sys/Test.pm
+lib/Math/GSL/Vector.pm
lib/Math/GSL/Vector/Test.pm
+lib/Math/GSL/Wavelet.pm
lib/Math/GSL/Wavelet/Test.pm
+lib/Math/GSL/Wavelet2D.pm
lib/Math/GSL/Wavelet2D/Test.pm
Linalg.i
Machine.i
@@ -69,6 +126,7 @@ Multimin.i
Multiroots.i
NTuple.i
ODEIV.i
+perl_libyaml.c
Permutation.i
Poly.i
PowInt.i
@@ -82,12 +140,12 @@ Siman.i
Sort.i
Spline.i
Statistics.i
-Sys.i
-gsl_typemaps.i
subsystems.txt
Sum.i
+Sys.i
t/00-load.t
t/01-pod.t
+t/BLAS.t
t/Block.t
t/CBLAS.t
t/CDF.t
@@ -101,10 +159,12 @@ t/FFT.t
t/Fit.t
t/GSL.t
t/Histogram.t
+t/Interp.t
t/Linalg.t
t/Machine.t
t/Matrix.t
t/Min.t
+t/Multifit.t
t/ODEIV.t
t/Permutation.t
t/Poly.t
View
3  MANIFEST.SKIP
@@ -1,9 +1,8 @@
\.git*
tmp.*
-\..*swp
+\..*sw?
\.bak
_build
Build
.*_wrap.*
blib/*
-lib/Math/GSL/[A-z0-9]*\.pm
View
23 t/Deriv.t
@@ -9,15 +9,24 @@ use warnings;
BEGIN{ gsl_set_error_handler_off() };
{
+ local $TODO = "gsl_function *";
my ($x,$h)=(5,0.01);
- my $func = Math::GSL::Deriv::gsl_function_struct->new;
- isa_ok( $func, 'Math::GSL::Deriv::gsl_function_struct' );
- local $TODO = "gsl_function *";
- $func->swig_params_set(0);
- $func->swig_function_set( sub { $_[0] ** 2 } );
+ my $gsl_func = Math::GSL::Deriv::gsl_function_struct->new;
+
+ isa_ok( $gsl_func, 'Math::GSL::Deriv::gsl_function_struct' );
+
+
+ $gsl_func->swig_function_set( sub { print "FOO\n" } );
+ my $func = $gsl_func->swig_function_get();
+ ok( ref $func eq 'CODE', 'swig_function_get works' );
+
+ my $params = $gsl_func->swig_params_set(0);
+ ok( defined $params, 'swig_params_set works' );
- #my ($value, $abserr) = gsl_deriv_central ( $func, $x, $h);
- #print Dumper [ $value, $abserr ];
+ my ($value, $result, $abserr);
+ print "about to call deriv_central\n";
+ #($value, $abserr) = gsl_deriv_central ( $gsl_func, $x, $h, $result, $abserr);
+ print Dumper [ $value, $abserr ];
}
Please sign in to comment.
Something went wrong with that request. Please try again.