Name:           nftables
Version:        0.9.2
Release:        1%{?_dist_release}
Summary:        Netfilter Tables userspace utillites

License:        GPLv2
Group:          System Environment/Base
URL:            http://netfilter.org/projects/nftables/

Source0:        http://ftp.netfilter.org/pub/nftables/nftables-%{version}.tar.bz2
Source1:        nftables.init
Source2:        nftables.conf

Vendor:         Project Vine
Distribution:   Vine Linux

#BuildRequires: autogen
#BuildRequires: autoconf
#BuildRequires: automake
#BuildRequires: libtool
BuildRequires: flex
BuildRequires: bison
BuildRequires: libmnl-devel
BuildRequires: gmp-devel
BuildRequires: readline-devel
BuildRequires: libnftnl-devel
BuildRequires: asciidoc
BuildRequires: docbook2X
BuildRequires: jansson-devel
BuildRequires: iptables-devel
BuildRequires: python-rpm-macros

%description
 Netfilter Tables userspace utilities.

%package        devel
Summary:        Development library for nftables / libnftables
Requires:       %{name} = %{version}-%{release}
Requires:       pkgconfig

%description devel
 Development tools and static libraries and header files for
the libnftables library.

%prep
#setup -q -n nftables-%{snapdate}
%setup -q

%build
#./autogen.sh
%configure --disable-silent-rules --with-xtables --with-json --enable-python=no
make %{?_smp_mflags}

%install
%make_install
find %{buildroot} -name '*.la' -exec rm -f {} ';'
chmod 644 %{buildroot}/%{_mandir}/man8/nft*

# Don't ship static lib (for now at least)
rm -f $RPM_BUILD_ROOT/%{_libdir}/libnftables.a

chmod 644 $RPM_BUILD_ROOT/%{_mandir}/man8/nft*

mkdir -p $RPM_BUILD_ROOT/%{_initdir}
install -m755 %{SOURCE1} $RPM_BUILD_ROOT/%{_initdir}/nftables

mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/sysconfig
cp -a %{SOURCE2} $RPM_BUILD_ROOT/%{_sysconfdir}/sysconfig/
chmod 600 $RPM_BUILD_ROOT/%{_sysconfdir}/sysconfig/nftables.conf

mkdir -m 700 -p $RPM_BUILD_ROOT/%{_sysconfdir}/nftables
chmod 600 $RPM_BUILD_ROOT/%{_sysconfdir}/nftables/*.nft
chmod 700 $RPM_BUILD_ROOT/%{_sysconfdir}/nftables

rm -rf %{buildroot}%{python_sitelib}/*

%post
/sbin/ldconfig
/sbin/chkconfig --add nftables

%preun
if [ "$1" = 0 ]; then
	/sbin/chkconfig --del nftables
fi

%postun -p /sbin/ldconfig

%files
%license COPYING
%doc TODO
%config(noreplace) %{_sysconfdir}/nftables/
%config(noreplace) %{_sysconfdir}/sysconfig/nftables.conf
%{_libdir}/*.so.*
%{_sbindir}/nft
%{_mandir}/man5/libnftables-json*
%{_mandir}/man8/nft*
%{_initdir}/nftables

%files devel
%{_libdir}/pkgconfig/*.pc
%{_libdir}/*.so
%{_includedir}/*
%{_mandir}/man3/libnftables*


%changelog
* Mon Sep 02 2019 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 0.9.2-1
- new upstream release.

* Sun Feb 25 2018 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 0.8.2-1
- new upstream release.
- dropped Patch0: fixed in upstream.

* Sat Sep  5 2015 Ryoichi INAGAKI <ryo1@toki.waseda.jp> 0.4-4
- added Group tag

* Wed Jul  8 2015 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 0.4-3
- initial build for Vine Linux.

* Sat Jan 10 2015 Kevin Fenzi <kevin@scrye.com> 0.4-2
- Add patch to fix nft -f dep gen.

* Fri Dec 26 2014 Kevin Fenzi <kevin@scrye.com> 0.4-1
- Update to 0.4
- Add Epoch to fix versioning. 

* Wed Sep 03 2014 Kevin Fenzi <kevin@scrye.com> 0.100-4.20140903git
- Update to 20140903 snapshot

* Sun Aug 17 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.100-4.20140704git
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild

* Fri Jul 04 2014 Kevin Fenzi <kevin@scrye.com> 0.100-3.20140704git
- Update to new snapshot

* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.100-2.20140426git
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild

* Sat Apr 26 2014 Kevin Fenzi <kevin@scrye.com> 0.100-1.20140426git
- Update t0 20140426

* Sun Mar 30 2014 Kevin Fenzi <kevin@scrye.com> 0.100-1.20140330git
- Update to 20140330 snapshot
- Sync versions to be post 0.100 release.

* Wed Mar 26 2014 Kevin Fenzi <kevin@scrye.com> 0-0.7.20140326git
- Update to 20140326 snapshot
- Fix permissions on man pages. 

* Mon Mar 24 2014 Kevin Fenzi <kevin@scrye.com> 0-0.6.20140324git
- Update to 20140324 snapshot

* Fri Mar 07 2014 Kevin Fenzi <kevin@scrye.com> 0-0.5.20140307git
- Update to 20140307

* Sat Jan 25 2014 Kevin Fenzi <kevin@scrye.com> 0-0.4.20140125git
- Update to 20140125 snapshot

* Sat Jan 18 2014 Kevin Fenzi <kevin@scrye.com> 0-0.3.20140118git
- Update to 20140118 snapshot
- Fixed License tag to be correct
- Fixed changelog
- nft scripts now use full path for nft
- Fixed man page building
- Dropped unneeded rm in install
- Patched build to not be silent. 

* Tue Dec 03 2013 Kevin Fenzi <kevin@scrye.com> 0-0.2.20131202git
- Use upstream snapshots for source.
- Use 0 for version. 

* Sat Nov 30 2013 Kevin Fenzi <kevin@scrye.com> 0-0.1
- initial version for Fedora review
