| 1 |
# Copyright 1999-2012 Gentoo Foundation |
| 2 |
# Distributed under the terms of the GNU General Public License v2 |
| 3 |
# $Header: /var/cvsroot/gentoo-x86/net-fs/samba/samba-3.6.6.ebuild,v 1.2 2012/10/19 08:10:00 swift Exp $ |
| 4 |
|
| 5 |
EAPI=4 |
| 6 |
|
| 7 |
inherit pam versionator multilib eutils |
| 8 |
|
| 9 |
MY_PV=${PV/_/} |
| 10 |
MY_P="${PN}-${MY_PV}" |
| 11 |
|
| 12 |
DESCRIPTION="Library bits of the samba network filesystem" |
| 13 |
HOMEPAGE="http://www.samba.org/" |
| 14 |
SRC_URI="mirror://samba/${MY_P}.tar.gz" |
| 15 |
LICENSE="GPL-3" |
| 16 |
SLOT="0" |
| 17 |
KEYWORDS="~amd64 ~hppa ~x86 ~amd64-fbsd ~x86-fbsd" |
| 18 |
IUSE="acl addns ads +aio avahi caps +client cluster cups debug doc examples fam |
| 19 |
ldap ldb +netapi pam quota +readline selinux +server +smbclient smbsharemodes |
| 20 |
swat syslog winbind" |
| 21 |
|
| 22 |
DEPEND="dev-libs/popt |
| 23 |
>=sys-libs/talloc-2.0.5 |
| 24 |
>=sys-libs/tdb-1.2.9 |
| 25 |
virtual/libiconv |
| 26 |
ads? ( virtual/krb5 sys-fs/e2fsprogs |
| 27 |
client? ( sys-apps/keyutils |
| 28 |
kernel_linux? ( net-fs/cifs-utils[ads] ) ) ) |
| 29 |
avahi? ( net-dns/avahi[dbus] ) |
| 30 |
caps? ( sys-libs/libcap ) |
| 31 |
client? ( !net-fs/mount-cifs |
| 32 |
dev-libs/iniparser |
| 33 |
kernel_linux? ( net-fs/cifs-utils ) ) |
| 34 |
cluster? ( >=dev-db/ctdb-1.13 ) |
| 35 |
cups? ( net-print/cups ) |
| 36 |
debug? ( dev-libs/dmalloc ) |
| 37 |
fam? ( virtual/fam ) |
| 38 |
ldap? ( net-nds/openldap ) |
| 39 |
ldb? ( sys-libs/ldb ) |
| 40 |
pam? ( virtual/pam |
| 41 |
winbind? ( dev-libs/iniparser ) |
| 42 |
) |
| 43 |
readline? ( >=sys-libs/readline-5.2 ) |
| 44 |
selinux? ( sec-policy/selinux-samba ) |
| 45 |
syslog? ( virtual/logger )" |
| 46 |
|
| 47 |
RDEPEND="${DEPEND}" |
| 48 |
|
| 49 |
# Disable tests since we don't want to build that much here |
| 50 |
RESTRICT="test" |
| 51 |
|
| 52 |
SBINPROGS="" |
| 53 |
BINPROGS="" |
| 54 |
KRBPLUGIN="" |
| 55 |
PLUGINEXT=".so" |
| 56 |
SHAREDMODS="" |
| 57 |
|
| 58 |
S="${WORKDIR}/${MY_P}/source3" |
| 59 |
|
| 60 |
# TODO: |
| 61 |
# - enable iPrint on Prefix/OSX and Darwin? |
| 62 |
# - selftest-prefix? selftest? |
| 63 |
# - AFS? |
| 64 |
|
| 65 |
CONFDIR="${FILESDIR}/$(get_version_component_range 1-2)" |
| 66 |
|
| 67 |
REQUIRED_USE=" |
| 68 |
ads? ( ldap ) |
| 69 |
swat? ( server ) |
| 70 |
" |
| 71 |
|
| 72 |
pkg_pretend() { |
| 73 |
if [[ ${MERGE_TYPE} != binary ]]; then |
| 74 |
if use winbind && |
| 75 |
[[ $(tc-getCC)$ == *gcc* ]] && |
| 76 |
[[ $(gcc-major-version)$(gcc-minor-version) -lt 43 ]] |
| 77 |
then |
| 78 |
eerror "It is a known issue that ${P} will not build with " |
| 79 |
eerror "winbind use flag enabled when using gcc < 4.3 ." |
| 80 |
eerror "Please use at least the latest stable gcc version." |
| 81 |
die "Using sys-devel/gcc < 4.3 with winbind use flag." |
| 82 |
fi |
| 83 |
fi |
| 84 |
} |
| 85 |
|
| 86 |
pkg_setup() { |
| 87 |
if use server ; then |
| 88 |
SBINPROGS="${SBINPROGS} bin/smbd bin/nmbd" |
| 89 |
BINPROGS="${BINPROGS} bin/testparm bin/smbstatus bin/smbcontrol bin/pdbedit |
| 90 |
bin/profiles bin/sharesec bin/eventlogadm bin/smbta-util" |
| 91 |
|
| 92 |
use swat && SBINPROGS="${SBINPROGS} bin/swat" |
| 93 |
use winbind && SBINPROGS="${SBINPROGS} bin/winbindd" |
| 94 |
use ads && use winbind && KRBPLUGIN="${KRBPLUGIN} bin/winbind_krb5_locator" |
| 95 |
fi |
| 96 |
|
| 97 |
if use client ; then |
| 98 |
BINPROGS="${BINPROGS} bin/smbclient bin/net bin/smbget bin/smbtree |
| 99 |
bin/nmblookup bin/smbpasswd bin/rpcclient bin/smbcacls bin/smbcquotas |
| 100 |
bin/ntlm_auth" |
| 101 |
|
| 102 |
fi |
| 103 |
|
| 104 |
use cups && BINPROGS="${BINPROGS} bin/smbspool" |
| 105 |
# use ldb && BINPROGS="${BINPROGS} bin/ldbedit bin/ldbsearch bin/ldbadd bin/ldbdel bin/ldbmodify bin/ldbrename"; |
| 106 |
|
| 107 |
if use winbind ; then |
| 108 |
BINPROGS="${BINPROGS} bin/wbinfo" |
| 109 |
SHAREDMODS="${SHAREDMODS}idmap_rid,idmap_hash" |
| 110 |
use ads && SHAREDMODS="${SHAREDMODS},idmap_ad" |
| 111 |
use ldap && SHAREDMODS="${SHAREDMODS},idmap_ldap,idmap_adex" |
| 112 |
fi |
| 113 |
} |
| 114 |
|
| 115 |
src_prepare() { |
| 116 |
cp "${FILESDIR}/samba-3.4.2-lib.tevent.python.mk" "../lib/tevent/python.mk" |
| 117 |
|
| 118 |
# ensure that winbind has correct ldflags (QA notice) |
| 119 |
sed -i \ |
| 120 |
-e 's|LDSHFLAGS="|LDSHFLAGS="\\${LDFLAGS} |g' \ |
| 121 |
configure || die "sed failed" |
| 122 |
cd "${WORKDIR}/${MY_P}" && epatch "${CONFDIR}"/smb.conf.default.patch |
| 123 |
} |
| 124 |
|
| 125 |
src_configure() { |
| 126 |
local myconf |
| 127 |
|
| 128 |
# Filter out -fPIE |
| 129 |
[[ ${CHOST} == *-*bsd* ]] && myconf+=" --disable-pie" |
| 130 |
|
| 131 |
# Upstream refuses to make this configurable |
| 132 |
use caps && export ac_cv_header_sys_capability_h=yes || export ac_cv_header_sys_capability_h=no |
| 133 |
|
| 134 |
#bug #399141 wrap newer iniparser version |
| 135 |
has_version ">=dev-libs/iniparser-3.0.0" && \ |
| 136 |
export CPPFLAGS+=" -Diniparser_getstr\(d,i\)=iniparser_getstring\(d,i,NULL\)" |
| 137 |
|
| 138 |
# Notes: |
| 139 |
# - automount is only needed in conjunction with NIS and we don't have that |
| 140 |
# anymore => LDAP? |
| 141 |
# - --without-dce-dfs and --without-nisplus-home can't be passed to configure but are disabled by default |
| 142 |
econf ${myconf} \ |
| 143 |
--with-piddir=/var/run/samba \ |
| 144 |
--sysconfdir=/etc/samba \ |
| 145 |
--localstatedir=/var \ |
| 146 |
$(use_enable debug developer) \ |
| 147 |
--enable-largefile \ |
| 148 |
--enable-socket-wrapper \ |
| 149 |
--enable-nss-wrapper \ |
| 150 |
$(use_enable swat) \ |
| 151 |
$(use_enable debug dmalloc) \ |
| 152 |
$(use_enable cups) \ |
| 153 |
--disable-iprint \ |
| 154 |
$(use_enable fam) \ |
| 155 |
--enable-shared-libs \ |
| 156 |
--disable-dnssd \ |
| 157 |
$(use_enable avahi) \ |
| 158 |
--with-fhs \ |
| 159 |
--with-privatedir=/var/lib/samba/private \ |
| 160 |
--with-rootsbindir=/var/cache/samba \ |
| 161 |
--with-lockdir=/var/cache/samba \ |
| 162 |
--with-swatdir=/usr/share/doc/${PF}/swat \ |
| 163 |
--with-configdir=/etc/samba \ |
| 164 |
--with-logfilebase=/var/log/samba \ |
| 165 |
--with-pammodulesdir=$(getpam_mod_dir) \ |
| 166 |
--without-afs \ |
| 167 |
--without-fake-kaserver \ |
| 168 |
--without-vfs-afsacl \ |
| 169 |
$(use_with ldap) \ |
| 170 |
$(use_with ads) \ |
| 171 |
$(use_with ads krb5 /usr) \ |
| 172 |
$(use_with ads dnsupdate) \ |
| 173 |
--without-automount \ |
| 174 |
$(use_with pam) \ |
| 175 |
$(use_with pam pam_smbpass) \ |
| 176 |
$(use_with syslog) \ |
| 177 |
$(use_with quota quotas) \ |
| 178 |
$(use_with quota sys-quotas) \ |
| 179 |
--without-utmp \ |
| 180 |
--without-lib{talloc,tdb} \ |
| 181 |
$(use_with netapi libnetapi) \ |
| 182 |
$(use_with smbclient libsmbclient) \ |
| 183 |
$(use_with smbsharemodes libsmbsharemodes) \ |
| 184 |
$(use_with addns libaddns) \ |
| 185 |
$(use_with cluster ctdb /usr) \ |
| 186 |
$(use_with cluster cluster-support) \ |
| 187 |
$(use_with acl acl-support) \ |
| 188 |
$(use_with aio aio-support) \ |
| 189 |
--with-sendfile-support \ |
| 190 |
$(use_with winbind) \ |
| 191 |
--with-shared-modules=${SHAREDMODS} \ |
| 192 |
--without-included-popt \ |
| 193 |
--without-included-iniparser |
| 194 |
} |
| 195 |
|
| 196 |
src_compile() { |
| 197 |
# compile libs |
| 198 |
if use addns ; then |
| 199 |
einfo "make addns library" |
| 200 |
emake libaddns |
| 201 |
fi |
| 202 |
if use netapi ; then |
| 203 |
einfo "make netapi library" |
| 204 |
emake libnetapi |
| 205 |
fi |
| 206 |
if use smbclient ; then |
| 207 |
einfo "make smbclient library" |
| 208 |
emake libsmbclient |
| 209 |
fi |
| 210 |
if use smbsharemodes ; then |
| 211 |
einfo "make smbsharemodes library" |
| 212 |
emake libsmbsharemodes |
| 213 |
fi |
| 214 |
|
| 215 |
# compile modules |
| 216 |
emake modules |
| 217 |
|
| 218 |
# compile pam moudles |
| 219 |
if use pam ; then |
| 220 |
einfo "make pam modules" |
| 221 |
emake pam_modules |
| 222 |
fi |
| 223 |
|
| 224 |
# compile winbind nss modules |
| 225 |
if use winbind ; then |
| 226 |
einfo "make nss modules" |
| 227 |
emake nss_modules |
| 228 |
fi |
| 229 |
|
| 230 |
# compile utilities |
| 231 |
if [ -n "${BINPROGS}" ] ; then |
| 232 |
einfo "make binprogs" |
| 233 |
emake ${BINPROGS} |
| 234 |
fi |
| 235 |
if [ -n "${SBINPROGS}" ] ; then |
| 236 |
einfo "make sbinprogs" |
| 237 |
emake ${SBINPROGS} |
| 238 |
fi |
| 239 |
|
| 240 |
if [ -n "${KRBPLUGIN}" ] ; then |
| 241 |
einfo "make krbplugin" |
| 242 |
emake ${KRBPLUGIN}${PLUGINEXT} |
| 243 |
fi |
| 244 |
|
| 245 |
} |
| 246 |
|
| 247 |
src_install() { |
| 248 |
# install libs |
| 249 |
if use addns ; then |
| 250 |
einfo "install addns library" |
| 251 |
emake installlibaddns DESTDIR="${D}" |
| 252 |
fi |
| 253 |
if use netapi ; then |
| 254 |
einfo "install netapi library" |
| 255 |
emake installlibnetapi DESTDIR="${D}" |
| 256 |
fi |
| 257 |
if use smbclient ; then |
| 258 |
einfo "install smbclient library" |
| 259 |
emake installlibsmbclient DESTDIR="${D}" |
| 260 |
fi |
| 261 |
if use smbsharemodes ; then |
| 262 |
einfo "install smbsharemodes library" |
| 263 |
emake installlibsmbsharemodes DESTDIR="${D}" |
| 264 |
fi |
| 265 |
|
| 266 |
# install modules |
| 267 |
emake installmodules DESTDIR="${D}" |
| 268 |
|
| 269 |
if use pam ; then |
| 270 |
einfo "install pam modules" |
| 271 |
emake installpammodules DESTDIR="${D}" |
| 272 |
|
| 273 |
if use winbind ; then |
| 274 |
newpamd "${CONFDIR}/system-auth-winbind.pam" system-auth-winbind |
| 275 |
doman ../docs/manpages/pam_winbind.8 |
| 276 |
# bug #376853 |
| 277 |
insinto /etc/security |
| 278 |
doins ../examples/pam_winbind/pam_winbind.conf || die |
| 279 |
fi |
| 280 |
|
| 281 |
newpamd "${CONFDIR}/samba.pam" samba |
| 282 |
dodoc pam_smbpass/README |
| 283 |
fi |
| 284 |
|
| 285 |
# Nsswitch extensions. Make link for wins and winbind resolvers |
| 286 |
if use winbind ; then |
| 287 |
einfo "install libwbclient" |
| 288 |
emake installlibwbclient DESTDIR="${D}" |
| 289 |
dolib.so ../nsswitch/libnss_wins.so |
| 290 |
dosym libnss_wins.so /usr/$(get_libdir)/libnss_wins.so.2 |
| 291 |
dolib.so ../nsswitch/libnss_winbind.so |
| 292 |
dosym libnss_winbind.so /usr/$(get_libdir)/libnss_winbind.so.2 |
| 293 |
einfo "install libwbclient related manpages" |
| 294 |
doman ../docs/manpages/idmap_rid.8 |
| 295 |
doman ../docs/manpages/idmap_hash.8 |
| 296 |
if use ldap ; then |
| 297 |
doman ../docs/manpages/idmap_adex.8 |
| 298 |
doman ../docs/manpages/idmap_ldap.8 |
| 299 |
fi |
| 300 |
if use ads ; then |
| 301 |
doman ../docs/manpages/idmap_ad.8 |
| 302 |
fi |
| 303 |
fi |
| 304 |
|
| 305 |
# install binaries |
| 306 |
insinto /usr |
| 307 |
for prog in ${SBINPROGS} ; do |
| 308 |
dosbin ${prog} |
| 309 |
doman ../docs/manpages/${prog/bin\/}* |
| 310 |
done |
| 311 |
|
| 312 |
for prog in ${BINPROGS} ; do |
| 313 |
dobin ${prog} |
| 314 |
doman ../docs/manpages/${prog/bin\/}* |
| 315 |
done |
| 316 |
|
| 317 |
# install scripts |
| 318 |
if use client ; then |
| 319 |
dobin script/findsmb |
| 320 |
doman ../docs/manpages/findsmb.1 |
| 321 |
fi |
| 322 |
|
| 323 |
# install krbplugin |
| 324 |
if [ -n "${KRBPLUGIN}" ] ; then |
| 325 |
if has_version app-crypt/mit-krb5 ; then |
| 326 |
insinto /usr/$(get_libdir)/krb5/plugins/libkrb5 |
| 327 |
doins ${KRBPLUGIN}${PLUGINEXT} |
| 328 |
elif has_version app-crypt/heimdal ; then |
| 329 |
insinto /usr/$(get_libdir)/plugin/krb5 |
| 330 |
doins ${KRBPLUGIN}${PLUGINEXT} |
| 331 |
fi |
| 332 |
insinto /usr |
| 333 |
for prog in ${KRBPLUGIN} ; do |
| 334 |
doman ../docs/manpages/${prog/bin\/}* |
| 335 |
done |
| 336 |
fi |
| 337 |
|
| 338 |
# install server components |
| 339 |
if use server ; then |
| 340 |
doman ../docs/manpages/vfs* ../docs/manpages/samba.7 |
| 341 |
|
| 342 |
diropts -m0700 |
| 343 |
keepdir /var/lib/samba/private |
| 344 |
|
| 345 |
diropts -m1777 |
| 346 |
keepdir /var/spool/samba |
| 347 |
|
| 348 |
diropts -m0755 |
| 349 |
keepdir /var/{cache,log}/samba |
| 350 |
keepdir /var/lib/samba/{netlogon,profiles} |
| 351 |
keepdir /var/lib/samba/printers/{W32X86,WIN40,W32ALPHA,W32MIPS,W32PPC,X64,IA64,COLOR} |
| 352 |
keepdir /usr/$(get_libdir)/samba/{auth,pdb,rpc,idmap,nss_info,gpext} |
| 353 |
|
| 354 |
newconfd "${CONFDIR}/samba.confd" samba |
| 355 |
newinitd "${CONFDIR}/samba.initd" samba |
| 356 |
|
| 357 |
insinto /etc/samba |
| 358 |
doins "${CONFDIR}"/{smbusers,lmhosts} |
| 359 |
|
| 360 |
if use ldap ; then |
| 361 |
insinto /etc/openldap/schema |
| 362 |
doins ../examples/LDAP/samba.schema |
| 363 |
fi |
| 364 |
|
| 365 |
if use swat ; then |
| 366 |
insinto /etc/xinetd.d |
| 367 |
newins "${CONFDIR}/swat.xinetd" swat |
| 368 |
script/installswat.sh "${D}" "${ROOT}/usr/share/doc/${PF}/swat" "${S}" |
| 369 |
fi |
| 370 |
|
| 371 |
dodoc ../MAINTAINERS.txt ../README* ../Roadmap ../WHATSNEW.txt ../docs/THANKS |
| 372 |
fi |
| 373 |
|
| 374 |
# install the spooler to cups |
| 375 |
if use cups ; then |
| 376 |
dosym /usr/bin/smbspool $(cups-config --serverbin)/backend/smb |
| 377 |
fi |
| 378 |
|
| 379 |
# install misc files |
| 380 |
insinto /etc/samba |
| 381 |
doins ../examples/smb.conf.default |
| 382 |
doman ../docs/manpages/smb.conf.5 |
| 383 |
|
| 384 |
insinto /usr/"$(get_libdir)"/samba |
| 385 |
doins ../codepages/{valid.dat,upcase.dat,lowcase.dat} |
| 386 |
|
| 387 |
# install docs |
| 388 |
if use doc ; then |
| 389 |
dohtml -r ../docs/htmldocs/* |
| 390 |
dodoc ../docs/*.pdf |
| 391 |
fi |
| 392 |
|
| 393 |
# install examples |
| 394 |
if use examples ; then |
| 395 |
insinto /usr/share/doc/${PF}/examples |
| 396 |
|
| 397 |
if use smbclient ; then |
| 398 |
doins -r ../examples/libsmbclient |
| 399 |
fi |
| 400 |
|
| 401 |
if use winbind ; then |
| 402 |
doins -r ../examples/pam_winbind ../examples/nss |
| 403 |
fi |
| 404 |
|
| 405 |
if use server ; then |
| 406 |
cd ../examples |
| 407 |
doins -r auth autofs dce-dfs LDAP logon misc pdb \ |
| 408 |
perfcounter printer-accounting printing scripts tridge \ |
| 409 |
validchars VFS |
| 410 |
fi |
| 411 |
fi |
| 412 |
|
| 413 |
# Remove empty installation directories |
| 414 |
rmdir --ignore-fail-on-non-empty \ |
| 415 |
"${D}/usr/$(get_libdir)/samba" \ |
| 416 |
"${D}/usr"/{sbin,bin} \ |
| 417 |
"${D}/usr/share"/{man,locale,} \ |
| 418 |
"${D}/var"/{run,lib/samba/private,lib/samba,lib,cache/samba,cache,} \ |
| 419 |
# || die "tried to remove non-empty dirs, this seems like a bug in the ebuild" |
| 420 |
} |
| 421 |
|
| 422 |
pkg_postinst() { |
| 423 |
elog "Samba 3.6 has adopted a number of improved security defaults that" |
| 424 |
elog "will impact on existing users of Samba." |
| 425 |
elog " client ntlmv2 auth = yes" |
| 426 |
elog " client use spnego principal = no" |
| 427 |
elog " send spnego principal = no" |
| 428 |
elog "" |
| 429 |
elog "SMB2 protocol support in 3.6.0 is fully functional and can be " |
| 430 |
elog "enabled by setting 'max protocol = smb2'. SMB2 is a new " |
| 431 |
elog "implementation of the SMB protocol used by Windows Vista and higher" |
| 432 |
elog "" |
| 433 |
elog "For further information make sure to read the release notes at" |
| 434 |
elog "http://samba.org/samba/history/${P}.html and " |
| 435 |
elog "http://samba.org/samba/history/${PN}-3.6.0.html" |
| 436 |
} |