Ticket #39222: p5-pdl.2.patch
File p5-pdl.2.patch, 6.2 KB (added by mgrimes@…, 11 years ago) |
---|
-
perl/p5-pdl/Portfile
diff --git a/perl/p5-pdl/Portfile b/perl/p5-pdl/Portfile index fa68d12..3751485 100644
a b PortSystem 1.0 5 5 PortGroup perl5 1.0 6 6 7 7 perl5.branches 5.8 5.10 5.12 5.14 5.16 8 perl5.setup PDL 2. 4.118 perl5.setup PDL 2.006 9 9 maintainers saao.ac.za:tim 10 10 license Artistic GPL-2 11 11 description Perl Data Language - scientific computing capability for perl … … platforms darwin 19 19 20 20 homepage http://pdl.perl.org/ 21 21 22 checksums rmd160 7c877c7477930a0a874190670aedc6375746c63d\23 sha256 c777ed2519d73ebde0d870e94931a2d2c57865abcee27dfec53f4412a2cac66222 checksums rmd160 d95e3fcd0b350a1863c28d331a44a902ae3b44be \ 23 sha256 78119429cbe9b23387173db9c0e8c39de18a4a8ec757c10d4156fa30979d7ec5 24 24 25 25 if {${perl5.major} != ""} { 26 # proj 4.7 is needed for now. https://trac.macports.org/ticket/3529227 depends_lib-append port:p${perl5.major}-text-balanced\26 depends_lib-append \ 27 port:p${perl5.major}-astro-fits-header \ 28 28 port:p${perl5.major}-inline \ 29 port:p${perl5.major}-term-readline-gnu \ 29 30 port:p${perl5.major}-extutils-f77 \ 30 port:p${perl5.major}-gd \31 port:p${perl5.major}-astro-fits-header \32 31 port:netpbm \ 33 32 port:hdf5-18 \ 34 33 port:jpeg \ 35 34 port:gsl \ 36 35 port:fftw-3 \ 37 port:proj47 \38 36 port:pgplot \ 39 port:p${perl5.major}-term-readline-gnu \ 40 port:plplot 37 port:p${perl5.major}-pgplot \ 38 port:plplot \ 39 port:p${perl5.major}-convert-uu \ 40 port:p${perl5.major}-file-map \ 41 port:p${perl5.major}-module-compile 42 43 # Might be needed: 44 # port:p${perl5.major}-gd \ 45 # port:p${perl5.major}-opengl \ 46 47 # Needed for pdl2, but no MacPort package available 48 # and the dependency chain is very long 49 # port:p${perl5.major}-devel-repl \ 50 51 # proj 4.7 might not be needed anymore 52 # https://trac.macports.org/ticket/35292 53 # port:proj47 \ 54 55 # Prereqs in Makefile.PL: 56 # 'Astro::FITS::Header' => 0, 57 # 'Convert::UU' => 0, 58 # 'Data::Dumper' => 2.121, # core 2.121 in 5.6.2 59 # 'ExtUtils::MakeMaker' => 6.31, # core 6.30 in 5.8.8 60 # 'File::Map' => 0.47, 61 # 'File::Spec' => 0.6, # core 0.6 in 5.00405 62 # 'File::Temp' => 0, # core in 5.6.1 63 # 'Filter::Util::Call' => 0, # core in 5.7.4 64 # 'Filter::Simple' => 0.88, # core, but only 0.84 65 # 'Inline' => 0.43, 66 # 'Module::Compile' => 0.23, 67 # 'Pod::Parser' => 0, # core in 5.6.0 68 # 'Pod::Select' => 0, # core in 5.6.0 69 # 'Storable' => 1.03, # core 2.04 in 5.8.0 70 # 'Text::Balanced' => 1.89, # core 1.89 in 5.7.3 71 41 72 42 73 # pgplot is not universal 43 74 universal_variant no … … if {${perl5.major} != ""} { 56 87 ${worksrcpath}/Lib/Transform/Proj4/Makefile.PL \ 57 88 ${worksrcpath}/t/callext.t 58 89 } 90 91 post-build { 92 # Create the pdldoc.db file for the help system 93 exec ${perl5.bin} -I ${worksrcpath}/blib/arch \ 94 -I ${worksrcpath}/blib/lib \ 95 ${worksrcpath}/Doc/scantree.pl ${worksrcpath}/blib/lib \ 96 ${worksrcpath}/pdldoc.db \ 97 ${worksrcpath}/blib/lib/PDL/Index.pod \ 98 >/dev/null 2>/dev/null 99 100 # Rewrite the paths in the pdldoc.db file. scantree will have the 101 # ${worksrcpath}/blib/lib paths, we need ${perl5.archlib}. 102 exec ${perl5.bin} ${filespath}/fix-pdldocdb.pl \ 103 ${worksrcpath}/pdldoc.db \ 104 ${worksrcpath}/blib/lib/PDL/pdldoc.db \ 105 "${worksrcpath}/blib/lib" \ 106 "${perl5.archlib}" 107 } 59 108 } -
new file perl/p5-pdl/files/fix-pdldocdb.pl
diff --git a/perl/p5-pdl/files/fix-pdldocdb.pl b/perl/p5-pdl/files/fix-pdldocdb.pl new file mode 100644 index 0000000..5f2fe0a
- + 1 #!/usr/bin/env perl 2 3 use strict; 4 use warnings; 5 6 my ( $src_file, $dst_file, $cur_path, $new_path ) = @ARGV; 7 usage() unless $src_file && $dst_file && -e $src_file; 8 usage() unless $cur_path && $new_path; 9 10 sub usage { 11 warn "usage: $0 <input pdldoc.db> <output pdldoc.db>\n"; 12 warn " <current path> <path after install>\n"; 13 warn @_; 14 exit 1; 15 } 16 17 my $hash = ensuredb( { File => [$src_file], Scanned => [], } ); 18 fix_directories($hash); 19 savedb( { Outfile => $dst_file }, $hash ); 20 21 sub fix_directories { 22 my ($hash) = @_; 23 24 for my $key (%$hash) { 25 next unless exists $hash->{$key}->{File}; 26 $hash->{$key}->{File} =~ s{^$cur_path}{$new_path}; 27 } 28 } 29 30 # Taken from PDL::Doc with minor modifications 31 sub ensuredb { 32 my ($this) = @_; 33 while ( my $fi = pop @{ $this->{File} } ) { 34 open IN, $fi 35 or die "can't open database $fi, scan docs first"; 36 binmode IN; 37 my ( $plen, $txt ); 38 while ( read IN, $plen, 2 ) { 39 my ($len) = unpack "S", $plen; 40 read IN, $txt, $len; 41 my ( $sym, %hash ) = split chr(0), $txt; 42 $this->{SYMS}->{$sym} = {%hash}; 43 } 44 close IN; 45 push @{ $this->{Scanned} }, $fi; 46 } 47 return $this->{SYMS}; 48 } 49 50 sub savedb { 51 my ( $this, $hash ) = @_; 52 ## my $hash = $this->ensuredb(); 53 54 open OUT, ">$this->{Outfile}" 55 or die "can't write to symdb $this->{Outfile}"; 56 binmode OUT; 57 while ( my ( $key, $val ) = each %$hash ) { 58 next unless scalar(%$val); 59 my $txt = "$key" . chr(0) . join( chr(0), %$val ); 60 print OUT pack( "S", length($txt) ) . $txt; 61 } 62 } 63