zstd/zstd.spec

119 lines
2.9 KiB
RPMSpec
Raw Normal View History

2018-06-21 18:06:17 +10:00
%define oname zstd
%define major 1
%define libname %mklibname %{oname} %{major}
%define devname %mklibname %{oname} -d
2020-04-12 19:55:36 +00:00
# static libraries are used by qemu. Please don't disable them.
%define sdevname %mklibname %{name} -d -s
2018-06-21 10:14:25 +03:00
2018-06-21 18:06:17 +10:00
%bcond_with tests
2018-06-21 10:14:25 +03:00
2018-06-21 18:06:17 +10:00
Summary: Zstd compression library
Name: zstd
2024-04-01 12:47:20 +00:00
Version: 1.5.6
2022-06-20 16:03:48 +00:00
Release: 1
2018-06-21 18:06:17 +10:00
License: BSD and GPLv2+
Group: Archiving/Compression
2025-02-02 12:52:47 +00:00
URL: http://www.zstd.net
2018-06-21 18:06:17 +10:00
Source0: https://github.com/facebook/zstd/archive/v%{version}/%{name}-%{version}.tar.gz
BuildRequires: gtest-devel
2020-04-12 19:55:36 +00:00
BuildRequires: pkgconfig(liblz4)
BuildRequires: pkgconfig(liblzma)
BuildRequires: pkgconfig(zlib)
2025-02-02 12:52:47 +00:00
BuildRequires: pkgconfig(openssl3.3)
2020-04-12 19:55:36 +00:00
BuildRequires: cmake
BuildRequires: ninja
2018-06-21 10:14:25 +03:00
%description
Zstd, short for Zstandard, is a fast lossless compression algorithm,
targeting real-time compression scenarios at zlib-level compression ratio.
%files
%{_bindir}/%{name}
%{_bindir}/%{name}cat
%{_bindir}/%{name}grep
%{_bindir}/%{name}less
%{_bindir}/%{name}mt
2018-06-21 10:14:25 +03:00
%{_bindir}/p%{name}
%{_bindir}/un%{name}
2020-04-12 19:55:36 +00:00
%{_mandir}/man1/*
2018-06-21 10:14:25 +03:00
#----------------------------------------------------------------------------
%package -n %{libname}
2018-06-21 18:06:17 +10:00
Summary: Zstd shared library
2018-06-21 10:14:25 +03:00
Group: System/Libraries
2018-06-21 18:06:17 +10:00
2018-06-21 10:14:25 +03:00
%description -n %{libname}
Zstandard compression shared library.
%files -n %{libname}
2018-06-21 18:06:17 +10:00
%{_libdir}/libzstd.so.%{major}*
2018-06-21 10:14:25 +03:00
#----------------------------------------------------------------------------
2018-06-21 18:06:17 +10:00
%package -n %{devname}
Summary: Header files for Zstd library
2018-06-21 10:14:25 +03:00
Group: Development/C
2018-06-21 18:06:17 +10:00
Requires: %{libname} = %{EVRD}
Provides: %{name}-devel = %{EVRD}
2018-06-21 10:14:25 +03:00
2018-06-21 18:06:17 +10:00
%description -n %{devname}
2018-06-21 10:14:25 +03:00
Header files for Zstd library.
2018-06-21 18:06:17 +10:00
%files -n %{devname}
2020-04-12 19:55:36 +00:00
%doc %{_docdir}/zstd
%{_includedir}/*.h
2018-06-21 10:14:25 +03:00
%{_libdir}/pkgconfig/libzstd.pc
%{_libdir}/libzstd.so
2020-06-22 10:30:19 +00:00
%{_libdir}/cmake/%{name}/*.cmake
2018-06-21 10:14:25 +03:00
#----------------------------------------------------------------------------
2020-04-12 19:55:36 +00:00
%package -n %{sdevname}
Summary: Static libraries for zstd
Group: Development/C
Requires: %{devname} = %{version}-%{release}
2023-02-06 16:48:59 +00:00
Provides: %{name}-static-devel = %{EVRD}
2020-04-12 19:55:36 +00:00
%description -n %{sdevname}
Static library for zstd.
%files -n %{sdevname}
%{_libdir}/libzstd.a
#----------------------------------------------------------------------------
2018-06-21 10:14:25 +03:00
%prep
2024-09-16 19:19:23 +00:00
%setup -q
2020-04-12 19:55:36 +00:00
# Get rid of -L/usr/lib insanity
sed -i -e 's,-L\${libdir} ,,g' lib/*.pc.in
sed -i -e '/^Cflags:/d' lib/*.pc.in
2018-06-21 10:14:25 +03:00
find -name .gitignore -delete
2022-06-20 16:03:48 +00:00
# Don't use obsolete standards
# https://github.com/facebook/zstd/issues/3163
sed -i -e 's,c99,gnu2a,g' build/cmake/CMakeModules/AddZstdCompilationFlags.cmake
2018-06-21 10:14:25 +03:00
%build
2020-04-12 19:55:36 +00:00
%set_build_flags
2023-02-06 17:03:54 +00:00
%ifarch %{riscv}
export LDFLAGS="%{ldflags} -latomic"
%endif
2020-04-12 19:55:36 +00:00
pushd build/cmake
%cmake -DZSTD_BUILD_CONTRIB:BOOL=ON \
-DZSTD_LEGACY_SUPPORT:BOOL=ON \
-DZSTD_LZ4_SUPPORT:BOOL=ON \
-DZSTD_LZMA_SUPPORT:BOOL=ON \
-DZSTD_PROGRAMS_LINK_SHARED:BOOL=ON \
-DZSTD_ZLIB_SUPPORT:BOOL=ON -G Ninja
%ninja_build
popd
2018-06-21 10:14:25 +03:00
%install
2020-04-12 19:55:36 +00:00
pushd build/cmake
%ninja_install -C build
install -m 755 build/contrib/pzstd/pzstd %{buildroot}%{_bindir}/
install -D -m644 build/programs/%{name}.1 %{buildroot}%{_mandir}/man1/p%{name}.1
popd