summaryrefslogtreecommitdiffstats
path: root/devel/staf/Makefile
blob: 0b3a29b608812baa724d6ccd9f307fde2d92398a (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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
# Created by: Sergey Kozlov <kozlov.sergey.404@gmail.com>
# $FreeBSD$

PORTNAME=	staf
PORTVERSION=	3.4.23
PORTREVISION=	1
CATEGORIES=	devel net
MASTER_SITES=	SF/${PORTNAME}/${PORTNAME}/V${PORTVERSION}
DISTNAME=	STAF${PORTVERSION:S/.//g}-src

MAINTAINER=	kozlov.sergey.404@gmail.com
COMMENT=	Software Testing Automation Framework

LICENSE=	EPL
LICENSE_FILE=	${WRKSRC}/LICENSE.htm

WRKSRC=		${WRKDIR}/src
WRKSRC_SUBDIR=	${PORTNAME}
INSTALL_WRKSRC=	${WRKDIR}/rel/freebsd/staf/${STAF_BUILD_TYPE}

MAKEFILE=	makefile
MAKE_ARGS=	OS_NAME="freebsd" \
		CC_CC=${CXX} \
		CC_C=${CC} \
		CFLAGS="${CFLAGS}" \
		CXXFLAGS="${CXXFLAGS}" \
		LINKFLAGS="${LDFLAGS}" \
		STAF_USE_SSL=${STAF_USE_SSL} \
		STAF_USE_IPV6=${STAF_USE_IPV6} \
		ZLIB_ROOT=/usr \
		BUILD_TYPE=${STAF_BUILD_TYPE} \
		PROJECTS="${STAF_PROJECTS}"

OPTIONS_DEFINE=	DEBUG IPV6 OPENSSL PYTHON
OPTIONS_DEFAULT=OPENSSL
OPTIONS_SUB=	yes

DEBUG_VARS=	staf_build_type=debug
DEBUG_VARS_OFF=	staf_build_type=retail

IPV6_VARS=	staf_use_ipv6=1
IPV6_VARS_OFF=	staf_use_ipv6=""

OPENSSL_VARS=	staf_use_ssl=1 use_openssl=yes
OPENSSL_MAKE_ARGS=	OPENSSL_ROOT=${OPENSSLBASE} \
			OPENSSL_LIBDIRS="${OPENSSLLIB}" \
			OPENSSL_INCLUDEDIRS=${OPENSSLINC}
OPENSSL_VARS_OFF=	staf_use_ssl=""

PYTHON_USES=	python:-3.4
PYTHON_VARS=	staf_projects+=python use_python=py3kplist
PYTHON_MAKE_ARGS=	PYTHON_V${PYTHON_SUFFIX}_ROOT=${LOCALBASE} \
			PYTHON_V${PYTHON_SUFFIX}_INCLUDEDIRS=${PYTHON_INCLUDEDIR} \
			PYTHON_V${PYTHON_SUFFIX}_LIBS=${PYTHON_VERSION}${PYTHON_ABIVER} \
			PYTHON_BUILD_V${PYTHON_SUFFIX}=1

MAKE_JOBS_UNSAFE=	yes
USES=		gmake
USE_LDCONFIG=	yes
USE_RC_SUBR=	stafproc
SUB_LIST+=	STAF_VAR_DIR=${STAF_VAR_DIR}
PLIST_SUB+=	STAF_VAR_DIR=${STAF_VAR_DIR}

STAF_PROJECTS=	staf connprov_tcp connprov_localipc zip
STAF_BIN_FILES=	STAF STAFProc STAFReg STAFLoop STAFExecProxy FmtLog
STAF_LIB_FILES=	libHello.so libSTAF.so libSTAFDSLS.so libSTAFDeviceService.so \
		libSTAFEXECPROXY.so libSTAFLIPC.so libSTAFLog.so \
		libSTAFMon.so libSTAFPool.so libSTAFReg.so libSTAFTCP.so \
		libSTAFZip.so
STAF_PYLIB_FILES=	PySTAFLog.py PySTAFMon.py
STAF_SSL_FILES=	CAList.crt STAFDefault.crt STAFDefault.key
STAF_PYTHON_VERSIONS=	22 23 24 25 26 27 30 31 32 33 34
STAF_VAR_DIR?=	/var/db/STAF

.include <bsd.port.pre.mk>

.if ${PORT_OPTIONS:MPYTHON}
.if ${PYTHON_MAJOR_VER} == 2
STAF_PYLIB_FILES+=	PySTAF.py
PLIST_SUB+=		PYTHON_2="" PYTHON_3="@comment "
MAKE_ARGS+=		PYTHON_V${PYTHON_SUFFIX}_LIBDIRS=${PYTHON_LIBDIR}/config
.else
STAF_PYLIB_FILES+=	PySTAFv3.py
PLIST_SUB+=		PYTHON_3="" PYTHON_2="@comment "
MAKE_ARGS+=		PYTHON_V${PYTHON_SUFFIX}_LIBDIRS=${PYTHON_LIBDIR}/config-${PYTHON_VER}${PYTHON_ABIVER}
.endif

.for i in ${STAF_PYTHON_VERSIONS}
.if ${PYTHON_SUFFIX} != ${i}
PYTHON_MAKE_ARGS+=	PYTHON_BUILD_V${i}=0
.endif
.endfor
.endif

post-patch:
	${REINPLACE_CMD} "s|%%DATADIR%%|${DATADIR}|" \
		${WRKSRC}/stafif/STAFConverter.cpp \
		${WRKSRC}/connproviders/tcp/STAFTCPConnProvider.cpp
	${REINPLACE_CMD} "s|%%PREFIX%%|${PREFIX}|g" \
		${WRKSRC}/stafproc/STAFProc.cpp
	${REINPLACE_CMD} "s|%%STAFVARDIR%%|${STAF_VAR_DIR}|g" \
		${WRKSRC}/stafproc/STAFProc.cpp

do-install:
.for bin in ${STAF_BIN_FILES}
	${INSTALL_PROGRAM} ${INSTALL_WRKSRC}/bin/${bin} ${STAGEDIR}${PREFIX}/bin/
.endfor
	${LN} -s ${PREFIX}/bin/STAF ${STAGEDIR}${PREFIX}/bin/staf
.for lib in ${STAF_LIB_FILES}
	${INSTALL_LIB} ${INSTALL_WRKSRC}/lib/${lib} ${STAGEDIR}${PREFIX}/lib/
.endfor
	${INSTALL_DATA} ${INSTALL_WRKSRC}/bin/STAF.cfg \
		${STAGEDIR}${PREFIX}/etc/STAF.cfg.sample
	cd ${INSTALL_WRKSRC}/include && \
		${COPYTREE_SHARE} . ${STAGEDIR}${PREFIX}/include
	${MKDIR} ${STAGEDIR}${DATADIR}/codepage
	cd ${INSTALL_WRKSRC}/codepage && \
		${COPYTREE_SHARE} . ${STAGEDIR}${DATADIR}/codepage
	${MKDIR} ${STAGEDIR}${EXAMPLESDIR}
	cd ${INSTALL_WRKSRC}/samples && \
		${COPYTREE_SHARE} . ${STAGEDIR}${EXAMPLESDIR}

do-install-OPENSSL-on:
	${MKDIR} ${STAGEDIR}${DATADIR}
.for sslfile in ${STAF_SSL_FILES}
	${INSTALL_DATA} ${INSTALL_WRKSRC}/bin/${sslfile} ${STAGEDIR}${DATADIR}
.endfor

do-install-PYTHON-on:
	${MKDIR} ${STAGEDIR}${PYTHON_SITELIBDIR}/${PORTNAME}
.for lib in ${STAF_PYLIB_FILES}
	${INSTALL_DATA} ${INSTALL_WRKSRC}/lib/${lib} \
		${STAGEDIR}${PYTHON_SITELIBDIR}/${PORTNAME}
.endfor
	${PYTHON_CMD} -m compileall -d ${PYTHON_SITELIBDIR}/${PORTNAME} \
		${STAGEDIR}${PYTHON_SITELIBDIR}/${PORTNAME}
	${PYTHON_CMD} -O -m compileall -d ${PYTHON_SITELIBDIR}/${PORTNAME} \
		${STAGEDIR}${PYTHON_SITELIBDIR}/${PORTNAME}
	${INSTALL_LIB} ${INSTALL_WRKSRC}/lib/python${PYTHON_SUFFIX}/PYSTAF.so \
		${STAGEDIR}${PYTHON_SITELIBDIR}/${PORTNAME}
	${ECHO} ${PORTNAME} > ${STAGEDIR}${PYTHON_SITELIBDIR}/${PORTNAME}.pth
	${MKDIR} ${STAGEDIR}${DOCSDIR}
	cd ${INSTALL_WRKSRC}/docs && \
		${COPYTREE_SHARE} . ${STAGEDIR}${DOCSDIR}

post-install:
	${MKDIR} ${STAGEDIR}${STAF_VAR_DIR}

.include <bsd.port.post.mk>
OpenPOWER on IntegriCloud