Subject: Xft2 buildlink2 patch for xfree-current (coming 4.3)
To: None <tech-pkg@netbsd.org>
From: Bernd Ernesti <netbsd@lists.veego.de>
List: tech-pkg
Date: 01/13/2003 20:34:24
--J/dobhs11T7y2rNN
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Hi,

xfree-current or the coming 4.3 release contains a newer Xft2 library,
so it would be nice to do the same hack as we have for freetype2.

Here is a patch for Xft2 which is not really tested, but I think
I share the patch here so someone else can take a look at it.

Oh, and fonts/fontconfig/buildlink2.mk needs also be patched
because that one is also included in a newer xfree, but I didn't
made the changes for it yet.

Bernd


--J/dobhs11T7y2rNN
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="xft2.buildlink2.patch"

Index: buildlink2.mk
===================================================================
RCS file: /home/source/NetBSD-cvs/main/pkgsrc/fonts/Xft2/buildlink2.mk,v
retrieving revision 1.3
diff -c -r1.3 buildlink2.mk
*** buildlink2.mk	24 Dec 2002 00:43:42 -0000	1.3
--- buildlink2.mk	1 Jan 2003 18:15:43 -0000
***************
*** 8,19 ****
  .if !defined(XFT2_BUILDLINK2_MK)
  XFT2_BUILDLINK2_MK=	# defined
  
! BUILDLINK_PACKAGES+=			Xft2
! BUILDLINK_DEPENDS.Xft2?=		Xft2>=2.1nb1
  BUILDLINK_PKGSRCDIR.Xft2?=		../../fonts/Xft2
  
  EVAL_PREFIX+=	BUILDLINK_PREFIX.Xft2=Xft2
  BUILDLINK_PREFIX.Xft2_DEFAULT=	${LOCALBASE}
  BUILDLINK_FILES.Xft2+=	include/X11/Xft/*
  BUILDLINK_FILES.Xft2+=	lib/libXft.*
  BUILDLINK_FILES.Xft2+=	lib/pkgconfig/xft.pc
--- 8,73 ----
  .if !defined(XFT2_BUILDLINK2_MK)
  XFT2_BUILDLINK2_MK=	# defined
  
! .include "../../mk/bsd.prefs.mk"
! 
! BUILDLINK_DEPENDS.Xft2?=		Xft2>=2.0.1
  BUILDLINK_PKGSRCDIR.Xft2?=		../../fonts/Xft2
  
+ # Check if we got Xft2 distributed with XFree86 4.x or if we need to
+ # depend on the Xft2 package.
+ #
+ _REQUIRE_BUILTIN_XFT2?=	NO
+ 
+ _XFT_H=			${X11BASE}/include/X11/Xft/Xft.h
+ _X11_TMPL=		${X11BASE}/lib/X11/config/X11.tmpl
+ .if exists(${_XFT_H}) && exists(${_X11_TMPL})
+ _IS_BUILTIN_XFT2!=	${GREP} -c BuildXftLibrary ${_X11_TMPL} || ${TRUE}
+ .else
+ _IS_BUILTIN_XFT2=	0
+ .endif
+ 
+ .if !empty(_REQUIRE_BUILTIN_XFT2:M[yY][eE][sS])
+ _NEED_XFT2=		NO
+ .else
+ .  if ${_IS_BUILTIN_XFT2} == "0"
+ _NEED_XFT2=		YES
+ .  else
+ #
+ # Create an appropriate Xft2 package name for the built-in Xft2
+ # distributed with XFree86 4.x.  This package name can be used to check
+ # against BUILDLINK_DEPENDS.Xft2 to see if we need to install the
+ # pkgsrc Xft2 or if the built-in one is sufficient.
+ #
+ _XFT2_MAJOR!= \
+ 	${AWK} '/.*\#define[[:blank:]]XFT_MAJOR/ { print $$3 }' ${_XFT_H}
+ _XFT2_MINOR!= \
+ 	${AWK} '/.*\#define[[:blank:]]XFT_MINOR/ { print "."$$3 }' ${_XFT_H}
+ _XFT2_REVISION!= \
+ 	${AWK} '/.*\#define[[:blank:]]XFT_REVISION/ { print "."$$3 }' ${_XFT_H}
+ _XFT2_VERSION=	${_XFT2_MAJOR}${_XFT2_MINOR}${_XFT2_REVISION}
+ _XFT2_PKG=	Xft2-${_XFT2_VERSION}
+ _XFT2_DEPENDS=	${BUILDLINK_DEPENDS.Xft2}
+ _NEED_XFT2!= \
+ 	if ${PKG_ADMIN} pmatch '${_XFT2_DEPENDS}' ${_XFT2_PKG}; then \
+ 		${ECHO} "NO";		\
+ 	else				\
+ 		${ECHO} "YES";		\
+ 	fi
+ .  endif
+ .endif
+ 
+ .if ${_NEED_XFT2} == "YES"
+ BUILDLINK_PACKAGES+=			Xft2
  EVAL_PREFIX+=	BUILDLINK_PREFIX.Xft2=Xft2
  BUILDLINK_PREFIX.Xft2_DEFAULT=	${LOCALBASE}
+ # If we depend on the package, depend on the latest version
+ # with a library major bump.
+ BUILDLINK_DEPENDS.Xft2?=	Xft2>=2.1
+ .else
+ BUILDLINK_PREFIX.Xft2=		${X11BASE}
+ USE_X11=			# defined
+ .endif
+ 
  BUILDLINK_FILES.Xft2+=	include/X11/Xft/*
  BUILDLINK_FILES.Xft2+=	lib/libXft.*
  BUILDLINK_FILES.Xft2+=	lib/pkgconfig/xft.pc

--J/dobhs11T7y2rNN--