Gentoo Archives: gentoo-commits

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