%define build_compat32 %{?_with_compat32:1}%{!?_with_compat32:0}

Summary:        A low-level cryptographic library
Summary(ja):    低レベル暗号化ライブラリ
Name:           nettle
Version:        3.10
Release:        1%{?_dist_release}
Group:          system
Vendor:         Project Vine
Distribution:   Vine Linux

License:        LGPLv3+ or GPLv2+
URL:            http://www.lysator.liu.se/~nisse/nettle/
Source0:        https://ftp.gnu.org/gnu/nettle/nettle-%{version}.tar.gz

BuildRoot:      %{_tmppath}/%{name}-%{version}-root
BuildRequires:  gettext-devel
BuildRequires:  gmp-devel
BuildRequires:  m4

%description
Nettle is a cryptographic library that is designed to fit easily in more
or less any context: In crypto toolkits for object-oriented languages
(C++, Python, Pike, ...), in applications like LSH or GNUPG, or even in
kernel space.


%package devel
Summary:        Development headers for a low-level cryptographic library
Summary(ja):    低レベル暗号化ライブラリの開発ヘッダ
Group:          programming
Requires:       %{name} = %{version}-%{release}
Requires:       gmp-devel

%description devel
Nettle is a cryptographic library that is designed to fit easily in more
or less any context: In crypto toolkits for object-oriented languages
(C++, Python, Pike, ...), in applications like LSH or GNUPG, or even in
kernel space.  This package contains kernel headers.


%if %{build_compat32}
%package -n compat32-%{name}
Summary:        A low-level cryptographic library
Summary(ja):    低レベル暗号化ライブラリ
Group:          system,legacy
Requires:	%{name} = %{version}-%{release}

%description -n compat32-%{name}
Nettle is a cryptographic library that is designed to fit easily in more
or less any context: In crypto toolkits for object-oriented languages
(C++, Python, Pike, ...), in applications like LSH or GNUPG, or even in
kernel space.


%package -n compat32-%{name}-devel
Summary:        Development headers for a low-level cryptographic library
Summary(ja):    低レベル暗号化ライブラリの開発ヘッダ
Group:          programming,legacy
Requires:       %{name}-devel = %{version}-%{release}
Requires:       compat32-%{name} = %{version}-%{release}
Requires:       compat32-gmp-devel

%description -n compat32-%{name}-devel
Nettle is a cryptographic library that is designed to fit easily in more
or less any context: In crypto toolkits for object-oriented languages
(C++, Python, Pike, ...), in applications like LSH or GNUPG, or even in
kernel space.  This package contains compat libraries.
%endif


%debug_package


%prep
%autosetup -p1


%build
autoreconf -ifv
# Disable -ggdb3 which makes debugedit unhappy
sed s/ggdb3/g/ -i configure
# For annocheck
export ASM_FLAGS="-Wa,--generate-missing-build-notes=yes"
%configure --enable-shared --enable-fat
make %{?_smp_mflags}


%install
rm -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT INSTALL="install -p"
make install-shared DESTDIR=$RPM_BUILD_ROOT INSTALL="install -p"
mkdir -p $RPM_BUILD_ROOT%{_infodir}
install -p -m 644 nettle.info $RPM_BUILD_ROOT%{_infodir}/

chmod 755 $RPM_BUILD_ROOT%{_libdir}/libhogweed.so.*
chmod 755 $RPM_BUILD_ROOT%{_libdir}/libnettle.so.*

rm -rf %{buildroot}/%{_libdir}/*.a
rm -rf %{buildroot}/%{_infodir}/dir


%check
make check


%files
%license COPYING*
%doc AUTHORS ChangeLog NEWS README
%{_infodir}/nettle.info.gz
%{_bindir}/nettle-hash
%{_bindir}/nettle-lfib-stream
%{_bindir}/pkcs1-conv
%{_bindir}/sexp-conv
%{_bindir}/nettle-pbkdf2
%{_libdir}/libhogweed.so.*
%{_libdir}/libnettle.so.*

%files devel
%doc descore.README nettle.html nettle.pdf
%{_libdir}/libhogweed.so
%{_libdir}/libnettle.so
%{_includedir}/nettle
%{_libdir}/pkgconfig/*

# compat32
%if %{build_compat32}
%files -n compat32-%{name}
%{_libdir}/libhogweed.so.*
%{_libdir}/libnettle.so.*

%files -n compat32-%{name}-devel
%{_libdir}/libhogweed.so
%{_libdir}/libnettle.so
%endif


%changelog
* Thu Jun 27 2024 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 3.10-1
- new upstream release.

* Tue Jul 04 2023 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 3.9.1-1
- new upstream release.

* Tue Aug 09 2022 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 3.8.1-1
- new upstream release.
- dropped install-info scriptlets.

* Tue Jun 08 2021 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 3.7.3-1
- new upstream release.

* Sat Apr 10 2021 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 3.7.2-1
- new upstream release.
- dropped ldconfig scriptlets.

* Wed Feb 24 2021 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 3.7.1-1
- new upstream release.

* Tue Feb 02 2021 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 3.7-1
- new upstream release.

* Tue Sep 08 2020 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 3.6-1
- new upstream release.
- imported Patch0 from rawhide.

* Sun May 05 2019 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 3.4.1-1
- new upstream release.

* Thu Nov 08 2018 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 3.4-1
- new upstream release.

* Tue Jul  5 2016 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 3.2-1
- new upstream release.

* Mon Dec 28 2015 Satoshi IWAMOTO <satoshi.iwamoto@nifty.ne.jp> 3.1.1-1
- new upstream release

* Thu Dec 11 2014 Ryoichi INAGAKI <ryo1@toki.waseda.jp> - 2.7.1-4
- fixed Requires typo of compat32-nettle-devel package

* Sun Oct 26 2014 Ryoichi INAGAKI <ryo1@toki.waseda.jp> - 2.7.1-3
- moved nettle to System Environment/Libraries Group

* Sun Feb  9 2014 Satoshi IWAMOTO <satoshi.iwamoto@nifty.ne.jp> - 2.7.1-2
- add compat32,compat32-devel packages

* Sun Jan 12 2014 Yoji TOYODA <bsyamato@sea.plala.or.jp> - 2.7.1-1
- update to 2.7.1

* Fri Dec 02 2011 Toshiharu Kudoh <toshi.kd2@gmail.com> - 2.4-1
- initial build for VineSeed

* Sat Jul 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.15-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild

* Wed Feb 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.15-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild

* Thu Apr 10 2008 Ian Weller <ianweller@gmail.com> 1.15-5
- Moved static lib to -static

* Mon Mar 24 2008 Ian Weller <ianweller@gmail.com> 1.15-4
- Added libraries and ldconfig

* Mon Feb 18 2008 Ian Weller <ianweller@gmail.com> 1.15-3
- Added provides -static to -devel

* Sun Feb 17 2008 Ian Weller <ianweller@gmail.com> 1.15-2
- Removed redundant requires
- Removed redundant documentation between packages
- Fixed license tag
- Fixed -devel description
- Added the static library back to -devel
- Added make clean

* Fri Feb 08 2008 Ian Weller <ianweller@gmail.com> 1.15-1
- First package build.
