distributable:
  url: https://archives.eyrie.org/software/perl/podlators-{{version.raw}}.tar.xz
  strip-components: 1
display-name: pod2man
versions:
  url: https://archives.eyrie.org/software/perl/
  match: /podlators-\d+\.\d+\.tar\.xz/
  strip:
    - /^podlators-/
    - /\.tar\.xz/
runtime:
  env:
    PERL5LIB: "{{prefix}}/lib/perl5:{{prefix}}/libexec/lib/perl5:$PERL5LIB"
dependencies:
  perl.org: ^5
build:
  dependencies:
    gnu.org/make: '*'
    gnu.org/wget: '*'
    linux:
      cpanmin.us: ^1
  script:
    - run: cpanm -l {{prefix}} $PKGS
      if: linux
    - wget https://cpan.metacpan.org/authors/id/K/KH/KHW/Pod-Simple-3.43.tar.gz
    - tar -xzf Pod-Simple-3.43.tar.gz
    - run: |
        perl Makefile.PL INSTALL_BASE={{prefix}}/libexec
        make --jobs {{ hw.concurrency }}
        make --jobs {{ hw.concurrency }} install
      working-drectory: Pod-Simple-3.43
    - perl Makefile.PL $ARGS
    - make --jobs {{ hw.concurrency }}
    - make --jobs {{ hw.concurrency }} install
    - run: |
        sed -i.bak -E -e 's|/.*/bin/perl|/usr/bin/env perl|g' pod2man pod2text
        rm pod2man.bak pod2text.bak
      working-directory: ${{prefix}}/bin
  env:
    PERL5LIB: "{{prefix}}/libexec/lib/perl5:{{prefix}}/lib/perl5:$PERL5LIB"
    ARGS:
      - INSTALL_BASE={{prefix}}
      - INSTALLSITEMAN1DIR={{prefix}}/man/man1
      - INSTALLSITEMAN3DIR={{prefix}}/man/man3
    linux:
      PKGS:
        - ExtUtils::MakeMaker
        - Pod::Escapes

provides:
  - bin/pod2man
  - bin/pod2text
test:
  script:
    - pod2man test.pod | grep 'Pod::Man {{version.major}}'
