Use https by default
[gentoo.git] / net-fs / openafs / openafs-1.6.14.ebuild
1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Id$
4
5 EAPI="5"
6
7 inherit autotools eutils flag-o-matic multilib pam systemd toolchain-funcs versionator
8
9 MY_PV=$(delete_version_separator '_')
10 MY_P="${PN}-${MY_PV}"
11 PVER="20150626"
12
13 DESCRIPTION="The OpenAFS distributed file system"
14 HOMEPAGE="http://www.openafs.org/"
15 # We always d/l the doc tarball as man pages are not USE=doc material
16 [[ ${PV} == *_pre* ]] && MY_PRE="candidate/" || MY_PRE=""
17 SRC_URI="
18         http://openafs.org/dl/openafs/${MY_PRE}${MY_PV}/${MY_P}-src.tar.bz2
19         http://openafs.org/dl/openafs/${MY_PV}/${MY_P}-doc.tar.bz2
20         https://dev.gentoo.org/~bircoph/afs/${PN}-patches-${PVER}.tar.xz
21 "
22
23 LICENSE="IBM BSD openafs-krb5-a APSL-2"
24 SLOT="0"
25 KEYWORDS="~amd64 ~amd64-fbsd ~amd64-linux ~sparc ~x86 ~x86-fbsd ~x86-linux"
26
27 IUSE="doc kerberos +modules pam"
28
29 CDEPEND="
30         sys-libs/ncurses
31         pam? ( virtual/pam )
32         kerberos? ( virtual/krb5 )"
33
34 DEPEND="${CDEPEND}
35         doc? (
36                 app-text/docbook-xsl-stylesheets
37                 dev-libs/libxslt
38         )"
39
40 RDEPEND="${CDEPEND}
41         modules? ( ~net-fs/openafs-kernel-${PV} )"
42
43 S="${WORKDIR}/${MY_P}"
44
45 src_prepare() {
46         EPATCH_EXCLUDE="050_all_job_server.patch" \
47         EPATCH_SUFFIX="patch" \
48         epatch "${WORKDIR}"/gentoo/patches
49         epatch_user
50
51         # fixing 2-nd level makefiles to honor flags
52         sed -i -r 's/\<CFLAGS[[:space:]]*=/CFLAGS+=/; s/\<LDFLAGS[[:space:]]*=/LDFLAGS+=/' \
53                 src/*/Makefile.in || die '*/Makefile.in sed failed'
54
55         # packaging is f-ed up, so we can't run eautoreconf
56         # run autotools commands based on what is listed in regen.sh
57         eaclocal -I src/cf
58         eautoconf
59         eautoconf -o configure-libafs configure-libafs.ac
60         eautoheader
61         einfo "Deleting autom4te.cache directory"
62         rm -rf autom4te.cache
63 }
64
65 src_configure() {
66         AFS_SYSKVERS=26 \
67         econf \
68                 --disable-kernel-module \
69                 --disable-strip-binaries \
70                 --enable-supergroups \
71                 $(use_enable pam) \
72                 $(use_with doc html-xsl /usr/share/sgml/docbook/xsl-stylesheets/html/chunk.xsl) \
73                 $(use_with kerberos krb5)
74 }
75
76 src_compile() {
77         emake all_nolibafs
78         local d
79         if use doc; then
80                 for d in doc/xml/{AdminGuide,QuickStartUnix,UserGuide}; do
81                         emake -C "${d}" html;
82                 done
83         fi
84 }
85
86 src_install() {
87         local OPENRCDIR="${WORKDIR}/gentoo/openrc"
88         local SYSTEMDDIR="${WORKDIR}/gentoo/systemd"
89
90         emake DESTDIR="${ED}" install_nolibafs
91
92         insinto /etc/openafs
93         doins src/afsd/CellServDB
94         echo "/afs:/var/cache/openafs:200000" > "${ED}"/etc/openafs/cacheinfo
95         echo "openafs.org" > "${ED}"/etc/openafs/ThisCell
96
97         # pam_afs and pam_afs.krb have been installed in irregular locations, fix
98         if use pam ; then
99                 dopammod "${ED}"/usr/$(get_libdir)/pam_afs*
100         fi
101         rm -f "${ED}"/usr/$(get_libdir)/pam_afs* || die
102
103         # remove kdump stuff provided by kexec-tools #222455
104         rm -rf "${ED}"/usr/sbin/kdump*
105
106         # avoid collision with mit_krb5's version of kpasswd
107         mv "${ED}"/usr/bin/kpasswd{,_afs} || die
108         mv "${ED}"/usr/share/man/man1/kpasswd{,_afs}.1 || die
109
110         # move lwp stuff around #200674 #330061
111         mv "${ED}"/usr/include/{lwp,lock,timer}.h "${ED}"/usr/include/afs/ || die
112         mv "${ED}"/usr/$(get_libdir)/liblwp* "${ED}"/usr/$(get_libdir)/afs/ || die
113         # update paths to the relocated lwp headers
114         sed -ri \
115                 -e '/^#include <(lwp|lock|timer).h>/s:<([^>]*)>:<afs/\1>:' \
116                 "${ED}"/usr/include/*.h \
117                 "${ED}"/usr/include/*/*.h \
118                 || die
119
120         # minimal documentation
121         use pam && doman src/pam/pam_afs.5
122         dodoc "${WORKDIR}/gentoo/README" src/afsd/CellServDB
123
124         # documentation package
125         if use doc ; then
126                 dodoc -r doc/{arch,examples,protocol,txt}
127                 dohtml -r doc/xml/*
128         fi
129
130         # Gentoo related scripts
131         newinitd "${OPENRCDIR}"/openafs-client.initd openafs-client
132         newconfd "${OPENRCDIR}"/openafs-client.confd openafs-client
133         newinitd "${OPENRCDIR}"/openafs-server.initd openafs-server
134         newconfd "${OPENRCDIR}"/openafs-server.confd openafs-server
135         systemd_dotmpfilesd "${SYSTEMDDIR}"/tmpfiles.d/openafs-client.conf
136         systemd_dounit "${SYSTEMDDIR}"/openafs-client.service
137         systemd_dounit "${SYSTEMDDIR}"/openafs-server.service
138
139         # used directories: client
140         keepdir /etc/openafs
141
142         # used directories: server
143         keepdir /etc/openafs/server
144         diropts -m0700
145         keepdir /var/lib/openafs
146         keepdir /var/lib/openafs/db
147         diropts -m0755
148         keepdir /var/lib/openafs/logs
149
150         # link logfiles to /var/log
151         dosym ../lib/openafs/logs /var/log/openafs
152 }
153
154 pkg_preinst() {
155         ## Somewhat intelligently install default configuration files
156         ## (when they are not present)
157         local x
158         for x in cacheinfo CellServDB ThisCell ; do
159                 if [ -e "${EROOT}"/etc/openafs/${x} ] ; then
160                         cp "${EROOT}"/etc/openafs/${x} "${ED}"/etc/openafs/
161                 fi
162         done
163 }
164
165 pkg_postinst() {
166         elog "This installation should work out of the box (at least the"
167         elog "client part doing global afs-cell browsing, unless you had"
168         elog "a previous and different configuration).  If you want to"
169         elog "set up your own cell or modify the standard config,"
170         elog "please have a look at the Gentoo OpenAFS documentation"
171         elog "(warning: it is not yet up to date wrt the new file locations)"
172         elog
173         elog "The documentation can be found at:"
174         elog "  https://wiki.gentoo.org/wiki/OpenAFS"
175 }