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

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

CVSweb <webmaster@jp.NetBSD.org>