summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fonts/fontconfig/buildlink2.mk118
-rw-r--r--fonts/fontconfig/buildlink3.mk105
2 files changed, 199 insertions, 24 deletions
diff --git a/fonts/fontconfig/buildlink2.mk b/fonts/fontconfig/buildlink2.mk
index 247101210aa..15a0570e259 100644
--- a/fonts/fontconfig/buildlink2.mk
+++ b/fonts/fontconfig/buildlink2.mk
@@ -1,31 +1,117 @@
-# $NetBSD: buildlink2.mk,v 1.6 2004/02/09 20:20:43 reed Exp $
-#
-# This Makefile fragment is included by packages that use fontconfig.
-#
-# This file was created automatically using createbuildlink 2.2.
-#
+# $NetBSD: buildlink2.mk,v 1.7 2004/02/16 19:16:59 jlam Exp $
.if !defined(FONTCONFIG_BUILDLINK2_MK)
FONTCONFIG_BUILDLINK2_MK= # defined
-BUILDLINK_PACKAGES+= fontconfig
+.include "../../mk/bsd.prefs.mk"
+
BUILDLINK_DEPENDS.fontconfig?= fontconfig>=2.1nb1
-BUILDLINK_PKGSRCDIR.fontconfig?= ../../fonts/fontconfig
+BUILDLINK_PKGSRCDIR.fontconfig?= ../../x11/fontconfig
+# Check if we got fontconfig distributed with XFree86 4.x or if we need to
+# depend on the fontconfig package.
+#
+_REQUIRE_BUILTIN_FONTCONFIG?= NO
+
+_FONTCONFIG_FONTCONFIG_H= ${X11BASE}/include/fontconfig/fontconfig.h
+_X11_TMPL= ${X11BASE}/lib/X11/config/X11.tmpl
+
+.if !defined(_BUILTIN_FONTCONFIG)
+_BUILTIN_FONTCONFIG= NO
+. if exists(${_FONTCONFIG_FONTCONFIG_H}) && exists(${_X11_TMPL})
+_IS_BUILTIN.fontconfig!= \
+ if ${GREP} -q BuildFontconfigLibrary ${_X11_TMPL}; then \
+ ${ECHO} "YES"; \
+ else \
+ ${ECHO} "NO"; \
+ fi
+_BUILTIN_FONTCONFIG= ${_IS_BUILTIN.fontconfig}
+. if !empty(_IS_BUILTIN.fontconfig:M[yY][eE][sS])
+#
+# Create an appropriate package name for the built-in fontconfig distributed
+# with the system. This package name can be used to check against
+# BUILDLINK_DEPENDS.<pkg> to see if we need to install the pkgsrc version
+# or if the built-in one is sufficient.
+#
+_FONTCONFIG_MAJOR!= \
+ ${AWK} '/\#define[ ]*FC_MAJOR/ { print $$3 }' \
+ ${_FONTCONFIG_FONTCONFIG_H}
+_FONTCONFIG_MINOR!= \
+ ${AWK} '/\#define[ ]*FC_MINOR/ { print $$3 }' \
+ ${_FONTCONFIG_FONTCONFIG_H}
+_FONTCONFIG_REVISION!= \
+ ${AWK} '/\#define[ ]*FC_REVISION/ { print $$3 }' \
+ ${_FONTCONFIG_FONTCONFIG_H}
+_FONTCONFIG_VERSION= \
+ ${_FONTCONFIG_MAJOR}.${_FONTCONFIG_MINOR}.${_FONTCONFIG_REVISION}
+_FONTCONFIG_PKG= fontconfig-${_FONTCONFIG_VERSION}
+
+_BUILTIN_FONTCONFIG?= YES
+. for _depend_ in ${BUILDLINK_DEPENDS.fontconfig}
+. if !empty(_BUILTIN_FONTCONFIG:M[yY][eE][sS])
+_BUILTIN_FONTCONFIG!= \
+ if ${PKG_ADMIN} pmatch '${_depend_}' ${_FONTCONFIG_PKG}; then \
+ ${ECHO} "YES"; \
+ else \
+ ${ECHO} "NO"; \
+ fi
+. endif
+. endfor
+. endif
+. endif
+MAKEFLAGS+= _BUILTIN_FONTCONFIG=${_BUILTIN_FONTCONFIG}
+.endif
+
+.if !empty(_BUILTIN_FONTCONFIG:M[yY][eE][sS])
+_NEED_FONTCONFIG= NO
+.else
+_NEED_FONTCONFIG= YES
+.endif
+
+.if !empty(PREFER_NATIVE:M[yY][eE][sS]) && \
+ ${_BUILTIN_FONTCONFIG} == "YES"
+_NEED_FONTCONFIG= NO
+.endif
+.if !empty(PREFER_PKGSRC:M[yY][eE][sS])
+_NEED_FONTCONFIG= YES
+.endif
+.if !empty(PREFER_NATIVE:Mfontconfig) && \
+ ${_BUILTIN_FONTCONFIG} == "YES"
+_NEED_FONTCONFIG= NO
+.endif
+.if !empty(PREFER_PKGSRC:Mfontconfig)
+_NEED_FONTCONFIG= YES
+.endif
+
+.if !empty(_REQUIRE_BUILTIN_FONTCONFIG:M[yY][eE][sS])
+_NEED_FONTCONFIG= NO
+.endif
+
+.if ${_NEED_FONTCONFIG} == "YES"
+BUILDLINK_PACKAGES+= fontconfig
EVAL_PREFIX+= BUILDLINK_PREFIX.fontconfig=fontconfig
-BUILDLINK_PREFIX.fontconfig_DEFAULT= ${LOCALBASE}
-BUILDLINK_FILES.fontconfig+= include/fontconfig/fcfreetype.h
-BUILDLINK_FILES.fontconfig+= include/fontconfig/fcprivate.h
-BUILDLINK_FILES.fontconfig+= include/fontconfig/fontconfig.h
-BUILDLINK_FILES.fontconfig+= lib/libfontconfig.*
-BUILDLINK_FILES.fontconfig+= lib/pkgconfig/fontconfig.pc
+BUILDLINK_PREFIX.fontconfig_DEFAULT= ${X11PREFIX}
+#
+# If we depend on the package, depend on the latest version
+# with a library minor bump.
+#
+BUILDLINK_DEPENDS.fontconfig= fontconfig>=2.1nb2
+.else
+BUILDLINK_PREFIX.fontconfig= ${X11BASE}
+.endif
+
+BUILDLINK_FILES.fontconfig+= include/fontconfig/fcfreetype.h
+BUILDLINK_FILES.fontconfig+= include/fontconfig/fcprivate.h
+BUILDLINK_FILES.fontconfig+= include/fontconfig/fontconfig.h
+BUILDLINK_FILES.fontconfig+= lib/libfontconfig.*
-BUILDLINK_DEPENDS.freetype2= freetype2>=2.1.3
+USE_X11= yes
+.include "../../devel/zlib/buildlink2.mk"
.include "../../graphics/freetype2/buildlink2.mk"
.include "../../textproc/expat/buildlink2.mk"
-BUILDLINK_TARGETS+= fontconfig-buildlink
+BUILDLINK_TARGETS+= fontconfig-buildlink
fontconfig-buildlink: _BUILDLINK_USE
diff --git a/fonts/fontconfig/buildlink3.mk b/fonts/fontconfig/buildlink3.mk
index e19efd50f0b..85b1c732ce0 100644
--- a/fonts/fontconfig/buildlink3.mk
+++ b/fonts/fontconfig/buildlink3.mk
@@ -1,22 +1,111 @@
-# $NetBSD: buildlink3.mk,v 1.3 2004/02/09 20:20:43 reed Exp $
+# $NetBSD: buildlink3.mk,v 1.4 2004/02/16 19:16:59 jlam Exp $
-BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
FONTCONFIG_BUILDLINK3_MK:= ${FONTCONFIG_BUILDLINK3_MK}+
-.if !empty(BUILDLINK_DEPTH:M+)
-BUILDLINK_DEPENDS+= fontconfig
-.endif
+.include "../../mk/bsd.prefs.mk"
.if !empty(FONTCONFIG_BUILDLINK3_MK:M+)
BUILDLINK_PACKAGES+= fontconfig
BUILDLINK_DEPENDS.fontconfig+= fontconfig>=2.1nb1
-BUILDLINK_PKGSRCDIR.fontconfig?= ../../fonts/fontconfig
+BUILDLINK_PKGSRCDIR.fontconfig?= ../../x11/fontconfig
+.endif # FONTCONFIG_BUILDLINK3_MK
+
+BUILDLINK_CHECK_BUILTIN.fontconfig?= NO
+
+_FONTCONFIG_FONTCONFIG_H= ${X11BASE}/include/fontconfig/fonticonfig.h
+_X11_TMPL= ${X11BASE}/lib/X11/config/X11.tmpl
+
+.if !defined(BUILDLINK_IS_BUILTIN.fontconfig)
+BUILDLINK_IS_BUILTIN.fontconfig= NO
+. if exists(${_FONTCONFIG_FONTCONFIG_H}) && exists(${_X11_TMPL})
+_IS_BUILTIN.fontconfig!= \
+ if ${GREP} -q BuildFontconfigLibrary ${_X11_TMPL}; then \
+ ${ECHO} "YES"; \
+ else \
+ ${ECHO} "NO"; \
+ fi
+BUILDLINK_IS_BUILTIN.fontconfig= ${_IS_BUILTIN.fontconfig}
+. if !empty(BUILDLINK_CHECK_BUILTIN.fontconfig:M[nN][oO]) && \
+ !empty(_IS_BUILTIN.fontconfig:M[yY][eE][sS])
+#
+# Create an appropriate package name for the built-in fontconfig distributed
+# with the system. This package name can be used to check against
+# BUILDLINK_DEPENDS.<pkg> to see if we need to install the pkgsrc version
+# or if the built-in one is sufficient.
+#
+_FONTCONFIG_MAJOR!= \
+ ${AWK} '/\#define[ ]*FC_MAJOR/ { print $$3 }' \
+ ${_FONTCONFIG_FONTCONFIG_H}
+_FONTCONFIG_MINOR!= \
+ ${AWK} '/\#define[ ]*FC_MINOR/ { print $$3 }' \
+ ${_FONTCONFIG_FONTCONFIG_H}
+_FONTCONFIG_REVISION!= \
+ ${AWK} '/\#define[ ]*FC_REVISION/ { print $$3 }' \
+ ${_FONTCONFIG_FONTCONFIG_H}
+_FONTCONFIG_VERSION= \
+ ${_FONTCONFIG_MAJOR}.${_FONTCONFIG_MINOR}.${_FONTCONFIG_REVISION}
+_FONTCONFIG_PKG= fontconfig-${_FONTCONFIG_VERSION}
+
+BUILDLINK_IS_BUILTIN.fontconfig?= YES
+. for _depend_ in ${BUILDLINK_DEPENDS.fontconfig}
+. if !empty(BUILDLINK_IS_BUILTIN.fontconfig:M[yY][eE][sS])
+BUILDLINK_IS_BUILTIN.fontconfig!= \
+ if ${PKG_ADMIN} pmatch '${_depend_}' ${_FONTCONFIG_PKG}; then \
+ ${ECHO} "YES"; \
+ else \
+ ${ECHO} "NO"; \
+ fi
+. endif
+. endfor
+. endif
+. endif
+MAKEFLAGS+= \
+ BUILDLINK_IS_BUILTIN.fontconfig=${BUILDLINK_IS_BUILTIN.fontconfig}
+.endif
+
+.if !empty(BUILDLINK_IS_BUILTIN.fontconfig:M[yY][eE][sS])
+BUILDLINK_USE_BUILTIN.fontconfig= YES
+.else
+BUILDLINK_USE_BUILTIN.fontconfig= NO
+.endif
+
+.if !empty(PREFER_NATIVE:M[yY][eE][sS]) && \
+ !empty(BUILDLINK_IS_BUILTIN.fontconfig:M[yY][eE][sS])
+BUILDLINK_USE_BUILTIN.fontconfig= YES
+.endif
+.if !empty(PREFER_PKGSRC:M[yY][eE][sS])
+BUILDLINK_USE_BUILTIN.fontconfig= NO
+.endif
+.if !empty(PREFER_NATIVE:Mfontconfig) && \
+ !empty(BUILDLINK_IS_BUILTIN.fontconfig:M[yY][eE][sS])
+BUILDLINK_USE_BUILTIN.fontconfig= YES
+.endif
+.if !empty(PREFER_PKGSRC:Mfontconfig)
+BUILDLINK_USE_BUILTIN.fontconfig= NO
+.endif
+.if !empty(BUILDLINK_CHECK_BUILTIN.fontconfig:M[yY][eE][sS])
+BUILDLINK_USE_BUILTIN.fontconfig= YES
+.endif
+
+.if !empty(BUILDLINK_USE_BUILTIN.fontconfig:M[nN][oO])
+BUILDLINK_DEPENDS.fontconfig+= fontconfig>2.1nb2
+. if !empty(BUILDLINK_DEPTH:M+)
+BUILDLINK_DEPENDS+= fontconfig
+. endif
+.endif
+
+.if !empty(FONTCONFIG_BUILDLINK3_MK:M+)
+. if !empty(BUILDLINK_USE_BUILTIN.fontconfig:M[yY][eE][sS])
+BUILDLINK_PREFIX.fontconfig= ${X11BASE}
+. endif
+USE_X11= yes
BUILDLINK_DEPENDS.freetype2+= freetype2>=2.1.3
. include "../../devel/zlib/buildlink3.mk"
. include "../../graphics/freetype2/buildlink3.mk"
. include "../../textproc/expat/buildlink3.mk"
-.endif # FONTCONFIG_BUILDLINK3_MK
+.endif # FONTCONFIG_BUILDLINK3_MK
-BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:S/+$//}
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:S/+$//}