File Coverage

blib/lib/Alien/MuPDF.pm
Criterion Covered Total %
statement 26 26 100.0
branch 1 2 50.0
condition n/a
subroutine 9 9 100.0
pod 4 5 80.0
total 40 42 95.2


line stmt bran cond sub pod time code
1             package Alien::MuPDF;
2             $Alien::MuPDF::VERSION = '0.011';
3 2     2   134473 use strict;
  2         14  
  2         61  
4 2     2   11 use warnings;
  2         2  
  2         66  
5              
6 2     2   558 use parent qw(Alien::Base);
  2         325  
  2         11  
7 2     2   64801 use File::Spec;
  2         5  
  2         503  
8              
9             sub mutool_path {
10 1     1 1 1698 my ($self) = @_;
11 1         11 File::Spec->catfile( File::Spec->rel2abs($self->dist_dir) , 'bin', 'mutool' );
12             }
13              
14             sub inline_auto_include {
15 4     4 1 60 return [ 'mupdf/fitz.h' ];
16             }
17              
18             sub cflags {
19 2     2 1 102 my ($self) = @_;
20 2         101 my $top_include = File::Spec->catfile( File::Spec->rel2abs($self->dist_dir), qw(include) );
21             # We do not include $self->SUPER::cflags() because that adds too many
22             # header files to the path. In particular, it adds -Imupdf/fitz, which
23             # leads to "mupdf/fitz/math.h" being included when trying to include
24             # the C standard "math.h" header.
25 2         1618 return "-I$top_include";
26             }
27              
28             sub libs {
29             # third party
30 2     2 1 14 "-lcrypto";
31             }
32              
33             sub Inline {
34 2     2 0 1534821 my ($self, $lang) = @_;
35              
36 2 50       53 if( $lang eq 'C' ) {
37 2         51 my $params = Alien::Base::Inline(@_);
38             $params->{MYEXTLIB} .= ' ' .
39             join( " ",
40 2         57 map { File::Spec->catfile(
  4         624  
41             File::Spec->rel2abs(Alien::MuPDF->dist_dir),
42             'lib', $_ ) }
43             qw(libmupdf.a libmupdf-third.a)
44             );
45 2         562 $params->{PRE_HEAD} = <<' EOF';
46             #if defined(_MSC_VER) || defined(__MINGW32__)
47             # define NO_XSLOCKS /* To avoid PerlProc_setjmp/PerlProc_longjmp unresolved symbols */
48             #endif
49             EOF
50              
51 2         9 return $params;
52             }
53             }
54              
55             1;
56              
57             =pod
58              
59             =encoding UTF-8
60              
61             =head1 NAME
62              
63             Alien::MuPDF - Alien package for the MuPDF PDF rendering library
64              
65             =head1 VERSION
66              
67             version 0.011
68              
69             =head1 METHODS
70              
71             =head2 mutool_path
72              
73             Returns a C which contains the absolute path
74             to the C binary.
75              
76             =head1 Inline support
77              
78             This module supports L.
79              
80             =head1 SEE ALSO
81              
82             L
83              
84             L
85              
86             =head1 AUTHOR
87              
88             Zakariyya Mughal
89              
90             =head1 COPYRIGHT AND LICENSE
91              
92             This software is copyright (c) 2013 by Zakariyya Mughal.
93              
94             This is free software; you can redistribute it and/or modify it under
95             the same terms as the Perl 5 programming language system itself.
96              
97             =cut
98              
99             __END__