File libmcrypt.spec of Package libmcrypt

#
# spec file for package libmcrypt (Version 2.5.8)
#
# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#

# norootforbuild


Name:           libmcrypt
BuildRequires:  gcc-c++
License:        GPLv2+ ; LGPLv2.1+
Group:          System/Libraries
AutoReqProv:    on
Version:        2.5.8
Release:        100
Summary:        Data Encryption Library
Source:         %{name}-%{version}.tar.bz2
Source1:        %{name}-idea-0.9.tar.bz2
Source2:        %{name}-mars-0.9.tar.bz2
Source3:        %{name}-rc6-0.9.tar.bz2
Source4:        %{name}-skipjack-0.9.tar.bz2
Patch:          %{name}-%{version}.diff
Patch1:         %{name}-%{version}-notdynamic.diff
Patch2:         %{name}-%{version}-uninitialized.diff
Patch3:         %{name}-%{version}-prototypes.diff
Url:            http://mcrypt.sourceforge.net/
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
Libmcrypt  is a data encryption library.  The library is thread safe
and provides encryption and decryption functions. This version of the
library supports many encryption algorithms and encryption modes.
Supported algorithms include SERPENT, RIJNDAEL, 3DES, GOST, SAFER+,
CAST-256, RC2, XTEA, 3WAY, TWOFISH, BLOWFISH, ARC. FOUR, and WAKE.



Authors:
--------
    Nikos Mavroyanopoulos <nmav@hellug.gr>

%package devel
License:        GPLv2+ ; LGPLv2.1+
Summary:        Development Package for Libmcrypt
Group:          Development/Libraries/C and C++
Requires:       libmcrypt = %{version}

%description devel
Files needed for software development using libmcrypt.



Authors:
--------
    Nikos Mavroyanopoulos <nmav@hellug.gr>

%prep
%setup -q -a 1 -a 2 -a 3 -a 4
%patch
%patch1
%patch2
%patch3

%build
libtoolize --force
%{suse_update_config -f}
# add algorithms
for m in idea mars rc6 skipjack; do
  cp libmcrypt-$m-*/modules/algorithms/*.[ch] modules/algorithms
  sed -e "s/^EXTRA_DIST = /EXTRA_DIST = $m.h /" \
      -e "s/^EXTRA_LTLIBRARIES = /EXTRA_LTLIBRARIES = $m.la /" \
      modules/algorithms/Makefile.am >modules/algorithms/Makefile.am2
  mv modules/algorithms/Makefile.am2 modules/algorithms/Makefile.am
  echo "${m}_la_SOURCES = $m.c" >> modules/algorithms/Makefile.am
  echo "${m}_la_LDFLAGS = -module -avoid-version -rpath \$(pkglibdir)" >> modules/algorithms/Makefile.am
done
# remove algorithms which do not work
remove_module() {
  cd modules/algorithms;
  for mname in $*; do
    sed -e "/${mname//-/_}_la/d" -e "s/${mname}.h//" -e "s/${mname}.la//" Makefile.am > Makefile.am2;
    mv Makefile.am2 Makefile.am
  done
  cd -
  for mname in $*; do
    sed -e "s/${mname}//" configure.in > configure.in.2
    mv configure.in.2 configure.in
  done
}
# big endian architectures
%ifarch sparc ppc ppc64 s390 s390x mips
remove_module panama rc6
%endif
# 64bit architectures and s390
%ifarch alpha ia64 s390
remove_module cast-256 mars rc6
%endif
rm -f acinclude.m4
autoreconf -fi
%configure --enable-static
%{__make} %{?_smp_mflags}

%install
%{__make} install DESTDIR=$RPM_BUILD_ROOT
#useless
%{__rm} %{buildroot}%{_libdir}/libmcrypt.la

%check
%{__make} check || echo "tests failed"

%clean
%{__rm} -rf $RPM_BUILD_ROOT

%files
%defattr(-, root, root)
%{_libdir}/libmcrypt.so.*

%files devel
%defattr(-, root, root)
%doc AUTHORS ChangeLog KNOWN-BUGS NEWS README THANKS TODO doc/README.*
%doc doc/example.c
%{_bindir}/*
%{_datadir}/aclocal/*
%{_includedir}/*
%{_libdir}/libmcrypt.a
%{_libdir}/libmcrypt.so
%{_mandir}/man3/*

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%changelog
openSUSE Build Service is sponsored by