tech-pkg archive

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

Re: [PATCH] cmake/build.mk: Hide non-buildlink3 libraries from cmake



> Date: Sat, 5 Apr 2025 19:14:21 +1100
> From: Paul Ripke <stix%stix.id.au@localhost>
> 
> Finally updating to pkgsrc-2025Q1, and tripping over what appears to
> be breakage due to this? Looks like ${WRKDIR} is leaking into installed
> cmake files. I tripped over this with cad/occt, used from
> e.g. wip/prusaslicer, and I've also tried and failed to remove the leak
> from wip/soqt. I *think* that the boost ones are harmless, but still
> look messy.

Well, that's frustrating.

> I guess maybe CHECK_WRKREF could catch this?

Yes, we should adapt CHECK_WRKREF to catch this.  It'll require some
work because not all of the wrkrefs are necessarily problems, as you
noted, but probably everything in INTERFACE_LINK_LIBRARIES lines is a
problem.

> ksh$ grep -r pkgwrk /usr/pkg/lib/cmake
> /usr/pkg/lib/cmake/minizip-ng/minizip-ng.cmake:  INTERFACE_LINK_LIBRARIES "/tmp/pkgwrk/archivers/minizip-ng/work/.buildlink/lib/libz-ng.so;/usr/lib/libbz2.so;lzma;zstd;ssl;crypto"
> /usr/pkg/lib/cmake/mongoc-1.0/mongoc-targets.cmake:  INTERFACE_LINK_LIBRARIES "/tmp/pkgwrk/databases/mongo-c-driver/work/.buildlink/lib/libsnappy.so;/usr/lib/libz.so;/usr/pkg/lib/libzstd.so;mongo::bson_static;mongo::detail::c_dependencies"
> /usr/pkg/lib/cmake/opencascade/OpenCASCADEDrawTargets.cmake:  INTERFACE_LINK_LIBRARIES "TKernel;TKG2d;TKGeomBase;TKG3d;TKMath;TKBRep;TKGeomAlgo;TKShHealing;TKMesh;TKService;TKHLR;TKTopAlgo;/tmp/pkgwrk/cad/occt/work/.buildlink/lib/libtcl86.so;/tmp/pkgwrk/cad/occt/work/.buildlink/lib/libtk86.so;X11;pthread;rt;stdc++"

The workaround we have used for this has been something like

SUBST_CLASSES+=		unbl3
SUBST_MESSAGE.unbl3=	Undoing buildlink3 paths in cmake exports.
SUBST_STAGE.unbl3=	post-build
SUBST_FILES.unbl3+=	${CMAKE_BUILD_DIR}/src/CMakeFiles/Export/*/*Targets.cmake
SUBST_SED.unbl3+=	-e 's,${BUILDLINK_DIR}/lib,${PREFIX}/lib,g'

However, this approach is not scaling well (see, e.g., x11/libfm-qt),
and I suspect the problem is better treated at the source.

The cmake documentation has some recommendations, in the context of
relocatable packages (even though pkgsrc does not make relocatable
packages), but I am not yet sure immediately how to implement them:

https://cmake.org/cmake/help/latest/prop_tgt/INTERFACE_LINK_LIBRARIES.html#creating-relocatable-packages
https://cmake.org/cmake/help/latest/manual/cmake-packages.7.html#creating-relocatable-packages

In the case of chat/occt, it looks like the logic to generate target
link libraries might live in ${WRKSRC}/adm/cmake/occt_toolkit.cmake.


Home | Main Index | Thread Index | Old Index