Subject: Re: options.mk in buildlink files?
To: Todd Vierling <tv@duh.org>
From: Christian Hattemer <c.hattemer@arcor.de>
List: tech-pkg
Date: 04/20/2006 17:02:41
Hello Todd,

On 19.04.06, you wrote:

> Do dependencies of cairo *actually* break when built without the line
> in cairo/buildlink3.mk?  (The point here is that if cairo hides the
> glitz API from cairo's dependents, then the dependents don't need the
> .include in cairo/buildlink3.mk.)

It looks a bit strange that (when building with glitz enabled) the
requirements listings at the beginning of the build and after install
sometimes list glitz and sometimes don't. This may have to do with build
vs. run depends, but it still looks a bit strange. E.g. pango lists it at
the start and not after install and not in the package. With cairo it's the
oposite, IIRC.

pango builds ok without the line, make test runs ok, it doesn't package due
to some missing files (however I do have older packages from it, seems
something changed). But it runs ok, at least for gtk2. I had it quite
some time this way, but I need the package now.

>> It seems this isn't the right way to go. How is it done?
>
> See graphics/aalib/buildlink3.mk for an example.

Thanks for the hint. It think this should be mentioned in the pkgsrc guide
in a section that could be named "nifty tricks you can't dig out yourself
easily", or something like that.

Please also add an "Published at" timestamp to the titlepage, as the NetBSD
guide has it. The timestamp on the RCS id of pkgsrc.xml doesn't say much
about how uptodate the rest of the document is.

Here's also the revised diff.

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    20 Apr 2006 14:53:44 -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    20 Apr 2006 14:53:44 -0000
@@ -20,11 +20,21 @@
 BUILDLINK_API_DEPENDS.Xrender+=    Xrender>=0.8
 .endif    # CAIRO_BUILDLINK3_MK
 
+.if !defined(PKG_BUILD_OPTIONS.cairo)
+PKG_BUILD_OPTIONS.cairo!=                        \
+    cd ${BUILDLINK_PKGSRCDIR.cairo} &&                \
+    ${MAKE} show-var ${MAKEFLAGS} VARNAME=PKG_OPTIONS
+MAKEFLAGS+=    PKG_BUILD_OPTIONS.cairo=${PKG_BUILD_OPTIONS.cairo:Q}
+.endif
+MAKEVARS+=    PKG_BUILD_OPTIONS.cairo
+
 .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"
+.if !empty(PKG_BUILD_OPTIONS.cairo:Mglitz)
+.  include "../../graphics/glitz/buildlink3.mk"
+.endif
 .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    20 Apr 2006 14:53:44 -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 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