aboutsummaryrefslogtreecommitdiffstats
path: root/sysutils/py-zfs/Makefile
blob: b17ede8bef20a500e18431f2fbde0c5b174bf7bc (plain) (blame)
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
# New ports collection makefile for:    pyzfs
# Date created:             11 July 2010
# Whom:                 Martin Matuska <mm@FreeBSD.org>
#
# $FreeBSD$
#

PORTNAME=   zfs
PORTVERSION=    1
PORTREVISION=   2
CATEGORIES= sysutils python
MASTER_SITES=   # none
PKGNAMEPREFIX=  ${PYTHON_PKGNAMEPREFIX}
DISTFILES=  # none

MAINTAINER= mm@FreeBSD.org
COMMENT=    Python ZFS library

USE_PYTHON= 2.4-2.7
MAKEFILE=   ${FILESDIR}/Makefile.lib
MAKE_ARGS+= PYTHON_INCLUDEDIR="${PYTHON_INCLUDEDIR}" \
        PYTHON_LDFLAGS="-L${LOCALBASE}/lib -l${PYTHON_VERSION}"
NO_WRKSUBDIR=   yes
SRCDIR?=    /usr/src

SUB_FILES+= compile.py
SUB_LIST+=  PYTHON_CMD=${PYTHON_CMD}

PYFILES=    __init__.py \
        allow.py \
        dataset.py \
        groupspace.py\
        unallow.py \
        userspace.py \
        util.py

.if !exists(${SRCDIR}/cddl/contrib/opensolaris/lib/pyzfs) || \
 !exists(${SRCDIR}/cddl/contrib/opensolaris/cmd/pyzfs)
IGNORE= requires ZFS v15 or higher sources with pyzfs (in ${SRCDIR})
.endif

.if exists(${SRCDIR}/cddl/contrib/opensolaris/lib/pyzfs/common/holds.py) && \
exists(${SRCDIR}/cddl/contrib/opensolaris/lib/pyzfs/common/table.py)
PYFILES+=   holds.py \
        table.py
PLIST_SUB+= V28=""
EXTRA_PATCHES+= ${FILESDIR}/extra-patch-util.py \
        ${FILESDIR}/extra-patch-userspace.py
.else
PLIST_SUB+= V28="@comment "
.endif

do-extract:
    @${MKDIR} ${WRKSRC}
    @${CP} ${SRCDIR}/cddl/contrib/opensolaris/cmd/pyzfs/pyzfs.py \
    ${WRKSRC}/pyzfs.py
.for PYFILE in ${PYFILES}
    @${CP} ${SRCDIR}/cddl/contrib/opensolaris/lib/pyzfs/common/${PYFILE} \
    ${WRKSRC}/${PYFILE}
.endfor

post-patch:
    
.for PYFILE in pyzfs.py ${PYFILES}
    @${REINPLACE_CMD} -e "s|#! /usr/bin/python.*|#! ${PYTHON_CMD}|g" \
        ${WRKSRC}/${PYFILE}
.endfor

do-install:
    ${MKDIR} ${PYTHONPREFIX_SITELIBDIR}/zfs
.for PYFILE in ${PYFILES}
    ${INSTALL_DATA} ${WRKSRC}/${PYFILE} \
        ${PYTHONPREFIX_SITELIBDIR}/zfs
.endfor
    ${INSTALL_DATA} ${WRKSRC}/ioctl.so ${PYTHONPREFIX_SITELIBDIR}/zfs
    @${PYTHON_CMD} ${WRKDIR}/compile.py ${PYTHONPREFIX_SITELIBDIR}/zfs
    @${PYTHON_CMD} -O ${WRKDIR}/compile.py ${PYTHONPREFIX_SITELIBDIR}/zfs
    ${MKDIR} /usr/lib/zfs
    ${INSTALL_SCRIPT} ${WRKSRC}/pyzfs.py /usr/lib/zfs
    @${PYTHON_CMD} ${WRKDIR}/compile.py /usr/lib/zfs
    @${PYTHON_CMD} -O ${WRKDIR}/compile.py /usr/lib/zfs

.include <bsd.port.mk>