%bcond_without python3

%define build_compat32 %{?_with_compat32:1}%{!?_with_compat32:0}
%define _unpackaged_files_terminate_build 1

Summary: Library providing the Gnome XSLT engine
Summary(ja): XSLT エンジンライブラリ
Name: libxslt
Version: 1.1.38
Release: 1%{_dist_release}
Group: system
Vendor: Project Vine
Distribution: Vine Linux

License: MIT
URL: http://xmlsoft.org/XSLT/
Source: https://gitlab.gnome.org/GNOME/%{name}/-/archive/v%{version}/%{name}-v%{version}.tar.bz2

BuildRoot: %{_tmppath}/%{name}-%{version}-root
BuildRequires: libtirpc-devel
BuildRequires: libxcrypt-devel
BuildRequires: libxml2-devel >= 2.9.9
BuildRequires: zlib-devel >= 1.1.4
BuildRequires: perl
BuildRequires: python python-devel python-rpm-macros libxml2-python
%if %{with python3}
BuildRequires: python3 python3-devel python3-rpm-macros python3-libxml2
%endif
Requires: libxml2 >= 2.9.9

%description
This C library allows to transform XML files into other XML files
(or HTML, text, ...) using the standard XSLT stylesheet transformation
mechanism. To use it you need to have a version of libxml2 >= 2.6.15
installed. The xsltproc command is a command line interface to the XSLT engine

%description -l ja
XSLTスタイルシートを使ってXML型式をHTML型式に変換するためのライブラリです。


%package devel
Summary: Libraries, includes, etc. to embed the Gnome XSLT engine
Summary(ja): XSLT 開発用ファイル
Group: programming
Requires: %{name} = %{version}-%{release}
Requires: libxml2-devel >= 2.6.27

%description devel
This C library allows to transform XML files into other XML files
(or HTML, text, ...) using the standard XSLT stylesheet transformation
mechanism. To use it you need to have a version of libxml2 >= 2.6.15
installed.

%description devel -l ja
XSLTのための開発用ファイルです。


%package static
Summary: Static library for %{name}
Summary(ja): %{name} のスタティックライブラリ
Group: programming
Requires: libxslt-devel = %{version}-%{release}

%description static
The libxslt-static package contains the static library for libxslt.


%package python
Summary: Python bindings for the libxslt library
Group: programming
Requires: libxslt = %{version}-%{release}
Requires: libxml2 >= 2.9.9
Requires: python

%description python
The libxslt-python package contains a module that permits applications
written in the Python programming language to use the interface
supplied by the libxslt library to apply XSLT transformations.

This library allows to parse sytlesheets, uses the libxml2-python
to load and save XML and HTML files. Direct access to XPath and
the XSLT transformation context are possible to extend the XSLT language
with XPath functions written in Python.


%if %{with python3}
%package -n python3-%{name}
Summary: Python bindings for the libxslt library
Group: programming
Requires: libxslt = %{version}-%{release}
Requires: libxml2 >= 2.9.9
Requires: python3

%description -n python3-%{name}
The libxslt-python package contains a module that permits applications
written in the Python programming language to use the interface
supplied by the libxslt library to apply XSLT transformations.

This library allows to parse sytlesheets, uses the libxml2-python
to load and save XML and HTML files. Direct access to XPath and
the XSLT transformation context are possible to extend the XSLT language
with XPath functions written in Python.

%endif


# compat32
%package -n compat32-%{name}
Summary: Library providing the Gnome XSLT engine
Summary(ja): XSLT エンジンライブラリ
Group: system,legacy
Requires: %{name} = %{version}-%{release}
Requires: compat32-libxml2 >= 2.6.27

%description -n compat32-%{name}
This C library allows to transform XML files into other XML files
(or HTML, text, ...) using the standard XSLT stylesheet transformation
mechanism. To use it you need to have a version of libxml2 >= 2.6.15
installed. The xsltproc command is a command line interface to the XSLT engine

%description -n compat32-%{name} -l ja
XSLTスタイルシートを使ってXML型式をHTML型式に変換するためのライブラリです。


%package -n compat32-%{name}-devel
Summary: Libraries, includes, etc. to embed the Gnome XSLT engine
Summary(ja): XSLT 開発用ファイル
Group: programming,legacy
Requires: %{name}-devel = %{version}-%{release}
Requires: compat32-%{name} = %{version}-%{release}
Requires: compat32-libxml2-devel >= 2.6.27

%description -n compat32-%{name}-devel
This C library allows to transform XML files into other XML files
(or HTML, text, ...) using the standard XSLT stylesheet transformation
mechanism. To use it you need to have a version of libxml2 >= 2.6.15
installed.

%description -n compat32-%{name}-devel -l ja
XSLTのための開発用ファイルです。


%debug_package


%prep
%autosetup -p1 -n %{name}-v%{version}
chmod 644 python/tests/*


%build
autoreconf -ivf
perl -pi -e 's|sysconfig\.get_python_lib\(\)|sysconfig.get_python_lib(1)|' configure

mkdir py2 py3
%global _configure ../configure
%global _configure_disable_silent_rules 1
( export PYTHON=%{__python}; cd py2 && %configure --without-crypto --with-python=%{__python} --enable-static)
make %{?_smp_mflags} -C py2

%if %{with python3}
( export PYTHON=%{__python3}; cd py3 && %configure --without-crypto --with-python=%{__python3} --enable-static)
make %{?_smp_mflags} -C py3
%endif


%install
[ -n "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != / ] && rm -rf $RPM_BUILD_ROOT

make install -C py2 DESTDIR=$RPM_BUILD_ROOT

find %{buildroot}%{python_sitearch} -name '*.a' -print -delete

%if %{with python3}
make install -C py3 DESTDIR=$RPM_BUILD_ROOT
find %{buildroot}%{python3_sitearch} -name '*.a' -print -delete
%endif

find %{buildroot} -name '*.la' -print -delete

# multiarch crazyness on timestamp differences
touch -m --reference=%{buildroot}%{_includedir}/libxslt/xslt.h %{buildroot}%{_bindir}/xslt-config
rm -vrf %{buildroot}%{_docdir}

rm -f %{buildroot}%{python_sitelib}/libxslt.py{c,o}


%clean
[ -n "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != / ] && rm -rf $RPM_BUILD_ROOT


%files
%defattr(-, root, root)
%license Copyright
%doc AUTHORS NEWS README TODO FEATURES
%doc doc/*.html doc/tutorial doc/EXSLT
%{_bindir}/xsltproc
%{_libdir}/lib*.so.*
%{_mandir}/man1/xsltproc.1*

%files devel
%defattr(-, root, root)
%license Copyright
%doc AUTHORS NEWS README TODO FEATURES
%{_includedir}/*
%{_libdir}/lib*.so
%{_libdir}/*.sh
%dir %{_libdir}/pkgconfig
%{_libdir}/pkgconfig/*.pc
%dir %{_libdir}/cmake
%{_libdir}/cmake/libxslt
%{_bindir}/xslt-config
%{_datadir}/aclocal/*.m4
%{_mandir}/man3/*
%exclude %{_datadir}/gtk-doc

%files static
%defattr(-, root, root)
%{_libdir}/lib*.a

%files python
%defattr(-, root, root)
%license Copyright
%doc AUTHORS NEWS README FEATURES
%doc python/tests/*.py
%doc python/tests/*.xml
%doc python/tests/*.xsl
%{python_sitelib}/libxslt.py
%{python_sitearch}/libxsltmod*

%if %{with python3}
%files -n python3-%{name}
%defattr(-, root, root)
%license Copyright
%doc AUTHORS NEWS README FEATURES
%doc python/TODO
%doc python/tests/*.py
%doc python/tests/*.xml
%doc python/tests/*.xsl
%{python3_sitelib}/libxslt.py
%{python3_sitelib}/__pycache__/*
%{python3_sitearch}/libxsltmod*
%endif

# compat32
%if %{build_compat32}
%files -n compat32-%{name}
%defattr(-, root, root)
%{_libdir}/lib*.so.*

%files -n compat32-%{name}-devel
%defattr(-, root, root)
%{_libdir}/lib*.so
%{_libdir}/lib*.a
%{_libdir}/*.sh
%endif


%changelog
* Fri Sep 01 2023 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 1.1.38-1
- updated to 1.1.38.

* Fri Oct 28 2022 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 1.1.37-1
- updated to 1.1.37.

* Thu May 12 2022 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 1.1.35-1
- updated to 1.1.35.

* Thu May 20 2021 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 1.1.34-2
- dropped ldconfig scriptlets.

* Mon Dec 16 2019 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 1.1.34-1
- updated to 1.1.34.
- dropped Patch1-4: fixed in upstream.

* Sat Oct 26 2019 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 1.1.33-2
- added Patch1-4.

* Mon May 13 2019 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 1.1.33-1
- updated to 1.1.33.
- added a sub-package "python3-libxslt".
- added BR:libxcrypt-devel.
- added BR:libtirpc-devel.

* Sat Jan 06 2018 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 1.1.32-1
- updated to 1.1.32.

* Wed Jun  8 2016 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 1.1.29-1
- updated to 1.1.29.
- dropped Patch0.

* Thu Oct 29 2015 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.1.28-2
- add Patch0 (libxslt-1.1.28-CVE-2015-7995.patch)

* Sat Mar 29 2014 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.1.28-1
- update to 1.1.28

* Mon Dec 30 2013 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.1.27-2
- rebuild with VineSeed environment

* Thu Sep 27 2012 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.1.27-1
- new upstream release

* Thu Feb 16 2012 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.1.26-7
- rebuild with python-2.7.2

* Tue Sep 21 2010 IWAI, Masaharu <iwai@alib.jp> 1.1.26-6
- build with rpm-4.8.1-1 for pkg-config file

* Fri Feb 12 2010 MATSUBAYASHI Kohji <shaolin@vinelinux.org> - 1.1.26-5
- rebuilt with gcc-4.4.3-3 on ppc

* Sat Feb  6 2010 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.1.26-4
- removed %%{_libdir}/python*/site-packages/*.{a,la}

* Tue Feb 02 2010 Shu KONNO <owa@bg.wakwak.com> 1.1.26-3
- rebuild with python-2.6

* Tue Feb  2 2010 MATSUBAYASHI Kohji <shaolin@vinelinux.org> - 1.1.26-2
- rebuilt with new toolchain

* Wed Jan 20 2010 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.1.26-1
- new upstream release
- split static libraries to subpackage

* Mon Jul 13 2009 NAKAMURA Kenta <kenta@vinelinux.org> 1.1.23-3
- added compat32 package for x86_64 arch support

* Fri Jul 18 2008 Shu KONNO <owa@bg.wakwak.com> 1.1.23-2
- rebuilt with python-2.5.2

* Tue Apr 29 2008 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.1.23-1
- new upstream release
- remove *.la file from devel package

* Wed Oct  3 2007 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.1.22-0vl1
- new upstream release

* Sun Feb  4 2007 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.1.20-0vl1
- new upstream release
- updated BuildRequires: libxml2-devel >= 2.6.27
- updated Requires: libxml2 >= 2.6.27

* Sat Aug 05 2006 NAKAMURA Kenta <kenta@vinelinux.org> 1.1.17-0vl1
- added --libdir=%%{_libdir} to ./configure option

* Fri Jul 14 2006 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.1.17-0vl1
- new upstream release
- updated libxml2 dependancy

* Mon Oct 17 2005 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 1.1.15-0vl1
- new upstream release

* Tue Apr 12 2005 Satoshi MACHINO <machino@vinelinux.org> 1.1.14-0vl1
- new upstream release

* Sun Apr 03 2005 Shu KONNO <owa@bg.wakwak.com> 1.1.12-0vl3
- rebuild with python-2.4.1-0vl1

* Thu Nov 11 2004 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 1.1.12-0vl2
- build without libgcrypt (add --without-crypto to configure option)
- remove lines about snapshot release
- use %%makeinstall
- add %%{_libdir}/python*/site-packages/libxsltmod* to python package

* Thu Nov 11 2004 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 1.1.12-0vl1
- source upgrade (security fix)
- BuildPrereq: libxml2-devel >= 2.6.15
- Requires: libxml2 >= 2.6.15
- add doc/EXSLT to %%doc

* Tue Sep 07 2004 Satoshi MACHINO <machino@vinelinux.org> 1.1.9-0vl1
- new upstream version

* Tue Apr 27 2004 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 1.1.6-0vl1
- source upgrade
- BuildPrereq: libxml2-devel >= 2.6.8
- Requires: libxml2 >= 2.6.8

* Sat Apr 17 2004 Shu KONNO <owa@bg.wakwak.com> 1.1.4-0vl2
- rebuild with python-2.3.3-0vl1

* Sat Apr 10 2004 Shu KONNO <owa@bg.wakwak.com> 1.1.4-0vl1.1
- rebuild with python-2.3.3-0vl0.3 (for TestPkg)

* Thu Mar 25 2004 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.1.4-0vl1
- new upstream release

* Thu Jan 29 2004 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.1.2-0vl1
- new upstream release
- BuildPrereq: libxml2-devel >= 2.6.3
- Requires: libxml2 >= 2.6.3

* Fri Sep 05 2003 Daisuke SUZUKI <daisuke@linux.or.jp> 1.0.32-0vl1
- new upstream release

* Sun Jul 20 2003 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 1.0.31-0vl1
- source upgrade

* Sat May 17 2003 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 1.0.30-0vl1
- source upgrade

* Mon Feb 17 2003 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.0.26-0vl1
- source upgrade
- BuildPrereq: libxml2-devel >= 2.5.2
- Requires: libxml2 >= 2.5.2

* Sun Dec 15 2002 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 1.0.23-0vl1
- source upgrade
- build with new toolchains

* Tue Oct 29 2002 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.0.22-0vl1
- source update to 1.0.22
- BuildPrereq: libxml2-devel >= 2.4.23
- Requires: libxml2 >= 2.4.23

* Sun May 26 2002 AKIYAMA Kazuhito <akiyama@karen.servepics.com> 1.0.17-1vl1
- merged with 1.0.17-1
 -- Fri Feb  8 2002 Daniel.Veillard <veillard@redhat.com>
  - added the python module
- clean up spec
- BuildPrereq: libxml2-devel >= 2.4.17
- Requires: libxml2 >= 2.4.17

* Mon Mar 18 2002 AKIYAMA Kazuhito <akiyama@karen.servepics.com> 1.0.10-0vl2
- changed License to MIT (not LGPL)
- add BuildPrereq: zlib-devel >= 1.1.4 perl

* Sun Feb 24 2002 AKIYAMA Kazuhito <akiyama@karen.servepics.com> 1.0.10-0vl1
- source update
- BuildPrereq: libxml2-devel >= 2.4.13

* Thu Oct 11 2001 AKIYAMA Kazuhito <akiyama@karen.servepics.com> 1.0.9-0vl1
- add gtk-doc to BuildPrereq

* Thu Oct 11 2001 AKIYAMA Kazuhito <akiyama@karen.servepics.com>
- 1.0.1-1vl2
- Build for VineSeed

* Fri Aug 24 2001 Tuscus Pino-potamus Japonus <ursragna@hotmail.com>
- 1.0.1-1vl1
- cleaning

* Fri Jul 27 2001 Tuscus Pino-potamus Japonus <ursragna@hotmail.com>
- 1.0.1-1vl0
- modify for Vine Linux 2.1x

* Mon Jan 22 2001 Daniel.Veillard <daniel@veillard.com>
- created based on libxml2 spec file
