# Copyright 1999-2016 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 EAPI=8 inherit flag-o-matic multilib toolchain-funcs MY_PV="${PV//.}" DOC_PV="$(ver_cut 1-2).0" DESCRIPTION="Powerful security toolkit for adding encryption to software" HOMEPAGE="http://www.cs.auckland.ac.nz/~pgut001/cryptlib/" SRC_URI="https://cryptlib.com/downloads/cryptlib${MY_PV}.zip doc? ( https://cryptlib.com/wp21/wp-content/uploads/2025/04/Cryptlib-${PV}-Product-Manual-2024.pdf -> ${P}-manual.pdf )" LICENSE="Sleepycat" SLOT="0" KEYWORDS="~amd64 ~x86" IUSE="doc ldap odbc" S="${WORKDIR}" RDEPEND=" sys-libs/zlib ldap? ( net-nds/openldap ) odbc? ( dev-db/unixODBC ) " DEPEND=" ${RDEPEND} app-arch/unzip " src_prepare() { default rm -fr zlib || die sed -i \ -e "s:-m.*=pentium::g" \ -e "s:-fomit-frame-pointer::g" \ -e "s:-O2::g" \ -e "s:-O3::g" \ -e "s:-O4::g" \ makefile || die "sed makefile failed" sed -i \ -e "s/-march=[[:alnum:]\.=-]*//g" \ -e "s/-mcpu=[[:alnum:]\.=-]*//g" \ -e "s:-O2::g" \ -e "s:-O3::g" \ tools/ccopts.sh || die "sed tools/ccopts.sh failed" sed -i -e "s:@\?make:\$(MAKE):g" makefile || die "sed makefile failed" sed -i -e 's:i\[3,4,5,6\]86:___:g' makefile || die "sed makefile failed" sed -i -e 's/PLV="2"/PLV="3"/' tools/buildall.sh || die "sed tools/buildall.sh failed" #eapply "${FILESDIR}/${P}-build.patch" #eapply "${FILESDIR}/${P}-zlib.patch" } src_compile() { local libname="libcl.so.${PV}" replace-flags -O -O2 replace-flags -O0 -O2 replace-flags -O1 -O2 replace-flags -Os -O2 is-flagq -O* || append-flags -O2 append-flags "-fPIC -D__UNIX__ -DOSVERSION=2 -DNDEBUG -I." if [[ -f /usr/include/pthread.h ]] && grep -q PTHREAD_MUTEX_RECURSIVE /usr/include/pthread.h ; then append-flags "-DHAS_RECURSIVE_MUTEX" fi if [[ -f /usr/include/pthread.h ]] && grep -q PTHREAD_MUTEX_ROBUST /usr/include/pthread.h ; then append-flags "-DHAS_ROBUST_MUTEX" fi use ldap && append-flags -DHAS_LDAP use odbc && append-flags -DHAS_ODBC emake directories emake toolscripts emake CC="$(tc-getCC)" CFLAGS="${CFLAGS} -c" STRIP=true Linux emake \ TARGET="${libname}" \ OBJPATH="./shared-obj/" \ CC="$(tc-getCC)" \ CFLAGS="${CFLAGS} -c" \ STRIP=true Linux } src_install() { dolib.so "libcl.so.${PV}" dosym "libcl.so.${PV}" "/usr/$(get_libdir)/libcl.so" dolib.a "libcl.a" doheader cryptlib.h dodoc README if use doc ; then newdoc "${DISITDIR}/${P}-manual.pdf" manual.pdf fi }