# -*- 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                    eggdrop
version                 1.6.21
license                 GPL-2+
set branch              [join [lrange [split ${version} .] 0 1] .]
categories              irc
maintainers             nomaintainer
description             Eggdrop is the world's most popular Internet Relay Chat (IRC) bot.
long_description        ${description}
homepage                http://www.eggheads.org
platforms               darwin
master_sites            ftp://ftp.eggheads.org/pub/eggdrop/source/${branch}/ freebsd
distname                ${name}${version}

checksums               rmd160  1006dfd6a6e735500c2b484eb3061f1d2dfd20f8 \
                        sha256  75bd5573a609eac3940c0b6ca8251c3f38ea5d54b520e1cad93c650b4bc21754

use_bzip2               yes

patchfiles              patch-Makefile.in-LDFLAGS.diff

post-configure          { system "cd ${worksrcpath} && make config" }
destroot.destdir        DEST=${destroot}${prefix}/share/eggdrop

post-destroot {
    delete ${destroot}${prefix}/share/eggdrop/eggdrop
    ln -s ../share/eggdrop/eggdrop-${version} ${destroot}${prefix}/bin/eggdrop
    move ${destroot}${prefix}/share/eggdrop/eggdrop.conf ${destroot}${prefix}/share/eggdrop/eggdrop.conf.sample
    move ${destroot}${prefix}/share/eggdrop/doc/man1/eggdrop.1 ${destroot}${prefix}/share/man/man1
}

platform darwin 8 {
        configure.cflags-append "-DBIND_8_COMPAT"
}

if {${os.platform} eq "darwin" && ${os.major} >= 10} {
    patchfiles-append patch-Makefile.in.diff
    patchfiles-append patch-src-tclhash.h.diff
    patchfiles-append patch-src-proto.h.diff
    patchfiles-append patch-src-match.c.diff
}