bzip2/bzip2.spec

155 lines
4.3 KiB
RPMSpec
Raw Permalink Normal View History

2012-02-01 15:17:18 +04:00
%define major 1
%define libname %mklibname %{name}_ %{major}
2015-02-16 02:35:57 +10:00
%define devname %mklibname %{name} -d
2012-02-01 15:17:18 +04:00
2015-02-16 02:35:57 +10:00
%bcond_with pdf
2012-02-01 15:17:18 +04:00
Summary: Extremely powerful file compression utility
Name: bzip2
2020-04-16 13:11:20 +00:00
Version: 1.0.8
Release: 3
2012-02-01 15:17:18 +04:00
License: BSD
Group: Archiving/Compression
2015-02-16 02:35:57 +10:00
Url: http://www.bzip.org/index.html
2020-04-16 13:11:20 +00:00
Source0: https://sourceware.org/pub/bzip2/bzip2-%{version}.tar.gz
2012-02-01 15:17:18 +04:00
Source1: bzgrep
Source2: bzme
Source3: bzme.1
2020-01-28 22:23:20 +00:00
Source4: bzip2.pc
2012-02-01 15:17:18 +04:00
Patch0: bzip2-1.0.6-makefile.diff
2020-04-16 13:11:20 +00:00
Patch1: bzip2-1.0.6-improve-makefile.patch
Patch2: build_good-so-lib.patch
# (tpg) ClearLinux Patches
Patch10: https://raw.githubusercontent.com/clearlinux-pkgs/bzip2/master/0001-Improve-file-access.patch
2015-02-16 02:35:57 +10:00
BuildRequires: libtool
BuildRequires: texinfo
%if %{with pdf}
2012-02-01 15:17:18 +04:00
BuildRequires: tetex-dvips
BuildRequires: tetex-latex
%endif
2015-02-16 02:35:57 +10:00
Requires: mktemp
2020-01-28 22:46:09 +00:00
Requires: %{libname} = %{version}-%{release}
2012-02-01 15:17:18 +04:00
%description
Bzip2 compresses files using the Burrows-Wheeler block-sorting text
compression algorithm, and Huffman coding. Compression is generally
considerably better than that achieved by more conventional LZ77/LZ78-based
compressors, and approaches the performance of the PPM family of statistical
compressors.
The command-line options are deliberately very similar to those of GNU Gzip,
but they are not identical.
2015-02-16 02:35:57 +10:00
%files
%doc README LICENSE CHANGES
%{_bindir}/*
%{_mandir}/man1/*
#----------------------------------------------------------------------------
2012-02-01 15:17:18 +04:00
%package -n %{libname}
Summary: Libraries for developing apps which will use bzip2
Group: System/Libraries
# manual provides for symlinks
# because soname is different on Debian/Ubuntu
# and we need compatibility with binaries built where
# https://bugzilla.rosalinux.ru/show_bug.cgi?id=9286
Provides: libbz2.so.1.0%{_arch_tag_suffix}
Provides: libbz2.so.%{version}%{_arch_tag_suffix}
2012-02-01 15:17:18 +04:00
2015-02-16 02:35:57 +10:00
%description -n %{libname}
2012-02-01 15:17:18 +04:00
Library of bzip2 functions, for developing apps which will use the
bzip2 library (aka libz2).
2015-02-16 02:35:57 +10:00
%files -n %{libname}
%doc LICENSE
2018-10-18 12:57:51 +03:00
/%{_lib}/libbz2.so.%{major}
/%{_lib}/libbz2.so.%{major}.0
/%{_lib}/libbz2.so.%{version}
2015-02-16 02:35:57 +10:00
#----------------------------------------------------------------------------
%package -n %{devname}
2012-02-01 15:17:18 +04:00
Summary: Header files for developing apps which will use bzip2
Group: Development/C
2020-01-28 22:46:09 +00:00
Requires: %{libname} = %{version}-%{release}
Provides: lib%{name}-devel = %{version}-%{release}
Provides: %{name}-devel = %{version}-%{release}
2012-02-01 15:17:18 +04:00
Obsoletes: %{mklibname bzip2_ 1 -d} < 1.0.5-3
2015-02-16 02:35:57 +10:00
%description -n %{devname}
2012-02-01 15:17:18 +04:00
Header files and static library of bzip2 functions, for developing apps which
will use the bzip2 library (aka libz2).
2015-02-16 02:35:57 +10:00
%files -n %{devname}
%doc *.html LICENSE
%if %{with pdf}
%doc manual.pdf
%endif
2020-04-16 15:24:41 +00:00
%{_libdir}/libbz2.so
2015-02-16 02:35:57 +10:00
%{_includedir}/*.h
2020-01-28 22:23:20 +00:00
%{_libdir}/pkgconfig/*.pc
2015-02-16 02:35:57 +10:00
#----------------------------------------------------------------------------
2012-02-01 15:17:18 +04:00
%prep
%setup -q
2019-07-10 20:29:35 +03:00
%apply_patches
2012-02-01 15:17:18 +04:00
echo "lib = %{_lib}" >> config.in
echo "CFLAGS = %{optflags}" >> config.in
echo "LDFLAGS = %{ldflags}" >> config.in
cp %{SOURCE1} bzgrep
cp %{SOURCE2} bzme
cp %{SOURCE3} bzme.1
2020-01-28 22:23:20 +00:00
cp %{SOURCE4} bzip2.pc
sed -i "s|^libdir=|libdir=%{_libdir}|" bzip2.pc
sed -i "s|@VERSION@|%{version}|" bzip2.pc
2012-02-01 15:17:18 +04:00
%build
2020-01-13 14:32:30 +03:00
%make -f Makefile-libbz2_so
%make
2012-02-01 15:17:18 +04:00
2015-02-16 02:35:57 +10:00
%if %{with pdf}
2012-02-01 15:17:18 +04:00
texi2dvi --pdf manual.texi
%endif
%install
2020-04-16 13:11:20 +00:00
%make_install -f Makefile-libbz2_so
make install-bin install-dev -f Makefile DESTDIR=%{buildroot}
2012-02-01 15:17:18 +04:00
2020-04-16 15:24:41 +00:00
install -m755 %{SOURCE1} -D %{buildroot}%{_bindir}/bzgrep
install -m755 %{SOURCE2} -D %{buildroot}%{_bindir}/bzme
install -m644 %{SOURCE3} -D %{buildroot}%{_mandir}/man1/bzme.1
mkdir -p %{buildroot}%{_libdir}/pkgconfig
install -m0644 bzip2.pc %{buildroot}%{_libdir}/pkgconfig
2012-02-01 15:17:18 +04:00
cat > %{buildroot}%{_bindir}/bzless <<EOF
#!/bin/sh
%{_bindir}/bunzip2 -c "\$@" | %{_bindir}/less
EOF
chmod 755 %{buildroot}%{_bindir}/bzless
2020-01-28 22:23:20 +00:00
# Compatibility with Debian, Ubuntu and logics
# https://bugzilla.rosalinux.ru/show_bug.cgi?id=9286
# https://stackoverflow.com/a/10586169
# bashisms :(
IFS='.' read -r -a array <<< %{version}
buildroot_lib="%{buildroot}/%{_lib}"
cur_name="libbz2.so" #cur_name - current name
for index in "${!array[@]}"
do
#echo "$index ${array[index]}"
if [ "$index" != '0' ]
then
cur_name="${cur_name}.${array[index]}"
[ ! -f "${buildroot_lib}/${cur_name}" ] && \
ln -sr "${buildroot_lib}/${cur_name_major}" "${buildroot_lib}/${cur_name}"
else
cur_name_major="${cur_name}.${array[index]}"
[ -f "${buildroot_lib}/${cur_name_major}" ] || exit 1
cur_name="${cur_name_major}"
fi
done