aboutsummaryrefslogtreecommitdiff
path: root/net/nss-pam-ldapd/Makefile
blob: cc70e826248b7560f8051eb6a1c38b38c4052aae (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
133
134
135
136
137
138
139
# Ports collection Makefile for:	nss_ldapd
# Date created:				23/7/2009
# Whom:					melifaro@ipfw.ru
#
# $FreeBSD$
#

PORTNAME=		nss-pam-ldapd
PORTVERSION=		0.7.7
CATEGORIES=		net
MASTER_SITES=		http://arthurdejong.org/nss-pam-ldapd/ \
			http://static.ipfw.ru/files/
LICENSE=		LGPL21 LGPL3
LICENSE_COMB=		dual

MAINTAINER=		melifaro@ipfw.ru
COMMENT=		Advanced fork of nss_ldap

GNU_CONFIGURE=		yes
USE_GMAKE=		yes
USE_OPENLDAP=		yes
USE_RC_SUBR=		nslcd

NSLCD_PIDFILE?=		/var/run/nslcd.pid
NSLCD_SOCKET?=		/var/run/nslcd.ctl

OPTIONS=		SASL		"Enable SASL" off \
			PAM		"Build pam_ldap" on \
			NSS_COMPAT	"Enable nss_ldap compatibility (DEPRECATED)" off

USERS=			nslcd
GROUPS=			nslcd

.include <bsd.port.pre.mk>

.if ${OSVERSION} < 700000
IGNORE=			problems with nss/libc TLS
.endif

CONFIGURE_ENV=		CPPFLAGS="-I${LOCALBASE}/include" \
			LDFLAGS="-L${LOCALBASE}/lib"

CONFIGURE_ARGS+=	--with-nslcd-pidfile=${NSLCD_PIDFILE} \
			--with-nslcd-socket=${NSLCD_SOCKET} \
			--with-ldap-lib=openldap --disable-kerberos

.if defined(WITHOUT_NSS)
.undef NSS_COMPAT
.endif

.if defined(WITH_NSS_COMPAT)
CONFIG_FILE=		"nss_ldap.conf"
CONFIGURE_ARGS+=	--enable-nss_compat --disable-configfile-checking --with-ldap-conf-file=${PREFIX}/etc/${CONFIG_FILE}
EXTRA_PATCHES+=		${FILESDIR}/nss_patch.diff
PLIST_SUB+=		CONFIG=${CONFIG_FILE}
.else
CONFIG_FILE=		"nslcd.conf"
CONFIGURE_ARGS+=	--with-ldap-conf-file=${PREFIX}/etc/${CONFIG_FILE}
PLIST_SUB+=		CONFIG=${CONFIG_FILE}
.endif

.if defined(WITH_SASL)
WANT_OPENLDAP_SASL=	yes
CONFIGURE_ARGS+=	--enable-sasl
.else
CONFIGURE_ARGS+=	--disable-sasl
.endif

.if defined(WITH_PAM)
CONFIGURE_ARGS+=	--enable-pam
MAN8+=			pam_ldap.8
CONFLICTS+=		pam_ldap-1.*
PLIST_SUB+=		PAM=""
.else
CONFIGURE_ARGS+=	--disable-pam
PLIST_SUB+=		PAM="@comment "
.endif

.if defined(WITHOUT_NSS)
CONFIGURE_ARGS+=	--disable-nss
PLIST_SUB+=		NSS="@comment "
.else
CONFIGURE_ARGS+=	--enable-nss
CONFLICTS+=		nss_ldap-1.*
PLIST_SUB+=		NSS=""
.endif

.if defined(WITHOUT_NSLCD)
CONFIGURE_ARGS+=	--disable-nslcd
PLIST_SUB+=		NSLCD="@comment "
.else
CONFIGURE_ARGS+=	--enable-nslcd
PLIST_SUB+=		NSLCD=""
MAN5+=			nslcd.conf.5
MAN8+=			nslcd.8
.endif

.if ${OSVERSION} < 800000
BROKEN=		fails to patch on 7.X
.endif

post-extract:
	@${REINPLACE_CMD} -e 's/\(INSTALL_\)\(.*\)) -D /\1\2) /' ${WRKSRC}/Makefile.in ${WRKSRC}/nss/Makefile.in
	@${REINPLACE_CMD} -e 's/shadow.$$(OBJEXT)/shadow.$$(OBJEXT) bsdnss.$$(OBJEXT)/;s/shadow\.c/shadow.c bsdnss.c/' ${WRKSRC}/nss/Makefile.in
	@${REINPLACE_CMD} -e 's/^NSS_VERS = .*/NSS_VERS = 1/;s/libnss_ldap\.so/nss_ldap.so/' ${WRKSRC}/nss/Makefile.in
	@${REINPLACE_CMD} -e 's/$$(DESTDIR)$$(NSS_LDAP_PATH_CONF)/$$(DESTDIR)$$(NSS_LDAP_PATH_CONF).sample/' ${WRKSRC}/Makefile.in
	@${REINPLACE_CMD} -e '/^$$(ACLOCAL_M4/,+2d' ${WRKSRC}/Makefile.in

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

post-install:
	@${ECHO_MSG}
	@${ECHO_MSG} =====================================================================
	@${ECHO_MSG}
.if defined(WITH_NSS_COMPAT)
	@${ECHO_MSG} "                NSS_LDAP compatibility ENABLED."
	@${ECHO_MSG} "          It is DEPRECATED now and will be removed."
	@${ECHO_MSG}
	@${ECHO_MSG} " LDAP configuration:      ${PREFIX}/etc/${CONFIG_FILE}"
	@${ECHO_MSG} " Secret file:             ${PREFIX}/etc/nss_ldap.secret"
	@${ECHO_MSG} " Sample configuration:    ${PREFIX}/etc/${CONFIG_FILE}.sample"
	@${ECHO_MSG}
	@${ECHO_MSG} " Check if you need to adjust  reconnect_* parameters"
	@${ECHO_MSG} " WARNING: nss_ldapd will use ONLY rootbinddn to access LDAP data"
.else
	@${ECHO_MSG} " LDAP configuration:      ${PREFIX}/etc/${CONFIG_FILE}"
	@${ECHO_MSG} " Sample configuration:    ${PREFIX}/etc/${CONFIG_FILE}.sample"
	@${ECHO_MSG}
.endif
.if !defined(WITHOUT_NSS)
	@${ECHO_MSG} " WARNING: Be sure to set uid and gid configuration parameters"
	@${ECHO_MSG} " WARNING: to make nslcd run under unprivileged user"
.endif
	@${ECHO_MSG}
	@${ECHO_MSG} =====================================================================
	@${ECHO_MSG}

.include <bsd.port.post.mk>