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

1.14    ! jlam        1: # $NetBSD: pyversion.mk,v 1.13 2002/10/09 11:06:13 jlam 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.14    ! jlam       87: PYPACKAGE=     python22
1.5       drochner   88: PYVERSSUFFIX=  2.2
1.2       drochner   89: PYPKGPREFIX=   py22
                     90: .elif ${_PYTHON_VERSION} == "21"
1.10      jlam       91: PYPKGSRCDIR=   ../../lang/python21
1.14    ! jlam       92: PYPACKAGE=     python21
1.10      jlam       93: PYDEPENDENCY=  ${BUILDLINK_DEPENDS.python21}:${PYPKGSRCDIR}
1.5       drochner   94: PYVERSSUFFIX=  2.1
1.1       drochner   95: PYPKGPREFIX=   py21
1.9       drochner   96: .elif ${_PYTHON_VERSION} == "21pth"
1.12      seb        97: PYPKGSRCDIR=   ../../lang/python21-pth
1.14    ! jlam       98: PYPACKAGE=     python21-pth
1.13      jlam       99: PYDEPENDENCY=  ${BUILDLINK_DEPENDS.python21-pth}:${PYPKGSRCDIR}
1.9       drochner  100: PYVERSSUFFIX=  2p1
                    101: PYPKGPREFIX=   py21pth
1.10      jlam      102: .  if defined(USE_BUILDLINK2)
                    103: .    include "../../devel/pth/buildlink2.mk"
                    104: .  else
                    105: .    include "../../devel/pth/buildlink.mk"
                    106: .  endif
1.1       drochner  107: .elif ${_PYTHON_VERSION} == "20"
1.10      jlam      108: PYPKGSRCDIR=   ../../lang/python20
1.14    ! jlam      109: PYPACKAGE=     python20
1.10      jlam      110: PYDEPENDENCY=  ${BUILDLINK_DEPENDS.python20}:${PYPKGSRCDIR}
1.5       drochner  111: PYVERSSUFFIX=  2.0
1.1       drochner  112: PYPKGPREFIX=   py20
1.7       drochner  113: .elif ${_PYTHON_VERSION} == "15"
1.10      jlam      114: PYPKGSRCDIR=   ../../lang/python15
1.14    ! jlam      115: PYPACKAGE=     python15
1.10      jlam      116: PYDEPENDENCY=  ${BUILDLINK_DEPENDS.python15}:${PYPKGSRCDIR}
1.7       drochner  117: PYVERSSUFFIX=  1.5
                    118: PYPKGPREFIX=   py15
                    119: .if !defined(PYTHON_DISTUTILS_BOOTSTRAP)
                    120: BUILD_DEPENDS+=        py15-distutils-*:../../devel/py-distutils
                    121: .endif
1.8       drochner  122: .else
                    123: # force an error
                    124:        error: no valid Python version
1.1       drochner  125: .endif
1.5       drochner  126: 
1.10      jlam      127: .if defined(USE_BUILDLINK2)
                    128: .  if defined(PYTHON_FOR_BUILD_ONLY)
                    129: BUILD_DEPMETHOD.python?=       build
                    130: .  endif
                    131: .  include "${PYPKGSRCDIR}/buildlink2.mk"
                    132: .else
                    133: .  if defined(PYTHON_FOR_BUILD_ONLY)
1.6       drochner  134: BUILD_DEPENDS+=        ${PYDEPENDENCY}
1.10      jlam      135: .  else
1.6       drochner  136: DEPENDS+=      ${PYDEPENDENCY}
1.10      jlam      137: .  endif
1.11      jlam      138: .endif
                    139: 
                    140: PYTHONBIN=     ${LOCALBASE}/bin/python${PYVERSSUFFIX}
                    141: 
                    142: .if exists(${PYTHONBIN})
                    143: PYINC!=        ${PYTHONBIN} -c "import distutils.sysconfig; \
                    144:        print distutils.sysconfig.get_python_inc(0, \"\")" || ${ECHO} ""
                    145: PYLIB!=        ${PYTHONBIN} -c "import distutils.sysconfig; \
                    146:        print distutils.sysconfig.get_python_lib(0, 1, \"\")" || ${ECHO} ""
                    147: PYSITELIB!=    ${PYTHONBIN} -c "import distutils.sysconfig; \
                    148:        print distutils.sysconfig.get_python_lib(0, 0, \"\")" || ${ECHO} ""
1.6       drochner  149: .endif
1.2       drochner  150: 
                    151: .endif # PYTHON_PYVERSION_MK

CVSweb <webmaster@jp.NetBSD.org>