pkgsrc-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: pkgsrc/mk/buildlink3



Module Name:    pkgsrc
Committed By:   dholland
Date:           Sun Nov  1 23:17:04 UTC 2026

Modified Files:
        pkgsrc/mk/buildlink3: bsd.buildlink3.mk

Log Message:
bsd.buildlink.mk: add hack/workaround for PR 57517

Something, at some point, some years back, changed the interaction of
things such that for builtin packages, BUILDLINK_PREFIX.pkg gets set
before we're done assessing whether to use the builtin package, and in
particular before the logic that makes USE_BUILTIN.pkg=no transitive
across deps.

The result has been that when this logic sets USE_BUILTIN.pkg=no, it's
ignored and we buildlink and use the builtin package anyway. This then
results in broken builds of things like fontconfig and Xft2 where this
matters.

As a workaround, clear BUILDLINK_PREFIX.pkg if we set USE_BUILTIN.pkg
to no in this logic. It will then get set to PKGBASE as needed later.

Strengthen the comments in and around this logic too, as what it does
is itself somewhat complicated and confusing and the implementation
is more so.

("Transitive across deps" means that if there's a builtin package A
that we're not using, and a package B that depends on A, we can't use
the builtin B either.)


To generate a diff of this commit:
cvs rdiff -u -r1.266 -r1.267 pkgsrc/mk/buildlink3/bsd.buildlink3.mk

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/mk/buildlink3/bsd.buildlink3.mk
diff -u pkgsrc/mk/buildlink3/bsd.buildlink3.mk:1.266 pkgsrc/mk/buildlink3/bsd.buildlink3.mk:1.267
--- pkgsrc/mk/buildlink3/bsd.buildlink3.mk:1.266        Sat May  3 16:02:45 2025
+++ pkgsrc/mk/buildlink3/bsd.buildlink3.mk      Sun Nov  1 23:17:04 2026
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.buildlink3.mk,v 1.266 2025/05/03 16:02:45 tnn Exp $
+# $NetBSD: bsd.buildlink3.mk,v 1.267 2026/11/01 23:17:04 dholland Exp $
 #
 # Copyright (c) 2004 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -117,6 +117,13 @@ BUILDLINK_BUILTIN_MK.${_pkg_}?=    ${BUILDL
 # is set to "no" if that package depends on any other packages where
 # USE_BUILTIN.pkg is set to "no".
 #
+# That is: fontconfig depends on freetype2, so a builtin fontconfig is
+# linked to a builtin freetype2. Therefore, if we are using pkgsrc
+# freetype2 and not builtin freetype2, we can't use builtin fontconfig
+# either. Trying will either fail at build time, if we're lucky, or
+# produce runtime nasal demons if not. (Not a hypothetical example:
+# getting broken fontconfig packages was what motivated this logic.)
+#
 
 _stack_:=bot
 _ok_:=yes
@@ -131,10 +138,20 @@ _ok_:=yes
 .  else
      # leaving a package (in the buildlink tree)
 .    if ${USE_BUILTIN.${_pkg_:S/^-//}:Uno:M[Yy][Ee][Ss]}
-       # this package is going to use the builtin version
+       # This package is, so far, going to be the builtin version.
 .      if ${_ok_} != yes
-         # not ok for it to be builtin; force it to pkgsrc
+         # We've seen a non-builtin dependency. That makes it not ok
+         # for this package to be builtin. Force the pkgsrc version.
          USE_BUILTIN.${_pkg_:S/^-//}:=no
+         # If the buildlink prefix is already set, it is pointing to
+         # the builtin version. Clear it; otherwise the buildlink
+         # logic will blindly use it and we'll buildlink the builtin
+         # version regardless of the USE_BUILTIN setting, and then
+         # things break. XXX: this is a hack.
+.        undef BUILDLINK_PREFIX.${_pkg_:S/^-//}
+         # Record what we did. If you're getting unexpected results
+         # from this logic, try make show-var VARNAME=FORCED_PKGSRC or
+         # VARNAME=FORCED_PKGSRC_REASONS.
          FORCED_PKGSRC+=${_pkg_:S/^-//}
          # using += here fails to evaluate ${_ok_} until after the loop
          FORCED_PKGSRC_REASONS:=${FORCED_PKGSRC_REASONS} ${_pkg_:S/^-//}:${_ok_:S/^no,//}



Home | Main Index | Thread Index | Old Index