aboutsummaryrefslogtreecommitdiff
path: root/net/nss-pam-ldapd/Makefile
blob: cbd58ca8a2c9299e7f806c2471705623b654eb35 (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
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
PORTNAME=		nss-pam-ldapd
PORTVERSION=		0.9.12
PORTREVISION=		1
CATEGORIES=		net
MASTER_SITES=		http://arthurdejong.org/nss-pam-ldapd/ \
			ZI

MAINTAINER?=		zi@FreeBSD.org
COMMENT?=		Advanced fork of nss_ldap
WWW=		https://arthurdejong.org/nss-pam-ldapd/

LICENSE=		LGPL21 LGPL3
LICENSE_COMB=		dual

USES=			cpe ldap

CPE_VENDOR=		arthurdejong
GNU_CONFIGURE=		yes
USE_RC_SUBR=		nslcd
PAM_LDAP_SHMAJOR=	1
NSS_LDAP_SHMAJOR=	1
SUB_FILES+=		pkg-message

NSLCD_PIDFILE?=		/var/run/nslcd.pid
NSLCD_VARDIR?=		/var/run/nslcd
NSLCD_SOCKET?=		${NSLCD_VARDIR}/nslcd.ctl

OPTIONS_DEFINE=		KERBEROS LCLASS
OPTIONS_DEFAULT=	KERBEROS

LCLASS_EXTRA_PATCHES=	${PATCHDIR}/lclass-patches
LCLASS_DESC=		Build with loginClass support

.if defined(SLAVE_PORT)
OPTIONS_DEFINE+=	SASL
OPTIONS_MULTI=		MG1
OPTIONS_MULTI_MG1=	PAM NSS
PAM_DESC=		Build pam_ldap
NSS_DESC=		Build nss support
SASL_DESC=		Build sasl support
OPTIONS_DEFAULT+=	PAM NSS
CONFLICTS+=		nss-pam-ldapd-[0-9]*
.else
OPTIONS_MULTI=		MG1
OPTIONS_MULTI_MG1=	PAM NSS
PAM_DESC=		Build pam_ldap
NSS_DESC=		Build nss support
OPTIONS_DEFAULT+=	PAM NSS
CONFLICTS+=		nss-pam-ldapd-sasl
.endif

USERS=			nslcd
GROUPS=			nslcd

.include <bsd.port.options.mk>

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

CONFIGURE_ARGS+=	--with-nslcd-pidfile=${NSLCD_PIDFILE} \
			--with-nslcd-socket=${NSLCD_SOCKET} \
			--with-ldap-lib=openldap \
			--with-nss-ldap-soname=nss_ldap.so.${NSS_LDAP_SHMAJOR}

CONFIG_FILE=		"nslcd.conf"
CONFIGURE_ARGS+=	--with-ldap-conf-file=${PREFIX}/etc/${CONFIG_FILE}
PLIST_SUB+=		CONFIG="${CONFIG_FILE}" \
			PAM_LDAP_SHMAJOR="${PAM_LDAP_SHMAJOR}" \
			NSS_LDAP_SHMAJOR="${NSS_LDAP_SHMAJOR}"
SUB_LIST+=		CONFIG_FILE="${PREFIX}/etc/${CONFIG_FILE}" \
			NSLCD_PIDFILE="${NSLCD_PIDFILE}" \
			NSLCD_VARDIR="${NSLCD_VARDIR}" \
			USERS="${USERS}" GROUPS="${GROUPS}"

.if empty(PORT_OPTIONS:MKERBEROS)
CONFIGURE_ARGS+=	--disable-kerberos
.endif

.if ${PORT_OPTIONS:MSASL}
CONFIGURE_ARGS+=	--enable-sasl
.else
CONFIGURE_ARGS+=	--disable-sasl
.endif

.if ${PORT_OPTIONS:MPAM}
CONFIGURE_ARGS+=	--enable-pam \
			--with-pam-seclib-dir=${PREFIX}/lib \
			--with-pam-ldap-soname=pam_ldap.so.${PAM_LDAP_SHMAJOR}
CONFLICTS+=		pam_ldap-1.*
PLIST_SUB+=		PAM=""
.else
CONFIGURE_ARGS+=	--disable-pam
PLIST_SUB+=		PAM="@comment "
.endif

.if ${PORT_OPTIONS:MNSS}
CONFIGURE_ARGS+=	--enable-nss
CONFLICTS+=		nss_ldap-1.*
PLIST_SUB+=		NSS=""
SUB_LIST+=		NSS_MESSAGE="WARNING: Be sure to set uid and gid configuration parameters to make nslcd run under unprivileged user."
.else
CONFIGURE_ARGS+=	--disable-nss
PLIST_SUB+=		NSS="@comment "
SUB_LIST+=		NSS_MESSAGE=""
.endif

# Won't hook this in to OPTIONS until PADL ports are at least DEPRECATED.
# It doesn't do the software any good to run as replacement for the PADL ports
# without running the daemon.
.if defined(WITHOUT_NSLCD)
CONFIGURE_ARGS+=	--disable-nslcd
PLIST_SUB+=		NSLCD="@comment "
.else
CONFIGURE_ARGS+=	--enable-nslcd
PLIST_SUB+=		NSLCD=""
.endif

post-extract:
	@${REINPLACE_CMD} -e 's/\(INSTALL_\)\(.*\)) -D /\1\2) /' ${WRKSRC}/Makefile.in ${WRKSRC}/nss/Makefile.in

post-configure:
	${REINPLACE_CMD} -e 's/^\(CFLAGS.*\) \-O2 \(.*\)$$/\1 -O0 \2/' ${WRKSRC}/nss/Makefile

post-install:
.if ${PORT_OPTIONS:MNSS}
	@${LN} -fs nss_ldap.so.${NSS_LDAP_SHMAJOR} ${STAGEDIR}${PREFIX}/lib/nss_ldap.so
.endif
.if ${PORT_OPTIONS:MPAM}
	@${LN} -fs pam_ldap.so.${PAM_LDAP_SHMAJOR} ${STAGEDIR}${PREFIX}/lib/pam_ldap.so
.endif

.include <bsd.port.mk>