tech-pkg archive

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

Re: inconsistent freetype2/fontconfig/libXft



On Sun, Nov 01, 2026 at 07:41:05AM -0500, Greg Troxel wrote:
 > > How's
 > >          # 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.
 > >
 > > ?
 > >
 > > There's another comment above the loop that explains what the whole
 > > thing is doing; if that's not good enough, it should be improved too.
 > >
 > > (I wrote the whole thing some years back and there's a decent chance
 > > I'm the only person who understands it :-| )
 > 
 > That's ok, except that I would like to see the point that the right
 > answer is the pkg version more in your face, despite being above,
 > because the whole scheme is surprising to find out it exists.   Once you
 > think about it for 10s, it's obviously necessary and the right approach.
 > But until this discussion I had no idea.

Right above this text it also says

         # not ok for it to be builtin; force it to pkgsrc
         USE_BUILTIN.${_pkg_:S/^-//}:=no

perhaps I should expand that?

Index: mk/buildlink3/bsd.buildlink3.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/buildlink3/bsd.buildlink3.mk,v
retrieving revision 1.266
diff -u -r1.266 bsd.buildlink3.mk
--- mk/buildlink3/bsd.buildlink3.mk	3 May 2025 16:02:45 -0000	1.266
+++ mk/buildlink3/bsd.buildlink3.mk	1 Nov 2026 22:13:22 -0000
@@ -117,6 +117,13 @@
 # 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 @@
 .  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,//}


-- 
David A. Holland
dholland%netbsd.org@localhost


Home | Main Index | Thread Index | Old Index