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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.4 - (show annotations) (download)
Mon Jan 14 08:55:06 2013 UTC (5 years, 5 months ago) by jlec
Branch: MAIN
CVS Tags: HEAD
Changes since 1.3: +1 -1 lines
FILE REMOVED
sys-fs/aufs3: Drop old and refactor patching procedure to reduce size of FILESDIR, #450800 and reliability, #368385 & #451970

(Portage version: 2.2.0_alpha151/cvs/Linux x86_64, signed Manifest commit with key 70EB7916)

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

  ViewVC Help
Powered by ViewVC 1.1.20