# -*- 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   makefile 1.0
PortGroup   openssl 1.0

openssl.branch 1.1

name        libpdel
version     0.6.1
revision    3
categories  devel www
license     Permissive BSD
maintainers nomaintainer
description Packet Design multi-purpose C library for embedded applications
long_description \
            The Packet Design Embedded Library (PDEL) is a kitchen \
            sink C library containing an assorted collection of code \
            useful for developing embedded applications: \
            - C data structure run-time introspection library \
            - Threaded HTTP client/server library with SSL and XML-RPC support \
            - PPP library using netgraph(4) with PPTP and L2TP servers \
            - Application configuration framework \
            - Heap memory accounting and sanity checking \
            - Generic template processing library \
            - Routines to configure networking interfaces, ARP and routing tables \
            - Logging library \
            - Generic TCP server \
            - Generic hash table implementation \
            - Generic balanced tree implementation \
            - Miscellaneous FILE * enhancements \
            - Base-64 encoding/decoding \
            - Events and actions with automated locking \
            - Generalized per-thread variables \
            - Message ports \
            - Digital signature creation/verification \
            - Filesystem mounting/unmounting \
            - String quoting/parsing.

homepage    https://web.archive.org/web/20080925073208/http://www.dellroad.org/pdel/index

master_sites \
            sourceforge:project/libpdel/libpdel-combined/${version}
use_bzip2   yes
checksums   rmd160  5e99afa267fd20e6bfff2437b01065d85063f4a7 \
            sha256  b0bccc74a51a936177ba6e9274c623631974986f9ccd3d7cf9461927920b5eab \
            size    528773

depends_lib-append \
            port:expat

worksrcdir  ${name}-${version}/pdel

# Darwin's sendfile() has a different prototype, so we skip the optimization.
patchfiles  GNUmakefile.patch \
            http_servlet_file.c.patch \
            pd_port.h.patch \
            http_http_server.patch \
            ppp_ppp__msoft.c.patch

post-patch {
    file copy -force ${filespath}/Darwin ${worksrcpath}/ports/
    reinplace "s|@SSLROOT@|[openssl::install_area]|g" ${worksrcpath}/GNUmakefile
}

build.type  gnu
build.args  ARCH=${configure.build_arch} \
            cc=${configure.cc} \
            mandir=${prefix}/share/man \
            MP_CFLAGS="${configure.cflags} [get_canonical_archflags cc]" \
            prefix=${prefix}

universal_variant \
            no

destroot.args \
            {*}${build.args}
