# -*- 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

github.setup            rrthomas pdfjam 4.2 v
categories              textproc pdf
maintainers             {gmail.com:jjstickel @jjstickel} openmaintainer
license                 GPL-2
platforms               any
supported_archs         noarch
use_configure           no

description             pdfjam is a shell-script front end to the LaTeX 'pdfpages' package

long_description \
    The pdfjam package makes available the pdfjam shell script that provides a simple interface to much of the \
    functionality of the excellent pdfpages package (by Andreas Matthias) for LaTeX. \
    The pdfjam script takes one or more PDF files (and/or JPG/PNG graphics files) as input, \
    and produces one or more PDF files as output. \
    It is useful for joining files together, selecting pages, reducing several source pages onto one output page, etc.

github.tarball_from     releases

checksums               rmd160  7db7ff4d8e5910bfa816d68951bbea0234cb2398 \
                        sha256  528d7b2eec8461b9ee9cea1d06a117c7ecfa306cf1191d09d64419122464dd89 \
                        size    34419

depends_run \
    bin:pdflatex:texlive-latex \
    path:share/texmf-dist/tex/latex/pdfpages/pdfpages.sty:texlive-latex-recommended

post-patch {
    reinplace "s|/usr/local|${prefix}|g" \
        ${worksrcpath}/bin/pdfjam \
        ${worksrcpath}/man/pdfjam.1 \
        ${worksrcpath}/README.md
}

build {}

test.run    yes
test.cmd    bin/pdfjam
test.target
test.args   --version

destroot {
    xinstall -m 755 ${worksrcpath}/bin/pdfjam ${destroot}${prefix}/bin/pdfjam
    xinstall -m 644 ${worksrcpath}/man/pdfjam.1 ${destroot}${prefix}/share/man/man1/pdfjam.1
    xinstall -m 644 ${worksrcpath}/pdfjam.conf ${destroot}${prefix}/etc/pdfjam.conf.sample

    xinstall -m 755 -d ${destroot}${prefix}/share/doc/${name}
    xinstall -m 644 -W ${worksrcpath} COPYING README.md VERSION-${version} \
       ${destroot}${prefix}/share/doc/${name}
}
