%define         perl_vendorarch %(eval "`perl -V:installvendorarch`"; echo $installvendorarch)

Name:           irssi
Version:        1.1.2
Release:        2
Summary:        A modular char client.
License:        GPLv2+
URL:            http://irssi.org/
Source0:        https://github.com/irssi/irssi/releases/download/%{version}/irssi-%{version}.tar.xz
Source1:        irssi-config.h
BuildRequires:  ncurses-devel openssl-devel zlib-devel autoconf automake libtool
BuildRequires:  pkgconfig glib2-devel perl-devel perl-generators perl(ExtUtils::Embed)
Requires:       perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version))

%description
Irssi is a modular chat client that is most commonly known for its text mode user interface,
but 80% of the code isn't text mode specific.Irssi comes with IRC support built in,
and there are third party ICB, SILC, XMPP(Jabber), PSYC and Quassel protocol modules available.

%package devel
Summary:        Development package for irssi
Requires:       irssi = %{version}-%{release}

%description devel
Development headers for irssi plugins.

%prep
%autosetup -n irssi-%{version} -p1

%build
autoreconf -i
%configure --enable-ipv6 --with-textui --with-proxy \
           --with-bot --with-perl=yes \
           --with-perl-lib=vendor --enable-true-color

%make_build CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing"
mv irssi-config.h irssi-config-$(getconf LONG_BIT).h
cp -p %{SOURCE1} irssi-config.h

%install
%make_install
install -p irssi-config-$(getconf LONG_BIT).h $RPM_BUILD_ROOT%{_includedir}/irssi/irssi-config-$(getconf LONG_BIT).h
chmod -R u+w $RPM_BUILD_ROOT%{perl_vendorarch}

%files
%doc docs/*.txt docs/*.html AUTHORS COPYING NEWS README.md TODO
%config(noreplace) %{_sysconfdir}/irssi.conf
%{_bindir}/{irssi,botti}
%{_datadir}/irssi
%{_libdir}/irssi
%{_mandir}/man1/irssi.1*
%{perl_vendorarch}/{Irssi*,auto/Irssi}
%exclude %{_libdir}/irssi/modules/lib*.*a
%exclude %{_libdir}/perl5/perllocal.pod
%exclude %{perl_vendorarch}/auto/Irssi/{.packlist,Irc/.packlist}
%exclude %{perl_vendorarch}/auto/Irssi/{TextUI/.packlist,UI/.packlist}

%files devel
%{_includedir}/irssi/

%changelog
* Wed Apr 22 2020 chengzihan <chengzihan2@huawei.com> - 1.1.2-2
- Package init
