Subject: .include "../../mk/bsd.prefs.mk" and EXTRA ITEM problem..
To: None <tech-pkg@netbsd.org>
From: Tomasz Luchowski <zuntum@eik.pl>
List: tech-pkg
Date: 01/03/2001 18:07:18
Hey,

I have some problems modifying pkgsrc/chat/epic4.

At the moment it looks like that:

root@cappi:/usr/pkgsrc/chat/epic4.orig# cat Makefile
# $NetBSD: Makefile,v 1.2 2000/12/30 11:43:06 hubertf Exp $
#

DISTNAME=       epic4-0.9.15
CATEGORIES=     chat
MASTER_SITES=   ftp://ftp.epicsol.org/pub/epic/EPIC4-BETA/ \
                ftp://ftp.magenet.com/pub/epic/EPIC4-BETA/ \
                http://zuntum.eik.pl/pkgsrc/distfiles/
DISTFILES=      epic4-0.9.15.tar.gz \
                epic4pre2-help.tar.gz

.if defined(USE_INET6) && ${USE_INET6} == "YES"
PATCH_SITES=    http://zuntum.eik.pl/patches/ \
                http://zuntum.invisible.yi.org/patches/
PATCHFILES=     epic4-0.9.15-ipv6-netbsd-20001230.patch.bz2
PATCH_DIST_STRIP=       -p1
.endif

MAINTAINER=     zuntum@eik.pl
HOMEPAGE=       http://www.epicsol.org/

EXTRACT_ONLY=   epic4-0.9.15.tar.gz

GNU_CONFIGURE=  YES

post-install:
                cd ${PREFIX}/share/epic && ( ${GUNZIP_CMD} -c ${DISTDIR}/epic4pre2-help.tar.gz | ${GTAR} xf - )

.include "../../mk/bsd.pkg.mk"

root@cappi:/usr/pkgsrc/chat/epic4.orig# make lint | egrep 'WARN|FATAL' | grep -v sane
WARN: extra item placed in the PATCH_SITES section.

That's acceptable. Now I want to include  "../../mk/bsd.prefs.mk" before specifying
PATCH_SITES and PATCHFILES to have USER_INET6 defined (.include is necessary as this value is taken from bsd.prefs.mk)
(the patch adds IPv6 support)

That's how itojun did it in pkgsrc/net/wget: he specified PATCHFILE, then put '.include prefs.mk',
and later he put .if defined(USE_INET6) && ${USE_INET6} == "YES". It it's true, ./configure gets --enable-ipv6,
else --disable-ipv6. But here, I can't fallback to ipv4-only build after applying the patch (configure doesn't know
about --enable-ipv6 or --disable-ipv6).
I tried to include  "../../mk/bsd.prefs.mk" immediatelly after DISTFILES section, before PATCH_SITES.
I did it in this place to have USER_INET6 defined (.include is necessary as this value
is taken from bsd.prefs.mk) before specifying PATCHFILES (or not doing that if USE_INET6=NO), but pkglint complains :/

Now it looks like that:

DISTNAME=       epic4-0.9.15
CATEGORIES=     chat
MASTER_SITES=   ftp://ftp.epicsol.org/pub/epic/EPIC4-BETA/ \
                ftp://ftp.magenet.com/pub/epic/EPIC4-BETA/ \
                http://zuntum.eik.pl/pkgsrc/distfiles/
DISTFILES=      epic4-0.9.15.tar.gz \
                epic4pre2-help.tar.gz

# to get USE_INET6
.include "../../mk/bsd.prefs.mk"

.if defined(USE_INET6) && ${USE_INET6} == "YES"
PATCH_SITES=    http://zuntum.eik.pl/patches/ \
                http://zuntum.invisible.yi.org/patches/
PATCHFILES=     epic4-0.9.15-ipv6-20001212.patch.gz
PATCH_DIST_STRIP=       -p1
.endif

and pkglint's output:
root@cappi:/usr/pkgsrc/chat/epic4# make lint
OK: checking Makefile.
WARN: is "epic4" sane as package name WITHOUT version number? if not, avoid "-" in version number part of DISTNAME.
FATAL: extra item ".include "../../mk/bsd.prefs.mk"" placed in the MAINTAINER section.
WARN: please add HOMEPAGE if the package has one.
FATAL: no MAINTAINER listed in Makefile.
WARN: "PATCH_SITES" has to appear earlier in Makefile.
WARN: "PATCHFILES" has to appear earlier in Makefile.
WARN: "PATCH_DIST_STRIP" has to appear earlier in Makefile.
WARN: "PATCH_SITES" has to appear earlier in Makefile.
WARN: "PATCHFILES" has to appear earlier in Makefile.
WARN: "PATCH_DIST_STRIP" has to appear earlier in Makefile.
WARN: "MAINTAINER" has to appear earlier in Makefile.
WARN: "HOMEPAGE" has to appear earlier in Makefile.
OK: checking pkg/PLIST.
OK: checking pkg/COMMENT.
OK: checking pkg/DESCR.
OK: checking files/md5.
2 fatal errors and 10 warnings found.
*** Error code 2

Stop.

What's the correct way to handle this USE_INET6? I don't want to use simple 'make USE_INET6=YES/NO'

-- 
/* [zuntum] zuntum@eik.pl , [WWW] http://zuntum.net */