From 4172bf1c18156435be6d45739bc5641a1e1fc34827d4ad310900b7445beef60e Mon Sep 17 00:00:00 2001 From: Bernhard Wiedemann Date: Mon, 17 Apr 2023 08:10:31 +0000 Subject: [PATCH] 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 --- zstd.changes | 6 ++++++ zstd.spec | 37 ++++++++++++++++++++++++------------- 2 files changed, 30 insertions(+), 13 deletions(-) diff --git a/zstd.changes b/zstd.changes index c29a34b..ef526ef 100644 --- a/zstd.changes +++ b/zstd.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Sun Apr 16 12:03:54 UTC 2023 - Hillwood Yang + +- Build it by cmake +- Add missing cmake profiles + ------------------------------------------------------------------- Thu Apr 13 11:15:39 UTC 2023 - Dirk Müller diff --git a/zstd.spec b/zstd.spec index efc112f..29b1e79 100644 --- a/zstd.spec +++ b/zstd.spec @@ -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