# Source0-md5: afdb94894f7f798702703f4a95a2e7ac
Patch0: %{name}-rdtsc.patch
Patch1: %{name}-soname.patch
+Patch2: optflags.patch
+Patch3: x32.patch
URL: http://www.cs.auckland.ac.nz/~pgut001/cryptlib/
BuildRequires: rpmbuild(macros) >= 1.710
BuildRequires: python-devel >= 1:2.5
unzip -q -L -a %{SOURCE0}
%patch0 -p1
%patch1 -p1
-
-sed -i -e 's/ -O3 / %{rpmcflags} /' makefile
+%patch2 -p1
+%patch3 -p1
%build
%{__make} \
+%ifarch x32
+ OPTFLAGS="%{rpmcflags} -DOPENSSL_NO_ASM" \
+%else
+ OPTFLAGS="%{rpmcflags}" \
+%endif
CC="%{__cc}"
%{__make} shared \
+%ifarch x32
+ OPTFLAGS="%{rpmcflags} -DOPENSSL_NO_ASM" \
+%else
+ OPTFLAGS="%{rpmcflags}" \
+%endif
CC="%{__cc}"
ln -sf libcl.so.%{libver} libcl.so
--- /dev/null
+--- cryptlib-3.3.3/makefile.orig 2009-07-21 01:02:22.000000000 +0200
++++ cryptlib-3.3.3/makefile 2015-12-22 09:14:14.998537699 +0100
+@@ -1754,10 +1755,10 @@
+ Linux:
+ @if uname -m | grep "i[3,4,5,6]86" > /dev/null; then \
+ ./tools/buildasm.sh $(AS) $(OBJPATH) ; \
+- make $(DEFINES) EXTRAOBJS="$(ASMOBJS)" CFLAGS="$(CFLAGS) -DUSE_ASM \
++ make $(DEFINES) EXTRAOBJS="$(ASMOBJS)" CFLAGS="$(CFLAGS) $(OPTFLAGS) \
+ -fomit-frame-pointer -D_REENTRANT" ; \
+ else \
+- make $(DEFINES) CFLAGS="$(CFLAGS) -fomit-frame-pointer -D_REENTRANT" ; \
++ make $(DEFINES) CFLAGS="$(CFLAGS) $(OPTFLAGS) -fomit-frame-pointer -D_REENTRANT" ; \
+ fi
+
+ # Mac OS X: BSD variant. Optimisation level is set via the ccopts.sh script.
--- /dev/null
+--- cryptlib-3.3.3/crypt/osconfig.h~ 2009-05-07 02:07:36.000000000 +0200
++++ cryptlib-3.3.3/crypt/osconfig.h 2015-12-22 09:12:29.940840903 +0100
+@@ -101,7 +101,7 @@
+ #if defined( __FreeBSD__ ) || defined( __bsdi__ ) || \
+ defined( __OpenBSD__ ) || defined( __NetBSD__ ) || \
+ defined( __linux__ )
+- #if defined( __x86_64__ ) || defined( __amd64__ )
++ #if (defined( __x86_64__ ) || defined( __amd64__ )) && !defined(__ILP32__)
+ /* 64-bit x86 has both 'long' and 'long long' as 64 bits. In addition
+ we use DES_INT since int's are 64-bit. We have to check for the
+ 64-bit x86 variants before the generic ones because they're a
+@@ -115,7 +115,7 @@
+ #define DES_RISC1
+ #define DES_UNROLL
+ #define RC4_INDEX
+- #elif defined( __i386__ )
++ #elif defined( __i386__ ) || ((defined( __x86_64__ ) || defined( __amd64__ )) && defined(__ILP32__))
+ #define L_ENDIAN
+ #define BN_LLONG
+ #define DES_PTR