commit:     e935143d704b71f9d82afb9aa4677aabeb44b66a
Author:     Alon Bar-Lev <alonbl <AT> gentoo <DOT> org>
AuthorDate: Sat Feb  4 04:37:07 2017 +0000
Commit:     Alon Bar-Lev <alonbl <AT> gentoo <DOT> org>
CommitDate: Sat Feb  4 09:33:30 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e935143d

dev-libs/cryptlib: cleanups

Package-Manager: portage-2.3.3

 ...b-3.4.3.1.ebuild => cryptlib-3.4.3.1-r1.ebuild} |  61 +++++-------
 .../cryptlib/files/cryptlib-3.4.3.1-build.patch    | 104 +++++++++++++++++++++
 .../cryptlib/files/cryptlib-3.4.3.1-tests.patch    |  52 +++++++++++
 3 files changed, 179 insertions(+), 38 deletions(-)

diff --git a/dev-libs/cryptlib/cryptlib-3.4.3.1.ebuild 
b/dev-libs/cryptlib/cryptlib-3.4.3.1-r1.ebuild
similarity index 64%
rename from dev-libs/cryptlib/cryptlib-3.4.3.1.ebuild
rename to dev-libs/cryptlib/cryptlib-3.4.3.1-r1.ebuild
index de6d98c..d63a959 100644
--- a/dev-libs/cryptlib/cryptlib-3.4.3.1.ebuild
+++ b/dev-libs/cryptlib/cryptlib-3.4.3.1-r1.ebuild
@@ -20,7 +20,7 @@ 
SRC_URI="ftp://ftp.franken.de/pub/crypt/cryptlib/cl${MY_PV}.zip
 LICENSE="Sleepycat"
 KEYWORDS="~amd64 ~x86"
 SLOT="0"
-IUSE="doc ldap odbc python"
+IUSE="doc ldap odbc python test"
 
 S="${WORKDIR}"
 
@@ -34,6 +34,7 @@ DEPEND="${RDEPEND}
 PATCHES=(
        "${FILESDIR}/${P}-build.patch"
        "${FILESDIR}/${P}-zlib.patch"
+       "${FILESDIR}/${P}-tests.patch"
 )
 
 src_unpack() {
@@ -63,20 +64,10 @@ src_prepare() {
        # 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"
-
        wrap_python ${FUNCNAME}
 }
 
 src_compile() {
-       local libname="libcl.so.$(get_version_component_range 1-3 ${PV})"
-
        # At least -O2 is needed.
        replace-flags -O  -O2
        replace-flags -O0 -O2
@@ -84,31 +75,25 @@ src_compile() {
        replace-flags -Os -O2
        is-flagq -O* || append-flags -O2
 
-       append-flags "-fPIC"
-       append-cppflags "-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-cppflags "-DHAS_RECURSIVE_MUTEX"
-       fi
-       if [ -f /usr/include/pthread.h -a \
-       `grep -c PTHREAD_MUTEX_ROBUST /usr/include/pthread.h` -ge 0 ] ; then
-               append-cppflags "-DHAS_ROBUST_MUTEX"
-       fi
-
        use ldap && append-cppflags -DHAS_LDAP
        use odbc && append-cppflags -DHAS_ODBC
 
-       emake directories
-       emake toolscripts
-       emake CC="$(tc-getCC)" CFLAGS="${CPPFLAGS} ${CFLAGS} -c" STRIP=true 
Linux
+       export DISABLE_AUTODETECT=1
+       emake EXTRA_CFLAGS="${CPPFLAGS} ${CFLAGS}" default
+       emake EXTRA_CFLAGS="${CPPFLAGS} ${CFLAGS}" shared
+       use test && emake EXTRA_CFLAGS="${CPPFLAGS} ${CFLAGS}" stestlib
 
-       emake TARGET=${libname} OBJPATH="./shared-obj/" CC="$(tc-getCC)" \
-               CFLAGS="${CPPFLAGS} ${CFLAGS} -c" STRIP=true Linux
+       #
+       # Without this:
+       # 1. python will link against the static lib
+       # 2. tests will not work find soname.
+       #
+       local libname="libcl.so.$(get_version_component_range 1-3 ${PV})"
+       local solibname="libcl.so.$(get_version_component_range 1-2 ${PV})"
+       ln -s "${libname}" "${solibname}" || die
+       ln -s "${solibname}" libcl.so || die
 
        if use python; then
-               # Without this python will link against the static lib
-               ln -s libcl.so.${PV} libcl.so || die
 
                # Python bindings don't work with -O2 and higher.
                replace-flags -O* -O1
@@ -117,18 +102,18 @@ src_compile() {
        fi
 }
 
-src_install() {
-       local libname="libcl.so.$(get_version_component_range 1-3 ${PV})"
-       local solibname="libcl.so.$(get_version_component_range 1-2 ${PV})"
+src_test() {
+       LD_LIBRARY_PATH="." ./stestlib || die "test failed"
+}
 
-       dolib.so "${libname}"
-       dosym "${libname}" "/usr/$(get_libdir)/${solibname}"
-       dosym "${solibname}" "/usr/$(get_libdir)/libcl.so"
-       dolib.a "libcl.a"
+src_install() {
+       einstalldocs
 
        doheader cryptlib.h
 
-       dodoc README
+       dolib.so libcl.so*
+       dolib.a libcl.a
+
        if use doc; then
                newdoc "${DOC_PREFIX}-manual.pdf" "manual.pdf"
        fi

diff --git a/dev-libs/cryptlib/files/cryptlib-3.4.3.1-build.patch 
b/dev-libs/cryptlib/files/cryptlib-3.4.3.1-build.patch
index 3a0e558..6fbbe0a 100644
--- a/dev-libs/cryptlib/files/cryptlib-3.4.3.1-build.patch
+++ b/dev-libs/cryptlib/files/cryptlib-3.4.3.1-build.patch
@@ -24,3 +24,107 @@ index 9a23592..c90dbc1 100644
 -- 
 2.10.2
 
+From 188dce32ea9c58271c8ce48ab02a3b255498bf9f Mon Sep 17 00:00:00 2001
+From: Alon Bar-Lev <alon.bar...@gmail.com>
+Date: Sat, 4 Feb 2017 05:08:47 +0200
+Subject: [PATCH] build: allow specify additional CFLAGS
+
+Signed-off-by: Alon Bar-Lev <alon.bar...@gmail.com>
+---
+ makefile | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/makefile b/makefile
+index cb9884c..827a78a 100644
+--- a/makefile
++++ b/makefile
+@@ -90,7 +90,7 @@ DYLIBNAME = lib$(PROJ).$(MAJ).$(MIN).dylib
+ # Further cc flags are gathered dynamically at runtime via the ccopts.sh
+ # script.
+ 
+-CFLAGS                = -c -D__UNIX__ -DNDEBUG -I.
++CFLAGS                = -c -D__UNIX__ -DNDEBUG -I. $(EXTRA_CFLAGS)
+ CFLAGS_ANALYSE = -c -D__UNIX__ -I.
+ CFLAGS_COVERAGE = -c -D__UNIX__ -I. -ggdb3 -fno-omit-frame-pointer -O1 
--coverage -fprofile-arcs -ftest-coverage
+ CFLAGS_DEBUG = -c -D__UNIX__ -I. -ggdb3 -fno-omit-frame-pointer -O0
+-- 
+2.10.2
+
+From 3a084f090f12ebc65cef7b14aeaa28257dacaaaa Mon Sep 17 00:00:00 2001
+From: Alon Bar-Lev <alon.bar...@gmail.com>
+Date: Sat, 4 Feb 2017 06:19:51 +0200
+Subject: [PATCH] build: ccopts: detect mutex using pre-processor
+
+this required for proper cross compile detection.
+
+Signed-off-by: Alon Bar-Lev <alon.bar...@gmail.com>
+---
+ tools/ccopts.sh | 15 ++++++++-------
+ 1 file changed, 8 insertions(+), 7 deletions(-)
+
+diff --git a/tools/ccopts.sh b/tools/ccopts.sh
+index e506c6c..8cc87ff 100644
+--- a/tools/ccopts.sh
++++ b/tools/ccopts.sh
+@@ -324,13 +324,14 @@ fi
+ # tend to be somewhat hit-and-miss but we at least indicate their presence
+ # via a define.
+ 
+-if [ -f /usr/include/pthread.h ] ; then
+-      if [ "$(grep -c PTHREAD_MUTEX_RECURSIVE /usr/include/pthread.h)" -gt 0 
] ; then
+-              CCARGS="$CCARGS -DHAS_RECURSIVE_MUTEX" ;
+-      fi ;
+-      if [ "$(grep -c PTHREAD_MUTEX_ROBUST /usr/include/pthread.h)" -gt 0 ] ; 
then
+-              CCARGS="$CCARGS -DHAS_ROBUST_MUTEX" ;
+-      fi ;
++PTHREAD_OUT="$(echo "#include <pthread.h>" | ${CC} -E - 2> /dev/null)"
++if [ $? -eq 0 ]; then
++      if echo "${PTHREAD_OUT}" | grep -q PTHREAD_MUTEX_RECURSIVE; then
++              CCARGS="$CCARGS -DHAS_RECURSIVE_MUTEX"
++      fi
++      if echo "${PTHREAD_OUT}" | grep -q PTHREAD_MUTEX_ROBUST; then
++              CCARGS="$CCARGS -DHAS_ROBUST_MUTEX"
++      fi
+ fi
+ 
+ # If we're not using gcc, we're done.  This isn't as simple as a straight
+-- 
+2.10.2
+
+From 489a81e89103a7a3c653b9e95e279eefa1514c51 Mon Sep 17 00:00:00 2001
+From: Alon Bar-Lev <alon.bar...@gmail.com>
+Date: Sat, 4 Feb 2017 06:28:03 +0200
+Subject: [PATCH] build: ccopts: support disable of autodetection
+
+requires for cross-compile and explicit predictable build.
+
+Signed-off-by: Alon Bar-Lev <alon.bar...@gmail.com>
+---
+ tools/ccopts.sh | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/tools/ccopts.sh b/tools/ccopts.sh
+index 8cc87ff..296bc80 100644
+--- a/tools/ccopts.sh
++++ b/tools/ccopts.sh
+@@ -150,7 +150,7 @@ case $OSNAME in
+                       HASDYNLOAD=1 ;
+               fi ;;
+ esac
+-if [ $HASDYNLOAD -gt 0 ] ; then
++if [ -z $DISABLE_AUTODETECT ] && [ $HASDYNLOAD -gt 0 ] ; then
+       if [ -f /usr/include/sql.h ] ; then
+               echo "ODBC interface detected, enabling ODBC support." >&2 ;
+               CCARGS="$CCARGS -DHAS_ODBC" ;
+@@ -181,7 +181,7 @@ if [ $HASDYNLOAD -gt 0 ] ; then
+               CCARGS="$CCARGS -DNCIPHER_PKCS11" ;
+       fi
+ fi
+-if [ -d /usr/include/event2 ] && [ -f /usr/include/event2/event.h ] ; then
++if [ -z $DISABLE_AUTODETECT ] && [ -d /usr/include/event2 ] && [ -f 
/usr/include/event2/event.h ] ; then
+       echo "  (Enabling use of libevent)." >&2 ;
+       CCARGS="$CCARGS -DHAS_LIBEVENT" ;
+ fi
+-- 
+2.10.2
+

diff --git a/dev-libs/cryptlib/files/cryptlib-3.4.3.1-tests.patch 
b/dev-libs/cryptlib/files/cryptlib-3.4.3.1-tests.patch
new file mode 100644
index 00000000..f18bc96
--- /dev/null
+++ b/dev-libs/cryptlib/files/cryptlib-3.4.3.1-tests.patch
@@ -0,0 +1,52 @@
+From c25dad21f5b1db106e4fe42f38a0dac6290b8a41 Mon Sep 17 00:00:00 2001
+From: Alon Bar-Lev <alon.bar...@gmail.com>
+Date: Sat, 4 Feb 2017 05:48:54 +0200
+Subject: [PATCH] tests: disable online tests
+
+Signed-off-by: Alon Bar-Lev <alon.bar...@gmail.com>
+---
+ test/testfunc.c | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/test/testfunc.c b/test/testfunc.c
+index 79d7148..017a4a8 100644
+--- a/test/testfunc.c
++++ b/test/testfunc.c
+@@ -1119,6 +1119,7 @@ BOOLEAN testSessions( void )
+               }
+       if( !testSessionAttributes() )
+               return( FALSE );
++#if 0
+       if( !testSessionSSH() )
+               return( FALSE );
+       if( !testSessionSSHPubkeyAuth() )
+@@ -1127,6 +1128,7 @@ BOOLEAN testSessions( void )
+               return( FALSE );
+       if( !testSessionSSHExec() )
+               return( FALSE );
++#endif
+       if( !testSessionSSL() )
+               return( FALSE );
+       if( !testSessionSSLLocalSocket() )
+@@ -1147,14 +1149,18 @@ BOOLEAN testSessions( void )
+       if( !testSessionTLS12ClientCert() )
+               return( FALSE );
+ #endif /* 0 */
++#if 0
+       if( !testSessionOCSP() )
+               return( FALSE );
++#endif
++#if 0
+       if( !testSessionTSP() )
+               return( FALSE );
+       if( !testSessionEnvTSP() )
+               return( FALSE );
+       if( !testSessionCMP() )
+               return( FALSE );
++#endif
+ 
+       return( TRUE );
+       }
+-- 
+2.10.2
+

Reply via email to