Annotation of pkgsrc/lang/python/pyversion.mk, revision 1.13

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

CVSweb <webmaster@jp.NetBSD.org>