Name:            libcdio
Version:         2.1.0
Release:         4
Summary:         CD-ROM input and control library
License:         GPLv3+
URL:             http://www.gnu.org/software/libcdio/
Source0:         https://ftp.gnu.org/gnu/libcdio/libcdio-%{version}.tar.bz2
Source1:         https://ftp.gnu.org/gnu/libcdio/libcdio-%{version}.tar.bz2.sig
Source2:         libcdio_x86_64_config.h
Patch9000:       0001-fix-Werror-format-security.patch

BuildRequires:   gcc gcc-c++ pkgconfig doxygen ncurses-devel help2man chrpath gettext-devel  libcdio
Requires(post):  /sbin/ldconfig
Requires(post):  /sbin/install-info
Requires(preun): /sbin/install-info

%description
The GNU Compact Disc Input and Control library (libcdio) contains a library for CD-ROM and CD image access.
Applications wishing to be oblivious of the OS- and device-dependent properties of a CD-ROM or of the specific 
details of various CD-image formats may benefit from using this library.

%package devel
Summary: Header files and development Files for %{name}
Requires: %{name} = %{version}-%{release}

%description devel
This package contains header files and development Files for for %{name}.

%package_help

%prep
%autosetup -n %{name}-%{version} -p1
iconv -f ISO88591 -t utf-8 -o THANKS.utf8 THANKS && mv THANKS.utf8 THANKS

%build
%configure  --disable-rpath --disable-vcd-info --disable-dependency-tracking --disable-cddb
%make_build

cd doc/doxygen
sed -i -e  "s,EXCLUDE .*$,EXCLUDE = ../../include/cdio/cdio_config.h,g;" Doxyfile

./run_doxygen

%install
%make_install
if [ `uname -i` =  x86_64 ]; then
  mv $RPM_BUILD_ROOT%{_includedir}/cdio/cdio_config.h $RPM_BUILD_ROOT%{_includedir}/cdio/cdio_config_`uname -i`.h
  install -m 644 %{SOURCE2} $RPM_BUILD_ROOT%{_includedir}/cdio
fi
rm -f $RPM_BUILD_ROOT%{_infodir}/dir
chrpath --delete $RPM_BUILD_ROOT%{_bindir}/*
chrpath --delete $RPM_BUILD_ROOT%{_libdir}/*.so.*
%delete_la

cp -a %{_libdir}/libcdio.so.18 $RPM_BUILD_ROOT%{_libdir}
cp -a %{_libdir}/libcdio.so.18.0.0 $RPM_BUILD_ROOT%{_libdir}

%check
make check

%post
/sbin/ldconfig
/sbin/install-info %{_infodir}/%{name}.info %{_infodir}/dir 2>/dev/null || :

%preun
if [ $1 = 0 ]; then
	/sbin/install-info --delete %{_infodir}/%{name}.info \
		%{_infodir}/dir 2>/dev/null || :
fi

%postun -p /sbin/ldconfig

%files
%defattr(-,root,root)
%doc AUTHORS 
%license COPYING
%{_bindir}/*
%{_libdir}/libcdio++.so.*
%{_libdir}/libcdio.so.*
%{_libdir}/libiso9660++.so.*
%{_libdir}/libiso9660.so.*
%{_libdir}/libudf.so.*

%files devel
%defattr(-,root,root)
%{_libdir}/pkgconfig/*.pc
%{_libdir}/libcdio++.so
%{_libdir}/libcdio.so
%{_libdir}/libiso9660++.so
%{_libdir}/libiso9660.so
%{_libdir}/libudf.so
%{_libdir}/*.a
%{_includedir}/cdio/*.h
%{_includedir}/cdio++/*.hpp

%files help
%doc NEWS.md README README.libcdio THANKS TODO
%{_mandir}/man1/*
%{_infodir}/*

%changelog
* Fri Mar 11 2022 JunYang <jun.yang@suse.com> - 2.1.0-4
- Fix compiler error for option -Werror=format-security

* Fri Jul 30 2021 chenyanpanHW <chenyanpan@huawei.com> - 2.1.0-3
- DESC: delete -S git from %autosetup, and delete BuildRequires git

* Tue Feb 9 2021 jinzhimin <jinzhimin2@huawei.com> - 2.1.0-2
- add old so file

* Fri Jan 29 2021 zhanzhimin <zhanzhimin@huawei.com> - 2.1.0-1
- update to 2.1.0

* Thu Jan 9 2020 openEuler Buildteam <buildteam@openeuler.org> - 2.0.0-8
- Type:bugfix
- ID:NA
- SUG:NA
- DESC: optimization the spec

* Mon Jan 6 2020 openEuler Buildteam <buildteam@openeuler.org> - 2.0.0-7
- update software package

* Sat Aug 31 2019 openEuler Buildteam <buildteam@openeuler.org> - 2.0.0-6
- Type:bugfix
- ID:NA
- SUG:NA

* Tue Aug 27 2019 openEuler Buildteam <buildteam@openeuler.org> - 2.0.0-5
- Type:bugfix
- ID:NA
- SUG:NA
- DESC: openEuler Debranding

* Wed Aug 14 2019 sunyun <sunyun9@huawei.com> - 2.0.0-4
- Package init

