Name:          ntfs-3g
Version:       2022.10.3
Release:       1
Epoch:         2
Summary:       Linux NTFS userspace driver
License:       GPLv2+
URL:           http://www.ntfs-3g.org/
Source0:       http://tuxera.com/opensource/%{name}_ntfsprogs-%{version}%{?subver}.tgz
Patch0:        0000-ntfs-3g_ntfsprogs-2011.10.9-RC-ntfsck-unsupported-return-0.patch
Patch1:        add-version-and-help-usage.patch

BuildRequires: libtool, libattr-devel, libconfig-devel, libgcrypt-devel, gnutls-devel, libuuid-devel
Provides:      ntfsprogs-fuse = %{epoch}:%{version}-%{release}
Obsoletes:     ntfsprogs-fuse
Provides:      fuse-ntfs-3g = %{epoch}:%{version}-%{release}
Provides:      ntfsprogs%{?_isa} ntfsprogs
Obsoletes:     ntfsprogs
Provides:      ntfsprogs-gnomevfs = %{epoch}:%{version}-%{release}
Obsoletes:     ntfsprogs-gnomevfs
Obsoletes:     ntfsprogs < 2.0.0-17

%description
NTFS-3G is a stable, open source, GPL licensed, POSIX, read/write NTFS driver for Linux and many other operating systems.
It provides safe handling of the Windows XP, Windows Server 2003, Windows 2000, Windows Vista, Windows Server 2008 and
Windows 7 NTFS file systems.

%package       devel
Summary:       Development files for %{name}
Requires:      %{name}%{?_isa} = %{epoch}:%{version}-%{release}, pkgconfig
Provides:      ntfsprogs-devel = %{epoch}:%{version}-%{release}
Obsoletes:     ntfsprogs-devel < 2.0.0-17

%description   devel
This package includes development files for %{name}.

%package        help
Summary:        man files for %{name}
Requires:       man

%description    help
This package includes man files for %{name}.

%prep
%autosetup -n %{name}_ntfsprogs-%{version}%{?subver} -p1

%build
CFLAGS="$RPM_OPT_FLAGS -D_FILE_OFFSET_BITS=64"
%configure --disable-static --disable-ldconfig --exec-prefix=/ --enable-posix-acls --enable-xattr-mappings --enable-crypto --enable-extras --enable-quarantined
%make_build LIBTOOL=%{_bindir}/libtool

%install
make LIBTOOL=%{_bindir}/libtool DESTDIR=$RPM_BUILD_ROOT install
rm -rf $RPM_BUILD_ROOT%{_libdir}/*.la
rm -rf $RPM_BUILD_ROOT%{_libdir}/*.a

rm -rf $RPM_BUILD_ROOT/%{_sbindir}/mount.ntfs-3g
cp -a $RPM_BUILD_ROOT/%{_bindir}/ntfs-3g $RPM_BUILD_ROOT/%{_sbindir}/mount.ntfs-3g

cd $RPM_BUILD_ROOT/%{_bindir}
ln -s ntfs-3g ntfsmount
cd -
cd $RPM_BUILD_ROOT/%{_sbindir}
ln -s mount.ntfs-3g mount.ntfs-fuse
ln -s mount.ntfs-3g mount.ntfs
ln -s ../bin/ntfsck fsck.ntfs
cd -

mv $RPM_BUILD_ROOT/sbin/* $RPM_BUILD_ROOT/%{_sbindir}
rmdir $RPM_BUILD_ROOT/sbin

rm -rf $RPM_BUILD_ROOT%{_defaultdocdir}/%{name}/README

%ldconfig_scriptlets

%files
%doc AUTHORS CREDITS NEWS README
%license COPYING
%{_sbindir}/mount.*
%{_sbindir}/*ntfs*
%{_bindir}/*ntfs*
%{_libdir}/libntfs-3g.so.*

%files devel
%{_includedir}/ntfs-3g/
%{_libdir}/libntfs-3g.so
%{_libdir}/pkgconfig/*.pc

%files help
%{_mandir}/man*/*

%changelog
* Tue Apr 18 2023 liyanan <thistleslyn@163.com> - 2:2022.10.3-1
- Update to 2022.10.3

* Thu Nov 10 2022 liyuxiang<liyuxiang@ncti-gba.cn> - 2:2022.5.17-2
- fix CVE-2022-40284

* Fri May 27 2022 wangkai <wangkai385@h-partners.com> - 2:2022.5.17-1
- Upgrade to 2022.5.17 to fix the cves

* Thu Oct 21 2021 wangyue <wangyue92@huawei.com> - 2:2021.8.22-2
- add version and help usage

* Wed Sep 22 2021 houyingchao <houyingchao@huawei.com> - 2:2021.8.22-1
- Upgrade to 2021.8.22 to fix the cves

* Wed 25 Nov 2020 zhanghua <zhanghua40@huawei.com> - 2:2017.3.23-12
- Type:bugfix
- Id:NA
- SUG:NA
- DESC:fix issue #I24Y33, change %% to % in Source0

* Tue Sep 8 2020 zhanghua <zhanghua40@huawei.com> - 2:2017.3.23-11
- Type:bugfix
- Id:NA
- SUG:NA
- DESC:fix CVE-2019-9755

* Fri Dec 13 2019 openEuler Buildteam <buildteam@openeuler.org> - 2:2017.3.23-10
- Package init
