From da9fc0da0c362c0e7174374c701ffd1eb6f11c96 Mon Sep 17 00:00:00 2001 From: Diab Jerius Date: Tue, 15 Aug 2017 17:10:51 -0400 Subject: [PATCH 1/4] globally ignore deprecated functions GSL has not build deprecated functions by default since commit c2dcd9a5647208ba78ceff56bad6eabd7b7e1991 in 2006. As of 2.{3,4}, more functions have been deprecated, affecting more modules than BSpline. --- Build.PL | 2 +- swig/BSpline.i | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/Build.PL b/Build.PL index 59fc6f1..11e37b4 100644 --- a/Build.PL +++ b/Build.PL @@ -56,7 +56,7 @@ $ccflags .= try_cflags("-Wno-unused-variable"); $ccflags .= try_cflags("-Wno-gnu"); $ccflags .= try_cflags("-g"); -$swig_flags = "$gsl_conf->{gsl_cflags} $swig_flags"; +$swig_flags = "$gsl_conf->{gsl_cflags} $swig_flags -DGSL_DISABLE_DEPRECATED"; if ( GSLBuilder::is_cygwin() && $Config{shrpenv} =~ m{\Aenv LD_RUN_PATH=(.*)\Z} ) { $ldflags .= " -L$1 -lperl"; diff --git a/swig/BSpline.i b/swig/BSpline.i index d6ac32d..6b20ba0 100644 --- a/swig/BSpline.i +++ b/swig/BSpline.i @@ -3,8 +3,6 @@ %include "gsl_typemaps.i" %include "renames.i" -#define GSL_DISABLE_DEPRECATED 1 - %include "gsl/gsl_math.h" %include "gsl/gsl_vector.h" %include "gsl/gsl_bspline.h" From 0252afe1f2d9d0d795d0aa4a6c7da9a86b356c68 Mon Sep 17 00:00:00 2001 From: Diab Jerius Date: Wed, 16 Aug 2017 09:42:27 -0400 Subject: [PATCH 2/4] very shallow update to work with GSL 2.3 & 2.4 * functions new to 2.3 and 2.4 have been added to ver2func * no new tests! --- CREDITS | 3 +++ Changes | 2 ++ inc/ver2func | 48 ++++++++++++++++++++++++++++++++++++++++++++++ swig/Integration.i | 7 +++++++ t/Diff.t | 17 +++++++++++++--- 5 files changed, 74 insertions(+), 3 deletions(-) diff --git a/CREDITS b/CREDITS index 910ee5c..a693dfb 100644 --- a/CREDITS +++ b/CREDITS @@ -38,5 +38,8 @@ E: ambs@cpan.org N: Bartosz Jakubski U: bjakubski +N: Diab Jerius +U: djerius +E: djerius@cpan.org =cut diff --git a/Changes b/Changes index b7e3394..e00ade0 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,7 @@ =head1 Math::GSL Changes + - compiles against GSL 2.3 and GSL 2.4 + - added Math::GSL::Multiset (standard gsl API and Perl OO) =head1 v0.40 - ??? 2016 diff --git a/inc/ver2func b/inc/ver2func index ecac109..8052192 100644 --- a/inc/ver2func +++ b/inc/ver2func @@ -119,4 +119,52 @@ return { "2.2.1" => [qw/ ^gsl_linalg_cholesky_decomp1$ /], + "2.3" => [qw/ + ^gsl_multifit_linear_tsvd$ + ^gsl_multifit_linear_rank$ + ^gsl_multifit_wlinear_tsvd$ + ^gsl_multifit_linear_gcv_init$ + ^gsl_multifit_linear_gcv_curve$ + ^gsl_multifit_linear_gcv_min$ + ^gsl_multifit_linear_gcv_calc$ + ^gsl_multifit_linear_gcv$ + /], + "2.4" => [qw/ + ^gsl_integration_fixed_n$ + ^gsl_integration_fixed_nodes$ + ^gsl_integration_fixed_weights$ + ^gsl_integration_fixed$ + ^gsl_linalg_COD_lssolve2$ + ^gsl_sf_hermite_prob_e$ + ^gsl_sf_hermite_prob$ + ^gsl_sf_hermite_prob_der_e$ + ^gsl_sf_hermite_prob_der$ + ^gsl_sf_hermite_phys_e$ + ^gsl_sf_hermite_phys$ + ^gsl_sf_hermite_phys_der_e$ + ^gsl_sf_hermite_phys_der$ + ^gsl_sf_hermite_func_e$ + ^gsl_sf_hermite_func$ + ^gsl_sf_hermite_prob_array$ + ^gsl_sf_hermite_prob_array_der$ + ^gsl_sf_hermite_prob_der_array$ + ^gsl_sf_hermite_prob_series_e$ + ^gsl_sf_hermite_prob_series$ + ^gsl_sf_hermite_phys_array$ + ^gsl_sf_hermite_phys_array_der$ + ^gsl_sf_hermite_phys_der_array$ + ^gsl_sf_hermite_phys_series_e$ + ^gsl_sf_hermite_phys_series$ + ^gsl_sf_hermite_func_array$ + ^gsl_sf_hermite_func_series_e$ + ^gsl_sf_hermite_func_series$ + ^gsl_sf_hermite_func_der_e$ + ^gsl_sf_hermite_func_der$ + ^gsl_sf_hermite_prob_zero_e$ + ^gsl_sf_hermite_prob_zero$ + ^gsl_sf_hermite_phys_zero_e$ + ^gsl_sf_hermite_phys_zero$ + ^gsl_sf_hermite_func_zero_e$ + ^gsl_sf_hermite_func_zero$ + /], }; diff --git a/swig/Integration.i b/swig/Integration.i index 0272059..aa02130 100644 --- a/swig/Integration.i +++ b/swig/Integration.i @@ -4,9 +4,16 @@ %include "renames.i" %{ + #ifndef GSL_VAR + #include "gsl/gsl_types.h" + #endif + #include "gsl/gsl_integration.h" #include "gsl/gsl_math.h" %} +#ifndef GSL_VAR +%include "gsl/gsl_types.h" +#endif %include "gsl/gsl_integration.h" %include "gsl/gsl_math.h" %include "../pod/Integration.pod" diff --git a/t/Diff.t b/t/Diff.t index a863597..c2cb59c 100644 --- a/t/Diff.t +++ b/t/Diff.t @@ -13,19 +13,30 @@ sub make_fixture : Test(setup) { sub teardown : Test(teardown) { } -sub TEST_DIFF_CENTRAL : Tests { +sub TEST_DIFF_CENTRAL : Tests { + + if ( !defined &{\&gsl_diff_central} ) { + $_[0]->builder->skip( "gsl_diff_central not found" ); + return; + } + my ($success, $result, $error) = gsl_diff_central(sub { return $_[0]**(1.5)}, 2.0); ok_similar($result, 2.1213203435, "Testing Result"); ok_similar($error, 0.01490, "Testing Error", 0.00001); - } sub TEST_DIFF_FORWARD : Tests { + + if ( !defined &{\&gsl_diff_forward} ) { + $_[0]->builder->skip( "gsl_diff_forward not found" ); + return; + } + my ($success, $result, $error) = gsl_diff_forward(sub { return $_[0]**(1.5)}, 0.0); ok_similar($result, 0.0012172897, "Testing Result"); ok_similar($error, 0.05028, "Testing Error", 0.00001); -} +} From 514b122b200f709131a6f64fe13103ae9712231c Mon Sep 17 00:00:00 2001 From: Diab Jerius Date: Fri, 3 Nov 2017 16:07:30 -0400 Subject: [PATCH 3/4] update travis build files to test up to 2.4 and fix bug where /tmp/gsl-master exists but is empty --- .travis.yml | 6 +++++- _travis/before_install.sh | 11 ++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index bde287f..ae9a2fa 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,6 +7,8 @@ cache: - ccache - apt - directories: + - /tmp/gsl-2.4 + - /tmp/gsl-2.3 - /tmp/gsl-2.2.1 - /tmp/gsl-2.0 - /tmp/gsl-2.1 @@ -29,6 +31,8 @@ env: - CCACHE_CPP2=1 - CC="ccache clang" matrix: + - GSL=2.4 + - GSL=2.3 - GSL=2.2.1 - GSL=2.1 - GSL=2.0 @@ -50,7 +54,7 @@ before_install: ./_travis/before_install.sh # Add verbosity for debugging install: # this should always point to the version we build the CPAN dist with - - PATH=/tmp/gsl-2.2.1/bin:$PATH cpanm --installdeps --notest . &> /dev/null + - PATH=/tmp/gsl-4/bin:$PATH cpanm --installdeps --notest . &> /dev/null before_script: - ulimit -c unlimited -S # enable core dumps diff --git a/_travis/before_install.sh b/_travis/before_install.sh index 9a10cde..fce6815 100755 --- a/_travis/before_install.sh +++ b/_travis/before_install.sh @@ -19,6 +19,9 @@ get_gsl () { } _get_master_gsl () { + + rmdir "gsl-master" && echo "removed empty gsl-master directory" + if [ ! -d "gsl-master" ]; then git clone git://git.savannah.gnu.org/gsl.git gsl-master cd gsl-master @@ -52,12 +55,14 @@ get_gsl 1.16 get_gsl 2.0 get_gsl 2.1 get_gsl 2.2.1 +get_gsl 2.3 +get_gsl 2.4 get_master_gsl ls -la /tmp/ -ls -la /tmp/gsl-2.2.1/bin -cd /home/travis/build/leto/math--gsl -LD_LIBRARY_PATH=/tmp/gsl-2.2.1/lib:$LD_LIBRARY_PATH PATH=/tmp/gsl-2.2.1/bin:$PATH perl Build.PL && ./Build && ./Build dist # create a CPAN dist with latest supported GSL release +ls -la /tmp/gsl-2.4/bin +cd $TRAVIS_BUILD_DIR +LD_LIBRARY_PATH=/tmp/gsl-4/lib:$LD_LIBRARY_PATH PATH=/tmp/gsl-4/bin:$PATH perl Build.PL && ./Build && ./Build dist # create a CPAN dist with latest supported GSL release cp Math-GSL*.tar.gz /tmp ls -la /tmp/Math-GSL*.tar.gz # now we have a CPAN dist to test on each version of GSL cd $ORIG_DIR From 4e1d3eda69aa2478a6afbf689113d56d9e04f487 Mon Sep 17 00:00:00 2001 From: Diab Jerius Date: Fri, 3 Nov 2017 16:36:33 -0400 Subject: [PATCH 4/4] clean up code so it's less error prone; fix typo (gsl-4 instead of gsl-2.4) --- _travis/before_install.sh | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/_travis/before_install.sh b/_travis/before_install.sh index fce6815..d55bcc2 100755 --- a/_travis/before_install.sh +++ b/_travis/before_install.sh @@ -59,11 +59,22 @@ get_gsl 2.3 get_gsl 2.4 get_master_gsl +GSL_CURRENT_DIR=/tmp/gsl-2.4 + ls -la /tmp/ -ls -la /tmp/gsl-2.4/bin +ls -la $GSL_CURRENT_DIR/bin cd $TRAVIS_BUILD_DIR -LD_LIBRARY_PATH=/tmp/gsl-4/lib:$LD_LIBRARY_PATH PATH=/tmp/gsl-4/bin:$PATH perl Build.PL && ./Build && ./Build dist # create a CPAN dist with latest supported GSL release +export LD_LIBRARY_PATH=$GSL_CURRENT_DIR/lib:$LD_LIBRARY_PATH +export PATH=$GSL_CURRENT_DIR/bin:$PATH + +# create a CPAN dist with latest supported GSL release +perl Build.PL \ + && ./Build \ + && ./Build dist + cp Math-GSL*.tar.gz /tmp -ls -la /tmp/Math-GSL*.tar.gz # now we have a CPAN dist to test on each version of GSL + +# now we have a CPAN dist to test on each version of GSL +ls -la /tmp/Math-GSL*.tar.gz cd $ORIG_DIR