# 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 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" LICENSE="GPL-3" SLOT="0" KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~sparc-fbsd ~x86 ~x86-fbsd" IUSE="acl caps debug developer doc dso examples gnutls ldap readline swat" RDEPEND="sys-libs/e2fsprogs-libs dev-lang/python acl? ( sys-apps/acl 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 use doc && myconf="${myconf} --docdir=/usr/share/doc/${PF}" 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" } 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 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 # 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}/python doins -r "${S}/scripting/python/examples" fi insinto /usr/share/${PN}/setup doins -r setup } 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() { python_version python_mod_optimize /usr/$(get_libdir)/python${PYVER}/site-packages/samba 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." 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 }