# -*- 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                    gnet2
set gname               gnet
version                 2.0.8
set branch              [join [lrange [split ${version} .] 0 1] .]
categories              devel
license                 LGPL-2.1+
platforms               darwin
maintainers             nomaintainer

description             Simple network library

long_description        GNet is a simple network library written in C.  It is \
                        object-oriented, and built upon GLib.

homepage                https://wiki.gnome.org/Projects/GNetLibrary
master_sites            gnome:sources/${gname}/${branch}/

distname                ${gname}-${version}
use_bzip2               yes
checksums               md5     93327d2fca333d7e54ba2cf54e071165 \
                        sha1    74a33dd25cc594b874e3a5171795efd99e567387

depends_build           port:pkgconfig
depends_lib             path:lib/pkgconfig/glib-2.0.pc:glib2 \
                        port:gettext \
                        port:libiconv

# /usr/bin/ranlib: library member: libgnetxmlrpc.a(libgnet-2.0.la) is not an object file (not allowed in a library with multiple architectures)
universal_variant       no

post-configure {
    reinplace "s|-pthread|-lpthread|g" \
        ${workpath}/${distname}/src/Makefile
    reinplace "s|-pthread|-lpthread|g" \
        ${workpath}/${distname}/examples/Makefile
    reinplace "s|-pthread|-lpthread|g" \
        ${workpath}/${distname}/tests/Makefile
}

post-destroot {
    system "ln -fs libgnet-2.0.0.8.0.dylib \
        ${destroot}${prefix}/lib/libgnet.2.dylib"
}

livecheck.type          gnome
livecheck.name          ${gname}
