Annotation of pkgsrc/lang/python/pyversion.mk, revision 1.30
1.30 ! recht 1: # $NetBSD: pyversion.mk,v 1.29 2004/07/23 15:35:50 recht Exp $
1.2 drochner 2:
3: .if !defined(PYTHON_PYVERSION_MK)
4: PYTHON_PYVERSION_MK= defined
1.1 drochner 5:
6: .include "../../mk/bsd.prefs.mk"
7:
1.26 danw 8: PYTHON_VERSION_DEFAULT?= 23
1.17 schmonz 9: .if ${OPSYS} == "Darwin"
1.28 tv 10: PYTHON_VERSIONS_INCOMPATIBLE+= 23 22 21 21pth 20 15
1.26 danw 11: BUILDLINK_DEPENDS.python22-pth?= python22-pth>=2.2.3nb2
12: BUILDLINK_DEPENDS.python23-pth?= python23-pth>=2.3.3nb3
1.28 tv 13: .endif
1.30 ! recht 14: PYTHON_VERSIONS_ACCEPTED?= 24 24pth 23 23pth 22 22pth 21 21pth 20
1.28 tv 15: PYTHON_VERSIONS_INCOMPATIBLE?= # empty by default
1.1 drochner 16:
1.13 jlam 17: BUILDLINK_DEPENDS.python15?= python15>=1.5
18: BUILDLINK_DEPENDS.python20?= python20>=2.0
19: BUILDLINK_DEPENDS.python21?= python21>=2.1
20: BUILDLINK_DEPENDS.python21-pth?= python21-pth>=2.1
21: BUILDLINK_DEPENDS.python22?= python22>=2.2
1.15 drochner 22: BUILDLINK_DEPENDS.python22-pth?= python22-pth>=2.2
1.21 drochner 23: BUILDLINK_DEPENDS.python23?= python23>=2.3
24: BUILDLINK_DEPENDS.python23-pth?= python23-pth>=2.3
1.30 ! recht 25: BUILDLINK_DEPENDS.python24?= python24>=2.4
! 26: BUILDLINK_DEPENDS.python24-pth?= python24-pth>=2.4
1.4 drochner 27:
1.1 drochner 28: # transform the list into individual variables
29: .for pv in ${PYTHON_VERSIONS_ACCEPTED}
1.28 tv 30: .if empty(PYTHON_VERSIONS_INCOMPATIBLE:M${pv})
1.1 drochner 31: _PYTHON_VERSION_${pv}_OK= yes
1.28 tv 32: .endif
1.1 drochner 33: .endfor
34:
35: # check what is installed
1.30 ! recht 36: .if exists(${LOCALBASE}/bin/python2.4)
! 37: _PYTHON_VERSION_24_INSTALLED= yes
! 38: .endif
! 39: .if exists(${LOCALBASE}/bin/python2p4)
! 40: _PYTHON_VERSION_24pth_INSTALLED=yes
! 41: .endif
1.21 drochner 42: .if exists(${LOCALBASE}/bin/python2.3)
43: _PYTHON_VERSION_23_INSTALLED= yes
44: .endif
45: .if exists(${LOCALBASE}/bin/python2p3)
46: _PYTHON_VERSION_23pth_INSTALLED=yes
47: .endif
1.2 drochner 48: .if exists(${LOCALBASE}/bin/python2.2)
49: _PYTHON_VERSION_22_INSTALLED= yes
50: .endif
1.15 drochner 51: .if exists(${LOCALBASE}/bin/python2p2)
52: _PYTHON_VERSION_22pth_INSTALLED=yes
53: .endif
1.1 drochner 54: .if exists(${LOCALBASE}/bin/python2.1)
55: _PYTHON_VERSION_21_INSTALLED= yes
56: .endif
1.9 drochner 57: .if exists(${LOCALBASE}/bin/python2p1)
58: _PYTHON_VERSION_21pth_INSTALLED=yes
59: .endif
1.1 drochner 60: .if exists(${LOCALBASE}/bin/python2.0)
61: _PYTHON_VERSION_20_INSTALLED= yes
62: .endif
1.7 drochner 63: .if exists(${LOCALBASE}/bin/python1.5)
64: _PYTHON_VERSION_15_INSTALLED= yes
65: .endif
1.1 drochner 66:
67: #
68: # choose a python version where to add,
69: # try to be intelligent
70: #
1.2 drochner 71: # if a version is explicitely required, take it
72: .if defined(PYTHON_VERSION_REQD)
73: _PYTHON_VERSION= ${PYTHON_VERSION_REQD}
74: .endif
1.1 drochner 75: # if the default is already installed, it is first choice
1.2 drochner 76: .if !defined(_PYTHON_VERSION)
1.1 drochner 77: .if defined(_PYTHON_VERSION_${PYTHON_VERSION_DEFAULT}_OK)
78: .if defined(_PYTHON_VERSION_${PYTHON_VERSION_DEFAULT}_INSTALLED)
79: _PYTHON_VERSION= ${PYTHON_VERSION_DEFAULT}
80: .endif
81: .endif
1.2 drochner 82: .endif
1.1 drochner 83: # prefer an already installed version, in order of "accepted"
84: .if !defined(_PYTHON_VERSION)
85: .for pv in ${PYTHON_VERSIONS_ACCEPTED}
1.28 tv 86: .if defined(_PYTHON_VERSION_${pv}_OK)
1.1 drochner 87: .if defined(_PYTHON_VERSION_${pv}_INSTALLED)
88: _PYTHON_VERSION?= ${pv}
89: .else
90: # keep information as last resort - see below
91: _PYTHON_VERSION_FIRSTACCEPTED?= ${pv}
92: .endif
1.28 tv 93: .endif
1.1 drochner 94: .endfor
95: .endif
96: # if the default is OK for the addon pkg, take this
97: .if !defined(_PYTHON_VERSION)
98: .if defined(_PYTHON_VERSION_${PYTHON_VERSION_DEFAULT}_OK)
99: _PYTHON_VERSION= ${PYTHON_VERSION_DEFAULT}
100: .endif
101: .endif
102: # take the first one accepted by the package
103: .if !defined(_PYTHON_VERSION)
104: _PYTHON_VERSION= ${_PYTHON_VERSION_FIRSTACCEPTED}
105: .endif
106:
107: #
1.5 drochner 108: # set variables for the version we decided to use:
109: # PYVERSSUFFIX: suffix to executables and in library path,
110: # equal to sys.version[0:3]
111: # PYPKGPREFIX: prefix to use in PKGNAME for extensions which can install
112: # to multiple Python versions
1.1 drochner 113: #
1.30 ! recht 114: .if ${_PYTHON_VERSION} == "24"
! 115: PYPKGSRCDIR= ../../lang/python24
! 116: PYDEPENDENCY= ${BUILDLINK_DEPENDS.python24}:${PYPKGSRCDIR}
! 117: PYPACKAGE= python24
! 118: PYVERSSUFFIX= 2.4
! 119: PYPKGPREFIX= py24
! 120: .elif ${_PYTHON_VERSION} == "24pth"
! 121: PYPKGSRCDIR= ../../lang/python24-pth
! 122: PYDEPENDENCY= ${BUILDLINK_DEPENDS.python24-pth}:${PYPKGSRCDIR}
! 123: PYPACKAGE= python24-pth
! 124: PYVERSSUFFIX= 2p4
! 125: PYPKGPREFIX= py24pth
! 126: . if defined(USE_BUILDLINK3) && empty(USE_BUILDLINK3:M[nN][oO])
! 127: PTHREAD_OPTS= require
! 128: . include "../../mk/pthread.buildlink3.mk"
! 129: . if ${PTHREAD_TYPE} == "pth"
! 130: . include "../../devel/pth/buildlink3.mk"
! 131: . endif
! 132: . endif
! 133: .elif ${_PYTHON_VERSION} == "23"
1.21 drochner 134: PYPKGSRCDIR= ../../lang/python23
135: PYDEPENDENCY= ${BUILDLINK_DEPENDS.python23}:${PYPKGSRCDIR}
136: PYPACKAGE= python23
137: PYVERSSUFFIX= 2.3
138: PYPKGPREFIX= py23
139: .elif ${_PYTHON_VERSION} == "23pth"
140: PYPKGSRCDIR= ../../lang/python23-pth
141: PYDEPENDENCY= ${BUILDLINK_DEPENDS.python23-pth}:${PYPKGSRCDIR}
142: PYPACKAGE= python23-pth
143: PYVERSSUFFIX= 2p3
144: PYPKGPREFIX= py23pth
1.27 recht 145: . if defined(USE_BUILDLINK3) && empty(USE_BUILDLINK3:M[nN][oO])
1.23 recht 146: PTHREAD_OPTS= require
147: . include "../../mk/pthread.buildlink3.mk"
148: . if ${PTHREAD_TYPE} == "pth"
149: . include "../../devel/pth/buildlink3.mk"
150: . endif
1.21 drochner 151: . endif
152: .elif ${_PYTHON_VERSION} == "22"
1.10 jlam 153: PYPKGSRCDIR= ../../lang/python22
154: PYDEPENDENCY= ${BUILDLINK_DEPENDS.python22}:${PYPKGSRCDIR}
1.14 jlam 155: PYPACKAGE= python22
1.5 drochner 156: PYVERSSUFFIX= 2.2
1.2 drochner 157: PYPKGPREFIX= py22
1.15 drochner 158: .elif ${_PYTHON_VERSION} == "22pth"
159: PYPKGSRCDIR= ../../lang/python22-pth
160: PYDEPENDENCY= ${BUILDLINK_DEPENDS.python22-pth}:${PYPKGSRCDIR}
161: PYPACKAGE= python22-pth
162: PYVERSSUFFIX= 2p2
163: PYPKGPREFIX= py22pth
1.27 recht 164: . if defined(USE_BUILDLINK3) && empty(USE_BUILDLINK3:M[nN][oO])
1.23 recht 165: PTHREAD_OPTS= require
166: . include "../../mk/pthread.buildlink3.mk"
167: . if ${PTHREAD_TYPE} == "pth"
168: . include "../../devel/pth/buildlink3.mk"
169: . endif
1.15 drochner 170: . endif
1.2 drochner 171: .elif ${_PYTHON_VERSION} == "21"
1.10 jlam 172: PYPKGSRCDIR= ../../lang/python21
1.14 jlam 173: PYPACKAGE= python21
1.10 jlam 174: PYDEPENDENCY= ${BUILDLINK_DEPENDS.python21}:${PYPKGSRCDIR}
1.5 drochner 175: PYVERSSUFFIX= 2.1
1.1 drochner 176: PYPKGPREFIX= py21
1.9 drochner 177: .elif ${_PYTHON_VERSION} == "21pth"
1.12 seb 178: PYPKGSRCDIR= ../../lang/python21-pth
1.14 jlam 179: PYPACKAGE= python21-pth
1.13 jlam 180: PYDEPENDENCY= ${BUILDLINK_DEPENDS.python21-pth}:${PYPKGSRCDIR}
1.9 drochner 181: PYVERSSUFFIX= 2p1
182: PYPKGPREFIX= py21pth
1.27 recht 183: . if defined(USE_BUILDLINK3) && empty(USE_BUILDLINK3:M[nN][oO])
1.23 recht 184: PTHREAD_OPTS= require
185: . include "../../mk/pthread.buildlink3.mk"
186: . if ${PTHREAD_TYPE} == "pth"
187: . include "../../devel/pth/buildlink3.mk"
188: . endif
1.10 jlam 189: . endif
1.1 drochner 190: .elif ${_PYTHON_VERSION} == "20"
1.10 jlam 191: PYPKGSRCDIR= ../../lang/python20
1.14 jlam 192: PYPACKAGE= python20
1.10 jlam 193: PYDEPENDENCY= ${BUILDLINK_DEPENDS.python20}:${PYPKGSRCDIR}
1.5 drochner 194: PYVERSSUFFIX= 2.0
1.1 drochner 195: PYPKGPREFIX= py20
1.7 drochner 196: .elif ${_PYTHON_VERSION} == "15"
1.10 jlam 197: PYPKGSRCDIR= ../../lang/python15
1.14 jlam 198: PYPACKAGE= python15
1.10 jlam 199: PYDEPENDENCY= ${BUILDLINK_DEPENDS.python15}:${PYPKGSRCDIR}
1.7 drochner 200: PYVERSSUFFIX= 1.5
201: PYPKGPREFIX= py15
202: .if !defined(PYTHON_DISTUTILS_BOOTSTRAP)
203: BUILD_DEPENDS+= py15-distutils-*:../../devel/py-distutils
204: .endif
1.8 drochner 205: .else
206: # force an error
207: error: no valid Python version
1.1 drochner 208: .endif
1.5 drochner 209:
1.27 recht 210: .if (defined(USE_BUILDLINK3) && empty(USE_BUILDLINK3:M[nN][oO]))
1.10 jlam 211: . if defined(PYTHON_FOR_BUILD_ONLY)
212: BUILD_DEPMETHOD.python?= build
213: . endif
1.27 recht 214: . include "${PYPKGSRCDIR}/buildlink3.mk"
1.10 jlam 215: .else
216: . if defined(PYTHON_FOR_BUILD_ONLY)
1.6 drochner 217: BUILD_DEPENDS+= ${PYDEPENDENCY}
1.10 jlam 218: . else
1.6 drochner 219: DEPENDS+= ${PYDEPENDENCY}
1.10 jlam 220: . endif
1.11 jlam 221: .endif
222:
223: PYTHONBIN= ${LOCALBASE}/bin/python${PYVERSSUFFIX}
224:
225: .if exists(${PYTHONBIN})
226: PYINC!= ${PYTHONBIN} -c "import distutils.sysconfig; \
227: print distutils.sysconfig.get_python_inc(0, \"\")" || ${ECHO} ""
228: PYLIB!= ${PYTHONBIN} -c "import distutils.sysconfig; \
229: print distutils.sysconfig.get_python_lib(0, 1, \"\")" || ${ECHO} ""
230: PYSITELIB!= ${PYTHONBIN} -c "import distutils.sysconfig; \
231: print distutils.sysconfig.get_python_lib(0, 0, \"\")" || ${ECHO} ""
1.29 recht 232:
233: PRINT_PLIST_AWK+= /^@dirrm ${PYINC:S|/|\\/|g}$$/ { next; }
234: PRINT_PLIST_AWK+= /^@dirrm ${PYSITELIB:S|/|\\/|g}$$/ { next; }
235: PRINT_PLIST_AWK+= /^@dirrm ${PYLIB:S|/|\\/|g}$$/ { next; }
236:
237: PRINT_PLIST_AWK+= /^(@dirrm )?${PYINC:S|/|\\/|g}/ \
238: { gsub(/${PYINC:S|/|\\/|g}/, "$${PYINC}"); \
239: print; next; }
240: PRINT_PLIST_AWK+= /^(@dirrm )?${PYSITELIB:S|/|\\/|g}/ \
241: { gsub(/${PYSITELIB:S|/|\\/|g}/, "$${PYSITELIB}"); \
242: print; next; }
243: PRINT_PLIST_AWK+= /^(@dirrm )?${PYLIB:S|/|\\/|g}/ \
244: { gsub(/${PYLIB:S|/|\\/|g}/, "$${PYLIB}"); \
245: print; next; }
1.6 drochner 246: .endif
1.2 drochner 247:
248: .endif # PYTHON_PYVERSION_MK
CVSweb <webmaster@jp.NetBSD.org>