blob: 976b5d5c33212bd59866169037e4712b8e215a41 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
|
# $NetBSD: extension.buildlink.mk,v 1.2 2001/10/29 05:45:09 jmc Exp $
.include "../../mk/bsd.prefs.mk"
PYTHON_VERSION_DEFAULT?= 21
PYTHON_VERSIONS_ACCEPTED?= 21 20
# transform the list into individual variables
.for pv in ${PYTHON_VERSIONS_ACCEPTED}
_PYTHON_VERSION_${pv}_OK= yes
.endfor
# check what is installed
.if exists(${LOCALBASE}/bin/python2.1)
_PYTHON_VERSION_21_INSTALLED= yes
.endif
.if exists(${LOCALBASE}/bin/python2.0)
_PYTHON_VERSION_20_INSTALLED= yes
.endif
#
# choose a python version where to add,
# try to be intelligent
#
# if the default is already installed, it is first choice
.if defined(_PYTHON_VERSION_${PYTHON_VERSION_DEFAULT}_OK)
.if defined(_PYTHON_VERSION_${PYTHON_VERSION_DEFAULT}_INSTALLED)
_PYTHON_VERSION= ${PYTHON_VERSION_DEFAULT}
.endif
.endif
# prefer an already installed version, in order of "accepted"
.if !defined(_PYTHON_VERSION)
.for pv in ${PYTHON_VERSIONS_ACCEPTED}
.if defined(_PYTHON_VERSION_${pv}_INSTALLED)
_PYTHON_VERSION?= ${pv}
.else
# keep information as last resort - see below
_PYTHON_VERSION_FIRSTACCEPTED?= ${pv}
.endif
.endfor
.endif
# if the default is OK for the addon pkg, take this
.if !defined(_PYTHON_VERSION)
.if defined(_PYTHON_VERSION_${PYTHON_VERSION_DEFAULT}_OK)
_PYTHON_VERSION= ${PYTHON_VERSION_DEFAULT}
.endif
.endif
# take the first one accepted by the package
.if !defined(_PYTHON_VERSION)
_PYTHON_VERSION= ${_PYTHON_VERSION_FIRSTACCEPTED}
.endif
#
# set variables for the version we decided to use
#
.if ${_PYTHON_VERSION} == "21"
DEPENDS+= python21>=2.1:../../lang/python21
PYTHONBIN= ${LOCALBASE}/bin/python2.1
PYPKGPREFIX= py21
.elif ${_PYTHON_VERSION} == "20"
#DEPENDS+= python20>=2.0:../../lang/python20
DEPENDS+= python-2.0.1:../../lang/python
PYTHONBIN= ${LOCALBASE}/bin/python2.0
PYPKGPREFIX= py20
.endif
#
# below is what used to be in bsd.python.mk
#
.if defined(PYBINMODULE)
.if ${MACHINE_ARCH} == "powerpc" || ${MACHINE_ARCH} == "mips" || ${MACHINE_ARCH} == "vax"
IGNORE="${PKGNAME} needs dynamic loading"
.endif
.endif
.if exists(${PYTHONBIN})
PYINC!= ${PYTHONBIN} -c "import distutils.sysconfig; \
print distutils.sysconfig.get_python_inc(0, \"\")"
PYSITELIB!= ${PYTHONBIN} -c "import distutils.sysconfig; \
print distutils.sysconfig.get_python_lib(0, 0, \"\")"
.endif
.if defined(PYDISTUTILSPKG)
PYSETUP?= setup.py
PYSETUPBUILDARGS?= #empty
PYSETUPINSTALLARGS?= #empty
PY_PATCHPLIST?= yes
do-build:
(cd ${WRKSRC} && ${PYTHONBIN} ${PYSETUP} ${PYSETUPBUILDARGS} build)
do-install:
(cd ${WRKSRC} && ${PYTHONBIN} ${PYSETUP} ${PYSETUPINSTALLARGS} install)
.endif
PY_PLIST_TEMPLATE?= ${PKGDIR}/PLIST
PY_PLIST_SRC?= ${WRKDIR}/.PLIST_SRC
py_patchplist:
${SED} "s|PYINC|${PYINC}|g;s|PYSITELIB|${PYSITELIB}|g" \
<${PY_PLIST_TEMPLATE} >${PY_PLIST_SRC}
.if defined(PY_PATCHPLIST)
PLIST_SRC?= ${PY_PLIST_SRC}
pre-install: py_patchplist
.endif
|