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

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

CVSweb <webmaster@jp.NetBSD.org>