Merge from vendor branch TNF:
[pkgsrcv2.git] / net / samba33 / options.mk
1 # $NetBSD: options.mk,v 1.28 2012/01/30 15:44:02 adam Exp $
2
3 # Recommended package options for various setups:
4 #
5 #   Standalone Samba server             cups
6 #   Domain Member server                cups ldap winbind
7 #   Active Directory Member server      ads cups winbind
8 #   Domain Controller                   ldap winbind
9 #
10 PKG_OPTIONS_VAR=        PKG_OPTIONS.samba
11 PKG_SUPPORTED_OPTIONS=  ads cups fam ldap pam winbind
12 PKG_SUGGESTED_OPTIONS=  ads ldap pam winbind
13
14 .include "../../mk/bsd.fast.prefs.mk"
15
16 SAMBA_ACL_OPSYS=        AIX Darwin FreeBSD HPUX IRIX Linux OSF1 SunOS
17 .if !empty(SAMBA_ACL_OPSYS:M${OPSYS})
18 PKG_SUPPORTED_OPTIONS+= acl
19 .endif
20
21 .include "../../mk/bsd.options.mk"
22
23 SAMBA_STATIC_MODULES:=  # empty
24
25 ###
26 ### Allow Samba to join as a member server of an Active Directory domain.
27 ###
28 .if !empty(PKG_OPTIONS:Mads)
29 .  include "../../mk/krb5.buildlink3.mk"
30 .  if empty(PKG_OPTIONS:Mldap)
31 PKG_OPTIONS+=           ldap
32 .  endif
33 CONFIGURE_ARGS+=        --with-ads
34 CONFIGURE_ARGS+=        --with-krb5=${KRB5BASE}
35
36 # Avoid build failures with recent version of Heimdal under NetBSD.
37 .  if ${OPSYS} == "NetBSD"
38 CONFIGURE_ENV+= samba_cv_HAVE_KRB5_DEPRECATED_WITH_IDENTIFIER=no
39 .  endif
40
41 # ignore gssapi.h on Solaris as it conflicts with <gssapi/gssapi.h>
42 .  if ${OPSYS} == "SunOS"
43 CONFIGURE_ENV+=         ac_cv_header_gssapi_h=no
44 .  endif
45 .else
46 CONFIGURE_ARGS+=        --without-ads
47 CONFIGURE_ARGS+=        --without-krb5
48 .endif
49
50 ###
51 ### Access Control List support.
52 ###
53 .if !empty(PKG_OPTIONS:Macl)
54 CONFIGURE_ARGS+=        --with-acl-support
55 .endif
56
57 ###
58 ### Native CUPS support for providing printing services.
59 ###
60 PLIST_VARS+=            cups
61 .if !empty(PKG_OPTIONS:Mcups)
62 .  include "../../print/cups/buildlink3.mk"
63 CONFIGURE_ARGS+=        --enable-cups
64 PLIST.cups=             yes
65 INSTALLATION_DIRS+=     libexec/cups/backend
66
67 .PHONY: samba-cups-install
68 post-install: samba-cups-install
69 samba-cups-install:
70         cd ${DESTDIR}${PREFIX}/libexec/cups/backend && \
71                 ${LN} -fs ../../../bin/smbspool smb
72 .else
73 CONFIGURE_ARGS+=        --disable-cups
74 .endif
75
76 ###
77 ### Access Control List support.
78 ###
79 PLIST_VARS+=            fam
80 .if !empty(PKG_OPTIONS:Mfam)
81 .  include "../../mk/fam.buildlink3.mk"
82 CONFIGURE_ARGS+=        --enable-fam
83 PLIST.fam=              yes
84 .else
85 CONFIGURE_ARGS+=        --disable-fam
86 .endif
87
88 ###
89 ### Support LDAP authentication and storage of Samba account information.
90 ###
91 .if !empty(PKG_OPTIONS:Mldap)
92 .  include "../../databases/openldap-client/buildlink3.mk"
93 CONFIGURE_ARGS+=        --with-ldap
94 .else
95 CONFIGURE_ARGS+=        --without-ldap
96 .endif
97
98 ###
99 ### Support PAM authentication and build smbpass and winbind PAM modules.
100 ###
101 PLIST_VARS+=            pam
102 .if !empty(PKG_OPTIONS:Mpam)
103 .  include "../../security/PAM/module.mk"
104 CONFIGURE_ARGS+=        --with-pam
105 CONFIGURE_ARGS+=        --with-pam_smbpass
106 CONFIGURE_ARGS+=        --with-pammodulesdir=${PAM_INSTMODULEDIR}
107 PLIST.pam=              yes
108 INSTALLATION_DIRS+=     ${EGDIR}/pam_smbpass
109
110 .PHONY: samba-pam-smbpass-install
111 post-install: samba-pam-smbpass-install
112 samba-pam-smbpass-install:
113         ${INSTALL_DATA} ${WRKSRC}/pam_smbpass/README                    \
114                 ${DESTDIR}${PREFIX}/${DOCDIR}/README.pam_smbpass
115         cd ${WRKSRC}/pam_smbpass/samples; for f in [a-z]*; do           \
116                 ${INSTALL_DATA} $${f} \
117                         ${DESTDIR}${PREFIX}/${EGDIR}/pam_smbpass/$${f}; \
118         done
119 .endif
120
121 ###
122 ### Support querying a PDC for domain user and group information, e.g.,
123 ### through NSS or PAM.
124 ###
125 PLIST_VARS+=            winbind
126 .if !empty(PKG_OPTIONS:Mwinbind)
127 CONFIGURE_ARGS+=        --with-winbind
128
129 SAMBA_STATIC_MODULES:=  ${SAMBA_STATIC_MODULES},idmap_rid
130 .  if !empty(PKG_OPTIONS:Mads)
131 SAMBA_STATIC_MODULES:=  ${SAMBA_STATIC_MODULES},idmap_ad
132 .  endif
133
134 WINBINDD_RCD_SCRIPT=    winbindd
135 PLIST.winbind=          yes
136
137 # Install the NSS winbind module if it exists.
138 PLIST_SUBST+=           NSS_WINBIND=${NSS_WINBIND:Q}
139 NSS_WINBIND=            ${NSS_WINBIND_cmd:sh}
140 NSS_WINBIND_cmd=        \
141         ${TEST} -x ${WRKSRC}/config.status ||                           \
142                 { ${ECHO} "@comment no NSS winbind module" ; exit 0; }; \
143         cd ${WRKDIR} && ${ECHO} @WINBIND_NSS@ |                         \
144         ${WRKSRC}/config.status --file=-:- |                            \
145         ${AWK} '/^$$/ { print "@comment no NSS winbind module"; exit 0; } \
146                 { sub(".*/", "lib/"); print; }' &&                      \
147         ${RM} -f config.log
148
149 .PHONY: samba-nss-winbind-install
150 post-install: samba-nss-winbind-install
151 samba-nss-winbind-install:
152         lib=${WRKSRC}/nsswitch/${NSS_WINBIND:T:Q};                      \
153         ${TEST} ! -f $$lib || ${INSTALL_LIB} $$lib ${DESTDIR}${PREFIX}/lib
154
155 # Install the NSS WINS module if it exists.
156 PLIST_SUBST+=   NSS_WINS=${NSS_WINS:Q}
157 NSS_WINS=       ${NSS_WINS_cmd:sh}
158 NSS_WINS_cmd=   \
159         ${TEST} -x ${WRKSRC}/config.status ||                           \
160                 { ${ECHO} "@comment no NSS WINS module" ; exit 0; };    \
161         cd ${WRKDIR} && ${ECHO} @WINBIND_WINS_NSS@ |                    \
162         ${WRKSRC}/config.status --file=-:- |                            \
163         ${AWK} '/^$$/ { print "@comment no NSS WINS module"; exit 0; }  \
164                 { sub(".*/", "lib/"); print; }' &&                      \
165         ${RM} -f config.log
166
167 .PHONY: samba-nss-wins-install
168 post-install: samba-nss-wins-install
169 samba-nss-wins-install:
170         lib=${WRKSRC}/nsswitch/${NSS_WINS:T:Q};                         \
171         ${TEST} ! -f $$lib || ${INSTALL_LIB} $$lib ${DESTDIR}${PREFIX}/lib
172 .else
173 CONFIGURE_ARGS+=        --without-winbind
174 PLIST_SUBST+=           NSS_WINBIND="no NSS winbind module"
175 PLIST_SUBST+=           NSS_WINS="no NSS WINS module"
176 .endif
177
178 ###
179 ### Add the optional static modules to the configuration.
180 ###
181 .if !empty(SAMBA_STATIC_MODULES)
182 CONFIGURE_ARGS+=        --with-static-modules=${SAMBA_STATIC_MODULES:S/^,//}
183 .endif