Subject: options.mk in buildlink files?
To: None <tech-pkg@netbsd.org>
From: Christian Hattemer <c.hattemer@arcor.de>
List: tech-pkg
Date: 04/19/2006 17:57:56
Hi,

it annoys me that cairo builds glitz, which isn't really necessary to use it
with gtk. So I added cairo an option to disable glitz. This works fine when
doing cd pkgsrc/graphics/cairo && make.

However when another pkg, e.g. pango, builds on cairo it will pull in glitz
from cairo's buildlink3.mk and build it anyway. If I remove the line that
includes the glitz buildlink in cairo's buildlink3.mk it's fine. But it has
to be done conditionally since it will break when the option is turned on
and cairo is built with glitz again.

After discussion with hubertf@ on IRC yesterday I've come up with the
patches below. They seem to work, but building looks somewhat strange
because cairo's options are printed twice now: Once by pango before the
build goes down to build cairo and then by cairo itself.

It seems this isn't the right way to go. How is it done?

Please CC me on reply.

Bye, Chris

Index: graphics/cairo/Makefile
===================================================================
RCS file: /cvsroot/pkgsrc/graphics/cairo/Makefile,v
retrieving revision 1.35
diff -u -r1.35 Makefile
--- graphics/cairo/Makefile    17 Apr 2006 13:45:57 -0000    1.35
+++ graphics/cairo/Makefile    19 Apr 2006 15:33:05 -0000
@@ -16,13 +16,14 @@
 GNU_CONFIGURE=        yes
 CONFIGURE_ARGS+=    --disable-atsui
 CONFIGURE_ARGS+=    --disable-xcb
-CONFIGURE_ARGS+=    --enable-glitz
 CONFIGURE_ARGS+=    --enable-pdf
 CONFIGURE_ARGS+=    --enable-ps
 CONFIGURE_ARGS+=    --with-html-dir=${PREFIX}/share/doc
 
 .include "../../mk/bsd.prefs.mk"
 
+.include "options.mk"
+
 .if ${OPSYS} == "Darwin" &&
exists(/System/Library/Frameworks/Quartz.framework)
 CONFIGURE_ARGS+=    --enable-quartz
 PLIST_SUBST+=        QUARTZ=
@@ -33,7 +34,6 @@
 BUILDLINK_API_DEPENDS.freetype2+=    freetype2>=2.1.5
 BUILDLINK_API_DEPENDS.Xft2+=    Xft2>=2.1.2
 BUILDLINK_API_DEPENDS.Xrender+=    Xrender>=0.8
-BUILDLINK_API_DEPENDS.glitz+=    glitz>=0.4.4
 BUILDLINK_API_DEPENDS.libpixman+=    libpixman>=0.1.5
 
 .include "../../mk/compiler.mk"
@@ -47,7 +47,6 @@
 .include "../../fonts/fontconfig/buildlink3.mk"
 .include "../../fonts/Xft2/buildlink3.mk"
 .include "../../graphics/freetype2/buildlink3.mk"
-.include "../../graphics/glitz/buildlink3.mk"
 .include "../../graphics/libpixman/buildlink3.mk"
 .include "../../graphics/png/buildlink3.mk"
 .include "../../x11/Xrender/buildlink3.mk"
Index: graphics/cairo/buildlink3.mk
===================================================================
RCS file: /cvsroot/pkgsrc/graphics/cairo/buildlink3.mk,v
retrieving revision 1.16
diff -u -r1.16 buildlink3.mk
--- graphics/cairo/buildlink3.mk    17 Apr 2006 13:45:57 -0000    1.16
+++ graphics/cairo/buildlink3.mk    19 Apr 2006 15:33:05 -0000
@@ -20,11 +20,12 @@
 BUILDLINK_API_DEPENDS.Xrender+=    Xrender>=0.8
 .endif    # CAIRO_BUILDLINK3_MK
 
+.include "options.mk"
+
 .include "../../devel/zlib/buildlink3.mk"
 .include "../../fonts/fontconfig/buildlink3.mk"
 .include "../../fonts/Xft2/buildlink3.mk"
 .include "../../graphics/freetype2/buildlink3.mk"
-.include "../../graphics/glitz/buildlink3.mk"
 .include "../../graphics/libpixman/buildlink3.mk"
 .include "../../graphics/png/buildlink3.mk"
 .include "../../x11/Xrender/buildlink3.mk"
Index: mk/defaults/options.description
===================================================================
RCS file: /cvsroot/pkgsrc/mk/defaults/options.description,v
retrieving revision 1.97
diff -u -r1.97 options.description
--- mk/defaults/options.description    2 Apr 2006 17:45:18 -0000    1.97
+++ mk/defaults/options.description    19 Apr 2006 15:33:05 -0000
@@ -87,6 +87,7 @@
 gif            Enable GIF support.
 gimp1-helpbrowser    Link against gnome1 to get a help browser.
 glib1    
+glitz            Enable glitz backend.
 glpk    
 gnome    
 gnupg    


------------- new cairo options.mk -----------------
# $NetBSD$

PKG_OPTIONS_VAR=    PKG_OPTIONS.cairo
PKG_SUPPORTED_OPTIONS=    glitz
PKG_SUGGESTED_OPTIONS=    glitz

.include "../../mk/bsd.options.mk"

.if !empty(PKG_OPTIONS:Mglitz)
BUILDLINK_API_DEPENDS.glitz+=    glitz>=0.4.4
.include "../../graphics/glitz/buildlink3.mk"
CONFIGURE_ARGS+=    --enable-glitz
PLIST_SUBST+=        GLITZ=
.else
CONFIGURE_ARGS+=    --disable-glitz
PLIST_SUBST+=        GLITZ="@comment "
.endif