--- /usr/local/gentoo/usr/portage/net-libs/c-client/c-client-2007f-r4.ebuild 2012-12-30 11:43:32.000000000 -0500 +++ /usr/local/portage/net-libs/c-client/c-client-2007f-r4.ebuild 2014-08-20 17:21:50.000000000 -0400 @@ -18,7 +18,7 @@ LICENSE="Apache-2.0" SLOT="0" -KEYWORDS="alpha amd64 arm hppa ia64 ~mips ppc ppc64 s390 sh sparc x86 ~amd64-fbsd ~x86-fbsd" +KEYWORDS="alpha amd64 arm hppa ia64 ~mips ppc ppc64 s390 sh sparc x86 ~amd64-fbsd ~x86-fbsd ~x64-macos ~x86-macos" IUSE="doc +ipv6 kerberos kernel_linux kernel_FreeBSD pam ssl static-libs topal chappa" RDEPEND="ssl? ( dev-libs/openssl ) @@ -27,6 +27,12 @@ DEPEND="${RDEPEND} kernel_linux? ( pam? ( >=sys-libs/pam-0.72 ) )" +pkg_pretend() { + if [[ ${CHOST} == *-darwin* ]] && ! use static-libs ; then + die "Non static build of c-client is not supported yet on darwin platform" + fi +} + src_prepare() { # Tarball packed with bad file perms chmod -R u+rwX,go-w . @@ -35,43 +41,53 @@ # generally should be built with it anyway. append-flags -fPIC - # Modifications so we can build it optimally and correctly - sed \ - -e "s:BASECFLAGS=\".*\":BASECFLAGS=:g" \ - -e 's:SSLDIR=/usr/local/ssl:SSLDIR=/usr:g' \ - -e 's:SSLCERTS=$(SSLDIR)/certs:SSLCERTS=/etc/ssl/certs:g' \ - -i src/osdep/unix/Makefile || die "Makefile sed fixing failed" - - # Make the build system more multilib aware - sed \ - -e "s:^SSLLIB=\$(SSLDIR)/lib:SSLLIB=\$(SSLDIR)/$(get_libdir):" \ - -e "s:^AFSLIB=\$(AFSDIR)/lib:AFSLIB=\$(AFSDIR)/$(get_libdir):" \ - -i src/osdep/unix/Makefile || die "Makefile sed fixing failed" - - # Targets should use the Gentoo (ie linux) fs - sed -e '/^bsf:/,/^$/ s:ACTIVEFILE=.*:ACTIVEFILE=/var/lib/news/active:g' \ - -i src/osdep/unix/Makefile || die "Makefile sex fixing failed for FreeBSD" - + if [[ ${CHOST} != *-darwin* ]] ; then + # Modifications so we can build it optimally and correctly + sed \ + -e "s:BASECFLAGS=\".*\":BASECFLAGS=:g" \ + -e 's:SSLDIR=/usr/local/ssl:SSLDIR=/usr:g' \ + -e 's:SSLCERTS=$(SSLDIR)/certs:SSLCERTS=/etc/ssl/certs:g' \ + -i src/osdep/unix/Makefile || die "Makefile sed fixing failed" + + # Make the build system more multilib aware + sed \ + -e "s:^SSLLIB=\$(SSLDIR)/lib:SSLLIB=\$(SSLDIR)/$(get_libdir):" \ + -e "s:^AFSLIB=\$(AFSDIR)/lib:AFSLIB=\$(AFSDIR)/$(get_libdir):" \ + -i src/osdep/unix/Makefile || die "Makefile sed fixing failed" + + # Targets should use the Gentoo (ie linux) fs + sed -e '/^bsf:/,/^$/ s:ACTIVEFILE=.*:ACTIVEFILE=/var/lib/news/active:g' \ + -i src/osdep/unix/Makefile || die "Makefile sex fixing failed for FreeBSD" + fi + # Apply a patch to only build the stuff we need for c-client epatch "${FILESDIR}"/${PN}-2006k_GENTOO_Makefile.patch - # Apply patch to add the compilation of a .so for PHP - # This was previously conditional, but is more widely useful. - epatch "${FILESDIR}"/${PN}-2006k_GENTOO_amd64-so-fix.patch + if [[ ${CHOST} != *-darwin* ]] ; then + # Apply patch to add the compilation of a .so for PHP + # This was previously conditional, but is more widely useful. + epatch "${FILESDIR}"/${PN}-2006k_GENTOO_amd64-so-fix.patch + fi # Remove the pesky checks about SSL stuff sed -e '/read.*exit/d' -i Makefile || die - # Respect LDFLAGS - epatch "${FILESDIR}"/${PN}-2007f-ldflags.patch - sed -e "s/CC=cc/CC=$(tc-getCC)/" \ - -e "s/ARRC=ar/ARRC=$(tc-getAR)/" \ - -e "s/RANLIB=ranlib/RANLIB=$(tc-getRANLIB)/" \ - -i src/osdep/unix/Makefile || die "Respecting build flags" + if [[ ${CHOST} != *-darwin* ]] ; then + # Respect LDFLAGS + epatch "${FILESDIR}"/${PN}-2007f-ldflags.patch + sed -e "s/CC=cc/CC=$(tc-getCC)/" \ + -e "s/ARRC=ar/ARRC=$(tc-getAR)/" \ + -e "s/RANLIB=ranlib/RANLIB=$(tc-getRANLIB)/" \ + -i src/osdep/unix/Makefile || die "Respecting build flags" + fi use topal && epatch "${FILESDIR}/${P}-topal.patch" use chappa && epatch "${DISTDIR}/${P}-chappa-${CHAPPA_PL}-all.patch.gz" + if [[ ${CHOST} == *-darwin* ]] ; then + epatch "${FILESDIR}/c-client-2007f-osx-prefix.patch" + fi + elibtoolize } @@ -85,6 +101,10 @@ elif use kernel_FreeBSD ; then target=bsf passwdtype=pam fi + if [[ ${CHOST} == *-darwin* ]] ; then + target=oxp passwdtype=std + use ssl && ssltype=nopwd + fi use kerberos \ && mymake="EXTRAAUTHENTICATORS=gss" \ && EXTRALIBS="-lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err" \ @@ -94,7 +114,8 @@ EXTRACFLAGS="${CFLAGS}" \ EXTRALDFLAGS="${LDFLAGS}" \ EXTRALIBS="${EXTRALIBS}" \ - GSSDIR=/usr + GSSDIR="${EPREFIX}/usr" \ + EPREFIX="${EPREFIX}" } src_install() { @@ -104,11 +125,13 @@ dosym c-client.a /usr/$(get_libdir)/libc-client.a fi - # Now the shared library - dolib.so c-client/libc-client.so.1.0.0 + if [[ ${CHOST} != *-darwin* ]] ; then + # Now the shared library + dolib.so c-client/libc-client.so.1.0.0 - dosym libc-client.so.1.0.0 /usr/$(get_libdir)/libc-client.so - dosym libc-client.so.1.0.0 /usr/$(get_libdir)/libc-client.so.1 + dosym libc-client.so.1.0.0 /usr/$(get_libdir)/libc-client.so + dosym libc-client.so.1.0.0 /usr/$(get_libdir)/libc-client.so.1 + fi # Headers insinto /usr/include/imap @@ -118,7 +141,7 @@ doins c-client/linkage.c doins c-client/osdep.h if use ssl; then - echo " ssl_onceonlyinit ();" >> "${D}"/usr/include/imap/linkage.c || die + echo " ssl_onceonlyinit ();" >> "${ED}"/usr/include/imap/linkage.c || die fi # Docs dodoc README docs/*.txt docs/BUILD docs/CONFIG docs/RELNOTES docs/SSLBUILD