[Bug 262109] Mk/Uses/python.mk: coddle cmake with more hints

From: <bugzilla-noreply_at_freebsd.org>
Date: Mon, 21 Feb 2022 22:37:15 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=262109

            Bug ID: 262109
           Summary: Mk/Uses/python.mk: coddle cmake with more hints
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: Individual Port(s)
          Assignee: jbeich@FreeBSD.org
          Reporter: jcfyecrayz@liamekaens.com
          Assignee: jbeich@FreeBSD.org
             Flags: maintainer-feedback?(jbeich@FreeBSD.org)

Created attachment 231998
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=231998&action=edit
[patch] suport FindPython.cmake, FindPython3.cmake, FindPython2.cmake modules

cmake supports more than one way to search for python.
Uses/python.mk passes -DPython_ADDITIONAL_VERSIONS=${PYTHON_VER} to help cmake
"find" the version of python that a port build wants to use.

The FindPython{,2,3}.cmake modules don't know anything about
Python_ADDITIONAL_VERSIONS.  The FindPython{Interp,Libs}.cmake modules do.  The
former use Python{,2,3}_EXECUTABLE as the hint.  I didn't do the archeology to
see which flavor of FindPython*.cmake came first, but of course it makes sense
in the bizarre world of cmake that you would not make a later flavor
compatible.  Oh cmake, how do I hate thee?  Let me count the ways.

Recently a couple ports broke when a newer version of python is installed in
addition to the default version of python (currently 3.8).

For instance, if python3.10 was installed in addition to python3.8 (and many
packages installed in the lib/python3.8/site-packages area), multimedia/onevpl
broke before ports/0378719b21c61d5a5d3dc8f31be7781fd7ff11ef.  See bug 261415.

Now graphics/libjxl has the same problem.  I did not open a bug for
graphics/libjxl yet.  Instead it seems that we need to appease cmake's
additional python support modules by adding more knobs to tell cmake what
version of python to use in case the port uses a different flavor of FindPython
than the one that wants Python_ADDITIONAL_VERSIONS.

Attached is a patch for Uses/python.mk that does that.  Feedback please.

-- 
You are receiving this mail because:
You are the assignee for the bug.