Name:          assimp
Version:       3.3.1
Release:       20
Summary:       Library to load and process various 3D model formats into applications.
License:       BSD and MIT
URL:           http://assimp.sourceforge.net
Source0:       https://github.com/assimp/assimp/archive/v3.3.1.tar.gz
Patch0001:     assimp-3.3.1-unbundle.patch
Patch0002:     assimp-3.2.0-pythonpath.patch
Patch0003:     0001-Assimp-cmake-provider-fix.patch
Patch0004:     assimp-3.3.1-namespace-bigendian.patch
Patch0005:     assimp-3.3.1-install-pkgconfig.patch
Patch0006:     0001-Morph-animation-support-for-collada.patch
Patch0007:     0001-Enable-doxygen-been-properly-used-from-cmake-build-a.patch
Patch0008:     0001-Apply-mechanism-to-decide-use-for-IrrXML-external-or.patch
BuildRequires: gcc-c++ boost-devel cmake dos2unix irrlicht-devel irrXML-devel
BuildRequires: doxygen poly2tri-devel gtest-devel pkgconfig(zzip-zlib-config)
BuildRequires: pkgconfig(zlib) pkgconfig(minizip) pkgconfig(python2) python2-rpm-macros
BuildRequires: pkgconfig(python3) python3-rpm-macros
Provides:      bundled(polyclipping) = 4.8.8 bundled(openddl-parser)

%description
Assimp is a library to load and process geometric scenes from various data formats.
Assimp aims to provide a full asset conversion pipeline for use in game
engines and real-time rendering systems of any kind, but is not limited
to this purpose.

%package       devel
Summary:       Headers and libraries for assimp
Requires:      assimp = %{version}-%{release}

%description devel
This package provides the header files and libraries
for assimp. Developers use it to develop programs.

%package -n    python2-assimp
Summary:       Python2 bindings for assimp
BuildArch:     noarch
Requires:      assimp = %{version}-%{release} python2
Provides:      assimp-python = %{version}-%{release}
Obsoletes:     assimp-python < 3.1.1

%description -n python2-assimp
This package provides the PyAssimp python bindings

%package -n    python3-assimp
Summary:       Python3 bindings for assimp
BuildArch:     noarch
Requires:      assimp = %{version}-%{release} python3
Provides:      assimp-python3 = %{version}-%{release}
Obsoletes:     assimp-python3 < 3.1.1

%description -n python3-assimp
This package provides the PyAssimp3 python bindings

%package       help
Summary:       Assimp help doc
BuildArch:     noarch
Provides:      assimp-doc = %{version}-%{release}
Obsoletes:     assimp-doc < %{version}-%{release}

%description   help
Assimp help doc.

%prep
%autosetup -n assimp-%{version} -p1
rm -r contrib/irrXML;rm -r contrib/zlib;rm -r contrib/unzip;rm -r contrib/poly2tri

%build
mkdir build
pushd build
%cmake .. -DASSIMP_LIB_INSTALL_DIR=%{_libdir} -DASSIMP_BIN_INSTALL_DIR=%{_bindir} \
 -DASSIMP_INCLUDE_INSTALL_DIR=%{_includedir} -DBUILD_DOCS=ON \
 -DHTML_OUTPUT=%{name}-%{version} -DCMAKE_INSTALL_DOCDIR=%{_docdir} \
 -DPOLY2TRI_INCLUDE_PATH=%{_includedir}/poly2tri -DSYSTEM_IRRXML=ON
popd

%make_build -C build

dos2unix LICENSE README port/PyAssimp/README.md CREDITS
iconv -f iso8859-1 -t utf-8 CREDITS > CREDITS.conv && mv -f CREDITS.conv CREDITS

%install
%make_install -C build
install -d %{buildroot}%{python2_sitelib}/pyassimp/
install -m 0644 port/PyAssimp/pyassimp/*.py %{buildroot}%{python2_sitelib}/pyassimp/
install -d %{buildroot}%{python3_sitelib}/pyassimp/
install -m 0644 port/PyAssimp/pyassimp/*.py %{buildroot}%{python3_sitelib}/pyassimp/

%post
/sbin/ldconfig

%postun
/sbin/ldconfig

%files
%doc README CREDITS LICENSE
%{_bindir}/assimp
%{_libdir}/*.so.*

%files devel
%{_includedir}/assimp
%{_libdir}/*.so
%{_libdir}/pkgconfig/*.pc
%{_libdir}/cmake/*

%files help
%{_docdir}/*

%files -n python2-assimp
%doc port/PyAssimp/README.md
%{python2_sitelib}/pyassimp

%files -n python3-assimp
%doc port/PyAssimp/README.md
%{python3_sitelib}/pyassimp

%changelog
* Mon Dec 28 2020 wangxiao <wangxiao65@huawei.com> - 3.3.1-20
- Remove unnessary BuildRequire DevIL

* Wed Sep 9 2020 Ge Wang <wangge20@huawei.com> - 3.3.1-19
- Modify Source0 Url

* Fri Feb 14 2020 likexin <likexin4@huawei.com> - 3.3.1-18
- Package init
