Sun Sep 24 18:54:06 2023 UTC ()
meson: fix non-default Python sandboxed builds with py-cython

Since Meson is not Python versioned, but Cython is, we previously
ended up with a situation where builds of Cython-using packages
would fail. Instead of the Makefile kludge where it would simply
force the default Python version associated with Cython, use a
different hack that will search for all (presently) possible versions.

This is not an ideal solution, but is being committed to fix build
breakage in the lead up to branching pkgsrc 2023Q3. Other solutions
would be to go back to Python versioned Meson, or getting Meson to
handle multi-Python environments more cleanly.


(gutteridge)
diff -r1.56 -r1.57 pkgsrc/devel/meson/Makefile
diff -r1.49 -r1.50 pkgsrc/devel/meson/distinfo
diff -r1.3 -r1.4 pkgsrc/devel/meson/patches/patch-mesonbuild_compilers_detect.py

cvs diff -r1.56 -r1.57 pkgsrc/devel/meson/Makefile (expand / switch to unified diff)

--- pkgsrc/devel/meson/Makefile 2023/09/21 01:44:06 1.56
+++ pkgsrc/devel/meson/Makefile 2023/09/24 18:54:06 1.57
@@ -1,52 +1,42 @@ @@ -1,52 +1,42 @@
1# $NetBSD: Makefile,v 1.56 2023/09/21 01:44:06 gutteridge Exp $ 1# $NetBSD: Makefile,v 1.57 2023/09/24 18:54:06 gutteridge Exp $
2 2
3DISTNAME= meson-1.2.1 3DISTNAME= meson-1.2.1
4PKGREVISION= 2 4PKGREVISION= 3
5CATEGORIES= devel python 5CATEGORIES= devel python
6MASTER_SITES= ${MASTER_SITE_PYPI:=m/meson/} 6MASTER_SITES= ${MASTER_SITE_PYPI:=m/meson/}
7 7
8MAINTAINER= pkgsrc-users@NetBSD.org 8MAINTAINER= pkgsrc-users@NetBSD.org
9HOMEPAGE= https://mesonbuild.com/ 9HOMEPAGE= https://mesonbuild.com/
10COMMENT= Open source build system meant to be fast and user friendly 10COMMENT= Open source build system meant to be fast and user friendly
11LICENSE= apache-2.0 11LICENSE= apache-2.0
12 12
13CONFLICTS= ${PYPKGPREFIX}-meson-[0-9]* 13CONFLICTS= ${PYPKGPREFIX}-meson-[0-9]*
14SUPERSEDES= ${PYPKGPREFIX}-meson-[0-9]* 14SUPERSEDES= ${PYPKGPREFIX}-meson-[0-9]*
15 15
16DEPENDS+= ninja-build>=1.7:../../devel/ninja-build 16DEPENDS+= ninja-build>=1.7:../../devel/ninja-build
17 17
18PYTHON_VERSIONS_INCOMPATIBLE= 27 18PYTHON_VERSIONS_INCOMPATIBLE= 27
19 19
20USE_PKG_RESOURCES= yes 20USE_PKG_RESOURCES= yes
21 21
22USE_LANGUAGES= c c++ # c++ for tests 22USE_LANGUAGES= c c++ # c++ for tests
23 23
24SUBST_CLASSES+= man 24SUBST_CLASSES+= man
25SUBST_SED.man+= -e "s,share/man,${PKGMANDIR}," 25SUBST_SED.man+= -e "s,share/man,${PKGMANDIR},"
26SUBST_FILES.man+= setup.py 26SUBST_FILES.man+= setup.py
27SUBST_STAGE.man= pre-configure 27SUBST_STAGE.man= pre-configure
28SUBST_MESSAGE.man= Fixing man page installation path. 28SUBST_MESSAGE.man= Fixing man page installation path.
29 29
30# XXX this isn't an entirely correct approach, as this package is not 
31# Python-versioned, while py-cython is. This means in bulk builds, any 
32# Python packages that use meson and cython will fail with a mismatch 
33# for non-default Python versions, e.g., py-pandas and py-scipy. 
34SUBST_CLASSES+= cython 
35SUBST_STAGE.cython= pre-configure 
36SUBST_MESSAGE.cython= Fixing cython binary name. 
37SUBST_FILES.cython= mesonbuild/compilers/detect.py 
38SUBST_SED.cython= -e "s,'cython3','cython-${PYVERSSUFFIX}'," 
39 
40REPLACE_PYTHON+= ghwt.py 30REPLACE_PYTHON+= ghwt.py
41REPLACE_PYTHON+= meson.py 31REPLACE_PYTHON+= meson.py
42REPLACE_PYTHON+= mesonbuild/rewriter.py 32REPLACE_PYTHON+= mesonbuild/rewriter.py
43REPLACE_PYTHON+= mesonbuild/cmake/data/run_ctgt.py 33REPLACE_PYTHON+= mesonbuild/cmake/data/run_ctgt.py
44REPLACE_PYTHON+= run_*.py 34REPLACE_PYTHON+= run_*.py
45REPLACE_PYTHON+= test\ cases/*/*/*.py 35REPLACE_PYTHON+= test\ cases/*/*/*.py
46REPLACE_PYTHON+= test\ cases/*/*/*/*.py 36REPLACE_PYTHON+= test\ cases/*/*/*/*.py
47REPLACE_PYTHON+= test\ cases/*/*/*/*/*.py 37REPLACE_PYTHON+= test\ cases/*/*/*/*/*.py
48REPLACE_PYTHON+= test\ cases/common/14\ configure\ file/test.py.in 38REPLACE_PYTHON+= test\ cases/common/14\ configure\ file/test.py.in
49REPLACE_PYTHON+= test\ cases/common/187\ find\ override/subdir/gencodegen.py.in 39REPLACE_PYTHON+= test\ cases/common/187\ find\ override/subdir/gencodegen.py.in
50REPLACE_PYTHON+= test\ cases/common/54\ run\ target/configure.in 40REPLACE_PYTHON+= test\ cases/common/54\ run\ target/configure.in
51REPLACE_PYTHON+= test\ cases/windows/8\ find\ program/test-script 41REPLACE_PYTHON+= test\ cases/windows/8\ find\ program/test-script
52REPLACE_PYTHON+= tools/*.py 42REPLACE_PYTHON+= tools/*.py

cvs diff -r1.49 -r1.50 pkgsrc/devel/meson/distinfo (expand / switch to unified diff)

--- pkgsrc/devel/meson/distinfo 2023/08/08 21:34:11 1.49
+++ pkgsrc/devel/meson/distinfo 2023/09/24 18:54:06 1.50
@@ -1,11 +1,11 @@ @@ -1,11 +1,11 @@
1$NetBSD: distinfo,v 1.49 2023/08/08 21:34:11 adam Exp $ 1$NetBSD: distinfo,v 1.50 2023/09/24 18:54:06 gutteridge Exp $
2 2
3BLAKE2s (meson-1.2.1.tar.gz) = cb57477f193d3151058dc9cbaae4c1e8bdf7c7efd21a241360bad4e1860f9d67 3BLAKE2s (meson-1.2.1.tar.gz) = cb57477f193d3151058dc9cbaae4c1e8bdf7c7efd21a241360bad4e1860f9d67
4SHA512 (meson-1.2.1.tar.gz) = 6221a14a6046aaba2c6eb601a9a5b928308bbd9da813ccec16b8f7578296b27d741e30e9343723770c3c7825c86b53193b41b9672dd17468d06d3b8d743bf52e 4SHA512 (meson-1.2.1.tar.gz) = 6221a14a6046aaba2c6eb601a9a5b928308bbd9da813ccec16b8f7578296b27d741e30e9343723770c3c7825c86b53193b41b9672dd17468d06d3b8d743bf52e
5Size (meson-1.2.1.tar.gz) = 2182126 bytes 5Size (meson-1.2.1.tar.gz) = 2182126 bytes
6SHA1 (patch-mesonbuild_compilers_detect.py) = 44b3a70a127824808c8a05226a546988c6a1339f 6SHA1 (patch-mesonbuild_compilers_detect.py) = 378283e53e61e93af15dbf0b0fb9e9bda198fd82
7SHA1 (patch-mesonbuild_compilers_mixins_gnu.py) = 34c2f6f215d5aed1d6c422187f733d0d488ebb4f 7SHA1 (patch-mesonbuild_compilers_mixins_gnu.py) = 34c2f6f215d5aed1d6c422187f733d0d488ebb4f
8SHA1 (patch-mesonbuild_dependencies_dev.py) = 2165f1ee4ad5d9689eb2fb7e94841503336070b9 8SHA1 (patch-mesonbuild_dependencies_dev.py) = 2165f1ee4ad5d9689eb2fb7e94841503336070b9
9SHA1 (patch-mesonbuild_linkers_linkers.py) = 4ca793f71aac2119f94464bb2beb83ed3da3e9a0 9SHA1 (patch-mesonbuild_linkers_linkers.py) = 4ca793f71aac2119f94464bb2beb83ed3da3e9a0
10SHA1 (patch-mesonbuild_modules_pkgconfig.py) = 9ff9b4d5106b9db26850ad7592fe0bddb89dd043 10SHA1 (patch-mesonbuild_modules_pkgconfig.py) = 9ff9b4d5106b9db26850ad7592fe0bddb89dd043
11SHA1 (patch-mesonbuild_scripts_depfixer.py) = 0abd3326f7872e4d53006ff3de5716007c8f22b7 11SHA1 (patch-mesonbuild_scripts_depfixer.py) = 0abd3326f7872e4d53006ff3de5716007c8f22b7

cvs diff -r1.3 -r1.4 pkgsrc/devel/meson/patches/patch-mesonbuild_compilers_detect.py (expand / switch to unified diff)

--- pkgsrc/devel/meson/patches/patch-mesonbuild_compilers_detect.py 2022/08/15 08:19:39 1.3
+++ pkgsrc/devel/meson/patches/patch-mesonbuild_compilers_detect.py 2023/09/24 18:54:06 1.4
@@ -1,34 +1,45 @@ @@ -1,34 +1,45 @@
1$NetBSD: patch-mesonbuild_compilers_detect.py,v 1.3 2022/08/15 08:19:39 adam Exp $ 1$NetBSD: patch-mesonbuild_compilers_detect.py,v 1.4 2023/09/24 18:54:06 gutteridge Exp $
2 2
3Specify c++ language when making CXX parse standard input. 3Specify c++ language when making CXX parse standard input.
4Fixes problem where graphics/MesaLib fails to build due to: 4Fixes problem where graphics/MesaLib fails to build due to:
5 5
6> clang++ -std=c++14 -dM -E - 6> clang++ -std=c++14 -dM -E -
7> error: invalid argument '-std=c++14' not allowed with 'C' 7> error: invalid argument '-std=c++14' not allowed with 'C'
8 8
9--- mesonbuild/compilers/detect.py.orig 2022-08-13 08:48:46.000000000 +0000 9Also account for multiple versions of cython in pkgsrc.
 10
 11--- mesonbuild/compilers/detect.py.orig 2023-07-21 20:36:13.000000000 +0000
10+++ mesonbuild/compilers/detect.py 12+++ mesonbuild/compilers/detect.py
11@@ -1231,7 +1231,10 @@ def _get_gnu_compiler_defines(compiler:  13@@ -80,7 +80,7 @@ defaults['cuda'] = ['nvcc']
 14 defaults['rust'] = ['rustc']
 15 defaults['swift'] = ['swiftc']
 16 defaults['vala'] = ['valac']
 17-defaults['cython'] = ['cython', 'cython3'] # Official name is cython, but Debian renamed it to cython3.
 18+defaults['cython'] = ['cython', 'cython-3.11', 'cython-3.10', 'cython-3.9', 'cython-3.8'] # Handle pkgsrc multi-versions.
 19 defaults['static_linker'] = ['ar', 'gar']
 20 defaults['strip'] = ['strip']
 21 defaults['vs_static_linker'] = ['lib']
 22@@ -1318,7 +1318,10 @@ def _get_gnu_compiler_defines(compiler:
12 """ 23 """
13 # Arguments to output compiler pre-processor defines to stdout 24 # Arguments to output compiler pre-processor defines to stdout
14 # gcc, g++, and gfortran all support these arguments 25 # gcc, g++, and gfortran all support these arguments
15- args = compiler + ['-E', '-dM', '-'] 26- args = compiler + ['-E', '-dM', '-']
16+ args = compiler + ['-E', '-dM'] 27+ args = compiler + ['-E', '-dM']
17+ if compiler[0].endswith('++'): 28+ if compiler[0].endswith('++'):
18+ args += ['-x', 'c++'] 29+ args += ['-x', 'c++']
19+ args += ['-'] 30+ args += ['-']
20 mlog.debug(f'Running command: {join_args(args)}') 31 mlog.debug(f'Running command: {join_args(args)}')
21 p, output, error = Popen_safe(args, write='', stdin=subprocess.PIPE) 32 p, output, error = Popen_safe(args, write='', stdin=subprocess.PIPE)
22 if p.returncode != 0: 33 if p.returncode != 0:
23@@ -1258,7 +1261,10 @@ def _get_clang_compiler_defines(compiler 34@@ -1345,7 +1348,10 @@ def _get_clang_compiler_defines(compiler
24 """ 35 """
25 Get the list of Clang pre-processor defines 36 Get the list of Clang pre-processor defines
26 """ 37 """
27- args = compiler + ['-E', '-dM', '-'] 38- args = compiler + ['-E', '-dM', '-']
28+ args = compiler + ['-E', '-dM'] 39+ args = compiler + ['-E', '-dM']
29+ if compiler[0].endswith('++'): 40+ if compiler[0].endswith('++'):
30+ args += ['-x', 'c++'] 41+ args += ['-x', 'c++']
31+ args += ['-'] 42+ args += ['-']
32 mlog.debug(f'Running command: {join_args(args)}') 43 mlog.debug(f'Running command: {join_args(args)}')
33 p, output, error = Popen_safe(args, write='', stdin=subprocess.PIPE) 44 p, output, error = Popen_safe(args, write='', stdin=subprocess.PIPE)
34 if p.returncode != 0: 45 if p.returncode != 0: