summaryrefslogtreecommitdiff
path: root/net/samba/options.mk
blob: 954d3d25cd3c4fa29ff1764d53f1e75da4ae245b (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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
# $NetBSD: options.mk,v 1.15 2006/04/20 11:44:07 grant Exp $

# Recommended package options for various setups:
#
#   Standalone Samba server		cups
#   Domain Member server		cups ldap winbind
#   Active Directory Member server	ads cups winbind
#   Domain Controller			ldap winbind
#
PKG_OPTIONS_VAR=	PKG_OPTIONS.samba
PKG_SUPPORTED_OPTIONS=	ads cups ldap ldap-compat mysql pam pgsql	\
			winbind xml

.include "../../mk/bsd.options.mk"

SAMBA_PASSDB_BACKENDS:=	# empty
SAMBA_STATIC_MODULES:=	# empty

###
### Allow Samba to join as a member server of an Active Directory domain.
###
.if !empty(PKG_OPTIONS:Mads)
.  include "../../mk/krb5.buildlink3.mk"
.  if empty(PKG_OPTIONS:Mldap)
PKG_OPTIONS+=		ldap
.  endif
CONFIGURE_ARGS+=	--with-ads
CONFIGURE_ARGS+=	--with-krb5=${KRB5BASE:Q}

# ignore gssapi.h on Solaris as it conflicts with <gssapi/gssapi.h>
.  if ${OPSYS} == "SunOS"
CONFIGURE_ENV+=		ac_cv_header_gssapi_h=no
.  endif
.else
CONFIGURE_ARGS+=	--without-ads
CONFIGURE_ARGS+=	--without-krb5
.endif

###
### Native CUPS support for providing printing services.
###
.if !empty(PKG_OPTIONS:Mcups)
.  include "../../print/cups/buildlink3.mk"
CONFIGURE_ARGS+=	--enable-cups
PLIST_SUBST+=		CUPS=

.PHONY: samba-cups-install
post-install: samba-cups-install
samba-cups-install:
	${INSTALL_DATA_DIR} ${PREFIX}/libexec/cups/backend
	cd ${PREFIX}/libexec/cups/backend && ${LN} -fs ../../../bin/smbspool smb
.else
CONFIGURE_ARGS+=	--disable-cups
PLIST_SUBST+=		CUPS="@comment "
.endif

###
### Support Samba-2.x LDAP password and account databases.
###
.if !empty(PKG_OPTIONS:Mldap-compat)
.  if empty(PKG_OPTIONS:Mldap)
PKG_OPTIONS+=		ldap
.  endif
CONFIGURE_ARGS+=	--with-ldapsam
.endif

###
### Support LDAP authentication and storage of Samba account information.
###
.if !empty(PKG_OPTIONS:Mldap)
.  include "../../databases/openldap/buildlink3.mk"
CONFIGURE_ARGS+=	--with-ldap
.else
CONFIGURE_ARGS+=	--without-ldap
.endif

###
### Support using a MySQL database as a "passdb backend" for password
### and account information storage.
###
.if !empty(PKG_OPTIONS:Mmysql)
.  include "../../mk/mysql.buildlink3.mk"
SAMBA_PASSDB_BACKENDS:=	${SAMBA_PASSDB_BACKENDS},mysql
SAMBA_STATIC_MODULES:=	${SAMBA_STATIC_MODULES},pdb_mysql
.endif

###
### Support PAM authentication and build smbpass and winbind PAM modules.
###
.if !empty(PKG_OPTIONS:Mpam)
.  include "../../security/PAM/module.mk"
CONFIGURE_ARGS+=	--with-pam
CONFIGURE_ARGS+=	--with-pam_smbpass
PLIST_SUBST+=		PAM_SMBPASS=lib/security/pam_smbpass.so
PLIST_SUBST+=		PAM=

.PHONY: samba-pam-smbpass-install
post-install: samba-pam-smbpass-install
samba-pam-smbpass-install:
	${INSTALL_LIB_DIR} ${PAM_INSTMODULEDIR}
	${INSTALL_LIB} ${WRKSRC}/bin/pam_smbpass.so ${PAM_INSTMODULEDIR}
	${INSTALL_DATA_DIR} ${DOCDIR}
	${INSTALL_DATA} ${WRKSRC}/pam_smbpass/README			\
		${DOCDIR}/README.pam_smbpass
	${INSTALL_DATA_DIR} ${EGDIR}/pam_smbpass
	cd ${WRKSRC}/pam_smbpass/samples; for f in [a-z]*; do		\
		${INSTALL_DATA} $${f} ${EGDIR}/pam_smbpass/$${f};	\
	done
.else
PLIST_SUBST+=		PAM_SMBPASS="@comment no PAM smbpass module"
PLIST_SUBST+=		PAM="@comment "
.endif

###
### Support using a PostgreSQL database as a "passdb backend" for password
### and account information storage.
###
.if !empty(PKG_OPTIONS:Mpgsql)
.  include "../../mk/pgsql.buildlink3.mk"
SAMBA_PASSDB_BACKENDS:=	${SAMBA_PASSDB_BACKENDS},pgsql
SAMBA_STATIC_MODULES:=	${SAMBA_STATIC_MODULES},pdb_pgsql
.endif

###
### Support querying a PDC for domain user and group information, e.g.,
### through NSS or PAM.
###
.if !empty(PKG_OPTIONS:Mwinbind)
CONFIGURE_ARGS+=	--with-winbind

SAMBA_STATIC_MODULES:=	${SAMBA_STATIC_MODULES},idmap_rid
.  if !empty(PKG_OPTIONS:Mads)
SAMBA_STATIC_MODULES:=	${SAMBA_STATIC_MODULES},idmap_ad
.  endif

WINBINDD_RCD_SCRIPT=	winbindd
PLIST_SUBST+=		WINBIND=

# Install the PAM winbind module if we're also building with PAM support.
.  if empty(PKG_OPTIONS:Mpam)
PLIST_SUBST+=	PAM_WINBIND="@comment no PAM winbind module"
.  else
PLIST_SUBST+=	PAM_WINBIND=lib/security/pam_winbind.so

.PHONY: samba-pam-winbind-install
post-install: samba-pam-winbind-install
samba-pam-winbind-install:
	${INSTALL_LIB_DIR} ${PAM_INSTMODULEDIR}
	${INSTALL_LIB} ${WRKSRC}/nsswitch/pam_winbind.so ${PAM_INSTMODULEDIR}
.  endif

# Install the NSS winbind module if it exists.
PLIST_SUBST+=		NSS_WINBIND=${NSS_WINBIND:Q}
NSS_WINBIND=		${NSS_WINBIND_cmd:sh}
NSS_WINBIND_cmd=	\
	${TEST} -x ${WRKSRC}/config.status ||				\
		{ ${ECHO} "@comment no NSS winbind module" ; exit 0; };	\
	cd ${WRKDIR} && ${ECHO} @WINBIND_NSS@ |				\
	${WRKSRC}/config.status --file=-:- | 				\
	${AWK} '/^$$/ { print "@comment no NSS winbind module"; exit 0; } \
		{ sub(".*/", "lib/"); print; }' &&			\
	${RM} -f config.log

.PHONY: samba-nss-winbind-install
post-install: samba-nss-winbind-install
samba-nss-winbind-install:
	lib=${WRKSRC:Q}/nsswitch/${NSS_WINBIND:T:Q};			\
	${TEST} ! -f $$lib || ${INSTALL_LIB} $$lib ${PREFIX:Q}/lib

# Install the NSS WINS module if it exists.
PLIST_SUBST+=	NSS_WINS=${NSS_WINS:Q}
NSS_WINS=	${NSS_WINS_cmd:sh}
NSS_WINS_cmd=	\
	${TEST} -x ${WRKSRC}/config.status ||				\
		{ ${ECHO} "@comment no NSS WINS module" ; exit 0; };	\
	cd ${WRKDIR} && ${ECHO} @WINBIND_WINS_NSS@ |			\
	${WRKSRC}/config.status --file=-:- |				\
	${AWK} '/^$$/ { print "@comment no NSS WINS module"; exit 0; }	\
		{ sub(".*/", "lib/"); print; }' &&			\
	${RM} -f config.log

.PHONY: samba-nss-wins-install
post-install: samba-nss-wins-install
samba-nss-wins-install:
	lib=${WRKSRC:Q}/nsswitch/${NSS_WINS:T:Q};			\
	${TEST} ! -f $$lib || ${INSTALL_LIB} $$lib ${PREFIX:Q}/lib
.else
CONFIGURE_ARGS+=	--without-winbind
PLIST_SUBST+=		WINBIND="@comment "
PLIST_SUBST+=		PAM_WINBIND="@comment no PAM winbind module"
PLIST_SUBST+=		NSS_WINBIND="@comment no NSS winbind module"
PLIST_SUBST+=		NSS_WINS="@comment no NSS WINS module"
.endif

###
### Support using an XML file as a "passdb backend" for password and
### account information storage.
###
.if !empty(PKG_OPTIONS:Mxml)
.  include "../../textproc/libxml2/buildlink3.mk"
SAMBA_PASSDB_BACKENDS:=	${SAMBA_PASSDB_BACKENDS},xml
SAMBA_STATIC_MODULES:=	${SAMBA_STATIC_MODULES},pdb_xml
.endif

###
### Add the optional passdb backends to the configuration.
###
.if !empty(SAMBA_PASSDB_BACKENDS)
CONFIGURE_ARGS+=	--with-expsam=${SAMBA_PASSDB_BACKENDS:S/^,//}
.endif

###
### Add the optional static modules to the configuration.
###
.if !empty(SAMBA_STATIC_MODULES)
CONFIGURE_ARGS+=	--with-static-modules=${SAMBA_STATIC_MODULES:S/^,//}
.endif