mirror of
https://abf.rosa.ru/djam/bzip2.git
synced 2025-02-23 19:02:54 +00:00
156 lines
4.3 KiB
RPMSpec
156 lines
4.3 KiB
RPMSpec
%define major 1
|
|
%define libname %mklibname %{name}_ %{major}
|
|
%define devname %mklibname %{name} -d
|
|
|
|
%bcond_with pdf
|
|
|
|
Summary: Extremely powerful file compression utility
|
|
Name: bzip2
|
|
Version: 1.0.8
|
|
Release: 1
|
|
License: BSD
|
|
Group: Archiving/Compression
|
|
Url: http://www.bzip.org/index.html
|
|
Source0: https://sourceware.org/pub/bzip2/bzip2-%{version}.tar.gz
|
|
Source1: bzgrep
|
|
Source2: bzme
|
|
Source3: bzme.1
|
|
Source4: bzip2.pc
|
|
Patch0: bzip2-1.0.6-makefile.diff
|
|
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
|
|
BuildRequires: libtool
|
|
BuildRequires: texinfo
|
|
%if %{with pdf}
|
|
BuildRequires: tetex-dvips
|
|
BuildRequires: tetex-latex
|
|
%endif
|
|
Requires: mktemp
|
|
Requires: %{libname} = %{version}-%{release}
|
|
|
|
%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.
|
|
|
|
%files
|
|
%doc README LICENSE CHANGES
|
|
%{_bindir}/*
|
|
%{_mandir}/man1/*
|
|
|
|
#----------------------------------------------------------------------------
|
|
|
|
%package -n %{libname}
|
|
Summary: Libraries for developing apps which will use bzip2
|
|
Group: System/Libraries
|
|
|
|
%description -n %{libname}
|
|
Library of bzip2 functions, for developing apps which will use the
|
|
bzip2 library (aka libz2).
|
|
|
|
%files -n %{libname}
|
|
%doc LICENSE
|
|
/%{_lib}/libbz2.so.%{major}
|
|
/%{_lib}/libbz2.so.%{major}.*
|
|
|
|
#----------------------------------------------------------------------------
|
|
|
|
%package -n %{devname}
|
|
Summary: Header files for developing apps which will use bzip2
|
|
Group: Development/C
|
|
Requires: %{libname} = %{version}-%{release}
|
|
Provides: lib%{name}-devel = %{version}-%{release}
|
|
Provides: %{name}-devel = %{version}-%{release}
|
|
Obsoletes: %{mklibname bzip2_ 1 -d} < 1.0.5-3
|
|
|
|
%description -n %{devname}
|
|
Header files and static library of bzip2 functions, for developing apps which
|
|
will use the bzip2 library (aka libz2).
|
|
|
|
%files -n %{devname}
|
|
%doc *.html LICENSE
|
|
%if %{with pdf}
|
|
%doc manual.pdf
|
|
%endif
|
|
/%{_lib}/libbz2.so
|
|
%{_includedir}/*.h
|
|
%{_libdir}/pkgconfig/*.pc
|
|
|
|
#----------------------------------------------------------------------------
|
|
|
|
%prep
|
|
%setup -q
|
|
%apply_patches
|
|
|
|
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
|
|
cp %{SOURCE4} bzip2.pc
|
|
sed -i "s|^libdir=|libdir=%{_libdir}|" bzip2.pc
|
|
sed -i "s|@VERSION@|%{version}|" bzip2.pc
|
|
|
|
%build
|
|
%make -f Makefile-libbz2_so
|
|
%make
|
|
|
|
%if %{with pdf}
|
|
texi2dvi --pdf manual.texi
|
|
%endif
|
|
|
|
%install
|
|
%make_install -f Makefile-libbz2_so
|
|
make install-bin install-dev -f Makefile DESTDIR=%{buildroot}
|
|
|
|
install -m0755 bzme %{buildroot}%{_bindir}/
|
|
install -m0755 bzgrep %{buildroot}%{_bindir}/
|
|
install -m0644 bzgrep.1 %{buildroot}%{_mandir}/man1/
|
|
|
|
cat > %{buildroot}%{_bindir}/bzless <<EOF
|
|
#!/bin/sh
|
|
%{_bindir}/bunzip2 -c "\$@" | %{_bindir}/less
|
|
EOF
|
|
chmod 755 %{buildroot}%{_bindir}/bzless
|
|
install -m 644 %{SOURCE3} %{buildroot}%{_mandir}/man1/
|
|
|
|
# cleanup
|
|
rm -f %{buildroot}%{_lib}/*.a
|
|
|
|
# use e.g. /lib64 instead of /usr/lib64, because we have some binaries in /sbin and /bin, linked with libbz2.so.*
|
|
mkdir -p %{buildroot}/%{_lib}
|
|
mv -v %{buildroot}/%{_libdir}/* %{buildroot}/%{_lib}/
|
|
|
|
mkdir -p %{buildroot}%{_libdir}/pkgconfig
|
|
install -m0644 bzip2.pc %{buildroot}%{_libdir}/pkgconfig
|
|
|
|
# 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
|