Annotation of pkgsrc/lang/python/pyversion.mk, revision 1.17
1.17 ! schmonz 1: # $NetBSD: pyversion.mk,v 1.16 2002/10/30 22:36:16 tsarna 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.16 tsarna 8: PYTHON_VERSION_DEFAULT?= 22
1.17 ! schmonz 9: .if ${OPSYS} == "Darwin"
! 10: PYTHON_VERSIONS_ACCEPTED= 22 # the only one that builds
! 11: .else
1.2 drochner 12: PYTHON_VERSIONS_ACCEPTED?= 22 21 20
1.17 ! schmonz 13: .endif
1.1 drochner 14:
1.13 jlam 15: BUILDLINK_DEPENDS.python15?= python15>=1.5
16: BUILDLINK_DEPENDS.python20?= python20>=2.0
17: BUILDLINK_DEPENDS.python21?= python21>=2.1
18: BUILDLINK_DEPENDS.python21-pth?= python21-pth>=2.1
19: BUILDLINK_DEPENDS.python22?= python22>=2.2
1.15 drochner 20: BUILDLINK_DEPENDS.python22-pth?= python22-pth>=2.2
1.4 drochner 21:
1.1 drochner 22: # transform the list into individual variables
23: .for pv in ${PYTHON_VERSIONS_ACCEPTED}
24: _PYTHON_VERSION_${pv}_OK= yes
25: .endfor
26:
27: # check what is installed
1.2 drochner 28: .if exists(${LOCALBASE}/bin/python2.2)
29: _PYTHON_VERSION_22_INSTALLED= yes
30: .endif
1.15 drochner 31: .if exists(${LOCALBASE}/bin/python2p2)
32: _PYTHON_VERSION_22pth_INSTALLED=yes
33: .endif
1.1 drochner 34: .if exists(${LOCALBASE}/bin/python2.1)
35: _PYTHON_VERSION_21_INSTALLED= yes
36: .endif
1.9 drochner 37: .if exists(${LOCALBASE}/bin/python2p1)
38: _PYTHON_VERSION_21pth_INSTALLED=yes
39: .endif
1.1 drochner 40: .if exists(${LOCALBASE}/bin/python2.0)
41: _PYTHON_VERSION_20_INSTALLED= yes
42: .endif
1.7 drochner 43: .if exists(${LOCALBASE}/bin/python1.5)
44: _PYTHON_VERSION_15_INSTALLED= yes
45: .endif
1.1 drochner 46:
47: #
48: # choose a python version where to add,
49: # try to be intelligent
50: #
1.2 drochner 51: # if a version is explicitely required, take it
52: .if defined(PYTHON_VERSION_REQD)
53: _PYTHON_VERSION= ${PYTHON_VERSION_REQD}
54: .endif
1.1 drochner 55: # if the default is already installed, it is first choice
1.2 drochner 56: .if !defined(_PYTHON_VERSION)
1.1 drochner 57: .if defined(_PYTHON_VERSION_${PYTHON_VERSION_DEFAULT}_OK)
58: .if defined(_PYTHON_VERSION_${PYTHON_VERSION_DEFAULT}_INSTALLED)
59: _PYTHON_VERSION= ${PYTHON_VERSION_DEFAULT}
60: .endif
61: .endif
1.2 drochner 62: .endif
1.1 drochner 63: # prefer an already installed version, in order of "accepted"
64: .if !defined(_PYTHON_VERSION)
65: .for pv in ${PYTHON_VERSIONS_ACCEPTED}
66: .if defined(_PYTHON_VERSION_${pv}_INSTALLED)
67: _PYTHON_VERSION?= ${pv}
68: .else
69: # keep information as last resort - see below
70: _PYTHON_VERSION_FIRSTACCEPTED?= ${pv}
71: .endif
72: .endfor
73: .endif
74: # if the default is OK for the addon pkg, take this
75: .if !defined(_PYTHON_VERSION)
76: .if defined(_PYTHON_VERSION_${PYTHON_VERSION_DEFAULT}_OK)
77: _PYTHON_VERSION= ${PYTHON_VERSION_DEFAULT}
78: .endif
79: .endif
80: # take the first one accepted by the package
81: .if !defined(_PYTHON_VERSION)
82: _PYTHON_VERSION= ${_PYTHON_VERSION_FIRSTACCEPTED}
83: .endif
84:
85: #
1.5 drochner 86: # set variables for the version we decided to use:
87: # PYVERSSUFFIX: suffix to executables and in library path,
88: # equal to sys.version[0:3]
89: # PYPKGPREFIX: prefix to use in PKGNAME for extensions which can install
90: # to multiple Python versions
1.1 drochner 91: #
1.2 drochner 92: .if ${_PYTHON_VERSION} == "22"
1.10 jlam 93: PYPKGSRCDIR= ../../lang/python22
94: PYDEPENDENCY= ${BUILDLINK_DEPENDS.python22}:${PYPKGSRCDIR}
1.14 jlam 95: PYPACKAGE= python22
1.5 drochner 96: PYVERSSUFFIX= 2.2
1.2 drochner 97: PYPKGPREFIX= py22
1.15 drochner 98: .elif ${_PYTHON_VERSION} == "22pth"
99: PYPKGSRCDIR= ../../lang/python22-pth
100: PYDEPENDENCY= ${BUILDLINK_DEPENDS.python22-pth}:${PYPKGSRCDIR}
101: PYPACKAGE= python22-pth
102: PYVERSSUFFIX= 2p2
103: PYPKGPREFIX= py22pth
104: . if defined(USE_BUILDLINK2)
105: . include "../../devel/pth/buildlink2.mk"
106: . else
107: . include "../../devel/pth/buildlink.mk"
108: . endif
1.2 drochner 109: .elif ${_PYTHON_VERSION} == "21"
1.10 jlam 110: PYPKGSRCDIR= ../../lang/python21
1.14 jlam 111: PYPACKAGE= python21
1.10 jlam 112: PYDEPENDENCY= ${BUILDLINK_DEPENDS.python21}:${PYPKGSRCDIR}
1.5 drochner 113: PYVERSSUFFIX= 2.1
1.1 drochner 114: PYPKGPREFIX= py21
1.9 drochner 115: .elif ${_PYTHON_VERSION} == "21pth"
1.12 seb 116: PYPKGSRCDIR= ../../lang/python21-pth
1.14 jlam 117: PYPACKAGE= python21-pth
1.13 jlam 118: PYDEPENDENCY= ${BUILDLINK_DEPENDS.python21-pth}:${PYPKGSRCDIR}
1.9 drochner 119: PYVERSSUFFIX= 2p1
120: PYPKGPREFIX= py21pth
1.10 jlam 121: . if defined(USE_BUILDLINK2)
122: . include "../../devel/pth/buildlink2.mk"
123: . else
124: . include "../../devel/pth/buildlink.mk"
125: . endif
1.1 drochner 126: .elif ${_PYTHON_VERSION} == "20"
1.10 jlam 127: PYPKGSRCDIR= ../../lang/python20
1.14 jlam 128: PYPACKAGE= python20
1.10 jlam 129: PYDEPENDENCY= ${BUILDLINK_DEPENDS.python20}:${PYPKGSRCDIR}
1.5 drochner 130: PYVERSSUFFIX= 2.0
1.1 drochner 131: PYPKGPREFIX= py20
1.7 drochner 132: .elif ${_PYTHON_VERSION} == "15"
1.10 jlam 133: PYPKGSRCDIR= ../../lang/python15
1.14 jlam 134: PYPACKAGE= python15
1.10 jlam 135: PYDEPENDENCY= ${BUILDLINK_DEPENDS.python15}:${PYPKGSRCDIR}
1.7 drochner 136: PYVERSSUFFIX= 1.5
137: PYPKGPREFIX= py15
138: .if !defined(PYTHON_DISTUTILS_BOOTSTRAP)
139: BUILD_DEPENDS+= py15-distutils-*:../../devel/py-distutils
140: .endif
1.8 drochner 141: .else
142: # force an error
143: error: no valid Python version
1.1 drochner 144: .endif
1.5 drochner 145:
1.10 jlam 146: .if defined(USE_BUILDLINK2)
147: . if defined(PYTHON_FOR_BUILD_ONLY)
148: BUILD_DEPMETHOD.python?= build
149: . endif
150: . include "${PYPKGSRCDIR}/buildlink2.mk"
151: .else
152: . if defined(PYTHON_FOR_BUILD_ONLY)
1.6 drochner 153: BUILD_DEPENDS+= ${PYDEPENDENCY}
1.10 jlam 154: . else
1.6 drochner 155: DEPENDS+= ${PYDEPENDENCY}
1.10 jlam 156: . endif
1.11 jlam 157: .endif
158:
159: PYTHONBIN= ${LOCALBASE}/bin/python${PYVERSSUFFIX}
160:
161: .if exists(${PYTHONBIN})
162: PYINC!= ${PYTHONBIN} -c "import distutils.sysconfig; \
163: print distutils.sysconfig.get_python_inc(0, \"\")" || ${ECHO} ""
164: PYLIB!= ${PYTHONBIN} -c "import distutils.sysconfig; \
165: print distutils.sysconfig.get_python_lib(0, 1, \"\")" || ${ECHO} ""
166: PYSITELIB!= ${PYTHONBIN} -c "import distutils.sysconfig; \
167: print distutils.sysconfig.get_python_lib(0, 0, \"\")" || ${ECHO} ""
1.6 drochner 168: .endif
1.2 drochner 169:
170: .endif # PYTHON_PYVERSION_MK
CVSweb <webmaster@jp.NetBSD.org>