Default to python 3.10 if compiler lacks c11 support.diff -r1.156 -r1.157 pkgsrc/lang/python/pyversion.mk
(nia)
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | # $NetBSD: pyversion.mk,v 1.156 2023/10/02 20:10:38 adam Exp $ | 1 | # $NetBSD: pyversion.mk,v 1.157 2023/11/07 11:36:57 nia Exp $ | |
2 | 2 | |||
3 | # This file should be included by packages as a way to depend on | 3 | # This file should be included by packages as a way to depend on | |
4 | # python when none of the other methods are appropriate, e.g. a | 4 | # python when none of the other methods are appropriate, e.g. a | |
5 | # package that produces a binary that embeds python. | 5 | # package that produces a binary that embeds python. | |
6 | # It determines which Python version is used as a dependency for | 6 | # It determines which Python version is used as a dependency for | |
7 | # a package. | 7 | # a package. | |
8 | # | 8 | # | |
9 | # === User-settable variables === | 9 | # === User-settable variables === | |
10 | # | 10 | # | |
11 | # PYTHON_VERSION_DEFAULT | 11 | # PYTHON_VERSION_DEFAULT | |
12 | # The preferred Python version to use. | 12 | # The preferred Python version to use. | |
13 | # | 13 | # | |
14 | # Possible values: 27 38 39 310 311 312 | 14 | # Possible values: 27 38 39 310 311 312 | |
@@ -92,27 +92,31 @@ PYTHON_VERSION_REQD?= ${PKGNAME_REQD:C/( | @@ -92,27 +92,31 @@ PYTHON_VERSION_REQD?= ${PKGNAME_REQD:C/( | |||
92 | .elif defined(PKGNAME_OLD) && !empty(PKGNAME_OLD:Mpy[0-9][0-9]-*) || \ | 92 | .elif defined(PKGNAME_OLD) && !empty(PKGNAME_OLD:Mpy[0-9][0-9]-*) || \ | |
93 | defined(PKGNAME_OLD) && !empty(PKGNAME_OLD:M*-py[0-9][0-9]-*) | 93 | defined(PKGNAME_OLD) && !empty(PKGNAME_OLD:M*-py[0-9][0-9]-*) | |
94 | PYTHON_VERSION_REQD?= ${PKGNAME_OLD:C/(^.*-|^)py([0-9][0-9])-.*/\2/} | 94 | PYTHON_VERSION_REQD?= ${PKGNAME_OLD:C/(^.*-|^)py([0-9][0-9])-.*/\2/} | |
95 | .elif defined(PKGNAME_OLD) && !empty(PKGNAME_OLD:Mpy[0-9][0-9][0-9]-*) || \ | 95 | .elif defined(PKGNAME_OLD) && !empty(PKGNAME_OLD:Mpy[0-9][0-9][0-9]-*) || \ | |
96 | defined(PKGNAME_OLD) && !empty(PKGNAME_OLD:M*-py[0-9][0-9][0-9]-*) | 96 | defined(PKGNAME_OLD) && !empty(PKGNAME_OLD:M*-py[0-9][0-9][0-9]-*) | |
97 | PYTHON_VERSION_REQD?= ${PKGNAME_OLD:C/(^.*-|^)py([0-9][0-9][0-9])-.*/\2/} | 97 | PYTHON_VERSION_REQD?= ${PKGNAME_OLD:C/(^.*-|^)py([0-9][0-9][0-9])-.*/\2/} | |
98 | .endif | 98 | .endif | |
99 | 99 | |||
100 | .include "../../mk/bsd.prefs.mk" | 100 | .include "../../mk/bsd.prefs.mk" | |
101 | 101 | |||
102 | BUILD_DEFS+= PYTHON_VERSION_DEFAULT | 102 | BUILD_DEFS+= PYTHON_VERSION_DEFAULT | |
103 | BUILD_DEFS_EFFECTS+= PYPACKAGE | 103 | BUILD_DEFS_EFFECTS+= PYPACKAGE | |
104 | 104 | |||
105 | .if ${COMPILER_HAS_C11:Uyes} != "no" | |||
105 | PYTHON_VERSION_DEFAULT?= 311 | 106 | PYTHON_VERSION_DEFAULT?= 311 | |
107 | .else | |||
108 | PYTHON_VERSION_DEFAULT?= 310 | |||
109 | .endif | |||
106 | PYTHON_VERSIONS_ACCEPTED?= 312 311 310 39 38 27 | 110 | PYTHON_VERSIONS_ACCEPTED?= 312 311 310 39 38 27 | |
107 | PYTHON_VERSIONS_INCOMPATIBLE?= # empty by default | 111 | PYTHON_VERSIONS_INCOMPATIBLE?= # empty by default | |
108 | 112 | |||
109 | # transform the list into individual variables | 113 | # transform the list into individual variables | |
110 | .for pv in ${PYTHON_VERSIONS_ACCEPTED} | 114 | .for pv in ${PYTHON_VERSIONS_ACCEPTED} | |
111 | . if empty(PYTHON_VERSIONS_INCOMPATIBLE:M${pv}) | 115 | . if empty(PYTHON_VERSIONS_INCOMPATIBLE:M${pv}) | |
112 | _PYTHON_VERSION_${pv}_OK= yes | 116 | _PYTHON_VERSION_${pv}_OK= yes | |
113 | _PYTHON_VERSIONS_ACCEPTED+= ${pv} | 117 | _PYTHON_VERSIONS_ACCEPTED+= ${pv} | |
114 | . endif | 118 | . endif | |
115 | .endfor | 119 | .endfor | |
116 | 120 | |||
117 | # | 121 | # | |
118 | # choose a python version where to add, | 122 | # choose a python version where to add, |
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | # $NetBSD: gcc.mk,v 1.264 2023/11/07 09:54:49 nia Exp $ | 1 | # $NetBSD: gcc.mk,v 1.265 2023/11/07 11:36:57 nia Exp $ | |
2 | # | 2 | # | |
3 | # This is the compiler definition for the GNU Compiler Collection. | 3 | # This is the compiler definition for the GNU Compiler Collection. | |
4 | # | 4 | # | |
5 | # User-settable variables: | 5 | # User-settable variables: | |
6 | # | 6 | # | |
7 | # GCCBASE | 7 | # GCCBASE | |
8 | # If using a native GCC and the compiler is not in $PATH then | 8 | # If using a native GCC and the compiler is not in $PATH then | |
9 | # this should be set to the base installation directory. | 9 | # this should be set to the base installation directory. | |
10 | # | 10 | # | |
11 | # USE_NATIVE_GCC | 11 | # USE_NATIVE_GCC | |
12 | # When set to "yes", the native gcc is used, no matter which | 12 | # When set to "yes", the native gcc is used, no matter which | |
13 | # compiler version a package requires. | 13 | # compiler version a package requires. | |
14 | # | 14 | # | |
@@ -325,26 +325,32 @@ _GCC_VERSION= 0 | @@ -325,26 +325,32 @@ _GCC_VERSION= 0 | |||
325 | .endif | 325 | .endif | |
326 | _GCC_PKG= gcc-${_GCC_VERSION:C/-.*$//} | 326 | _GCC_PKG= gcc-${_GCC_VERSION:C/-.*$//} | |
327 | 327 | |||
328 | .if !empty(_GCC_VERSION:M[23]\..*) || !empty(_GCC_VERSION:M4.[01]\..*) | 328 | .if !empty(_GCC_VERSION:M[23]\..*) || !empty(_GCC_VERSION:M4.[01]\..*) | |
329 | # A lot of packages attempt to do this as a workaround for a | 329 | # A lot of packages attempt to do this as a workaround for a | |
330 | # well-intentioned default in XCode 12+, but it's a common cause of | 330 | # well-intentioned default in XCode 12+, but it's a common cause of | |
331 | # build failures on old versions of Darwin which use gcc and don't | 331 | # build failures on old versions of Darwin which use gcc and don't | |
332 | # understand this syntax. | 332 | # understand this syntax. | |
333 | # | 333 | # | |
334 | # Note that pkgsrc also sets this flag itself for Darwin+clang. | 334 | # Note that pkgsrc also sets this flag itself for Darwin+clang. | |
335 | BUILDLINK_TRANSFORM+= rm:-Wno-error=implicit-function-declaration | 335 | BUILDLINK_TRANSFORM+= rm:-Wno-error=implicit-function-declaration | |
336 | .endif | 336 | .endif | |
337 | 337 | |||
338 | .if !empty(_GCC_VERSION:M[23]\..*) || !empty(_GCC_VERSION:M4.[0-8]\..*) | |||
339 | COMPILER_HAS_C11?= no | |||
340 | .else | |||
341 | COMPILER_HAS_C11?= yes | |||
342 | .endif | |||
343 | ||||
338 | .for _version_ in ${_C_STD_VERSIONS} | 344 | .for _version_ in ${_C_STD_VERSIONS} | |
339 | _C_STD_FLAG.${_version_}?= -std=${_version_} | 345 | _C_STD_FLAG.${_version_}?= -std=${_version_} | |
340 | .endfor | 346 | .endfor | |
341 | # XXX: pkgsrc historically hardcoded c99=gnu99 so we retain that for now, but | 347 | # XXX: pkgsrc historically hardcoded c99=gnu99 so we retain that for now, but | |
342 | # we should look at removing this and be explicit in packages where required. | 348 | # we should look at removing this and be explicit in packages where required. | |
343 | _C_STD_FLAG.c99= -std=gnu99 | 349 | _C_STD_FLAG.c99= -std=gnu99 | |
344 | 350 | |||
345 | .for _version_ in ${_CXX_STD_VERSIONS} | 351 | .for _version_ in ${_CXX_STD_VERSIONS} | |
346 | _CXX_STD_FLAG.${_version_}?= -std=${_version_} | 352 | _CXX_STD_FLAG.${_version_}?= -std=${_version_} | |
347 | .endfor | 353 | .endfor | |
348 | .if !empty(_GCC_VERSION:M[34].[1234].*) | 354 | .if !empty(_GCC_VERSION:M[34].[1234].*) | |
349 | _CXX_STD_FLAG.c++03= -std=c++0x | 355 | _CXX_STD_FLAG.c++03= -std=c++0x | |
350 | _CXX_STD_FLAG.gnu++03= -std=gnu++0x | 356 | _CXX_STD_FLAG.gnu++03= -std=gnu++0x |