summaryrefslogtreecommitdiff
blob: feaa6af0b7d9e5494d10df31b2ec50273a1d2d82 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
# Copyright 1999-2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

EAPI=5
inherit autotools linux-info linux-mod readme.gentoo

PV_MAJ="2.9beta"
MY_P="${PN}-${PV_MAJ}.20130530"

DESCRIPTION="OrangeFS is a branch of PVFS2 cluster filesystem"
HOMEPAGE="http://www.orangefs.org/"
SRC_URI="http://orangefs.org/downloads/${PV_MAJ}/source/${MY_P}.tar.gz"
S="${WORKDIR}/${MY_P}"

LICENSE="LGPL-2.1"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="aio apidocs capcache certcache debug doc examples fuse gtk infiniband
kmod-threads ldap memtrace +mmap modules open-mx reset-file-pos security-key
security-cert sendfile +server ssl static static-libs +tcp +threads
trusted-connections +usrint usrint-cache +usrint-cwd usrint-kmount valgrind"

CDEPEND="
	dev-lang/perl
	>=sys-libs/db-4.8.30:=
	virtual/perl-Math-BigInt
	fuse? ( sys-fs/fuse:= )
	gtk? ( x11-libs/gtk+:2 )
	infiniband? ( sys-fabric/ofed )
	ldap? ( net-nds/openldap )
	open-mx? ( sys-cluster/open-mx[static-libs?] )
	ssl? ( dev-libs/openssl[static-libs?] )
	valgrind? ( dev-util/valgrind )
"
RDEPEND="${CDEPEND}
	modules? ( virtual/modutils )
"
DEPEND="${CDEPEND}
	>=sys-devel/autoconf-2.59
	sys-devel/bison
	sys-devel/flex
	virtual/pkgconfig
	apidocs? ( app-doc/doxygen )
	doc? ( dev-tex/latex2html )
	modules? ( virtual/linux-sources )
"

# aio and sendfile are only meaningful for kernel module;
# apidocs needs docs to be build first;
# kernel threads obviously needs kernel module and threads
# memtrace and valgrind witout debug info will be a pain;
# if both Myrinet and TCP interfaces are enabled in BMI, 5 sec delays will
# occur, though, at lest one of them must be enabled;
# static flag affects only server, so it must depend on it;
REQUIRED_USE="
	aio? ( modules )
	apidocs? ( doc )
	capcache? ( || ( security-cert security-key ) )
	certcache? ( security-cert )
	kmod-threads? ( modules threads )
	memtrace? ( debug )
	reset-file-pos? ( modules )
	security-cert? ( ldap ssl )
	security-key? ( ssl )
	sendfile? ( modules )
	static? ( server static-libs )
	tcp? ( !infiniband !open-mx )
	usrint-cache? ( usrint )
	usrint-cwd? ( usrint )
	usrint-kmount? ( usrint )
	valgrind? ( debug )
	|| ( infiniband open-mx tcp )
	?? ( security-cert security-key )
"

BUILD_TARGETS="just_kmod"
MODULE_NAMES="pvfs2(fs::src/kernel/linux-2.6)"

pkg_setup() {
	use modules && linux-mod_pkg_setup
	if use modules && kernel_is -ge 3 4; then
		eerror "Sorry, linux kernels >= 3.4 are not support yet."
		eerror "(Well they are, but you'll have a dead lock.)"
		eerror "You may disable modules use flag and use fuse client to mount filesystem."
		eerror "PVFS2 server and ROMIO I/O API are still available too."
		return 1
	fi

	if use security-key || use security-cert && ! use capcache; then
		ewarn "Upstream recommends to enable capabilities cache (--enable-capcache) when"
		ewarn "security-key or security-cert is used."
	fi
	if use security-cert && ! use certcache; then
		ewarn "Upstream recommends to enable certificate cache (--enable-certcache) when"
		ewarn "security-cert is used."
	fi
}

src_prepare() {
	# Upstream doesn't seem to want to apply this which makes
	# sense as it probably only matters to us.  Simple patch
	# to split the installation of the module (which we use
	# the eclass for) and the installation of the kernapps.
	epatch "${FILESDIR}"/${PN}-2.8.5-split-kernapps.patch

	# Fix libm underliking issue for kernapps
	epatch "${FILESDIR}"/${P}-kernapps-lm.patch

	# Change defalt server logfile location to more appropriate value
	# used by init script.
	sed -i "s%/tmp/pvfs2-server.log%${EPREFIX}var/log/pvfs2/server.log%g" \
	src/apps/admin/pvfs2-genconfig || die "sed on pvfs2-genconfig failed"

	AT_M4DIR=./maint/config eautoreconf
}

src_configure() {
	local myconf=""

	use threads && use aio || myconf+=" --disable-aio-threaded-callbacks"

	# fast mode disables optimizations
	use debug && myconf+=" --disable-fast --with-berkdb-debug" \
			  || myconf+=" --enable-fast  --without-berkdb-debug"

	use modules && myconf+=" --with-kernel=${KV_DIR}"

	# ARCH is used to define linux header path, should be not set.
	unset ARCH
	# FIXME: VIS build is broken at this moment.
	# Please add SDL dependency on reenable.
	# Note: jdk, jni, hadoop are disabled because hadoop is out of portage
	# and jdk/jni is useless otherwise
	econf \
		--disable-jni \
		--disable-hadoop \
		--disable-nptl-workaround \
		--disable-redhat24 \
		--disable-visual \
		--enable-epoll \
	    --enable-shared \
		--enable-verbose-build \
	    --sysconfdir="${EPREFIX}"/etc/pvfs2 \
	    $(use_enable aio kernel-aio) \
	    $(use_enable capcache) \
	    $(use_enable certcache) \
	    $(use_enable debug perf-counters) \
	    $(use_enable debug segv-backtrace) \
	    $(use_enable fuse) \
	    $(use_enable gtk karma) \
	    $(use_enable mmap mmap-racache) \
	    $(use_enable kmod-threads threaded-kmod-helper) \
	    $(use_enable reset-file-pos) \
	    $(use_enable security-cert) \
	    $(use_enable security-key) \
	    $(use_enable sendfile kernel-sendfile) \
	    $(use_enable server) \
	    $(use_enable static static-server) \
	    $(use_enable static-libs static) \
	    $(use_enable trusted-connections) \
	    $(use_enable usrint) \
	    $(use_enable usrint-cache ucache) \
	    $(use_enable usrint-cwd) \
	    $(use_enable usrint-kmount) \
	    $(use_with infiniband openib "${EPREFIX}"/usr/) \
	    $(use_with memtrace mtrace) \
	    $(use_with ldap) \
	    $(use_with open-mx mx "${EPREFIX}"/usr/) \
	    $(use_with ssl) \
	    $(use_with tcp bmi-tcp) \
	    $(use_with valgrind) \
		${myconf}
}

src_compile() {
	emake all
	if use modules; then
		linux-mod_src_compile
		emake kernapps
	fi

	use doc && emake docs
	if use apidocs; then
		cd "${S}"/doc
		doxygen doxygen/pvfs2-doxygen.conf || die "doxygen failed"
	fi
}

src_install() {
	emake DESTDIR="${D}" install
	if use modules; then
		linux-mod_src_install
		emake DESTDIR="${D}" kernapps_install

		newinitd "${FILESDIR}"/pvfs2-client-init.d pvfs2-client
		newconfd "${FILESDIR}"/pvfs2-client-conf.d pvfs2-client
	fi

	if use server; then
	    newinitd "${FILESDIR}"/pvfs2-server-init.d pvfs2-server
	    newconfd "${FILESDIR}"/pvfs2-server-conf.d pvfs2-server
	fi

	keepdir "${EPREFIX}var/log/pvfs2"

	dodoc AUTHORS CREDITS ChangeLog INSTALL README SecuritySetup
	readme.gentoo_create_doc

	if use doc; then
		dodoc doc/{coding/,}*.{pdf,txt} doc/random/*.pdf \
			doc/{coding/valgrind,add-client-syscall,add-server-req,REFERENCES.bib}

	    if use apidocs; then
	        dohtml -A map -A md5 doc/doxygen/html/*
	    fi

		docinto design
		dodoc doc/design/*.{pdf,txt}
	fi
	if use examples; then
	    docinto examples
	    dodoc -r examples/{certs,heartbeat,keys}
	fi
}

pkg_postinst() {
	use modules && linux-mod_pkg_postinst

	readme.gentoo_pkg_postinst
	if ! use modules; then
		ewarn
		ewarn "Without modules support you wouldn't be able to use pvfs2-client and mount"
		ewarn "partitions using kernel VFS. Though, you are still able to use libpvfs2,"
		ewarn "ROMIO interface, and FUSE client (if fuse use flag is enabled)."
	fi
	if use modules && kernel_is -ge 3 1; then
		ewarn
		ewarn "ACL support for 3.1 and 3.2 kernels is known to have bugs."
	fi
	if use sendfile; then
		ewarn
		ewarn "With sendfile enabled performance will be degraded for small access patterns."
	fi
}

pkg_config() {
	local s
	local f="$(source "${ROOT}"etc/conf.d/pvfs2-server; echo ${PVFS2_FS_CONF})"
	[[ -z "${f}" ]] && f="${ROOT}etc/pvfs2/fs.conf"
	if [[ -f "${f}" ]]; then
		ewarn "Previous install detected."
		ewarn "We're about to wipe out ${f} and replace it with"
		ewarn "the file generated by running pvfs2-genconfig.  If this is what"
		ewarn "you want to do, hit any key to continue.  Otherwise hit ctrl+C"
		ewarn "to abort."
		read s
	fi
	einfo "Creating unified configuration file"
	[ ! -d "${ROOT}$(dirname "${f}")" ] && mkdir -p "${ROOT}$(dirname "${f}")"
	"${ROOT}"usr/bin/pvfs2-genconfig "${f}"
}