Subject: Re: pkgconfig and buildlink
To: None <mcmahill@mtl.mit.edu>
From: Johnny Lam <jlam@jgrind.org>
List: tech-pkg
Date: 03/19/2002 21:31:49
--45Z9DzgjV8m4Oswq
Content-Type: text/plain; charset=us-ascii

On Tue, Mar 19, 2002 at 08:35:57PM -0500, mcmahill@mtl.mit.edu wrote:
>
[ buildlink pkg-config implementation removed ]
> 
> The idea is just to create a wrapper around pkg-config.  Have to be a bit
> careful about return values as pkg-config's return value does mean
> something.

I'll modify the wrapper generated by _BUILDLINK_CONFIG_WRAPPER_USE to
respect the return value.  It makes a lot of sense to be more careful
here, and it would allow just reusing that macro target to generate
the pkg-config wrapper.

> Comments?  Maybe I should put this instead in a
> devel/pkgconfig/buildlink.mk file?  Maybe we need a USE_PKG_CONFIG
> variable?

Yes, I think a devel/pkgconfig/buildlink.mk file would be better.  The
idea is that pkgconfig/buildlink.mk should be included by packages that
actually use pkg-config, so unless glib2 or gtk2 _use_ pkg-config, then
their buildlink.mk files really don't need to include pkgconfig's.  I
was thinking something like the attached file (after I make the above
mentioned change to _BUILDLINK_CONFIG_WRAPPER_USE).  Note that it adds
a build dependency on pkgconfig and not a regular dependency, as from
your description, I don't think pkg-config is used at run-time.

	Comments?

	-- Johnny Lam <jlam@jgrind.org>

--45Z9DzgjV8m4Oswq
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="buildlink.mk"

.if !defined(PKGCONFIG_BUILDLINK_MK)

BUILDLINK_DEPENDS.pkgconfig?=	pkgconfig-[0-9]*
BUILD_DEPENDS+=		${BUILDLINK_DEPENDS.pkgconfig}:../../devel/pkgconfig

EVAL_PREFIX+=		BUILDLINK_PREFIX.pkgconfig=pkgconfig
BUILDLINK_PREFIX.pkgconfig_DEFAULT=	${LOCALBASE}

BUILDLINK_TARGETS.pkgconfig=	pkgconfig-buildlink-config-wrapper
BUILDLINK_TARGETS+=		${BUILDLINK_TARGETS.pkgconfig}

BUILDLINK_CONFIG.pkgconfig=	\
	${BUILDLINK_PREFIX.pkgconfig}/bin/pkg-config
BUILDLINK_CONFIG_WRAPPER.pkgconfig=	\
	${BUILDLINK_DIR}/bin/pkg-config
REPLACE_BUILDLINK_SED+=	\
	-e "s|${BUILDLINK_CONFIG_WRAPPER.pkgconfig}|${BUILDLINK_CONFIG.pkgconfig}|g"

.if defined(USE_CONFIG_WRAPPER)
PKG_CONFIG?=		${BUILDLINK_CONFIG_WRAPPER.pkgconfig}
CONFIGURE_ENV+=		PKG_CONFIG="${PKG_CONFIG}"
MAKE_ENV+=		PKG_CONFIG="${PKG_CONFIG}"
.endif

pre-configure: ${BUILDLINK_TARGETS.pkgconfig}
pkgconfig-buildlink-config-wrapper: _BUILDLINK_CONFIG_WRAPPER_USE

.endif	# PKGCONFIG_BUILDLINK_MK

--45Z9DzgjV8m4Oswq--