tech-pkg archive

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

Re: TOOL_DEPENDS



> Date: Thu, 1 Aug 2024 07:54:53 +0100
> From: Jonathan Perkin <jperkin%mnx.io@localhost>
> 
> * On 2024-07-31 at 18:13 BST, Thomas Klausner wrote:
> 
> >Since ecl needs compiler support, the headers and libraries need to be
> >buildlink'ed in, so do that (include its buildlink3.mk file). But
> >since ecl's not needed at runtime (no shared libraries, right?) you
> >can set
> >
> >BUILDLINK_DEPMETHOD.ecl=build
> >
> >in the package including ecl/buildlink3.mk, before including that
> >bl3.mk file.
> 
> I would strongly advise that we don't recommend using DEPMETHOD=build 
> unless you are absolutely sure it will only ever be used in a leaf 
> context.

DEPMETHOD=build is almost certainly justifiable here because of what
lang/sbcl is doing, even though lang/sbcl may not be a leaf package.

lang/sbcl is a Common Lisp implementation (view it as a compiler
toolchain for our purposes), which does things in two stages:

1. builds itself using some choice of host toolchain as a bootstrap
   (ecl, clisp, abcl, or existing sbcl)

2. builds itself with itself

Stage (1), when done with ECL, likely requires ecl/buildlink3.mk -- it
probably uses header files from $PREFIX/include/ecl and produces an
executable that is linked against $PREFIX/lib/libecl.so.

But that binary is used only in stage (2) and then thrown away.  After
stage (2), the newly built SBCL has been built with the bootstrap
SBCL, not with ECL, and no longer links against $PREFIX/lib/libecl.so
or anything.

If there are any remnants of ECL in the stage-2 SBCL build output,
which is what actually gets installed by the package, I expect the
SBCL developers would consider that to be a serious bug.


(Now, buildlink3.mk and DEPMETHOD=build is also not exactly right,
because we need to execute programs from lang/ecl as a build-time
toolchain, so this won't work for pkgsrc cross-builds.  A better model
for pkgsrc might be to split SBCL into

- lang/sbcl-bootstrap (stage 1, using lang/ecl buildlink3.mk)
- lang/sbcl (stage 2, using TOOL_DEPENDS+= sbcl-bootstrap)

but I'm not sure the SBCL supports that model well for actual
cross-builds, so it may not be worthwhile -- the supported method
requires running code on both the host and the target systems:
https://sourceforge.net/p/sbcl/sbcl/ci/24a6b32c98aad3204839ffbe4a74f73943dde784/tree/make.sh#l45)


Home | Main Index | Thread Index | Old Index