# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4

PortSystem          1.0
PortGroup           github 1.0
PortGroup           perl5 1.0

github.setup        macports macports-contrib 2c83e035816573b4589e46ff2c7df98ace5f5a88
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from tarball
set git_date        20190228
name                cpan2port
version             0.1.1_${git_date}
revision            1
categories          sysutils macports perl
maintainers         nomaintainer
license             WTFPL-2 permissive
supported_archs     noarch
platforms           any

description         A perl script to generate MacPorts portfiles
long_description    {*}${description} from CPAN modules.
homepage            https://trac.macports.org/wiki/howto/${name}

checksums           rmd160  d8c16e589b11717a3638e5485395d32dd5627f44 \
                    sha256  8e4e409a702a24e3ef4695dd21315d3b7e1bca6f17a238767c01011aed3ac48e \
                    size    241515

perl5.branches      5.34

depends_run-append  port:p${perl5.major}-carp-clan \
                    port:p${perl5.major}-cpan-meta-yaml \
                    port:p${perl5.major}-file-path \
                    port:p${perl5.major}-getopt-simple \
                    port:p${perl5.major}-list-moreutils \
                    port:p${perl5.major}-module-depends \
                    port:p${perl5.major}-cpan-meta \
                    port:p${perl5.major}-pod-simple \
                    port:p${perl5.major}-yaml

dist_subdir         macports-contrib
worksrcdir          ${worksrcdir}/${name}

configure {
    reinplace "s|#! /usr/bin/env perl|#!${prefix}/bin/perl${perl5.major}|g" ${worksrcpath}/${name}
}

# should be implied by overriding configure:
configure.ccache    no

build {}

destroot {
    xinstall -m 755 ${worksrcpath}/${name} ${destroot}${prefix}/bin/${name}
    xinstall -d ${destroot}${prefix}/share/doc/${name}
    xinstall -m 644 ${worksrcpath}/COPYING ${destroot}${prefix}/share/doc/${name}/COPYING
}
