%global       compat_version 1.3.0

Summary:      Public client interface library for NIS(YP) and NIS+
Name:         libnsl2
Version:      2.0.0
Release:      1%{?_dist_release}
Group:        system
Vendor:       Project Vine
Distribution: Vine Linux

License:      BSD and LGPLv2+
URL:          https://github.com/thkukuk/libnsl
Source0:      https://github.com/thkukuk/libnsl/archive/v%{version}.tar.gz#/libnsl-%{version}.tar.gz
Source1:      https://github.com/thkukuk/libnsl/archive/v%{version}.tar.gz#/libnsl-%{compat_version}.tar.gz

Patch100:     libnsl2-1.0.5-include_stdint.patch

BuildRequires: autoconf, automake, gettext-devel, libtool, libtirpc-devel

%description
This package contains the libnsl library. This library contains
the public client interface for NIS(YP) and NIS+.
This code was formerly part of glibc, but is now standalone to
be able to link against TI-RPC for IPv6 support.

%package devel
Summary: Development files for libnsl
Group: programming
Requires: %{name}%{?_isa} = %{version}-%{release}
Requires: glibc-devel >= 2.28

%description devel
Development files for libnsl2


%debug_package


%prep
%setup -n libnsl-%{version} -a 1
pushd libnsl-%{compat_version}
%patch100 -p1
popd


%build
export CFLAGS="%{optflags}"

autoreconf -fiv
%configure \
    --libdir=%{_libdir} \
    --includedir=%{_includedir}
%make_build

pushd libnsl-%{compat_version}
autoreconf -fiv
%configure\
    --libdir=%{_libdir}\
    --includedir=%{_includedir}

%make_build
popd


%install
rm -rf %{buildroot}
pushd libnsl-%{compat_version}
%make_install
rm -rf %{buildroot}%{_includedir}/*
rm -f %{buildroot}%{_libdir}/libnsl.{a,la,so}
rm -f %{buildroot}%{_libdir}/pkgconfig/libnsl.pc
popd

%make_install

rm %{buildroot}/%{_libdir}/libnsl.a
rm %{buildroot}/%{_libdir}/libnsl.la


%files
%license COPYING
%{_libdir}/libnsl.so.*

%files devel
%{_libdir}/libnsl.so
%{_includedir}/*
%{_libdir}/pkgconfig/libnsl.pc


%changelog
* Wed Nov 17 2021 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 2.0.0-1
- new upstream release.

* Thu Aug 05 2021 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 1.3.0-2
- rebuilt with current toolchain.

* Sat Apr 10 2021 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 1.3.0-1
- new upstream release.
- dropped Patch1-4.

* Sat Mar 28 2020 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 1.2.0-2
- rebuilt with current environment.

* Fri Jan 25 2019 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 1.2.0-1
- initial build for Vine Linux.
