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

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

CVSweb <webmaster@jp.NetBSD.org>