Gentoo Archives: gentoo-commits

From: Patrice Clement <monsieurp@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-libs/cryptlib/
Date: Fri, 03 Jun 2016 17:35:12
Message-Id: 1464973624.537fa88e8e9be9abf21c6d8063e19604f659cb83.monsieurp@gentoo
1 commit: 537fa88e8e9be9abf21c6d8063e19604f659cb83
2 Author: Austin English <wizardedit <AT> gentoo <DOT> org>
3 AuthorDate: Thu Jun 2 04:53:09 2016 +0000
4 Commit: Patrice Clement <monsieurp <AT> gentoo <DOT> org>
5 CommitDate: Fri Jun 3 17:07:04 2016 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=537fa88e
7
8 dev-libs/cryptlib: add python3 support
9
10 Package-Manager: portage-2.2.26
11 Closes: https://github.com/gentoo/gentoo/pull/1581
12
13 Signed-off-by: Patrice Clement <monsieurp <AT> gentoo.org>
14
15 dev-libs/cryptlib/cryptlib-3.4.0-r2.ebuild | 142 +++++++++++++++++++++++++++++
16 1 file changed, 142 insertions(+)
17
18 diff --git a/dev-libs/cryptlib/cryptlib-3.4.0-r2.ebuild b/dev-libs/cryptlib/cryptlib-3.4.0-r2.ebuild
19 new file mode 100644
20 index 0000000..f291d7d
21 --- /dev/null
22 +++ b/dev-libs/cryptlib/cryptlib-3.4.0-r2.ebuild
23 @@ -0,0 +1,142 @@
24 +# Copyright 1999-2016 Gentoo Foundation
25 +# Distributed under the terms of the GNU General Public License v2
26 +# $Id$
27 +
28 +EAPI=5
29 +
30 +PYTHON_COMPAT=( python2_7 python3_{3,4,5} pypy )
31 +DISTUTILS_OPTIONAL=1
32 +
33 +inherit distutils-r1 eutils flag-o-matic multilib toolchain-funcs
34 +
35 +MY_PV="${PV//.}"
36 +
37 +DESCRIPTION="Powerful security toolkit for adding encryption to software"
38 +HOMEPAGE="http://www.cs.auckland.ac.nz/~pgut001/cryptlib/"
39 +DOC_PREFIX="${PN}-${PV}"
40 +SRC_URI="ftp://ftp.franken.de/pub/crypt/cryptlib/cl${MY_PV}.zip
41 + doc? ( mirror://gentoo/${DOC_PREFIX}-manual.pdf.bz2 )"
42 +
43 +LICENSE="Sleepycat"
44 +KEYWORDS="~amd64 ~x86"
45 +SLOT="0"
46 +IUSE="doc ldap odbc python"
47 +
48 +S="${WORKDIR}"
49 +
50 +RDEPEND="sys-libs/zlib
51 + ldap? ( net-nds/openldap )
52 + odbc? ( dev-db/unixODBC )
53 + python? ( ${PYTHON_DEPS} )"
54 +DEPEND="${RDEPEND}
55 + app-arch/unzip"
56 +
57 +src_unpack() {
58 + # we need the -a option, so we can not use 'unpack'
59 + unzip -qoa "${DISTDIR}/cl${MY_PV}.zip" || die
60 + use doc && unpack "${DOC_PREFIX}-manual.pdf.bz2"
61 +}
62 +
63 +wrap_python() {
64 + if use python; then
65 + # cd bindings || die
66 +
67 + distutils-r1_${1}
68 + fi
69 +}
70 +
71 +src_prepare() {
72 + rm -fr zlib || die
73 +
74 + # we want our own CFLAGS ;-)
75 + sed -i -e "s:-m.*=pentium::g" -e "s:-fomit-frame-pointer::g" -e "s:-O2::g" \
76 + -e "s:-O3::g" -e "s:-O4::g" makefile || die "sed makefile failed"
77 + sed -i -e "s/-march=[[:alnum:]\.=-]*//g" -e "s/-mcpu=[[:alnum:]\.=-]*//g" \
78 + -e "s:-O2::g" -e "s:-O3::g" tools/ccopts.sh || die "sed tools/ccopts.sh failed"
79 +
80 + # change 'make' to '$(MAKE)'
81 + sed -i -e "s:@\?make:\$(MAKE):g" makefile || die "sed makefile failed"
82 +
83 + # NOTICE:
84 + # Because of stack execution
85 + # assembly parts are disabled.
86 + sed -i -e 's:i\[3,4,5,6\]86:___:g' makefile || die "sed makefile failed"
87 +
88 + # Fix version number of shared library.
89 + sed -i -e 's/PLV="2"/PLV="3"/' tools/buildall.sh || die "sed tools/buildall.sh failed"
90 +
91 + # Respect LDFLAGS and fix soname and strip issues.
92 + epatch "${FILESDIR}/${PN}-3.3.2-ld.patch"
93 +
94 + # Use external zlib.
95 + epatch "${FILESDIR}/${PN}-3.4.0-external-zlib.patch"
96 +
97 + # Fix setup.py
98 + epatch "${FILESDIR}"/${P}-python.patch
99 +
100 + # For some reason, setup.py is half-designed to be run from proper dir,
101 + # and half-designed to be run from root. Since the patch fixes it to
102 + # be completely from root, move it.
103 + #
104 + # When bumping the package, please update the patch to make setup.py work
105 + # properly when executed from 'bindings' subdirectory.
106 + mv bindings/setup.py . || die
107 +
108 + wrap_python ${FUNCNAME}
109 +}
110 +
111 +src_compile() {
112 + local libname="libcl.so.${PV}"
113 +
114 + # At least -O2 is needed.
115 + replace-flags -O -O2
116 + replace-flags -O0 -O2
117 + replace-flags -O1 -O2
118 + replace-flags -Os -O2
119 + is-flagq -O* || append-flags -O2
120 +
121 + append-flags "-D__UNIX__ -DOSVERSION=2 -DNDEBUG -I."
122 +
123 + if [ -f /usr/include/pthread.h -a \
124 + `grep -c PTHREAD_MUTEX_RECURSIVE /usr/include/pthread.h` -ge 0 ] ; then
125 + append-flags "-DHAS_RECURSIVE_MUTEX"
126 + fi
127 + if [ -f /usr/include/pthread.h -a \
128 + `grep -c PTHREAD_MUTEX_ROBUST /usr/include/pthread.h` -ge 0 ] ; then
129 + append-flags "-DHAS_ROBUST_MUTEX"
130 + fi
131 +
132 + use ldap && append-flags -DHAS_LDAP
133 + use odbc && append-flags -DHAS_ODBC
134 +
135 + emake directories
136 + emake toolscripts
137 + emake CC="$(tc-getCC)" CFLAGS="${CFLAGS} -c" Linux
138 +
139 + emake TARGET=${libname} OBJPATH="./shared-obj/" CC="$(tc-getCC)" \
140 + CFLAGS="${CFLAGS} -fPIC -c" Linux
141 +
142 + if use python; then
143 + ln -s libcl.so.${PV} libcl.so || die
144 +
145 + # Python bindings don't work with -O2 and higher.
146 + replace-flags -O* -O1
147 +
148 + wrap_python ${FUNCNAME}
149 + fi
150 +}
151 +
152 +src_install() {
153 + dolib.so "libcl.so.${PV}"
154 + dosym "libcl.so.${PV}" "/usr/$(get_libdir)/libcl.so"
155 + dolib.a "libcl.a"
156 +
157 + doheader cryptlib.h
158 +
159 + dodoc README
160 + if use doc; then
161 + newdoc "${DOC_PREFIX}-manual.pdf" "manual.pdf"
162 + fi
163 +
164 + wrap_python ${FUNCNAME}
165 +}