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

1.26    ! danw        1: # $NetBSD: pyversion.mk,v 1.25 2004/04/22 16:03:51 recht 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.22      kristerw  114: .  if defined(USE_BUILDLINK2) && empty(USE_BUILDLINK2:M[nN][oO])
1.21      drochner  115: PTHREAD_OPTS=  require
                    116: .    include "../../mk/pthread.buildlink2.mk"
                    117: .    if ${PTHREAD_TYPE} == "pth"
                    118: .        include "../../devel/pth/buildlink2.mk"
                    119: .    endif
1.23      recht     120: .  elif defined(USE_BUILDLINK3) && empty(USE_BUILDLINK3:M[nN][oO])
                    121: PTHREAD_OPTS=  require
                    122: .    include "../../mk/pthread.buildlink3.mk"
                    123: .    if ${PTHREAD_TYPE} == "pth"
                    124: .        include "../../devel/pth/buildlink3.mk"
                    125: .    endif
1.21      drochner  126: .  endif
                    127: .elif ${_PYTHON_VERSION} == "22"
1.10      jlam      128: PYPKGSRCDIR=   ../../lang/python22
                    129: PYDEPENDENCY=  ${BUILDLINK_DEPENDS.python22}:${PYPKGSRCDIR}
1.14      jlam      130: PYPACKAGE=     python22
1.5       drochner  131: PYVERSSUFFIX=  2.2
1.2       drochner  132: PYPKGPREFIX=   py22
1.15      drochner  133: .elif ${_PYTHON_VERSION} == "22pth"
                    134: PYPKGSRCDIR=   ../../lang/python22-pth
                    135: PYDEPENDENCY=  ${BUILDLINK_DEPENDS.python22-pth}:${PYPKGSRCDIR}
                    136: PYPACKAGE=     python22-pth
                    137: PYVERSSUFFIX=  2p2
                    138: PYPKGPREFIX=   py22pth
1.22      kristerw  139: .  if defined(USE_BUILDLINK2) && empty(USE_BUILDLINK2:M[nN][oO])
1.20      drochner  140: PTHREAD_OPTS=  require
                    141: .    include "../../mk/pthread.buildlink2.mk"
                    142: .    if ${PTHREAD_TYPE} == "pth"
                    143: .        include "../../devel/pth/buildlink2.mk"
                    144: .    endif
1.23      recht     145: .  elif defined(USE_BUILDLINK3) && empty(USE_BUILDLINK3:M[nN][oO])
                    146: PTHREAD_OPTS=  require
                    147: .    include "../../mk/pthread.buildlink3.mk"
                    148: .    if ${PTHREAD_TYPE} == "pth"
                    149: .        include "../../devel/pth/buildlink3.mk"
                    150: .    endif
1.15      drochner  151: .  endif
1.2       drochner  152: .elif ${_PYTHON_VERSION} == "21"
1.10      jlam      153: PYPKGSRCDIR=   ../../lang/python21
1.14      jlam      154: PYPACKAGE=     python21
1.10      jlam      155: PYDEPENDENCY=  ${BUILDLINK_DEPENDS.python21}:${PYPKGSRCDIR}
1.5       drochner  156: PYVERSSUFFIX=  2.1
1.1       drochner  157: PYPKGPREFIX=   py21
1.9       drochner  158: .elif ${_PYTHON_VERSION} == "21pth"
1.12      seb       159: PYPKGSRCDIR=   ../../lang/python21-pth
1.14      jlam      160: PYPACKAGE=     python21-pth
1.13      jlam      161: PYDEPENDENCY=  ${BUILDLINK_DEPENDS.python21-pth}:${PYPKGSRCDIR}
1.9       drochner  162: PYVERSSUFFIX=  2p1
                    163: PYPKGPREFIX=   py21pth
1.22      kristerw  164: .  if defined(USE_BUILDLINK2) && empty(USE_BUILDLINK2:M[nN][oO])
1.20      drochner  165: PTHREAD_OPTS=  require
                    166: .    include "../../mk/pthread.buildlink2.mk"
                    167: .    if ${PTHREAD_TYPE} == "pth"
                    168: .        include "../../devel/pth/buildlink2.mk"
                    169: .    endif
1.23      recht     170: .  elif defined(USE_BUILDLINK3) && empty(USE_BUILDLINK3:M[nN][oO])
                    171: PTHREAD_OPTS=  require
                    172: .    include "../../mk/pthread.buildlink3.mk"
                    173: .    if ${PTHREAD_TYPE} == "pth"
                    174: .        include "../../devel/pth/buildlink3.mk"
                    175: .    endif
1.10      jlam      176: .  endif
1.1       drochner  177: .elif ${_PYTHON_VERSION} == "20"
1.10      jlam      178: PYPKGSRCDIR=   ../../lang/python20
1.14      jlam      179: PYPACKAGE=     python20
1.10      jlam      180: PYDEPENDENCY=  ${BUILDLINK_DEPENDS.python20}:${PYPKGSRCDIR}
1.5       drochner  181: PYVERSSUFFIX=  2.0
1.1       drochner  182: PYPKGPREFIX=   py20
1.7       drochner  183: .elif ${_PYTHON_VERSION} == "15"
1.10      jlam      184: PYPKGSRCDIR=   ../../lang/python15
1.14      jlam      185: PYPACKAGE=     python15
1.10      jlam      186: PYDEPENDENCY=  ${BUILDLINK_DEPENDS.python15}:${PYPKGSRCDIR}
1.7       drochner  187: PYVERSSUFFIX=  1.5
                    188: PYPKGPREFIX=   py15
                    189: .if !defined(PYTHON_DISTUTILS_BOOTSTRAP)
                    190: BUILD_DEPENDS+=        py15-distutils-*:../../devel/py-distutils
                    191: .endif
1.8       drochner  192: .else
                    193: # force an error
                    194:        error: no valid Python version
1.1       drochner  195: .endif
1.5       drochner  196: 
1.23      recht     197: .if (defined(USE_BUILDLINK2) && empty(USE_BUILDLINK2:M[nN][oO])) || \
                    198:   (defined(USE_BUILDLINK3) && empty(USE_BUILDLINK3:M[nN][oO]))
1.10      jlam      199: .  if defined(PYTHON_FOR_BUILD_ONLY)
                    200: BUILD_DEPMETHOD.python?=       build
                    201: .  endif
1.23      recht     202: .  if defined(USE_BUILDLINK2) && empty(USE_BUILDLINK2:M[nN][oO])
                    203: .    include "${PYPKGSRCDIR}/buildlink2.mk"
                    204: .  else
                    205: .    include "${PYPKGSRCDIR}/buildlink3.mk"
                    206: .  endif
1.10      jlam      207: .else
                    208: .  if defined(PYTHON_FOR_BUILD_ONLY)
1.6       drochner  209: BUILD_DEPENDS+=        ${PYDEPENDENCY}
1.10      jlam      210: .  else
1.6       drochner  211: DEPENDS+=      ${PYDEPENDENCY}
1.10      jlam      212: .  endif
1.11      jlam      213: .endif
                    214: 
                    215: PYTHONBIN=     ${LOCALBASE}/bin/python${PYVERSSUFFIX}
                    216: 
                    217: .if exists(${PYTHONBIN})
                    218: PYINC!=        ${PYTHONBIN} -c "import distutils.sysconfig; \
                    219:        print distutils.sysconfig.get_python_inc(0, \"\")" || ${ECHO} ""
                    220: PYLIB!=        ${PYTHONBIN} -c "import distutils.sysconfig; \
                    221:        print distutils.sysconfig.get_python_lib(0, 1, \"\")" || ${ECHO} ""
                    222: PYSITELIB!=    ${PYTHONBIN} -c "import distutils.sysconfig; \
                    223:        print distutils.sysconfig.get_python_lib(0, 0, \"\")" || ${ECHO} ""
1.6       drochner  224: .endif
1.2       drochner  225: 
                    226: .endif # PYTHON_PYVERSION_MK

CVSweb <webmaster@jp.NetBSD.org>