SHA256
3
0
forked from pool/zstd

Accepting request 1079754 from home:hillwood:branches:Archiving

- Build it by cmake
- Add missing cmake profiles

OBS-URL: https://build.opensuse.org/request/show/1079754
OBS-URL: https://build.opensuse.org/package/show/Archiving/zstd?expand=0&rev=86
This commit is contained in:
Bernhard M. Wiedemann 2023-04-17 08:10:31 +00:00 committed by Git OBS Bridge
parent 0e5b261745
commit 4172bf1c18
2 changed files with 30 additions and 13 deletions

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Sun Apr 16 12:03:54 UTC 2023 - Hillwood Yang <hillwood@opensuse.org>
- Build it by cmake
- Add missing cmake profiles
-------------------------------------------------------------------
Thu Apr 13 11:15:39 UTC 2023 - Dirk Müller <dmueller@suse.com>

View File

@ -29,6 +29,7 @@ Source1: https://github.com/facebook/zstd/releases/download/v%{version}/%
Source2: zstd.keyring
Source99: baselibs.conf
Patch1: pzstd.1.patch
BuildRequires: cmake
BuildRequires: gcc
# C++ is needed for pzstd only
BuildRequires: gcc-c++
@ -102,30 +103,37 @@ an optimized deflate/zlib handling.
%prep
%autosetup -p1
sed -i '/build static library to build tests/d' build/cmake/CMakeLists.txt
sed -i 's/libzstd_static/libzstd_shared/g' build/cmake/tests/CMakeLists.txt
%build
%global _lto_cflags %{_lto_cflags} -ffat-lto-objects
export CFLAGS="%{optflags}"
export CXXFLAGS="%{optflags} -std=c++11"
# lib-mt is alias for multi-threaded library support
%make_build HAVE_ZLIB=1 prefix=%{_prefix} libdir=%{_libdir} -C lib lib-mt
for dir in programs contrib/pzstd; do
%make_build -C "$dir"
done
cd build/cmake
%cmake \
-DCMAKE_BUILD_TYPE=None \
-DCMAKE_INSTALL_PREFIX=%{_prefix} \
-DZSTD_ZLIB_SUPPORT=ON \
-DZSTD_LZMA_SUPPORT=OFF \
-DZSTD_LZ4_SUPPORT=OFF \
-DZSTD_BUILD_CONTRIB=ON \
-DZSTD_BUILD_STATIC=ON \
-DZSTD_BUILD_TESTS=ON \
-DZSTD_PROGRAMS_LINK_SHARED=ON
%cmake_build
%check
export CFLAGS="%{optflags}"
export CXXFLAGS="%{optflags} -std=c++11"
%make_build -C tests test-zstd
#make_build -C contrib/pzstd test-pzstd
%install
%make_install V=1 VERBOSE=1 prefix=%{_prefix} libdir=%{_libdir}
install -D -m755 contrib/pzstd/pzstd %{buildroot}%{_bindir}/pzstd
install -D -m644 programs/zstd.1 %{buildroot}%{_mandir}/man1/pzstd.1
ln -s zstd %{buildroot}/%{_bindir}/gzip
ln -s zstd %{buildroot}/%{_bindir}/gunzip
ln -s zstdcat %{buildroot}/%{_bindir}/zcat
cd build/cmake
%cmake_install
ln -sf %{_bindir}/zstd %{buildroot}%{_bindir}/gzip
ln -sf %{_bindir}/zstd %{buildroot}%{_bindir}/gunzip
ln -sf %{_bindir}/zstdcat %{buildroot}%{_bindir}/zcat
%post -n %{libname} -p /sbin/ldconfig
%postun -n %{libname} -p /sbin/ldconfig
@ -133,6 +141,8 @@ ln -s zstdcat %{buildroot}/%{_bindir}/zcat
%files
%license COPYING LICENSE
%doc README.md CHANGELOG
%dir %{_datadir}/doc/%{name}
%{_datadir}/doc/%{name}/%{name}_manual.html
%{_bindir}/pzstd
%{_bindir}/unzstd
%{_bindir}/zstd
@ -144,13 +154,14 @@ ln -s zstdcat %{buildroot}/%{_bindir}/zcat
%files -n %{libname}
%license COPYING LICENSE
%{_libdir}/libzstd.so.1*
%{_libdir}/libzstd.so.*
%files -n lib%{name}-devel
%license COPYING LICENSE
%{_includedir}/*.h
%{_libdir}/pkgconfig/libzstd.pc
%{_libdir}/libzstd.so
%{_libdir}/cmake/%{name}
%files -n lib%{name}-devel-static
%{_libdir}/libzstd.a