# -*- 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    darold pgFormatter 5.6 v
github.tarball_from archive

revision        0
license         PostgreSQL
description     PostgreSQL SQL syntax beautifier
maintainers     {danchr @danchr} openmaintainer
categories      databases devel textproc

supported_archs noarch

long_description {*}{
    This SQL formatter/beautifier supports keywords from SQL-92,
    SQL-99, SQL-2003, SQL-2008, SQL-2011 and PostgreSQL specifics
    keywords. Works with any other databases too.

    pgFormatter can work as a console program or as a CGI. It will
    automatically detect its environment and format output as text
    or as HTML following the context.  It can also
    return a JSON-formatted response if used as CGI with
    'Accept: application/json'.

    Keywords highlighting will only be available in CGI context.
}

checksums       rmd160  fda1c714b99fade95d04b2f4c274e5e49638bc78 \
    sha256  21a7f958cd3fe5d9c7851a882948278440bc9fd609e1a79ed5b8cf613d267fab \
    size    1329485

perl5.branches  5.34
perl5.create_variants  ${perl5.branches}

configure.cmd       ${perl5.bin}
configure.pre_args  Makefile.PL
configure.args      INSTALLDIRS=vendor

post-destroot {
    delete [glob ${destroot}${prefix}/lib/perl5/*/*/perllocal.pod]

    reinplace\
        "s|^#!/usr/bin/env perl|#!${perl5.bin}|" \
        ${destroot}${perl5.bindir}/pg_format

    foreach bin [glob -nocomplain -tails -directory "${destroot}${perl5.bindir}" *] {
        ln -s "${perl5.bindir}/${bin}" "${destroot}${prefix}/bin/${bin}"
    }

    file rename \
        [glob -dir ${destroot}${prefix}/share/perl${perl5.major}/man/man1 *.1] \
        ${destroot}${prefix}/share/man/man1
}
