# Copyright 1999-2007 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: /var/cvsroot/gentoo-x86/net-fs/coda/coda-6.0.15.ebuild,v 1.9 2007/07/12 05:38:40 mr_bones_ Exp $ inherit autotools eutils toolchain-funcs IUSE="coda-client coda-server coda-fs-layout kerberos" # coda-client causes the coda client (venus) to be built. # coda-server causes the coda server (vice) to be built. # coda-fs-layout doesn't apply gentoo directory layout patchs. Use this if # using any directory other than /coda for the mount point makes you upset. DESCRIPTION="Coda is an advanced networked filesystem developed at Carnegie Mellon Univ." HOMEPAGE="http://www.coda.cs.cmu.edu/" SRC_URI="http://www.coda.cs.cmu.edu/pub/coda/src/${P}.tar.gz" SLOT="0" LICENSE="GPL-2" KEYWORDS="~amd64 ~ppc ~x86" # partly based on the deps suggested by Mandrake's RPM, and/or on my current versions # Also, definely needs coda.h from linux-headers. RDEPEND=">=sys-libs/lwp-2.1 >=net-libs/rpc2-2.6 >=sys-libs/rvm-1.15 >=sys-libs/db-3 >=sys-libs/ncurses-4 >=sys-libs/readline-3 >=dev-lang/perl-5.8 kerberos? ( virtual/krb5 )" DEPEND="${RDEPEND} sys-apps/gawk sys-devel/bison sys-apps/grep virtual/os-headers" pkg_setup() { echo einfo "gcc-version = $(gcc-version)" echo if [[ "$(gcc-version)" > "4.3" ]]; then ewarn eerror "coda needs gcc < 4.4 to build cleanly" ewarn die "coda needs gcc < 4.4 to build cleanly" fi } src_unpack() { unpack ${A} cd "${S}" epatch "${FILESDIR}/${PN}-6.9.3-fixdeps.patch" epatch "${FILESDIR}/${PN}-6.9.3-gentoo-init.patch" use coda-fs-layout || epatch "${FILESDIR}/${PN}-6.9.3-gentoo-dirs.patch" eautoreconf } my_build_venus_prereqs() { # Coda uses a recursive make with some directories dependant # on objects build in other directories, so run make inside # the prerequisite dirs first. This builds everything required # by venus in the order listed in coda-src/Makefile.am. cd "${S}/lib-src" emake || die "emake failed" # auth2 depends on kerndep cd "${S}/coda-src/kerndep" emake || die "emake failed" # auth2 depends on util. cd "${S}/coda-src/util" emake || die "emake failed" # librepair depends on vicedep cd "${S}/coda-src/vicedep" emake || die "emake failed" # venus depends on dir cd "${S}/coda-src/dir" emake || die "emake failed" # venus depends on al cd "${S}/coda-src/al" emake || die "emake failed" # librepair depends on auth2 cd "${S}/coda-src/auth2" emake || die "emake failed" # venus depends on vv cd "${S}/coda-src/vv" emake || die "emake failed" # venus depends on lka cd "${S}/coda-src/lka" emake || die "emake failed" # venus depends on vol cd "${S}/coda-src/vol" emake || die "emake failed" # venus depends on librepair cd "${S}/coda-src/librepair" emake || die "emake failed" } src_compile() { local myflags="" # Coda uses type punning in a way that violates assumptions made by -O2 # and friends (via -fstrict-aliasing). Disable this optimization where # required. local my_safe_cflags="${CFLAGS} -fno-strict-aliasing" local my_safe_cxxflags="${CXXFLAGS} -fno-strict-aliasing" # Include the server/client code. if ! use coda-client && ! use coda-server; then ewarn "Neither coda-client nor coda-server is enabled." ewarn "Enabling coda-client." myflags="${myflags} --enable-client" else use coda-client && myflags="${myflags} --enable-client" use coda-server && myflags="${myflags} --enable-server" fi # Enable kerboeros? if use kerberos; then myflags="${myflags} --with-crypto" myflags="${myflags} --with-krb5" myflags="${myflags} --with-krb5-includes=/usr/include/krb5" myflags="${myflags} --with-krb5-libs=/usr/lib" fi # Perform the actual configure. cd "${S}" econf ${myflags} || die "configure failed" # Build any prerequisites for venus. my_build_venus_prereqs # Venus uses unsafe type punning, so disable # some optimizations for venus. cd "${S}/coda-src/venus" emake \ CFLAGS="${my_safe_cflags}" \ CXXFLAGS="${my_safe_cxxflags}" \ || die "emake failed" # Now run make in the source directory to finish the compile. cd "${S}" emake -j1 || die "emake failed" } src_install () { #these crazy makefiles dont seem to use DESTDIR, but they do use these... # (except infodir, but no harm in leaving it there) # see Makeconf.setup in the package #Also note that for Coda, we need to do "make client-install" for # the client, and "make server-install" for the server. #...you can find out about this from ./configs/Makerules emake DESTDIR="${D}" install || die "Install failed" dodoc INSTALL* README* ChangeLog CREDITS doinitd ${FILESDIR}/${PV}/venus doinitd ${FILESDIR}/coda-update doinitd ${FILESDIR}/codasrv doinitd ${FILESDIR}/auth2 # We may use a conf.d/coda file at some point ? # insinto /etc/conf.d # newins ${FILESDIR}/coda.conf.d coda # Modify coda to conform to gentoo filesystem layout. # TODO # Fix conflict with backup.sh from tar mv -f ${D}/usr/sbin/backup{,-coda}.sh if use coda-fs-layout; then # Add coda specific directories, the way coda intended. dodir /usr/coda dodir /usr/coda/etc dodir /usr/coda/spool dodir /coda dodir /vice dodir /vicepa diropts -m0700 dodir /usr/coda/venus.cache else # Add gentoo specific directorys. dodir /var/lib/coda dodir /var/log/coda dodir /var/spool/coda dodir /var/lib/coda/vice dodir /usr/lib/coda/vicepa dodir /media/coda diropts -m0700 dodir /var/cache/venus # Symlink traditional coda dirs to gentoo dirs. dosym ../var/lib/coda /usr/coda dosym var/lib/coda/vice /vice dosym var/lib/coda/vicepa /vicepa dosym media/coda /coda fi } pkg_preinst () { enewgroup codaroot enewuser codaroot -1 -1 -1 codaroot } pkg_postinst () { elog elog "To enable the coda server at boot up, please do:" elog " rc-update add auth2 default" elog " rc-update add updatecoda default" elog " rc-update add codasrv default" elog elog "To enable the coda client at boot up, do:" elog " rc-update add venus default" elog elog "To get started, run vice-setup and/or venus-setup." }