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

Name:           lzo
Summary:        Data compression library with very fast (de)compression
Summary(ja):    高速なデータ圧縮ライブラリ
Version:        2.10
Release:        3%{?_dist_release}
Group:          system
Vendor:         Project Vine
Distribution:   Vine Linux

License:        GPLv2+
URL:            http://www.oberhumer.com/opensource/lzo/
Source0:        http://www.oberhumer.com/opensource/lzo/download/%{name}-%{version}.tar.gz
Patch0:         lzo-2.08-configure.patch
Patch1:         lzo-2.08-rhbz1309225.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
BuildRequires:  pkgconfig(zlib)


%description
LZO is a portable lossless data compression library written in ANSI C.
It offers pretty fast compression and very fast decompression.
Decompression requires no memory. In addition there are slower
compression levels achieving a quite competitive compression ratio
while still decompressing at this very high speed.


%package minilzo
Summary:        Mini version of lzo for apps which don't need the full version
Group:          system

%description minilzo
A small (mini) version of lzo for embedding into applications which don't need
full blown lzo compression support.


%package devel
Summary:        Development files for the lzo library
Summary(ja):    lzo ライブラリの開発ファイル
Group:          programming
Requires:       %{name} = %{version}-%{release}
Requires:       %{name}-minilzo = %{version}-%{release}
Requires:       zlib-devel

%description devel
LZO is a portable lossless data compression library written in ANSI C.
It offers pretty fast compression and very fast decompression.
This package contains development files needed for lzo.


%package -n compat32-%{name}
Summary:        Data compression library with very fast (de)compression
Summary(ja):    高速なデータ圧縮ライブラリ
Group:          system,legacy

%description -n compat32-%{name}
LZO is a portable lossless data compression library written in ANSI C.
It offers pretty fast compression and very fast decompression.
Decompression requires no memory. In addition there are slower
compression levels achieving a quite competitive compression ratio
while still decompressing at this very high speed.


%package -n compat32-%{name}-minilzo
Summary:        Mini version of lzo for apps which don't need the full version
Group:          system,legacy
Requires:       %{name}-minilzo = %{version}-%{release}

%description -n compat32-%{name}-minilzo
A small (mini) version of lzo for embedding into applications which don't need
full blown lzo compression support.


%package -n compat32-%{name}-devel
Summary:        Development files for the lzo library
Summary(ja):    lzo ライブラリの開発ファイル
Group:          programming,legacy
Requires:       compat32-%{name} = %{version}-%{release}
Requires:       %{name}-minilzo = %{version}-%{release}
Requires:       compat32-zlib-devel

%description -n compat32-%{name}-devel
LZO is a portable lossless data compression library written in ANSI C.
It offers pretty fast compression and very fast decompression.
This package contains development files needed for lzo.


%debug_package


%prep
%setup -q
%patch0 -p1 -z .configure
%patch1 -p1 -z .rhbz1309225
# mark asm files as NOT needing execstack
for i in asm/i386/src_gas/*.S; do
  echo '.section .note.GNU-stack,"",@progbits' >> $i
done


%build
%configure --disable-dependency-tracking --disable-static --enable-shared
make %{?_smp_mflags}
# build minilzo too (bz 439979)
gcc %{optflags} -fpic -Iinclude/lzo -o minilzo/minilzo.o -c minilzo/minilzo.c
gcc -g -shared -o libminilzo.so.0 -Wl,-soname,libminilzo.so.0 minilzo/minilzo.o


%install
rm -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT
rm $RPM_BUILD_ROOT%{_libdir}/liblzo2.la
install -m 755 libminilzo.so.0 $RPM_BUILD_ROOT%{_libdir}
ln -s libminilzo.so.0 $RPM_BUILD_ROOT%{_libdir}/libminilzo.so
install -p -m 644 minilzo/minilzo.h $RPM_BUILD_ROOT%{_includedir}/lzo
rm -rf %{buildroot}%{_docdir}/lzo


%ifarch x86_64
%check
make check test
%endif


%files
%license COPYING
%doc AUTHORS ChangeLog NEWS README THANKS
%{_libdir}/liblzo2.so.*

%files minilzo
%doc minilzo/README.LZO
%{_libdir}/libminilzo.so.*

%files devel
%doc doc/LZOAPI.TXT doc/LZO.FAQ doc/LZO.TXT
%{_includedir}/lzo
%{_libdir}/lib*lzo*.so
%{_libdir}/pkgconfig/lzo2.pc

# compat32
%if %{build_compat32}
%files -n compat32-%{name}
%{_libdir}/liblzo2.so.*

%files -n compat32-%{name}-minilzo
%{_libdir}/libminilzo.so.0

%files -n compat32-%{name}-devel
%{_libdir}/lib*lzo*.so
%{_libdir}/pkgconfig/lzo2.pc
%endif


%changelog
* Thu Jul 11 2024 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 2.10-3
- rebuilt with current environment.

* Sun Mar 29 2020 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 2.10-2
- rebuilt with current environment.

* Sat Dec 30 2017 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 2.10-1
- new upstream release.
- updated Patch0.
- imported Patch1 from rawhide.

* Sat Dec 28 2013 Yoji TOYODA <bsyamato@sea.plala.or.jp> 2.03-4
- rebuild with VineSeed environment

* Sat Apr 16 2011 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 2.03-3
- rebuilt with current VineSeed

* Sat Jun 27 2009 NAKAMURA Kenta <kenta@vinelinux.org> 2.03-2
- added compat32 package for x86_64 arch support

* Fri Aug 08 2008 Daisuke SUZUKI <daisuke@linux.or.jp> 2.03-1
- initial build for Vine Linux

* Thu May  1 2008 Lubomir Rintel <lkundrak@v3.sk> 2.03-1
- New upstream release
- Changed the license to GPLv2+

* Wed Apr  2 2008 Hans de Goede <j.w.r.degoede@hhs.nl> 2.02-5
- Fix configure failure with -Werror-implicit-function-declaration in CFLAGS
- Add a minilzo subpackage which contains a shared version of minilzo, to be
  used by all applications which ship with their own copy of it (bz 439979)

* Tue Feb 19 2008 Fedora Release Engineering <rel-eng@fedoraproject.org> - 2.02-4
- Autorebuild for GCC 4.3

* Wed Aug 15 2007 Hans de Goede <j.w.r.degoede@hhs.nl> 2.02-3
- Update License tag for new Licensing Guidelines compliance

* Mon Aug 28 2006 Hans de Goede <j.w.r.degoede@hhs.nl> 2.02-2
- FE6 Rebuild

* Wed Jul 26 2006 Hans de Goede <j.w.r.degoede@hhs.nl> 2.02-1
- New upstream release 2.02, soname change!

* Mon Jul 24 2006 Hans de Goede <j.w.r.degoede@hhs.nl> 1.08-7
- Taking over as maintainer since Anvil has other priorities
- Add a patch to fix asm detection on i386 (bug 145882, 145893). Thanks to
  Carlo Marcelo Arenas Belon <carenas@sajinet.com.pe> for the initial patch.
- Removed unused build dependency on nasm
- Remove static lib
- Cleanup %%doc a bit

* Thu Mar 16 2006 Dams <anvil[AT]livna.org> - 1.08-6.fc5
- Rebuild for new gcc

* Tue Jan 17 2006 Dams <anvil[AT]livna.org> - 1.08-5.fc5
- Bumped release for gcc 4.1 rebuild

* Sun May 22 2005 Jeremy Katz <katzj@redhat.com> - 1.08-4
- rebuild on all arches

* Thu Apr  7 2005 Michael Schwendt <mschwendt[AT]users.sf.net>
- rebuilt

* Sun Apr 27 2003 Dams <anvil[AT]livna.org> 0:1.08-0.fdr.2
- Typo un devel description
- Added post and postun scriptlets
- Added URL in Source0

* Fri Apr 25 2003 Dams <anvil[AT]livna.org>
- Initial build.
