summaryrefslogtreecommitdiff
path: root/security/softether-devel/Makefile
blob: 704f19012e08afabbe9544c4c0ab4e98d21f6e9a (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

PORTNAME=	softether
DISTVERSION=	4.34-9745-beta
PORTREVISION=	3
CATEGORIES=	security net-vpn
MASTER_SITES=	https://www.softether-download.com/files/softether/v${DISTVERSION}-2020.04.05-tree/Source_Code/
PKGNAMESUFFIX=	-devel
DISTNAME=	${PORTNAME}-src-v${DISTVERSION}

MAINTAINER=	meta@FreeBSD.org
COMMENT=	Softether VPN 4 (stable beta version)

LICENSE=	APACHE20
LICENSE_FILE=	${WRKSRC}/LICENSE

ONLY_FOR_ARCHS=	amd64 i386
ONLY_FOR_ARCHS_REASON=	Upstream only supports amd64 and i386: https://www.softether.org/3-spec
IGNORE=		no beta version available right now, use security/softether instead

USES=		dos2unix gmake iconv:wchar_t localbase:ldflags ncurses \
		readline ssl
USE_RC_SUBR=	softether_bridge softether_client \
		softether_server softether_trafficserver

DOS2UNIX_FILES=	ChangeLog LICENSE README *.TXT \
		src/Cedar/*.* src/Mayaqua/*.*

OPTIONS_DEFINE=	DOCS

CONFLICTS_INSTALL=	softether-4.* softether5
PORTDOCS=	AUTHORS.TXT ChangeLog LICENSE README THIRD_PARTY.TXT WARNING.TXT

SE_DBDIR?=	/var/db/${PORTNAME}
SE_LOGDIR?=	/var/log/${PORTNAME}
SE_PIDDIR?=	/var/run/${PORTNAME}
PLIST_SUB=	SE_DBDIR="${SE_DBDIR}" SE_LOGDIR="${SE_LOGDIR}" SE_PIDDIR="${SE_PIDDIR}"
SUB_LIST=	SE_DBDIR="${SE_DBDIR}" SE_LOGDIR="${SE_LOGDIR}" SE_PIDDIR="${SE_PIDDIR}"
SUB_FILES=	pkg-message vpncmd

CPPFLAGS+=	-I${LOCALBASE}/include
LDFLAGS+=	-L${LOCALBASE}/lib

# a pity the source directory has such a naming scheme, but well
WRKSRC=		${WRKDIR}/v${DISTVERSION:S/-beta$//}

ALL_TARGET=	build

.include <bsd.port.options.mk>

post-patch:
	# SoftEther scatters logs, config files and PID files in PREFIX/libexec
	# directory. To write them in the right place, replace it.
	${REINPLACE_CMD} \
		-e "s|%%SE_DBDIR%%|${SE_DBDIR}|g" \
		-e "s|%%SE_LOGDIR%%|${SE_LOGDIR}|g" \
		-e "s|%%SE_PIDDIR%%|${SE_PIDDIR}|g" \
		${WRKSRC}/src/Mayaqua/FileIO.c

	# skip configure at all and copy the corresponding Makefile in place
.if ${ARCH} != "amd64"
	@${CP} ${WRKSRC}/src/makefiles/freebsd_32bit.mak ${WRKSRC}/Makefile
.else
	@${CP} ${WRKSRC}/src/makefiles/freebsd_64bit.mak ${WRKSRC}/Makefile
.endif
	# pull in user specific CFLAGS and LDFLAGS
	@${REINPLACE_CMD} -e "s|OPTIONS_COMPILE_RELEASE=|OPTIONS_COMPILE_RELEASE=${CFLAGS} |g" ${WRKSRC}/Makefile
	@${REINPLACE_CMD} -e "s|OPTIONS_LINK_RELEASE=|OPTIONS_LINK_RELEASE=${LDFLAGS} |g" ${WRKSRC}/Makefile

# manually install to ${PREFIX}/libexec/softether, then the final install will copy scripts
# into ${PREFIX}/sbin
do-install:
	${MKDIR} ${STAGEDIR}/${PREFIX}/libexec/softether
	${INSTALL_SCRIPT} ${WRKSRC}/bin/vpnbridge/vpnbridge ${STAGEDIR}/${PREFIX}/libexec/${PORTNAME}/vpnbridge
	${INSTALL_SCRIPT} ${WRKSRC}/bin/vpnclient/vpnclient ${STAGEDIR}/${PREFIX}/libexec/${PORTNAME}/vpnclient
	${INSTALL_SCRIPT} ${WRKSRC}/bin/vpncmd/vpncmd ${STAGEDIR}/${PREFIX}/libexec/${PORTNAME}/vpncmd
	${INSTALL_SCRIPT} ${WRKSRC}/bin/vpnserver/vpnserver ${STAGEDIR}/${PREFIX}/libexec/${PORTNAME}/vpnserver
	${INSTALL_DATA} ${WRKSRC}/bin/vpnserver/hamcore.se2 ${STAGEDIR}/${PREFIX}/libexec/${PORTNAME}/hamcore.se2
	${INSTALL_SCRIPT} ${WRKDIR}/vpncmd ${STAGEDIR}/${PREFIX}/sbin/vpncmd
.for i in vpnbridge vpnclient vpncmd vpnserver
	@${STRIP_CMD} ${STAGEDIR}${PREFIX}/libexec/${PORTNAME}/${i}
.endfor
	@${MKDIR} \
		${STAGEDIR}${DOCSDIR} \
		${STAGEDIR}${SE_DBDIR} \
		${STAGEDIR}${SE_LOGDIR} \
		${STAGEDIR}${SE_PIDDIR}
.for doc in ${PORTDOCS}
	${INSTALL_DATA} ${WRKSRC}/${doc} ${STAGEDIR}${DOCSDIR}
.endfor

.include <bsd.port.mk>