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