Summary:	A sophisticated file transfer program
Name:		lftp
Version:	4.9.2
Release:	5
License:	GPLv3+
URL:		http://lftp.yar.ru/
Source0:        http://lftp.yar.ru/ftp/%{name}-%{version}.tar.xz
BuildRequires:	ncurses-devel, gnutls-devel, perl-generators, pkgconfig, gettext
BuildRequires:	gettext readline-devel, zlib-devel, gcc-c++ desktop-file-utils
BuildRequires:  chrpath

Patch0:         lftp-4.0.9-date_fmt.patch

Patch6000:      backport-fix-a-coredump-in-TorrentTracker-fix-513.patch
Patch6001:      backport-fix-a-null-deref-on-exit.patch
Patch6002:      backport-Quit-while-source-file-increased.patch
Patch6003:      backport-Ensure-that-PollVec-enum-matches-poll-values.patch
Patch6004:      backport-fix-second-find_cmd-Segmentation-fault.patch

%description
LFTP is a sophisticated file transfer program supporting a number of
network protocols (ftp, http, sftp, fish, torrent). Like BASH, it has
job control and uses the readline library for input. It has bookmarks,
a built-in mirror command, and can transfer several files in parallel.
It was designed with reliability in mind. LFTP is free software,
distributed under the GNU GPL license.

%package scripts
Summary:	Scripts for lftp
Requires:	lftp >= %{version}-%{release}
BuildArch:	noarch

%description scripts
Utility scripts for use with lftp.

%package_help

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

sed -i.norpath -e \
        '/sys_lib_dlsearch_path_spec/s|/usr/lib |/usr/lib /usr/lib64 /lib64 |' \
        configure

%build
%configure --with-modules --with-gnutls --without-openssl --with-debug
%make_build

%install
export tagname=CC
make DESTDIR=$RPM_BUILD_ROOT INSTALL='install -p' install
%delete_la
iconv -f ISO88591 -t UTF8 NEWS -o NEWS.tmp
touch -c -r NEWS NEWS.tmp
mv NEWS.tmp NEWS
desktop-file-install    \
--dir=%{buildroot}%{_datadir}/applications      \
%{buildroot}/%{_datadir}/applications/lftp.desktop

chrpath -d %{buildroot}/%{_libdir}/%{name}/%{version}/*.so*

mkdir -p %{buildroot}/etc/ld.so.conf.d
echo "%{_libdir}/lftp/%{version}" > %{buildroot}/etc/ld.so.conf.d/%{name}-%{_arch}.conf

%ldconfig_scriptlets

%files
%defattr(-,root,root)
%doc COPYING
%{_datadir}/locale/*
%config(noreplace) %{_sysconfdir}/lftp.conf
%{_bindir}/*
%{_libdir}/lftp/%{version}/*.so
%{_libdir}/liblftp-*.so.*
%{_datadir}/applications/*.*
%{_datadir}/icons/hicolor/*/apps/*
%exclude %{_libdir}/*.so
%config(noreplace) /etc/ld.so.conf.d/*

%files scripts
%{_datadir}/lftp



%files help
%defattr(-,root,root)
%doc BUGS ChangeLog FAQ FEATURES NEWS THANKS TODO README*
%{_mandir}/*/*


%changelog
* Fri Aug 02 2024 chengyechun <chengyechun1@huawei.com> - 4.9.2-5
- Type:bugfix
- CVE:NA
- SUG:NA
- DESC:sync some patches and rename a patch

* Thu Mar 28 2024 chengyechun <chengyechun1@huawei.com> - 4.9.2-4
- Type:bugfix
- CVE:NA
- SUG:NA
- DESC:update the release version

* Thu Sep 8 2022 chengyechun <chengyechun1@huawei.com> - 4.9.2-3
- Type:bugfix
- CVE:NA
- SUG:NA
- DESC:fix second find_cmd Segmentation fault
       Ensure that PollVec enum matches poll values

* Thu Oct 28 2021 zhouyihang <zhouyihang3@huawei.com> - 4.9.2-2
- Type:bugfix
- ID:NA
- SUG:NA
- DESC: quit while source file increased

* Fri Jan 29 2021 xihaochen <xihaochen@huawei.com> - 4.9.2-1
- Type:requirements                                                                                                                                            
- Id:NA
- SUG:NA
- DESC:update lftp to 4.9.2

* Sat Jul 25 2020 gaihuiying <gaihuiying1@huawei.com> - 4.9.1-1
- Type:requirement
- ID:NA
- SUG:NA
- DESC: upgrade lftp version to 4.9.1

* Fri Feb 28 2020 zhuchengliang <zhuchengliang4@huawei.com> - 4.8.4-3
- Type:bugfix
- ID:NA
- SUG:NA
- DESC: remove rpath and runpath of exec files and libraries

* Wed Aug 28 2019 openEuler Buildteam <buildteam@openeuler.org> - 4.8.4-2
- Package init
