1 |
# Copyright 1999-2012 Gentoo Foundation |
2 |
# Distributed under the terms of the GNU General Public License v2 |
3 |
# $Header: /var/cvsroot/gentoo-x86/net-libs/c-client/c-client-2007f-r4.ebuild,v 1.11 2012/12/30 14:32:16 ago Exp $ |
4 |
|
5 |
EAPI=4 |
6 |
|
7 |
inherit flag-o-matic eutils libtool toolchain-funcs multilib |
8 |
|
9 |
MY_PN=imap |
10 |
MY_P="${MY_PN}-${PV}" |
11 |
S=${WORKDIR}/${MY_P} |
12 |
|
13 |
CHAPPA_PL=115 |
14 |
DESCRIPTION="UW IMAP c-client library" |
15 |
HOMEPAGE="http://www.washington.edu/imap/" |
16 |
SRC_URI="ftp://ftp.cac.washington.edu/imap/${MY_P}.tar.Z |
17 |
chappa? ( mirror://gentoo/${P}-chappa-${CHAPPA_PL}-all.patch.gz )" |
18 |
|
19 |
LICENSE="Apache-2.0" |
20 |
SLOT="0" |
21 |
KEYWORDS="alpha amd64 arm hppa ia64 ~mips ppc ppc64 s390 sh sparc x86 ~amd64-fbsd ~x86-fbsd" |
22 |
IUSE="doc +ipv6 kerberos kernel_linux kernel_FreeBSD pam ssl static-libs topal chappa" |
23 |
|
24 |
RDEPEND="ssl? ( dev-libs/openssl ) |
25 |
!net-mail/uw-imap |
26 |
kerberos? ( app-crypt/mit-krb5 )" |
27 |
DEPEND="${RDEPEND} |
28 |
kernel_linux? ( pam? ( >=sys-libs/pam-0.72 ) )" |
29 |
|
30 |
src_prepare() { |
31 |
# Tarball packed with bad file perms |
32 |
chmod -R u+rwX,go-w . |
33 |
|
34 |
# lots of things need -fPIC, including various platforms, and this library |
35 |
# generally should be built with it anyway. |
36 |
append-flags -fPIC |
37 |
|
38 |
# Modifications so we can build it optimally and correctly |
39 |
sed \ |
40 |
-e "s:BASECFLAGS=\".*\":BASECFLAGS=:g" \ |
41 |
-e 's:SSLDIR=/usr/local/ssl:SSLDIR=/usr:g' \ |
42 |
-e 's:SSLCERTS=$(SSLDIR)/certs:SSLCERTS=/etc/ssl/certs:g' \ |
43 |
-i src/osdep/unix/Makefile || die "Makefile sed fixing failed" |
44 |
|
45 |
# Make the build system more multilib aware |
46 |
sed \ |
47 |
-e "s:^SSLLIB=\$(SSLDIR)/lib:SSLLIB=\$(SSLDIR)/$(get_libdir):" \ |
48 |
-e "s:^AFSLIB=\$(AFSDIR)/lib:AFSLIB=\$(AFSDIR)/$(get_libdir):" \ |
49 |
-i src/osdep/unix/Makefile || die "Makefile sed fixing failed" |
50 |
|
51 |
# Targets should use the Gentoo (ie linux) fs |
52 |
sed -e '/^bsf:/,/^$/ s:ACTIVEFILE=.*:ACTIVEFILE=/var/lib/news/active:g' \ |
53 |
-i src/osdep/unix/Makefile || die "Makefile sex fixing failed for FreeBSD" |
54 |
|
55 |
# Apply a patch to only build the stuff we need for c-client |
56 |
epatch "${FILESDIR}"/${PN}-2006k_GENTOO_Makefile.patch |
57 |
|
58 |
# Apply patch to add the compilation of a .so for PHP |
59 |
# This was previously conditional, but is more widely useful. |
60 |
epatch "${FILESDIR}"/${PN}-2006k_GENTOO_amd64-so-fix.patch |
61 |
|
62 |
# Remove the pesky checks about SSL stuff |
63 |
sed -e '/read.*exit/d' -i Makefile || die |
64 |
|
65 |
# Respect LDFLAGS |
66 |
epatch "${FILESDIR}"/${PN}-2007f-ldflags.patch |
67 |
sed -e "s/CC=cc/CC=$(tc-getCC)/" \ |
68 |
-e "s/ARRC=ar/ARRC=$(tc-getAR)/" \ |
69 |
-e "s/RANLIB=ranlib/RANLIB=$(tc-getRANLIB)/" \ |
70 |
-i src/osdep/unix/Makefile || die "Respecting build flags" |
71 |
|
72 |
use topal && epatch "${FILESDIR}/${P}-topal.patch" |
73 |
use chappa && epatch "${DISTDIR}/${P}-chappa-${CHAPPA_PL}-all.patch.gz" |
74 |
|
75 |
elibtoolize |
76 |
} |
77 |
|
78 |
src_compile() { |
79 |
local mymake ipver ssltype target passwdtype |
80 |
ipver='IP=4' |
81 |
use ipv6 && ipver="IP=6" && touch ip6 |
82 |
use ssl && ssltype="unix" || ssltype="none" |
83 |
if use kernel_linux ; then |
84 |
use pam && target=lnp passwdtype=pam || target=lnx passwdtype=std |
85 |
elif use kernel_FreeBSD ; then |
86 |
target=bsf passwdtype=pam |
87 |
fi |
88 |
use kerberos \ |
89 |
&& mymake="EXTRAAUTHENTICATORS=gss" \ |
90 |
&& EXTRALIBS="-lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err" \ |
91 |
# no parallel builds supported! |
92 |
emake -j1 SSLTYPE=${ssltype} $target \ |
93 |
PASSWDTYPE=${passwdtype} ${ipver} ${mymake} \ |
94 |
EXTRACFLAGS="${CFLAGS}" \ |
95 |
EXTRALDFLAGS="${LDFLAGS}" \ |
96 |
EXTRALIBS="${EXTRALIBS}" \ |
97 |
GSSDIR=/usr |
98 |
} |
99 |
|
100 |
src_install() { |
101 |
if use static-libs; then |
102 |
# Library binary |
103 |
dolib.a c-client/c-client.a |
104 |
dosym c-client.a /usr/$(get_libdir)/libc-client.a |
105 |
fi |
106 |
|
107 |
# Now the shared library |
108 |
dolib.so c-client/libc-client.so.1.0.0 |
109 |
|
110 |
dosym libc-client.so.1.0.0 /usr/$(get_libdir)/libc-client.so |
111 |
dosym libc-client.so.1.0.0 /usr/$(get_libdir)/libc-client.so.1 |
112 |
|
113 |
# Headers |
114 |
insinto /usr/include/imap |
115 |
doins src/osdep/unix/*.h |
116 |
doins src/c-client/*.h |
117 |
doins c-client/linkage.h |
118 |
doins c-client/linkage.c |
119 |
doins c-client/osdep.h |
120 |
if use ssl; then |
121 |
echo " ssl_onceonlyinit ();" >> "${D}"/usr/include/imap/linkage.c || die |
122 |
fi |
123 |
# Docs |
124 |
dodoc README docs/*.txt docs/BUILD docs/CONFIG docs/RELNOTES docs/SSLBUILD |
125 |
if use doc; then |
126 |
docinto rfc |
127 |
dodoc docs/rfc/*.txt |
128 |
docinto draft |
129 |
dodoc docs/draft/* |
130 |
fi |
131 |
} |