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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations) (download)
Thu May 24 02:55:43 2012 UTC (2 years, 2 months ago) by vapier
Branch: MAIN
Changes since 1.1: +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_p20120523.ebuild,v 1.1 2012/05/23 06:31:29 jlec Exp $
4
5 EAPI=4
6
7 inherit linux-mod multilib toolchain-funcs eutils
8
9 AUFS_VERSION="${PV%%_p*}"
10 PATCH_MAX_VER=4
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 4 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 ewarn "You need to compile your kernel with the applied patch"
70 ewarn "to be able to load and use the aufs kernel module"
71 else
72 eerror "You need to apply a patch to your kernel to compile and run the ${PN} module"
73 eerror "Either enable the kernel-patch useflag to do it with this ebuild"
74 eerror "or apply ${FILESDIR}/${PN}-base-${PATCH_BRANCH}.patch and"
75 eerror "${FILESDIR}/${PN}-standalone-${PATCH_BRANCH}.patch by hand"
76 die "missing kernel patch, please apply it first"
77 fi
78 fi
79 export PKG_SETUP_HAS_BEEN_RAN=1
80 }
81
82 set_config() {
83 for option in $*; do
84 grep -q "^CONFIG_AUFS_${option} =" config.mk || die "${option} is not a valid config option"
85 sed "/^CONFIG_AUFS_${option}/s:=:= y:g" -i config.mk || die
86 done
87 }
88
89 src_prepare() {
90 local module_branch=origin/${PN}.${PATCH_BRANCH}
91 local util_branch=origin/${PN}.${UTIL_BRANCH}
92
93 einfo "Using for module creation branch ${module_branch}"
94 git checkout -q -b local-gentoo ${module_branch} || die
95
96 # All config options to off
97 sed "s:= y:=:g" -i config.mk || die
98
99 set_config RDU BRANCH_MAX_127 SBILIST
100
101 use debug && set_config DEBUG
102 use fuse && set_config BR_FUSE POLL
103 use hfs && set_config BR_HFSPLUS
104 use inotify && set_config HNOTIFY HFSNOTIFY
105 use nfs && set_config EXPORT
106 use nfs && use amd64 && set_config INO_T_64
107 use ramfs && set_config BR_RAMFS
108
109 use pax_kernel && epatch "${FILESDIR}"/pax.patch
110
111 sed -i "s:aufs.ko usr/include/linux/aufs_type.h:aufs.ko:g" Makefile || die
112 sed -i "s:__user::g" include/linux/aufs_type.h || die
113
114 cd "${WORKDIR}"/${PN/3}-util
115
116 einfo "Using for utils building branch ${util_branch}"
117 git checkout -b local-gentoo ${util_branch} || die
118 sed -i "/LDFLAGS += -static -s/d" Makefile || die
119 sed -i -e "s:m 644 -s:m 644:g" -e "s:/usr/lib:/usr/$(get_libdir):g" libau/Makefile || die
120 }
121
122 src_compile() {
123 local ARCH=x86
124
125 emake CC=$(tc-getCC) CONFIG_AUFS_FS=m KDIR=${KV_DIR}
126
127 cd "${WORKDIR}"/${PN/3}-util
128 emake CC=$(tc-getCC) AR=$(tc-getAR) KDIR=${KV_DIR} C_INCLUDE_PATH="${S}"/include
129 }
130
131 src_install() {
132 linux-mod_src_install
133
134 insinto /usr/share/doc/${PF}
135
136 use doc && doins -r Documentation
137
138 dodoc Documentation/filesystems/aufs/README
139
140 cd "${WORKDIR}"/${PN/3}-util
141 emake DESTDIR="${D}" KDIR=${KV_DIR} install
142
143 newdoc README README-utils
144 }

  ViewVC Help
Powered by ViewVC 1.1.20