From 0fae593bccf5a3b6a9e296275c3ec1dca346520e Mon Sep 17 00:00:00 2001 From: TAKATSU Tomonari Date: Thu, 5 May 2011 08:22:29 +0000 Subject: [PATCH] - Update to 1.17 * Detect both g77-34 and gfortran * Use a post-patch to set the CFLAGS and gfortran version correctly * Mark gfortran as the default compiler (since g77 is deprecated in ports tree), and enable g77-34 as a fallback PR: ports/155906 Submitted by: Zhihao Yuan --- lang/p5-ExtUtils-F77/Makefile | 12 ++--- lang/p5-ExtUtils-F77/distinfo | 5 +- lang/p5-ExtUtils-F77/files/patch-F77.pm | 65 +++++++++++++++++++++++++ lang/p5-ExtUtils-F77/pkg-plist | 1 - lang/p5-F77/Makefile | 12 ++--- lang/p5-F77/distinfo | 5 +- lang/p5-F77/files/patch-F77.pm | 65 +++++++++++++++++++++++++ lang/p5-F77/pkg-plist | 1 - 8 files changed, 146 insertions(+), 20 deletions(-) create mode 100644 lang/p5-ExtUtils-F77/files/patch-F77.pm create mode 100644 lang/p5-F77/files/patch-F77.pm diff --git a/lang/p5-ExtUtils-F77/Makefile b/lang/p5-ExtUtils-F77/Makefile index f4ceb0ccdf23..9b15ad343cab 100644 --- a/lang/p5-ExtUtils-F77/Makefile +++ b/lang/p5-ExtUtils-F77/Makefile @@ -6,8 +6,7 @@ # PORTNAME= ExtUtils-F77 -PORTVERSION= 1.16 -PORTREVISION= 1 +PORTVERSION= 1.17 CATEGORIES= lang perl5 MASTER_SITES= CPAN PKGNAMEPREFIX= p5- @@ -19,11 +18,12 @@ PERL_CONFIGURE= yes MAN3= ExtUtils::F77.3 -F2CLIB= -lg2c +GCCLIBDIR_CMDS= ${FC} -print-file-name=libgfortran.so | ${SED} -e s/libgfortran.so// +F2CLIB= -lgfortran post-patch: - @cd ${WRKSRC}; ${PERL5} -i.orig -pe \ - 's/(.*Freebsd.*lib )(-lf2c)(.*)/$$1 ${F2CLIB} $$3/' F77.pm - @${REINPLACE_CMD} -e "s/'f77',/'f77','g77-34',/" ${WRKSRC}/F77.pm + @${REINPLACE_CMD} -e "s/'gfortran44'/'${FC}'/" \ + -e "s/'-O2'/'${CFLAGS}'/" \ + ${WRKSRC}/F77.pm .include diff --git a/lang/p5-ExtUtils-F77/distinfo b/lang/p5-ExtUtils-F77/distinfo index e83055d2464f..c8515349c88f 100644 --- a/lang/p5-ExtUtils-F77/distinfo +++ b/lang/p5-ExtUtils-F77/distinfo @@ -1,3 +1,2 @@ -MD5 (ExtUtils-F77-1.16.tar.gz) = af925e7e8a2876a5fd9b6c4660e37664 -SHA256 (ExtUtils-F77-1.16.tar.gz) = d3dfed878678495bbd1054d78ad100ddd3df59cbc8a2ce550dae9cd2e989b84c -SIZE (ExtUtils-F77-1.16.tar.gz) = 10234 +SHA256 (ExtUtils-F77-1.17.tar.gz) = b3919200443174ff348ed5567d461335e289fba047cb17432f31dea5a26cad3f +SIZE (ExtUtils-F77-1.17.tar.gz) = 11225 diff --git a/lang/p5-ExtUtils-F77/files/patch-F77.pm b/lang/p5-ExtUtils-F77/files/patch-F77.pm new file mode 100644 index 000000000000..4a3976568b3a --- /dev/null +++ b/lang/p5-ExtUtils-F77/files/patch-F77.pm @@ -0,0 +1,65 @@ +--- F77.pm.orig 2010-12-31 19:53:06.000000000 -0600 ++++ F77.pm 2011-03-24 01:05:00.742862139 -0500 +@@ -351,9 +351,49 @@ $F77config{Aix}{DEFAULT} = 'F77'; + + ### FreeBSD ### + +-$F77config{Freebsd}{F77}{Trail_} = 1; +-$F77config{Freebsd}{F77}{Link} = '-L/usr/lib -lf2c -lm'; +-$F77config{Freebsd}{DEFAULT} = 'F77'; ++if($^O =~ /Freebsd/i) { ++ $gfortran = 'gfortran44'; # requires rewrite ++ $fallback_compiler = 'G77'; ++} ++ ++$F77config{Freebsd}{G77}{Link} = sub { ++ $dir = `g77-34 -print-file-name=libg2c.a`; ++ chomp $dir; ++ # Note that -print-file-name returns just the library name ++ # if it cant be found - make sure that we only accept the ++ # directory if it returns a proper path (or matches a /) ++ ++ if( defined $dir ) { ++ $dir =~ s,/libg2c.a$,,; ++ } else { ++ $dir = "/usr/local/lib"; ++ } ++ return( "-L$dir -L/usr/lib -lg2c -lm" ); ++}; ++ ++$F77config{Freebsd}{GFortran}{Link} = sub { ++ $dir = `$gfortran -print-file-name=libgfortran.a`; ++ chomp $dir; ++ # Note that -print-file-name returns just the library name ++ # if it cant be found - make sure that we only accept the ++ # directory if it returns a proper path (or matches a /) ++ ++ if( defined $dir ) { ++ $dir =~ s,/libgfortran.a$,,; ++ } else { ++ $dir = "/usr/local/lib"; ++ } ++ return( "-L$dir -L/usr/lib -lgfortran -lm" ); ++}; ++ ++$F77config{Freebsd}{G77}{Trail_} = 1; ++$F77config{Freebsd}{GFortran}{Trail_} = 1; ++$F77config{Freebsd}{G77}{Compiler} = 'g77-34'; ++$F77config{Freebsd}{GFortran}{Compiler} = "$gfortran"; ++$F77config{Freebsd}{G77}{Cflags} = '-O2'; ++$F77config{Freebsd}{GFortran}{Cflags} = '-O2'; ++$F77config{Freebsd}{DEFAULT} = 'GFortran'; ++ + + ### VMS ### + +@@ -446,7 +486,8 @@ $Pkg: Will try system=Generic Compiler=$ + EOD + $system = + $Config{cc} =~ /\bgcc/ && $^O =~ /MSWin32/i ? "MinGW" +- :"Generic"; ++ : $^O =~ /Freebsd/i ? "Freebsd" ++ : "Generic"; + $compiler = $fallback_compiler; + my $flibs = get ($F77config{$system}{$compiler}{Link}); + $Runtime = $flibs ; #. gcclibs($flibs); # Note gcclibs appears to be no longer required. diff --git a/lang/p5-ExtUtils-F77/pkg-plist b/lang/p5-ExtUtils-F77/pkg-plist index 089e64295cb4..763bdeb2fd27 100644 --- a/lang/p5-ExtUtils-F77/pkg-plist +++ b/lang/p5-ExtUtils-F77/pkg-plist @@ -1,6 +1,5 @@ %%SITE_PERL%%/ExtUtils/F77.pm %%SITE_PERL%%/%%PERL_ARCH%%/auto/ExtUtils/F77/.packlist -%%SITE_PERL%%/ExtUtils/._F77.pm @dirrm %%SITE_PERL%%/%%PERL_ARCH%%/auto/ExtUtils/F77 @dirrmtry %%SITE_PERL%%/%%PERL_ARCH%%/auto/ExtUtils @dirrmtry %%SITE_PERL%%/ExtUtils diff --git a/lang/p5-F77/Makefile b/lang/p5-F77/Makefile index f4ceb0ccdf23..9b15ad343cab 100644 --- a/lang/p5-F77/Makefile +++ b/lang/p5-F77/Makefile @@ -6,8 +6,7 @@ # PORTNAME= ExtUtils-F77 -PORTVERSION= 1.16 -PORTREVISION= 1 +PORTVERSION= 1.17 CATEGORIES= lang perl5 MASTER_SITES= CPAN PKGNAMEPREFIX= p5- @@ -19,11 +18,12 @@ PERL_CONFIGURE= yes MAN3= ExtUtils::F77.3 -F2CLIB= -lg2c +GCCLIBDIR_CMDS= ${FC} -print-file-name=libgfortran.so | ${SED} -e s/libgfortran.so// +F2CLIB= -lgfortran post-patch: - @cd ${WRKSRC}; ${PERL5} -i.orig -pe \ - 's/(.*Freebsd.*lib )(-lf2c)(.*)/$$1 ${F2CLIB} $$3/' F77.pm - @${REINPLACE_CMD} -e "s/'f77',/'f77','g77-34',/" ${WRKSRC}/F77.pm + @${REINPLACE_CMD} -e "s/'gfortran44'/'${FC}'/" \ + -e "s/'-O2'/'${CFLAGS}'/" \ + ${WRKSRC}/F77.pm .include diff --git a/lang/p5-F77/distinfo b/lang/p5-F77/distinfo index e83055d2464f..c8515349c88f 100644 --- a/lang/p5-F77/distinfo +++ b/lang/p5-F77/distinfo @@ -1,3 +1,2 @@ -MD5 (ExtUtils-F77-1.16.tar.gz) = af925e7e8a2876a5fd9b6c4660e37664 -SHA256 (ExtUtils-F77-1.16.tar.gz) = d3dfed878678495bbd1054d78ad100ddd3df59cbc8a2ce550dae9cd2e989b84c -SIZE (ExtUtils-F77-1.16.tar.gz) = 10234 +SHA256 (ExtUtils-F77-1.17.tar.gz) = b3919200443174ff348ed5567d461335e289fba047cb17432f31dea5a26cad3f +SIZE (ExtUtils-F77-1.17.tar.gz) = 11225 diff --git a/lang/p5-F77/files/patch-F77.pm b/lang/p5-F77/files/patch-F77.pm new file mode 100644 index 000000000000..4a3976568b3a --- /dev/null +++ b/lang/p5-F77/files/patch-F77.pm @@ -0,0 +1,65 @@ +--- F77.pm.orig 2010-12-31 19:53:06.000000000 -0600 ++++ F77.pm 2011-03-24 01:05:00.742862139 -0500 +@@ -351,9 +351,49 @@ $F77config{Aix}{DEFAULT} = 'F77'; + + ### FreeBSD ### + +-$F77config{Freebsd}{F77}{Trail_} = 1; +-$F77config{Freebsd}{F77}{Link} = '-L/usr/lib -lf2c -lm'; +-$F77config{Freebsd}{DEFAULT} = 'F77'; ++if($^O =~ /Freebsd/i) { ++ $gfortran = 'gfortran44'; # requires rewrite ++ $fallback_compiler = 'G77'; ++} ++ ++$F77config{Freebsd}{G77}{Link} = sub { ++ $dir = `g77-34 -print-file-name=libg2c.a`; ++ chomp $dir; ++ # Note that -print-file-name returns just the library name ++ # if it cant be found - make sure that we only accept the ++ # directory if it returns a proper path (or matches a /) ++ ++ if( defined $dir ) { ++ $dir =~ s,/libg2c.a$,,; ++ } else { ++ $dir = "/usr/local/lib"; ++ } ++ return( "-L$dir -L/usr/lib -lg2c -lm" ); ++}; ++ ++$F77config{Freebsd}{GFortran}{Link} = sub { ++ $dir = `$gfortran -print-file-name=libgfortran.a`; ++ chomp $dir; ++ # Note that -print-file-name returns just the library name ++ # if it cant be found - make sure that we only accept the ++ # directory if it returns a proper path (or matches a /) ++ ++ if( defined $dir ) { ++ $dir =~ s,/libgfortran.a$,,; ++ } else { ++ $dir = "/usr/local/lib"; ++ } ++ return( "-L$dir -L/usr/lib -lgfortran -lm" ); ++}; ++ ++$F77config{Freebsd}{G77}{Trail_} = 1; ++$F77config{Freebsd}{GFortran}{Trail_} = 1; ++$F77config{Freebsd}{G77}{Compiler} = 'g77-34'; ++$F77config{Freebsd}{GFortran}{Compiler} = "$gfortran"; ++$F77config{Freebsd}{G77}{Cflags} = '-O2'; ++$F77config{Freebsd}{GFortran}{Cflags} = '-O2'; ++$F77config{Freebsd}{DEFAULT} = 'GFortran'; ++ + + ### VMS ### + +@@ -446,7 +486,8 @@ $Pkg: Will try system=Generic Compiler=$ + EOD + $system = + $Config{cc} =~ /\bgcc/ && $^O =~ /MSWin32/i ? "MinGW" +- :"Generic"; ++ : $^O =~ /Freebsd/i ? "Freebsd" ++ : "Generic"; + $compiler = $fallback_compiler; + my $flibs = get ($F77config{$system}{$compiler}{Link}); + $Runtime = $flibs ; #. gcclibs($flibs); # Note gcclibs appears to be no longer required. diff --git a/lang/p5-F77/pkg-plist b/lang/p5-F77/pkg-plist index 089e64295cb4..763bdeb2fd27 100644 --- a/lang/p5-F77/pkg-plist +++ b/lang/p5-F77/pkg-plist @@ -1,6 +1,5 @@ %%SITE_PERL%%/ExtUtils/F77.pm %%SITE_PERL%%/%%PERL_ARCH%%/auto/ExtUtils/F77/.packlist -%%SITE_PERL%%/ExtUtils/._F77.pm @dirrm %%SITE_PERL%%/%%PERL_ARCH%%/auto/ExtUtils/F77 @dirrmtry %%SITE_PERL%%/%%PERL_ARCH%%/auto/ExtUtils @dirrmtry %%SITE_PERL%%/ExtUtils