On 2026/07/08 06:14, Stuart Cassoff wrote:
> Hi, thanks for having a look.
>
> On Mon, 6 Jul 2026, Stuart Henderson wrote:
> >
> > This with ports/x/y/tcl8 and ports/x/y/tcl9 and various duplication
> > and fiddling with Makefile.inc feels particularly awkward, especially
> > when it needs replicating for every Tcl extension port.
> >
> > It should be possible to do this with non-conflicting flavours of the
> > same port, similar to how python ports used to handle py2 + py3. The
> > difference compared to old python being that with this, one would
> > need to depend on the other, but I don't think that's a problem.
>
> Ok, I think I've got something working.
> Could you name a port that does/did this that I can use for example?
>
>
> > Most of the mechanism would be common to all Tcl extension ports
> > so could go in lang/tcl/tcl.port.mk so it's mostly one-time work to
> > do the setup there, with smaller changes to the individual ports as
> > they're moved across to it.
> >
> > For the files which need to be present in only one of the flavoured
> > packages, I'd use the SUBST_VARS trick with a variable that defined to
> > either "@comment " or "" and use that to prefix those files in PLIST so
> > a single PLIST can be shared between the flavours. Other differences in
> > PLISTs are mostly going to be formulaic so you'd have e.g. for these
>
> Seems I'm successful with that, though I can't guess (yet) what could
> be factored into tcl.port.mk.
>
>
> > : libxyz123.so, libxyz123.so.0.0 and libxyzstub123.a.
> > : libtcl9xyz123.so, libtcl9xyz123.so.0.0, and libxyzstub.a.
> >
> > you could set this in the tcl-xyz port
> >
> > MODTCL_LIBV= 123
> >
> > and in the module, other vars depending on the flavour (tcl8/tcl9),
> > to either of
> >
> > MODTCL_EXTLIB= libtcl9
> > MODTCL_STUB= stub.a
> >
> > MODTCL_EXTLIB= lib
> > MODTCL_STUB= stub${MODTCL_LIBV}.a
>
> I don't really get this but it doesn't seem as important right now.
> I figure the right bits will make themselves evident once a few
> ports have been converted.
An important part of this is that where you have a file where the
names differ for Tcl8/Tcl9 but it's broadly equivalent (i.e. the
loadable .so, or the linkable library), it's represented by a
single PLIST entry that uses variables to expand to the relevant
filename for the current flavour.
You just want to have an @comment/"" variable to 'turn off' the
files that you don't want in one of the flavours, rather than using
them for "either/or" lines in PLISTs.
That way you just need to make sure you're using the correct flavour
(presumably Tcl9) which includes pkgIndex etc when you generate the
PLIST, and life is much much easier for updates/new ports. Otherwise
you need to reinstate the lines for the other of the "either/or"
options (or deal with a PLIST and a couple of PFRAG files).
> I wan't too clear about the lib names.
> Probably not obvious what they mean.
> Basically two types: loadable-only and loadable/linkable+optional_stub.
> Loadable libs in ${LOCALBASE}/lib/tcl/xyz
> Linkable libs in ${LOCALBASE}/lib
>
> The default names are:
>
> Ver Loadable Linkable Stub
> Tcl8 libxyz123.so libxyz123.so.0.0 libxyzstub123.a
> Tcl9 libtcl9xyz123.so libtcl9xyz123.so.0.0 libxyzstub.a
>
>
> I want the Tcl9 stub name to conform: libtcl9xyzstub123.a
>
> I do think that the Tcl9 stub lib can be used for both.
> Until that gets worked-out, I'd like to use this consistent naming.
>
>
> Stu
>