Subject: build depends on bison or yacc?
To: None <>
From: Jeremy C. Reed <>
List: tech-pkg
Date: 07/30/2003 04:23:22
Many packages have a BUILD_DEPENDS on bison.

And some software just needs a BSD yacc to build (like flex and

It may be useful to have a pkgsrc/mk/ that sets YACC.
If it can't find a yacc, then it could do the BUILD_DEPENDS on bison and
set YACC to "bison -y".

I don't think it should do a BUILD_DEPENDS if the system already has a
bison or BSD yacc (and as long as it works).

I noticed a while ago that flex needs a yacc to build (PR #20772). And I
also packaged man-db which needs a yacc. (And my XFree86 package used a
yacc too.) And now I packaged mit-krb5 that also wants a yacc.

A basic idea is here:

# $NetBSD$
# This Makefile fragment is included by packages that need a yacc
# at build time.

.if !defined(YACC_MK)
YACC_MK= # defined

.if exists(/usr/bin/yacc)
   YACC=	/usr/bin/yacc
.elif exists(/usr/bin/bison)
   YACC=	/usr/bin/bison -y
   BUILD_DEPENDS+=		bison-[0-9]*:../../devel/bison
   YACC=	${LOCALBASE}/bin/bison -y

.endif  # YACC_MK

Also, it could have an option to choose to use byacc (I packaged it in
early April) instead of bison. Then all the packages that depend on bison
at a build time could be tested with a BSD yacc by using something like
USE_BSD_YACC=YES (in mk.conf) and
 #include "../../mk/"
to see if they really need bison or not.

Any thoughts?

   Jeremy C. Reed