# 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 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="~amd64 ~x86" IUSE="acl caps debug developer doc dso examples gnutls ldap readline threads" 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 )" # Don't build, if modularized Samba 3.3 (from dev-zero overlay) is installed DEPEND="!net-fs/samba-client !net-fs/samba-server !net-fs/samba-libs ${RDEPEND}" RESTRICT="nomirror" S=${WORKDIR}/${MY_P}/source4 CONFDIR=${FILESDIR}/config-4.0 PRIVATE_DST=/var/lib/samba/private src_unpack() { unpack ${A} cd "${S}" # 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}" local myconf use caps && export ac_cv_header_sys_capability_h=yes || export ac_cv_header_sys_capability_h=no use doc && myconf="${myconf} --docdir=/usr/share/doc/${PF}" econf \ --sysconfdir=/etc \ --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 threads 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}" emake test || die "tests failed" } src_install() { cd "${S}" emake DESTDIR="${D}" install || die "emake install failed" newinitd "${CONFDIR}/samba-init" samba newconfd "${CONFDIR}/samba-conf" samba # dirs diropts -m0700 ; keepdir "${PRIVATE_DST}" diropts -m0755 keepdir /var/{log,run,cache}/samba # docs dodoc "${S}"/{BUGS,NEWS,TODO} 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 echo " " 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.\n" elog "The provision helper scripts for setting up LDAP backends, etc. are installed" elog "/usr/share/samba/setup.\n" 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 }