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

name                radlib

version             2.12.0
revision            1

categories          devel

maintainers         macports.org:mbclark

license             BSD

use_autoconf        yes

description         Rapid Application Development Library
long_description \
  radlib is a rapid application development library for unix \
  multi-process applications. It uses SYS V IPC facilities and FIFOs \
  to provide an RTOS-like, event-driven, distributed framework. \
  Processes may be run as daemons or have a controlling terminal.

homepage            https://web.archive.org/web/20181106194552/http://radlib.teel.ws/
master_sites        sourceforge:project/${name}/${name}/${name}-${version}

checksums           md5     1330d46ab22e43425169d7dc75f5f2ea \
                    sha1    1b3feace6d0361436c9e4ce9b06856195a5ac1b1 \
                    rmd160  3509e555a35da26fc6e86a1f1134ef29d07f95c9

post-extract {
    # DOS to UNIX line endings so we can patch.
    reinplace -W ${worksrcpath}/src "s|\r||g" radevents.c radsystem.c
}

patchfiles          implicit.patch

variant mysql5 description {Includes mySQL5 database support} {
  configure.args-append     --enable-mysql
  configure.cflags-append   -I${prefix}/include/mysql5/mysql
  configure.ldflags-append  -L${prefix}/lib/mysql5/mysql
  depends_lib-append        path:lib/libssl.dylib:openssl port:zlib path:bin/mysql_config5:mysql5
}

variant sqlite3 description {Include sqlite3 database support} {
  configure.args-append     --enable-sqlite
  depends_lib-append        port:sqlite3
    # https://sourceforge.net/p/radlib/bugs/9/
    configure.ldflags-append  -lsqlite3
}

if {![variant_isset mysql5]} {
    default_variants +sqlite3
}
