aboutsummaryrefslogtreecommitdiffstats
path: root/sysutils/py-zfs/Makefile
blob: 1721d8acb1281f7a2c47b513ac1e061ac23b82c6 (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
84
85
86
# Created by: Martin Matuska <mm@FreeBSD.org>
# $FreeBSD$

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

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

LICENSE=    CDDL

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/libzfs_core/common/libzfs_core.h)
MAKEFILE=   ${FILESDIR}/Makefile.lib.v28
.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

NO_STAGE=   yes
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>