| 1 | 1 | ▶ | use alienfile; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 2 | |||||||||||||||
| 3 | 1 | requires 'File::Which'; | |||||||||||||
| 4 | |||||||||||||||
| 5 | # Probe for these tools by default in addition to the library. This can be | ||||||||||||||
| 6 | # overridden by setting `ALIEN_DJVULIBRE_PROBE_TOOLS`: | ||||||||||||||
| 7 | # | ||||||||||||||
| 8 | # - Set ALIEN_DJVULIBRE_PROBE_TOOLS=0 to disable probe for tools. | ||||||||||||||
| 9 | # - Set ALIEN_DJVULIBRE_PROBE_TOOLS to space-delimited list of alternative | ||||||||||||||
| 10 | # tools to probe. | ||||||||||||||
| 11 | 1 | my @DEFAULT_PROBE_TOOLS = qw{ddjvu c44 djvm}; | |||||||||||||
| 12 | |||||||||||||||
| 13 | my @should_probe_tools = exists $ENV{ALIEN_DJVULIBRE_PROBE_TOOLS} | ||||||||||||||
| 14 | ? ( $ENV{ALIEN_DJVULIBRE_PROBE_TOOLS} ne '0' | ||||||||||||||
| 15 | ? split(' ', $ENV{ALIEN_DJVULIBRE_PROBE_TOOLS}) | ||||||||||||||
| 16 | 1 | ▶ | : () | ||||||||||||
|
Branch: 2 branches
| |||||||||||||||
| 17 | ) | ||||||||||||||
| 18 | : @DEFAULT_PROBE_TOOLS; | ||||||||||||||
| 19 | |||||||||||||||
| 20 | 0 | ▶ | meta->around_hook( probe => sub { | ||||||||||||
|
Subroutine
__ANON__: not called CC=4 SCAR=30.0
| |||||||||||||||
| 21 | 0 | my $orig = shift; | |||||||||||||
| 22 | 0 | my ($build) = @_; | |||||||||||||
| 23 | 0 | my $install_type = $orig->(@_); | |||||||||||||
| 24 | |||||||||||||||
| 25 | 0 | ▶ | return $install_type unless @should_probe_tools; | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 26 | |||||||||||||||
| 27 | 0 | ▶ | if( $install_type eq 'system' ) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 28 | 0 | my @missing_tools = grep { ! File::Which::which($_) } @should_probe_tools; | |||||||||||||
| 29 | 0 | ▶ | if( ! @missing_tools ) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 30 | 0 | return 'system'; | |||||||||||||
| 31 | } else { | ||||||||||||||
| 32 | 0 | $build->log("Missing tools [ @missing_tools ] requires share install"); | |||||||||||||
| 33 | 0 | return 'share'; | |||||||||||||
| 34 | } | ||||||||||||||
| 35 | } | ||||||||||||||
| 36 | |||||||||||||||
| 37 | 0 | return $install_type; | |||||||||||||
| 38 | 1 | }); | |||||||||||||
| 39 | 1 | plugin 'PkgConfig' => 'ddjvuapi'; | |||||||||||||
| 40 | |||||||||||||||
| 41 | 1 | ▶ | share { | ||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=2.0
| |||||||||||||||
| 42 | 1 | requires 'ExtUtils::CppGuess' => '0.13'; | |||||||||||||
| 43 | 1 | plugin 'Decode::SourceForge'; | |||||||||||||
| 44 | 1 | start_url 'https://sourceforge.net/projects/djvu/files/DjVuLibre/3.5.28/'; | |||||||||||||
| 45 | 1 | plugin 'Download' => ( | |||||||||||||
| 46 | filter => qr/^djvulibre-[0-9\.]+\.tar\.gz$/, | ||||||||||||||
| 47 | version => qr/^djvulibre-([0-9\.]+)\.tar\.gz$/, | ||||||||||||||
| 48 | ); | ||||||||||||||
| 49 | 1 | plugin 'Extract' => 'tar.gz'; | |||||||||||||
| 50 | 1 | plugin 'Build::Make' => 'gmake'; | |||||||||||||
| 51 | 1 | plugin 'Build::Autoconf'; | |||||||||||||
| 52 | 1 | build [ | |||||||||||||
| 53 | '%{configure} --disable-xmltools --disable-desktopfiles --enable-shared --enable-static', | ||||||||||||||
| 54 | '%{make}', | ||||||||||||||
| 55 | '%{make} install', | ||||||||||||||
| 56 | ]; | ||||||||||||||
| 57 | 0 | ▶ | after gather => sub { | ||||||||||||
|
Subroutine
__ANON__: not called CC=4 SCAR=30.0
| |||||||||||||||
| 58 | 0 | my ($build) = @_; | |||||||||||||
| 59 | |||||||||||||||
| 60 | 0 | my @extra_compiler_flags; | |||||||||||||
| 61 | |||||||||||||||
| 62 | 0 | ▶ | if( $^O eq 'MSWin32' ) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 63 | # possibly only needed for MinGW | ||||||||||||||
| 64 | 0 | push @extra_compiler_flags, qw(-DDDJVUAPI_EXPORT -DMINILISPAPI_EXPORT); | |||||||||||||
| 65 | } | ||||||||||||||
| 66 | |||||||||||||||
| 67 | 0 | my @extra_linker_flags; | |||||||||||||
| 68 | |||||||||||||||
| 69 | 0 | push @extra_linker_flags, ExtUtils::CppGuess->new->linker_flags; | |||||||||||||
| 70 | |||||||||||||||
| 71 | 0 | ▶ | if( $^O eq 'darwin' ) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 72 | 0 | push @extra_linker_flags, qw(-framework CoreFoundation); | |||||||||||||
| 73 | } | ||||||||||||||
| 74 | |||||||||||||||
| 75 | 0 | for my $type ('', '_static') { | |||||||||||||
| 76 | $build->runtime_prop->{"cflags$type"} = join ' ', | ||||||||||||||
| 77 | 0 | $build->runtime_prop->{"cflags$type"}, | |||||||||||||
| 78 | @extra_compiler_flags; | ||||||||||||||
| 79 | $build->runtime_prop->{"libs$type"} = join ' ', | ||||||||||||||
| 80 | 0 | $build->runtime_prop->{"libs$type"}, | |||||||||||||
| 81 | @extra_linker_flags; | ||||||||||||||
| 82 | } | ||||||||||||||
| 83 | 1 | }; | |||||||||||||
| 84 | 1 | plugin 'Gather::IsolateDynamic'; | |||||||||||||
| 85 | 1 | }; | |||||||||||||