# Copyright 1999-2009 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: /var/cvsroot/gentoo-x86/net-fs/samba/samba-3.0.34.ebuild,v 1.1 2009/03/29 16:49:58 patrick Exp $ inherit autotools eutils pam python multilib versionator confutils VSCAN_P="samba-vscan-0.3.6c-beta5" MY_P=${PN}-${PV/_/} DESCRIPTION="A suite of SMB and CIFS client/server programs for UNIX" HOMEPAGE="http://www.samba.org/" SRC_URI="mirror://samba/samba4/${MY_P}.tar.gz oav? ( http://www.openantivirus.org/download/${VSCAN_P}.tar.gz )" LICENSE="GPL-3 oav? ( GPL-2 LGPL-2.1 )" SLOT="0" KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~sparc-fbsd ~x86 ~x86-fbsd" IUSE="acl attr caps debug developer doc dso examples gnutls ldap oav python readline swat" RDEPEND="sys-libs/e2fsprogs-libs acl? ( sys-apps/acl ) attr? ( sys-apps/attr ) caps? ( sys-libs/libcap ) gnutls? ( >=net-libs/gnutls-2.0 ) ldap? ( >=net-nds/openldap-2.4.15 ) readline? ( sys-libs/readline ) swat? ( sys-apps/xinetd )" DEPEND="${RDEPEND}" RESTRICT="nomirror" S=${WORKDIR}/${MY_P} CONFDIR=${FILESDIR}/config-4.0 PRIVATE_DST=/var/lib/samba/private src_unpack() { unpack ${A} cd "${S}/source4" # Ok, agreed, this is ugly. But it avoids a patch we # need for every samba version and we don't need autotools sed -i \ -e 's|"lib32" ||' \ -e 's|if test -d "$i/$l" ;|if test -d "$i/$l" -o -L "$i/$l";|' \ configure || die "sed failed" } src_compile() { cd "${S}/source4" local myconf use caps && export ac_cv_header_sys_capability_h=yes || export ac_cv_header_sys_capability_h=no # Otherwise we get the whole swat stuff installed if ! use swat ; then sed -i \ -e 's/^\(install:.*\)installswat \(.*\)/\1\2/' \ Makefile.in || die "sed failed" fi econf \ --sysconfdir=/etc/samba \ --localstatedir=/var \ --with-piddir=/var/run/samba \ --with-lockdir=/var/cache/samba \ --with-logfilebase=/var/log/samba \ --with-privatedir=${PRIVATE_DST} \ --enable-automatic-dependencies \ --enable-fhs \ --enable-socket-wrapper \ $(use_with pthreads) \ $(use_enable gnutls) \ $(use_enable debug) \ $(use_enable developer) \ $(use_enable dso) \ ${myconf} emake proto || die "emake proto failed" emake everything || die "emake everything failed" if use python ; then emake python_ext || die "emake python_ext failed" fi if use oav ; then # maintainer-info: # - there are no known releases of mks or kavdc, # setting to builtin to disable auto-detection cd "${WORKDIR}/${VSCAN_P}" econf \ --with-samba-source="${S}/source4" \ --with-libmksd-builtin \ --with-libkavdc-builtin \ --without-symantec \ --with-filetype \ --with-fileregexp \ $(use_enable debug) emake || die "emake oav plugins failed" fi } src_test() { cd "${S}/source4" emake test || die "tests failed" } src_install() { cd "${S}/source4" emake DESTDIR="${D}" install || die "emake install failed" # Extra rpctorture progs local extra_bins="rpctorture" for i in ${extra_bins} ; do [[ -x "${S}/bin/${i}" ]] && dobin "${S}/bin/${i}" done # remove .old stuff from /usr/bin: rm -f "${D}"/usr/bin/*.old if use python ; then emake DESTDIR="${D}" python_install || die "emake installpython failed" # We're doing that manually find "${D}/usr/$(get_libdir)/python${PYVER}/site-packages" -iname "*.pyc" -delete fi # General config files insinto /etc/samba newins "${CONFDIR}/smb.conf.example" smb.conf.example newpamd "${CONFDIR}/samba.pam" samba if use swat ; then insinto /etc/xinetd.d newins "${CONFDIR}/swat.xinetd" swat else rm -f "${D}/usr/sbin/swat" rm -f "${D}/usr/share/man/man8/swat.8" fi newinitd "${CONFDIR}/samba-init" samba newconfd "${CONFDIR}/samba-conf" samba # dirs diropts -m0700 ; keepdir "${PRIVATE_DST}" diropts -m1777 ; keepdir /var/spool/samba diropts -m0755 keepdir /var/{log,run,cache}/samba keepdir /var/lib/samba/{netlogon,profiles} keepdir /var/lib/samba/printers/{W32X86,WIN40,W32ALPHA,W32MIPS,W32PPC,X64,IA64,COLOR} keepdir /usr/$(get_libdir)/samba/{rpc,idmap,auth} # docs dodoc "${FILESDIR}/README.gentoo" dodoc "${S}"/{MAINTAINERS,README,Roadmap,WHATSNEW.txt} dodoc "${CONFDIR}/nsswitch.conf-wins" if use examples ; then insinto /usr/share/doc/${PF} doins -r "${S}/examples/" find "${D}/usr/share/doc/${PF}" -type d -print0 | xargs -0 chmod 755 find "${D}/usr/share/doc/${PF}/examples" ! -type d -print0 | xargs -0 chmod 644 if use python ; then insinto /usr/share/doc/${PF}/python doins -r "${S}/source/python/examples" fi fi insinto /usr/share/${PN}/setup doins -r setup if ! use doc ; then if ! use swat ; then rm -rf "${D}/usr/share/doc/${PF}/swat" else rm -rf "${D}/usr/share/doc/${PF}/swat/help"/{guide,howto,devel} rm -rf "${D}/usr/share/doc/${PF}/swat/using_samba" fi else cd "${S}/docs" insinto /usr/share/doc/${PF} doins *.pdf doins -r registry dohtml -r htmldocs/* fi if use oav ; then cd "${WORKDIR}/${VSCAN_P}" emake DESTDIR="${D}" install || die "emake install oav plugins failed" docinto samba-vscan dodoc AUTHORS ChangeLog FAQ INSTALL NEWS README TODO find . -iname "*.conf" -print0 | xargs -0 dodoc fi } pkg_preinst() { local PRIVATE_SRC=/etc/samba/private if [[ ! -r "${ROOT}/${PRIVATE_DST}/secrets.tdb" \ && -r "${ROOT}/${PRIVATE_SRC}/secrets.tdb" ]] ; then ebegin "Copying "${ROOT}"/${PRIVATE_SRC}/* to ${ROOT}/${PRIVATE_DST}/" mkdir -p "${D}/${PRIVATE_DST}" cp -pPRf "${ROOT}/${PRIVATE_SRC}"/* "${D}/${PRIVATE_DST}/" eend $? fi if [[ ! -f "${ROOT}/etc/samba/smb.conf" ]] ; then touch "${D}/etc/samba/smb.conf" fi } pkg_postinst() { if use python ; then python_version python_mod_optimize /usr/$(get_libdir)/python${PYVER}/site-packages/samba fi if use swat ; then einfo "swat must be enabled by xinetd:" einfo " change the /etc/xinetd.d/swat configuration" fi elog "Specialized mount/umount.cifs helper applications are not yet available for" elog "Samba 4.0." elog "You may try to install net-fs/mount-cifs at your own risk." if use oav ; then elog "The configure snippets for various antivirus plugins are available here:" elog " /usr/share/doc/${PF}/samba-vscan" fi elog "The provision helper scripts for setting up LDAP backends, etc. are installed" elog "/usr/share/samba/setup." ewarn "If you're upgrading from 3.x.x, make sure to read the information on the" ewarn "SambaWiki [http://wiki.samba.org/index.php/Samba4] to make yourself familiar" ewarn "with the status of Samba 4 and the various differences to the 3.x branch." } pkg_postrm() { if use python ; then python_version python_mod_cleanup /usr/$(get_libdir)/python${PYVER}/site-packages/samba fi }