From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-885325-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	by finch.gentoo.org (Postfix) with ESMTP id 2C21813829C
	for <garchives@archives.gentoo.org>; Fri,  3 Jun 2016 17:35:12 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 29941254031;
	Fri,  3 Jun 2016 17:35:09 +0000 (UTC)
Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id CB992254031
	for <gentoo-commits@lists.gentoo.org>; Fri,  3 Jun 2016 17:35:07 +0000 (UTC)
Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id B5C81340C6F
	for <gentoo-commits@lists.gentoo.org>; Fri,  3 Jun 2016 17:35:06 +0000 (UTC)
Received: from localhost.localdomain (localhost [127.0.0.1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id 035F2971
	for <gentoo-commits@lists.gentoo.org>; Fri,  3 Jun 2016 17:35:03 +0000 (UTC)
From: "Patrice Clement" <monsieurp@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: 8bit
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "Patrice Clement" <monsieurp@gentoo.org>
Message-ID: <1464973624.537fa88e8e9be9abf21c6d8063e19604f659cb83.monsieurp@gentoo>
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-libs/cryptlib/
X-VCS-Repository: repo/gentoo
X-VCS-Files: dev-libs/cryptlib/cryptlib-3.4.0-r2.ebuild
X-VCS-Directories: dev-libs/cryptlib/
X-VCS-Committer: monsieurp
X-VCS-Committer-Name: Patrice Clement
X-VCS-Revision: 537fa88e8e9be9abf21c6d8063e19604f659cb83
X-VCS-Branch: master
Date: Fri,  3 Jun 2016 17:35:03 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Archives-Salt: da7f90ef-914a-4227-9ddd-4f57af0e09fa
X-Archives-Hash: 01a291cdfef0dab4e6fc8020c285c4d6

commit:     537fa88e8e9be9abf21c6d8063e19604f659cb83
Author:     Austin English <wizardedit <AT> gentoo <DOT> org>
AuthorDate: Thu Jun  2 04:53:09 2016 +0000
Commit:     Patrice Clement <monsieurp <AT> gentoo <DOT> org>
CommitDate: Fri Jun  3 17:07:04 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=537fa88e

dev-libs/cryptlib: add python3 support

Package-Manager: portage-2.2.26
Closes: https://github.com/gentoo/gentoo/pull/1581

Signed-off-by: Patrice Clement <monsieurp <AT> gentoo.org>

 dev-libs/cryptlib/cryptlib-3.4.0-r2.ebuild | 142 +++++++++++++++++++++++++++++
 1 file changed, 142 insertions(+)

diff --git a/dev-libs/cryptlib/cryptlib-3.4.0-r2.ebuild b/dev-libs/cryptlib/cryptlib-3.4.0-r2.ebuild
new file mode 100644
index 0000000..f291d7d
--- /dev/null
+++ b/dev-libs/cryptlib/cryptlib-3.4.0-r2.ebuild
@@ -0,0 +1,142 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+PYTHON_COMPAT=( python2_7 python3_{3,4,5} pypy )
+DISTUTILS_OPTIONAL=1
+
+inherit distutils-r1 eutils flag-o-matic multilib toolchain-funcs
+
+MY_PV="${PV//.}"
+
+DESCRIPTION="Powerful security toolkit for adding encryption to software"
+HOMEPAGE="http://www.cs.auckland.ac.nz/~pgut001/cryptlib/"
+DOC_PREFIX="${PN}-${PV}"
+SRC_URI="ftp://ftp.franken.de/pub/crypt/cryptlib/cl${MY_PV}.zip
+	doc? ( mirror://gentoo/${DOC_PREFIX}-manual.pdf.bz2 )"
+
+LICENSE="Sleepycat"
+KEYWORDS="~amd64 ~x86"
+SLOT="0"
+IUSE="doc ldap odbc python"
+
+S="${WORKDIR}"
+
+RDEPEND="sys-libs/zlib
+	ldap? ( net-nds/openldap )
+	odbc? ( dev-db/unixODBC )
+	python? ( ${PYTHON_DEPS} )"
+DEPEND="${RDEPEND}
+	app-arch/unzip"
+
+src_unpack() {
+	# we need the -a option, so we can not use 'unpack'
+	unzip -qoa "${DISTDIR}/cl${MY_PV}.zip" || die
+	use doc && unpack "${DOC_PREFIX}-manual.pdf.bz2"
+}
+
+wrap_python() {
+	if use python; then
+		# cd bindings || die
+
+		distutils-r1_${1}
+	fi
+}
+
+src_prepare() {
+	rm -fr zlib || die
+
+	# we want our own CFLAGS ;-)
+	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"
+
+	# change 'make' to '$(MAKE)'
+	sed -i -e "s:@\?make:\$(MAKE):g" makefile || die "sed makefile failed"
+
+	# NOTICE:
+	# Because of stack execution
+	# assembly parts are disabled.
+	sed -i -e 's:i\[3,4,5,6\]86:___:g' makefile || die "sed makefile failed"
+
+	# Fix version number of shared library.
+	sed -i -e 's/PLV="2"/PLV="3"/' tools/buildall.sh || die "sed tools/buildall.sh failed"
+
+	# Respect LDFLAGS and fix soname and strip issues.
+	epatch "${FILESDIR}/${PN}-3.3.2-ld.patch"
+
+	# Use external zlib.
+	epatch "${FILESDIR}/${PN}-3.4.0-external-zlib.patch"
+
+	# Fix setup.py
+	epatch "${FILESDIR}"/${P}-python.patch
+
+	# For some reason, setup.py is half-designed to be run from proper dir,
+	# and half-designed to be run from root. Since the patch fixes it to
+	# be completely from root, move it.
+	#
+	# When bumping the package, please update the patch to make setup.py work
+	# properly when executed from 'bindings' subdirectory.
+	mv bindings/setup.py . || die
+
+	wrap_python ${FUNCNAME}
+}
+
+src_compile() {
+	local libname="libcl.so.${PV}"
+
+	# At least -O2 is needed.
+	replace-flags -O  -O2
+	replace-flags -O0 -O2
+	replace-flags -O1 -O2
+	replace-flags -Os -O2
+	is-flagq -O* || append-flags -O2
+
+	append-flags "-D__UNIX__ -DOSVERSION=2 -DNDEBUG -I."
+
+	if [ -f /usr/include/pthread.h -a \
+	`grep -c PTHREAD_MUTEX_RECURSIVE /usr/include/pthread.h` -ge 0 ] ; then
+		append-flags "-DHAS_RECURSIVE_MUTEX"
+	fi
+	if [ -f /usr/include/pthread.h -a \
+	`grep -c PTHREAD_MUTEX_ROBUST /usr/include/pthread.h` -ge 0 ] ; 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" Linux
+
+	emake TARGET=${libname} OBJPATH="./shared-obj/" CC="$(tc-getCC)" \
+		CFLAGS="${CFLAGS} -fPIC -c" Linux
+
+	if use python; then
+		ln -s libcl.so.${PV} libcl.so || die
+
+		# Python bindings don't work with -O2 and higher.
+		replace-flags -O* -O1
+
+		wrap_python ${FUNCNAME}
+	fi
+}
+
+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 "${DOC_PREFIX}-manual.pdf" "manual.pdf"
+	fi
+
+	wrap_python ${FUNCNAME}
+}