Alien-MuPDF

 view release on metacpan or  search on metacpan

lib/Alien/MuPDF.pm  view on Meta::CPAN

package Alien::MuPDF;
$Alien::MuPDF::VERSION = '0.012';
use strict;
use warnings;

use parent qw(Alien::Base);
use File::Spec;

sub mutool_path {
	my ($self) = @_;
	File::Spec->catfile( File::Spec->rel2abs($self->dist_dir) , 'bin', 'mutool' );
}

sub inline_auto_include {
	return  [ 'mupdf/fitz.h' ];
}

sub cflags {
	my ($self) = @_;
	my $top_include = File::Spec->catfile( File::Spec->rel2abs($self->dist_dir), qw(include) );
	# We do not include $self->SUPER::cflags() because that adds too many
	# header files to the path. In particular, it adds -Imupdf/fitz, which
	# leads to "mupdf/fitz/math.h" being included when trying to include
	# the C standard "math.h" header.
	return "-I$top_include";
}

sub libs {
	# third party
	"-lcrypto";
}

sub Inline {
	my ($self, $lang) = @_;

	if( $lang eq 'C' ) {
		my $params = Alien::Base::Inline(@_);
		$params->{MYEXTLIB} .= ' ' .
			join( " ",
				map { File::Spec->catfile(
					File::Spec->rel2abs(Alien::MuPDF->dist_dir),
					'lib',  $_ ) }
				qw(libmupdf.a libmupdf-third.a)
			);
		$params->{PRE_HEAD} = <<'		EOF';
		#if defined(_MSC_VER) || defined(__MINGW32__)
		#  define NO_XSLOCKS /* To avoid PerlProc_setjmp/PerlProc_longjmp unresolved symbols */
		#endif
		EOF

		return $params;
	}
}

1;

=pod

=encoding UTF-8

=head1 NAME

Alien::MuPDF - Alien package for the MuPDF PDF rendering library

=head1 VERSION

version 0.012

=head1 METHODS

=head2 mutool_path

Returns a C<Str> which contains the absolute path
to the C<mutool> binary.

=head1 Inline support

This module supports L<Inline's with functionality|Inline/"Playing 'with' Others">.

=head1 SEE ALSO



( run in 1.653 second using v1.01-cache-2.11-cpan-cdf2f3d4e48 )