# Copyright 1999-2026 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=8 inherit flag-o-matic toolchain-funcs DESCRIPTION="Powerful security toolkit for adding encryption to software" HOMEPAGE="https://github.com/cryptlib/cryptlib" SRC_URI="https://github.com/cryptlib/cryptlib/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz" S="${WORKDIR}/${P}" LICENSE="Sleepycat" SLOT="0" KEYWORDS="~amd64 ~x86" IUSE="doc ldap odbc" RDEPEND=" virtual/zlib ldap? ( net-nds/openldap ) odbc? ( dev-db/unixODBC ) " DEPEND="${RDEPEND}" src_prepare() { default 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 -i \ -e "s/-march=[[:alnum:]\.=-]*//g" \ -e "s/-mcpu=[[:alnum:]\.=-]*//g" \ -e "s:-O2::g" \ -e "s:-O3::g" \ tools/ccopts.sh || die sed -i -e 's:i\[3,4,5,6\]86:___:g' makefile || die # cryptlib otherwise prefers clang whenever it is installed, ignoring CC. sed -i \ -e '/# If we.*clang installed/,/fi/d' \ tools/getcompiler.sh || die } src_compile() { local buildopts=() 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 append-cppflags -D__UNIX__ -DNDEBUG -I. use ldap && buildopts+=( -DHAS_LDAP ) use odbc && buildopts+=( -DHAS_ODBC ) DISABLE_AUTODETECT=1 emake \ CC="$(tc-getCC)" \ LD="$(tc-getCC)" \ AR="$(tc-getAR)" \ STRIP=true \ CFLAGS="${CPPFLAGS} ${CFLAGS} -c" \ BUILDOPTS="${buildopts[*]}" \ shared } src_install() { local libname="libcl.so.3.4.9" local libdir="$(get_libdir)" newlib.so "${libname}" "${libname}" dosym "${libname}" "/usr/${libdir}/libcl.so.3.4" dosym "${libname}" "/usr/${libdir}/libcl.so" doheader cryptlib.h dodoc README README.md SECURITY.md architecture.md use doc && dodoc manual.pdf }