# New ports collection makefile for:    eggdrop
# Version required:     eggdrop1.0o
# Date created:         22 February 1997
# Whom:                 Bruce Gingery <bgingery@gtcs.com>
#
# $Id:
#
# Note:  Version 1.0o was released 4 Feb 1997 as the last of the 1.0 versions,
#        under development since December 1993.
#        Switched to GNU-GPL in Version 1.0n

#PORTSDIR=	/usr/ports
#DISTDIR=	${PORTSDIR}/distfiles
#PREFIX=	/usr/local
#PKGDIR=	${.CURDIR}/pkg
#PKD_DBDIR=	/var/db/pkg

#Master Site=   http://www.valuserve.com/~robey/eggdrop/
#  which is also author's homepage for this package.

MASTER_SITES= 	ftp://ftp.sodre.net/pub/eggdrop \
		ftp://ntis.com/pub/irc/DeadelviS/bot/c/eggdrop \
	        ftp://sunsite.unc.edu/pub/packages/irc/eggdrop \
	        ftp://ftp.umd.umich.edu/pub/mirrors/eggdrop \
	        ftp://ftp.eagle.ovik.se/pub/unix/irc/ftp_sodre_net \
	        ftp://despair.capecod.net/pub/Eggdrop \
	        ftp://ftp.gymnet.com/pub/irc/bots/eggdrop \
	        ftp://ftp.las.es/pub/unix/eggdrop \
	        ftp://ftp.genitek.com/pub/eggdrop \
	        ftp://mud.stack.nl/pub/irc/eggdrop

#MAINTAINER=
CATEGORIES+=	networking
KEYWORDS+=	irc bot robot eggdrop tcl scripted "relay chat" eggie

DISTNAME=	eggdrop1.0o
PKGNAME=	eggdrop-1.0o
#EXTRACT_SUFX=	.tar.gz

#MAINTAINER=	

#Note: CAN be statically linked with libtcl{verson}.a of course, and
#      Version 7.3 of TCL is still in the 2.1.[67] ports collection
#      but commands were added by tcl v7.6, so it's really better to
#      use 7.6 or later.  Eggdrop can also be dynamically linked with
#      a libtcl.*.so, or could even be put into its own .so with a
#      minimalist executable, but that would be of little value.

LIB_DEPENDS=	tcl\\.7\\.:${PORTSDIR}/lang/tcl

IS_INTERACTIVE=	yes
# Note:  Flagged interactive because the putegg script must be run
#        as a non-root user AFTER a "make" or make install"
#NO_CDROM=	Actually it would be a good CD-ROM candidate

#WRKDIR=	${.CURDIR}/work
#WRKSRC=	${WRKDIR}/${DISTNAME}

HAS_CONFIGURE=  yes
GNU_CONFIGURE=	yes
#USE_X11=       no
#XMKMF=		
#USE_GMAKE=	no
#DMAKE=
#MAKE_FLAGS	Handled by GNU Configure


CONFIGURE_ARGS=	--enable-shared --enable-gcc --bindir=${PREFIX}/bin \
		--libdir=${PREFIX}/lib --datadir=${PREFIX}/share \
		--mandir=${PREFIX}/man/man1

post-extract:
		@if [ `whoami` = "root" ] ; then \
		   echo "Enabling non-root handling for special user installs " ; \
		   cmd="chmod -R ugo+rwX ${WRKDIR}"; echo $$cmd; $$cmd; \
		   echo " " ; \
		fi

pre-patch:
		touch ${WRKSRC}/man1/putegg.1.in

post-patch:
		mv ${WRKSRC}/putegg ${WRKSRC}/putegg.in
		mv ${WRKSRC}/lamestbot ${WRKSRC}/lamestbot.in 
		mv ${WRKSRC}/botchk ${WRKSRC}/botchk.orig
		cp ${FILESDIR}/botchk ${WRKSRC}/ ; \
		chmod 0755 ${WRKSRC}/botchk ; \
		chown root.staff ${WRKSRC}/botchk

post-configure:
		mv ${WRKSRC}/lamestbot ${WRKSRC}/FBSDbot
		mv ${WRKSRC}/lamestbot.orig ${WRKSRC}/lamestbot
		mv ${WRKSRC}/putegg ${WRKSRC}/putegg.system
		mv ${WRKSRC}/putegg.orig ${WRKSRC}/putegg

post-build:	
		@if [ `whoami` = "root" ] ; then \
		    echo " " ; \
		    ${ECHO_MSG} "You have a choice for installation." ; \
		    echo "     you can do a normal \"make install\", in" ; \
		    echo "     which case the binary will be installed in" ; \
		    echo "     ${PREFIX}/bin, and the rest of the" ; \
		    echo "     package in ${PREFIX}/share/${PKGNAME}, OR" ; \
	         else \
		    echo ${ECHO_MSG} "As a non-root user, you must install" ; \
		    echo "     into a directory for which you have write" ; \
		    echo "     permissions.  If you have root access and" ; \
		    echo "     want a centralized install, run \"make install\" " ; \
		    echo "     as root." ; echo " ";\
		 fi
		@echo " " ; \
		 echo "For a \"user\" install..." ; \
		 echo "    1.  Create a directory, such as ~/MyBot" ; \
		 echo "    2.  cd ${WRKSRC}" ; \
		 echo "    3.  ./putegg ~/MyBot"
		@echo " " ; \
		 echo "  Either form does a functional install.  As root," ; \
		 echo "  it is more easily shared among users, or run as" ; \
		 echo "  its own user.  The ManPages may not be installed" ; \
		 echo "  if you do a \"user install\" now." ; echo " "

pre-install:
		@if [ `whoami` != "root" ] ; then \
		    echo "Must be installed as root, this way.  If you" ; \
		    echo "wish to do a \"user install\", use the putegg" ; \
		    echo "script in ${WRKSRC}." ; \
		    exit 1; \
		 fi

post-install:
		@if [ "${NOMANCOMPRESS}" != "true" ] ; then\
		    gzip -9nf ${PREFIX}/man/man1/eggdrop.1 \
			  ${PREFIX}/man/man1/putegg.1 ; \
		 fi
		@echo '===============================================' ; \
		 echo "Now cd to ${PREFIX}/share/eggdrop and run the" ; \
		 echo "putegg script there, to install a specific bot." ; \
		 echo "You will need a target directory for that bot's" ; \
		 echo "\"home\" directory.  This should NOT be done as" ; \
		 echo "root." ; \
		 echo '==============================================='


.include <bsd.port.mk>
#  We put these after the .include of <bsd.port.make> so that the current
#  version's makefile will have precedence over these, but these will be
#  defined.  Why?  Because some people are installing on back-version FreeBSD
#  in which some of these were NOT defined in <bsd.port.make>.
.if !defined(SETENV)
SETENV=		WRKSRC=${WRKSRC};WRKDIR=${WRKDIR};HOMEDIR=${.CURDIR};\
		PATCHDIR=${PATCHDIR};FILESDIR=${FILESDIR};\
		SCRIPTDIR=${SCRIPTDIR};PREFIX=${PREFIX};PKGDIR=${PKGDIR};
.endif
.if !defined(MAKE_ENV)
MAKE_ENV+=	export WRKSRC WRKDIR HOMEDIR PATCHDIR FILESDIR SCRIPTDIR\
		PREFIX PKGDIR;
.endif
.if !defined(CP)
CP=		/bin/cp
.endif
.if !defined(CAT)
CAT=		/bin/cat
.endif
.if !defined(RM)
RM=		/bin/rm
.endif
.if !defined(MKDIR)
MKDIR=		/bin/mkdir
.endif
