/[gentoo-x86]/sys-fs/aufs3/aufs3-3_p20120109.ebuild
Gentoo

Contents of /sys-fs/aufs3/aufs3-3_p20120109.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.4 - (show annotations) (download)
Thu May 24 02:55:43 2012 UTC (2 years, 2 months ago) by vapier
Branch: MAIN
Changes since 1.3: +2 -2 lines
Inherit eutils for epatch.

(Portage version: 2.2.0_alpha107_p3/cvs/Linux x86_64)

1 # Copyright 1999-2012 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/sys-fs/aufs3/aufs3-3_p20120109.ebuild,v 1.3 2012/05/05 11:41:29 maekke Exp $
4
5 EAPI=4
6
7 inherit linux-mod multilib toolchain-funcs eutils
8
9 AUFS_VERSION="${PV%%_p*}"
10 PATCH_MAX_VER="2"
11 UTIL_MAX_VER="0"
12
13 DESCRIPTION="An entirely re-designed and re-implemented Unionfs"
14 HOMEPAGE="http://aufs.sourceforge.net/"
15 SRC_URI="http://dev.gentoo.org/~jlec/distfiles/${P}.tar.xz"
16
17 LICENSE="GPL-2"
18 SLOT="0"
19 KEYWORDS="amd64 x86"
20 IUSE="debug doc fuse pax_kernel hfs inotify kernel-patch nfs ramfs"
21
22 DEPEND="dev-vcs/git"
23 RDEPEND="
24 !sys-fs/aufs
25 !sys-fs/aufs2"
26
27 S="${WORKDIR}"/${PN}-standalone
28
29 MODULE_NAMES="aufs(misc:${S})"
30
31 pkg_setup() {
32 CONFIG_CHECK="${CONFIG_CHECK} ~EXPERIMENTAL"
33 use inotify && CONFIG_CHECK="${CONFIG_CHECK} ~FSNOTIFY"
34 use nfs && CONFIG_CHECK="${CONFIG_CHECK} EXPORTFS"
35 use fuse && CONFIG_CHECK="${CONFIG_CHECK} ~FUSE_FS"
36 use hfs && CONFIG_CHECK="${CONFIG_CHECK} ~HFSPLUS_FS"
37
38 # this is needed so merging a binpkg ${PN} is possible w/out a kernel unpacked on the system
39 [ -n "$PKG_SETUP_HAS_BEEN_RAN" ] && return
40
41 get_version
42 kernel_is lt 3 0 0 && die "kernel too old, Please use sys-fs/aufs2"
43 kernel_is gt 3 2 99 && die "kernel too new"
44
45 linux-mod_pkg_setup
46
47 if [[ "${KV_MINOR}" -gt "${PATCH_MAX_VER}" ]]; then
48 PATCH_BRANCH="x-rcN"
49 else
50 PATCH_BRANCH="${KV_MINOR}"
51 fi
52
53 if [[ "${PATCH_BRANCH}" == "x-rcN" ]]; then
54 UTIL_BRANCH="x-rcN"
55 elif [[ "${KV_MINOR}" -gt "${UTIL_MAX_VER}" ]]; then
56 UTIL_BRANCH="${UTIL_MAX_VER}"
57 else
58 UTIL_BRANCH="${KV_MINOR}"
59 fi
60
61 if ! ( patch -p1 --dry-run --force -R -d ${KV_DIR} < "${FILESDIR}"/${PN}-standalone-${PATCH_BRANCH}.patch >/dev/null && \
62 patch -p1 --dry-run --force -R -d ${KV_DIR} < "${FILESDIR}"/${PN}-base-${PATCH_BRANCH}.patch >/dev/null ); then
63 if use kernel-patch; then
64 cd ${KV_DIR}
65 ewarn "Patching your kernel..."
66 patch --no-backup-if-mismatch --force -p1 -R -d ${KV_DIR} < "${FILESDIR}"/${PN}-standalone-${PATCH_BRANCH}.patch >/dev/null
67 patch --no-backup-if-mismatch --force -p1 -R -d ${KV_DIR} < "${FILESDIR}"/${PN}-base-${PATCH_BRANCH}.patch >/dev/null
68 epatch "${FILESDIR}"/${PN}-{base,standalone}-${PATCH_BRANCH}.patch
69 [[ ${KV_MINOR} -gt ${PATCH_MAX_VER} ]] && \
70 epatch "${FILESDIR}"/${PN}-fix-export-__devcgroup_inode_permission.patch
71 ewarn "You need to compile your kernel with the applied patch"
72 ewarn "to be able to load and use the aufs kernel module"
73 else
74 eerror "You need to apply a patch to your kernel to compile and run the ${PN} module"
75 eerror "Either enable the kernel-patch useflag to do it with this ebuild"
76 eerror "or apply ${FILESDIR}/${PN}-base-${PATCH_BRANCH}.patch and"
77 eerror "${FILESDIR}/${PN}-standalone-${PATCH_BRANCH}.patch by hand"
78 die "missing kernel patch, please apply it first"
79 fi
80 fi
81 export PKG_SETUP_HAS_BEEN_RAN=1
82 }
83
84 set_config() {
85 for option in $*; do
86 grep -q "^CONFIG_AUFS_${option} =" config.mk || die "${option} is not a valid config option"
87 sed "/^CONFIG_AUFS_${option}/s:=:= y:g" -i config.mk || die
88 done
89 }
90
91 src_prepare() {
92 local module_branch=origin/${PN}.${PATCH_BRANCH}
93 local util_branch=origin/${PN}.${UTIL_BRANCH}
94
95 einfo "Using for module creation branch ${module_branch}"
96 git checkout -q -b local-gentoo ${module_branch} || die
97
98 # All config options to off
99 sed "s:= y:=:g" -i config.mk || die
100
101 set_config RDU BRANCH_MAX_127 SBILIST
102
103 use debug && set_config DEBUG
104 use fuse && set_config BR_FUSE POLL
105 use hfs && set_config BR_HFSPLUS
106 use inotify && set_config HNOTIFY HFSNOTIFY
107 use nfs && set_config EXPORT
108 use nfs && use amd64 && set_config INO_T_64
109 use ramfs && set_config BR_RAMFS
110
111 use pax_kernel && epatch "${FILESDIR}"/pax.patch
112
113 sed -i "s:aufs.ko usr/include/linux/aufs_type.h:aufs.ko:g" Makefile || die
114 sed -i "s:__user::g" include/linux/aufs_type.h || die
115
116 cd "${WORKDIR}"/${PN/3}-util
117
118 einfo "Using for utils building branch ${util_branch}"
119 git checkout -b local-gentoo ${util_branch} || die
120 sed -i "/LDFLAGS += -static -s/d" Makefile || die
121 sed -i -e "s:m 644 -s:m 644:g" -e "s:/usr/lib:/usr/$(get_libdir):g" libau/Makefile || die
122 }
123
124 src_compile() {
125 local ARCH=x86
126
127 emake CC=$(tc-getCC) CONFIG_AUFS_FS=m KDIR=${KV_DIR}
128
129 cd "${WORKDIR}"/${PN/3}-util
130 emake CC=$(tc-getCC) AR=$(tc-getAR) KDIR=${KV_DIR} C_INCLUDE_PATH="${S}"/include
131 }
132
133 src_install() {
134 linux-mod_src_install
135
136 insinto /usr/share/doc/${PF}
137
138 use doc && doins -r Documentation
139
140 dodoc README
141
142 cd "${WORKDIR}"/${PN/3}-util
143 emake DESTDIR="${D}" KDIR=${KV_DIR} install
144
145 newdoc README README-utils
146 }

  ViewVC Help
Powered by ViewVC 1.1.20