Makefile 3.78 KB
Newer Older
ijliao's avatar
ijliao committed
1
2
# $FreeBSD$

3
PORTNAME=		tdb
4
PORTVERSION=		1.3.15
timur's avatar
timur committed
5
PORTREVISION=		0
tijl's avatar
tijl committed
6
PORTEPOCH=		1
7
CATEGORIES=		databases
mat's avatar
mat committed
8
MASTER_SITES=		SAMBA
ijliao's avatar
ijliao committed
9

timur's avatar
timur committed
10
MAINTAINER=		timur@FreeBSD.org
11
COMMENT=		Trivial Database
ijliao's avatar
ijliao committed
12

13
14
LICENSE=		GPLv3

15
IGNORE_NONTHREAD_PYTHON=needs port lang/python${PYTHON_SUFFIX} to be build with THREADS support
ijliao's avatar
ijliao committed
16

17
USES=			compiler pkgconfig waf
18
USE_LDCONFIG=		yes
19
WAF_CMD=		buildtools/bin/waf
timur's avatar
timur committed
20
CONFIGURE_LOG=		bin/config.log
21

timur's avatar
timur committed
22
PKGCONFIGDIR?=		${PREFIX}/libdata/pkgconfig
timur's avatar
timur committed
23
PLIST_SUB+=		PKGCONFIGDIR=${PKGCONFIGDIR:S;${PREFIX}/;;}
timur's avatar
timur committed
24

25
CONFIGURE_ARGS+=	--mandir=${MANPREFIX}/man \
26
27
28
			--infodir=${PREFIX}/${INFO_PATH}/${INFO_SUBDIR} \
			--disable-rpath \
			--without-gettext
29

30
31
32
OPTIONS_DEFINE=		MANPAGES
MANPAGES_DESC=		Build and install manpages (requires textproc/docbook-xsl)

timur's avatar
timur committed
33
.include <bsd.port.options.mk>
34

35
36
37
38
39
40
41
42
43
44
45
TDB_BINS=		bin/tdbbackup \
			bin/tdbdump \
			bin/tdbrestore \
			bin/tdbtool

PLIST_FILES+=		include/tdb.h \
			${TDB_BINS} \
			lib/libtdb.so \
			lib/libtdb.so.1 \
			%%PKGCONFIGDIR%%/tdb.pc

46
.if defined(NO_PYTHON)
47
USES+=			python:2.7,build
48
49
CONFIGURE_ARGS+=	--disable-python
.else
50
USES+=			python:2.7
51

52
53
PLIST_FILES+=		%%PYTHON_SITELIBDIR%%/tdb.so \
			%%PYTHON_SITELIBDIR%%/_tdb_text.py
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# XXX: This is a gross hack to make port use both Python 2.7+ and 3.3+
# This is not officially supported, use at your own risk
.if defined(WITH_SAMBA_PYTHON3) && ${WITH_SAMBA_PYTHON3:Mpython3\.[0-9]}
SAMBA_PYTHON3=		${WITH_SAMBA_PYTHON3}
SAMBA_PYTHON3_VERSION:=	${SAMBA_PYTHON3:S/^python//}
SAMBA_PYTHON3_VER:=	${SAMBA_PYTHON3_VERSION:C/\.//}
.if !exists(${PORTSDIR}/lang/python${SAMBA_PYTHON3_VER})
.error			unsupported or unknown Python version ${SAMBA_PYTHON3_VERSION}
.endif
BUILD_DEPENDS+=		${SAMBA_PYTHON3}:lang/python${SAMBA_PYTHON3_VER}
RUN_DEPENDS+=		${SAMBA_PYTHON3}:lang/python${SAMBA_PYTHON3_VER}
# cpython-36m
SAMBA_PYTHON3_SO_ABI!=	[ ! -f "${LOCALBASE}/bin/${SAMBA_PYTHON3}" ] || ${LOCALBASE}/bin/${SAMBA_PYTHON3} -c 'import sysconfig; print(sysconfig.get_config_var("SOABI") or "")' 2>/dev/null
SAMBA_PYTHON3_SITELIBDIR=lib/python${SAMBA_PYTHON3_VERSION}/site-packages

CONFIGURE_ENV+=		PYTHON3_SO_ABI_FLAG=.${SAMBA_PYTHON3_SO_ABI}
CONFIGURE_ARGS+=	--extra-python=${LOCALBASE}/bin/${SAMBA_PYTHON3}

PLIST_SUB+=		SAMBA_PYTHON3_SO_ABI=${SAMBA_PYTHON3_SO_ABI} \
			SAMBA_PYTHON3_SITELIBDIR=${SAMBA_PYTHON3_SITELIBDIR}

PLIST_FILES+=		%%SAMBA_PYTHON3_SITELIBDIR%%/tdb.so \
			%%SAMBA_PYTHON3_SITELIBDIR%%/_tdb_text.py
.endif
78
79
.endif

timur's avatar
timur committed
80
81
82
83
84
.include <bsd.port.pre.mk>

.if ! ${PORT_OPTIONS:MMANPAGES}
CONFIGURE_ENV+=		XSLTPROC="true"
.else
85
86
BUILD_DEPENDS+=		${LOCALBASE}/share/xsl/docbook/manpages/docbook.xsl:textproc/docbook-xsl \
			xsltproc:textproc/libxslt
timur's avatar
timur committed
87
88
89
90
91
.endif
# No fancy color error messages
.if ${COMPILER_TYPE} == "clang"
CFLAGS+=		-fno-color-diagnostics
.endif
timur's avatar
timur committed
92
93
94
CONFIGURE_ENV+=		NOCOLOR=yes
MAKE_ENV+=		NOCOLOR=yes

timur's avatar
timur committed
95
96
97
98
99
100
101
TDB_MAN8=		man/man8/tdbbackup.8.gz \
			man/man8/tdbdump.8.gz \
			man/man8/tdbrestore.8.gz \
			man/man8/tdbtool.8.gz

PLIST_FILES+=		${TDB_MAN8}

timur's avatar
timur committed
102
103
post-patch:
			@${REINPLACE_CMD} -e 's|%%PKGCONFIGDIR%%|${PKGCONFIGDIR}|g' \
104
105
106
107
108
109
110
111
112
113
				${BUILD_WRKSRC}/wscript

# Use threading (or multiprocessing) but not thread (renamed in python 3+).
pre-configure:
			@if ! ${PYTHON_CMD} -c "import multiprocessing;" 2>/dev/null; then \
				${ECHO_CMD}; \
				${ECHO_MSG} "===>  ${PKGNAME} "${IGNORE_NONTHREAD_PYTHON:Q}.; \
				${ECHO_CMD}; \
				${FALSE}; \
			fi
timur's avatar
timur committed
114

115
pre-build-MANPAGES-off:
timur's avatar
timur committed
116
			-${MKDIR} ${BUILD_WRKSRC}/bin/default/man
117
.for man in ${TDB_MAN8}
timur's avatar
timur committed
118
			${INSTALL_MAN} ${FILESDIR}/`basename ${man} .gz` ${BUILD_WRKSRC}/bin/default/man
119
120
121
122
123
124
125
126
127
128
129
.endfor

post-install:
.for lib in ${TDB_BINS} lib/libtdb.so
			${STRIP_CMD} ${STAGEDIR}${PREFIX}/${lib}
.endfor
.if !defined(NO_PYTHON)
			${STRIP_CMD} ${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}/tdb.so
.if defined(SAMBA_PYTHON3)
			${STRIP_CMD} ${STAGEDIR}${PREFIX}/${SAMBA_PYTHON3_SITELIBDIR}/tdb.so
.endif
timur's avatar
timur committed
130
.endif
131

132
.include <bsd.port.post.mk>