PortSystem          1.0

name                openpgpsdk
version             0.9
revision            5
categories          security devel
license             BSD
maintainers         nomaintainer
description         OpenPGP library SDK
long_description \
   The OpenPGP SDK project provides an open source library, written in C, \
   which implements the OpenPGP specification.

platforms           darwin

homepage            http://openpgp.nominet.org.uk/
master_sites        ${homepage}downloads/
extract.suffix      .tgz

checksums           md5     a2fe87ee864e6bcc0d5ea3db20e0f57a \
                    sha1    faa2eb844da0f1689dee29c3220364545ca7746b \
                    rmd160  9260e464f8f9b385d0cc8348d20e1c264856cee3

depends_build       bin:perl:perl5 path:bin/gpg:gnupg2

depends_lib         path:lib/libssl.dylib:openssl port:bzip2 port:zlib port:cunit

universal_variant   no

patchfiles          patch-disable_werror.diff

configure.pre_args
configure.args      --with-bz2lib=${prefix}/lib --with-cunit=${prefix} \
                    --with-openssl=${prefix} --with-zlib=${prefix}/lib \
                    --cc=${configure.cc}

test.run            yes

destroot {
   copy ${worksrcpath}/include/${name} ${destroot}${prefix}/include
   xinstall -m 644 -W ${worksrcpath}/lib libops.a ${destroot}${prefix}/lib
   xinstall -m 755 -W ${worksrcpath}/bin openpgp ${destroot}${prefix}/bin
}

variant doc description {Install doxygen-generated documentation} {
   depends_build-append   path:bin/doxygen:doxygen
   build.target-append    doc
   post-destroot {
      xinstall -m 755 -d ${destroot}${prefix}/share/doc/${name}
      # Using foreach instead of copy due to the number of files
      foreach htmlfile [glob ${worksrcpath}/doc/doxy-user/html/*] {
         xinstall -m 644 ${htmlfile} ${destroot}${prefix}/share/doc/${name}
      }
      foreach manpage [glob ${worksrcpath}/doc/doxy-user/man/man3/*] {
         xinstall -m 644 ${manpage} ${destroot}${prefix}/share/man/man3/
      }
   }
}

livecheck.type      none