# Copyright 1999-2009 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: /var/cvsroot/gentoo-x86/sys-fs/aufs2/aufs2-0_p20090601-r1.ebuild,v 1.2 2009/06/13 14:35:10 tommy Exp $ EGIT_REPO_URI="http://git.c3sl.ufpr.br/pub/scm/aufs/aufs2-standalone.git" inherit git linux-mod toolchain-funcs DESCRIPTION="An entirely re-designed and re-implemented Unionfs" HOMEPAGE="http://aufs.sourceforge.net" SRC_URI="" LICENSE="GPL-2" SLOT="0" KEYWORDS="~amd64 ~x86" IUSE="debug inotify kernel-patch ramfs" DEPEND="" RDEPEND="!sys-fs/aufs" MODULE_NAMES="aufs(misc:${S})" pkg_setup() { get_version kernel_is eq 2 6 || die "no supported kernel found" linux-mod_pkg_setup } src_unpack() { git_src_unpack cd "${S}" git checkout origin/aufs2-${KV_PATCH} || die "no patch exists for your kernel" use debug || sed -i "s:DEBUG = y:DEBUG =:g" config.mk use inotify && sed -i "s:HINOTIFY =:HINOTIFY = y:g" config.mk use ramfs && sed -i "s:RAMFS =:RAMFS = y:g" config.mk local modified_patch=aufs2-standalone-modified.patch cat aufs2-standalone.patch | \ sed -e "s/^+#ifdef CONFIG_AUFS_FS_MODULE/+#if 1/" \ -e "s/defined(CONFIG_AUFS_FS_MODULE)/1/" > $modified_patch if patch -p1 --dry-run --force -R -d ${KV_DIR} < $modified_patch >/dev/null; then einfo "aufs2 kernel patch has already been applied" elif use kernel-patch; then cd ${KV_DIR} addwrite ${KV_DIR} ewarn "Patching your kernel..." patch --no-backup-if-mismatch --force -p1 -d ${KV_DIR} < $modified_patch >/dev/null || \ die "could not apply the kernel patch $modified_patch to your kernel" einfo "You need to compile your kernel with the applied patch" einfo "to be able to load and use the aufs kernel module" else eerror "You need to apply a patch to your kernel to compile and run the aufs2 module" eerror "Either enable the kernel-patch useflag to do it with this ebuild" eerror "or apply the patch at ${S}/$modified_patch by hand" die "missing kernel patch, please apply it first" fi EGIT_REPO_URI="http://git.c3sl.ufpr.br/pub/scm/aufs/aufs2-util.git" # EGIT_TREE="8d4217be37b74732afa80bc6e6519bd9df7ea1af" EGIT_PROJECT="aufs2-utils" EGIT_BRANCH="" local S=${S}-utils git_src_unpack cd "${S}" sed -i "/LDFLAGS += -static -s/d" Makefile } src_compile() { ARCH=i386 use amd64 && ARCH=x86_64 emake CC=$(tc-getCC) CONFIG_AUFS_FS=m KDIR=${KV_OUT_DIR:-$KV_DIR} || die cd "${S}"-utils emake CC=$(tc-getCC) AR=$(tc-getAR) KDIR=${KV_OUT_DIR:-$KV_DIR} C_INCLUDE_PATH="${S}"/include || die } src_install() { linux-mod_src_install dodoc README || die docinto design dodoc design/*.txt || die cd "${S}"-utils emake DESTDIR="${D}" install || die docinto newdoc README README-utils || die }