Opened 10 years ago

Closed 16 months ago

#5366 closed enhancement (wontfix)

Add libc-client

Reported by: Thomas de Roo Owned by: blfs-book
Priority: normal Milestone: x-future
Component: BOOK Version: SVN
Severity: normal Keywords:
Cc:

Description

Could libc-client be added to the book? This would allow PHP to be compiled with "--with-imap=/usr/lib/c-client --with-imap-ssl", which is very useful when you want to run a webmail-server.

It can be installed like this:

wget ftp://ftp.cac.washington.edu/imap/imap-2007f.tar.gz
tar -xvf imap-2007f.tar.gz
cd imap-2007f
make lnp SSLINCLUDE=/usr/include SSLTYPE=unix EXTRACFLAGS=-fPIC
install -v -m755 -d /usr/lib/c-client
install -v -m755 -d /usr/lib/c-client/include
install -v -m755 -d /usr/lib/c-client/lib
install -v c-client/c-client.a /usr/lib/c-client/lib
install -v c-client/*.c /usr/lib/c-client/lib
install -v c-client/*.h /usr/lib/c-client/include
ln -s c-client.a /usr/lib/c-client//lib/lic-client.a
install -v -m755 -d /usr/share/doc/imap-2007f
install -v -m755 -d /usr/share/doc/imap-2007f/draft
install -v -m755 -d /usr/share/doc/imap-2007f/rfc
install -v -m644 docs/* /usr/share/doc/imap-2007f
install -v -m644 docs/draft/* /usr/share/doc/imap-2007f/draft
install -v -m644 docs/rfc/* /usr/share/doc/imap-2007f/rfc

Change History (11)

comment:1 by bdubbs@…, 10 years ago

Milestone: 7.6future
Summary: libc-clientNew package: libc-client

It's too close to starting the release cycle to add a new package now.

comment:2 by Armin K, 10 years ago

Also, patches welcome.

comment:3 by Thomas de Roo, 10 years ago

Sorry, a typo:

ln -s c-client.a /usr/lib/c-client/lib/libc-client.a

Making a patch might be an interesting challenge...

comment:4 by Armin K, 10 years ago

Building this package proved to be an interesting challenge because I wanted to build a shared library instead of a static one. With help of Debian, I finally got it.

Required dependencies are Linux-PAM and OpenSSL. Optional is MIT Kerberos, but I haven't tried to build GSSAPI support - it needs some more adjusting.

The shared library is a versioned one too, and soname is the actual package version. The package also contains an imap server and few more utils, but I haven't looked into that nor have any intention to do so - that's why I'd call this package simply libc-client instead of the actual tarball name - imap.

Hide some awful warnings from glibc-2.20

sed -i "s#BSD_SOURCE#DEFAULT_SOURCE#g" src/osdep/unix/os_{ln,sl}x.h

Hackery to build a shared library:

sed -i "s#BASELDFLAGS=\"\$(PAMLDFLAGS)\"#BASELDFLAGS=\"../c-client/c-client.a \$(PAMLDFLAGS)\"#g" src/osdep/unix/Makefile
sed -i "s#\$(BINARIES);\$(RANLIB)#\$(BINARIES) \$(LIBRARIES);\$(RANLIB)#g" src/osdep/unix/Makefile
sed -i "s#\$(CCLIENTLIB) ##g" $(grep -rl "(CCLIENTLIB)")

/bin/echo -e '
ldbs:  an
\t$(BUILD) BUILDTYPE=lnps IP=$(IP6) \
\tSPECIALS="SSLDIR=/usr SSLINCLUDE=/usr/include SSLCERTS=/etc/ssl/certs SSLKEYS=/etc/ssl/private"
' >> Makefile

/bin/echo -e '
lnps:  # Linux Pluggable Authentication modules (c-client as shared lib)
\t$(BUILD) `$(CAT) SPECIALS` OS=lnx \
\tSIGTYPE=psx CHECKPW=pam CRXTYPE=nfs \
\tSPOOLDIR=/var/spool \
\tACTIVEFILE=/var/lib/news/active \
\tRSHPATH=/usr/bin/rsh \
\tBASECFLAGS="-fPIC $(GCCCFLAGS)" \
\tARCHIVE="libc-client.so" \
\tBASELDFLAGS="-L../c-client -lc-client $(PAMLDFLAGS)" \
\tARRC="gcc --shared -Wl,-soname,libc-client.so.$(VERSION) -o" \
\tLIBRARIES="$(PAMLDFLAGS) $(EXTRALDFLAGS) $(SSLLDFLAGS)" \
\tRANLIB=true
' >> src/osdep/unix/Makefile

Build:

yes "y" | make ldbs VERSION=2007f

Install:

for file in c-client mail imap4r1 rfc822 linkage misc smtp nntp \
            osdep env_unix env fs ftl nl tcp sslio utf8 utf8aux
do
    install -Dm644 c-client/${file}.h /usr/include/c-client/${file}.h
done

install -Dm755 c-client/libc-client.so /usr/lib/libc-client.so.2007f
ln -sfv libc-client.so.2007f /usr/lib/libc-client.so

After doing all this, I was able to compile php-5.6.1 with "--with-imap=shared --with-imap-ssl" configure switches just fine and php info shows the imap module loaded.

comment:5 by Thomas de Roo, 10 years ago

I installed libc-client using Krejzis commands. This works great, I now have a shared library of libc-client installed. To make it useful in PHP, I had to compile PHP with configure switches "--with-imap=/usr --with-imap-ssl", though.

comment:6 by bdubbs@…, 10 years ago

Summary: New package: libc-clientAdd libc-client

comment:7 by bdubbs@…, 7 years ago

Milestone: futurex-future

Milestone renamed

comment:8 by bdubbs@…, 6 years ago

Owner: changed from blfs-book@… to bdubbs@…

comment:9 by bdubbs@…, 6 years ago

Owner: changed from bdubbs@… to blfs-book

comment:10 by Tim Tassonis, 5 years ago

Since c-client is not used a lot anymore apart from php, I suggest to build a temporary static c-client library and then a dynamically loadable php imap module. With the invaluable help of above settings, I did the following within a freshly unpacked php source tree (7.2.13), after having built and installed php before:

tar xf /lfs-src/imap-2007f.tar.gz
cd imap-2007f || exit


make lnp SSLINCLUDE=/usr/include SSLTYPE=unix EXTRACFLAGS=-fPIC
install -v -m755 -d $C_CLIENT_BASE
install -v -m755 -d $C_CLIENT_BASE/include
install -v -m755 -d $C_CLIENT_BASE/lib
install -v c-client/c-client.a $C_CLIENT_BASE/lib
install -v c-client/*.c $C_CLIENT_BASE/lib
install -v c-client/*.h $C_CLIENT_BASE/include
ln -s c-client.a $C_CLIENT_BASE/lib/libc-client.a

cd ..


cd ext/imap
phpize
./configure --with-imap=$C_CLIENT_BASE --with-imap-ssl
make || exit
sudo make install (or some make INSTALL_ROOT=$DESTDIR install)

I then only had to add

extension=imap.so

to my php.ini and got the imap extension successfully loaded. As not many php installations still require the imap extension, adding it dynamically migth be the better idea.

comment:11 by Bruce Dubbs, 16 months ago

Resolution: wontfix
Status: newclosed
Note: See TracTickets for help on using tickets.