From 89989b3ea2259b1073f2b903499d1909c60fdd75 Mon Sep 17 00:00:00 2001 From: Wong Hoi Sing Edison Date: Wed, 7 Feb 2024 00:51:15 +0800 Subject: [PATCH] alvistack/1.2.0 git clean -xdf git submodule sync --recursive git submodule update --init --recursive git submodule foreach git checkout -- . tar zcvf ../snappy_1.2.0.orig.tar.gz --exclude=.git . debuild -uc -us cp snappy.spec ../snappy_1.2.0-1.spec cp ../*snappy*1.2.0*.{gz,xz,spec,dsc} /osc/home\:alvistack/google-snappy-1.2.0/ rm -rf ../*snappy*1.2.0*.* See https://github.com/google/snappy/pull/178 Signed-off-by: Wong Hoi Sing Edison --- CMakeLists.txt | 36 +++++-- cmake/snappy.pc.in | 10 ++ debian/.gitignore | 9 ++ debian/changelog | 5 + debian/control | 42 ++++++++ debian/copyright | 21 ++++ debian/libsnappy-dev.install | 5 + debian/libsnappy-dev.lintian-overrides | 1 + debian/libsnappy1v5.install | 1 + debian/libsnappy1v5.lintian-overrides | 1 + debian/rules | 40 ++++++++ debian/source/format | 1 + debian/source/lintian-overrides | 4 + snappy.spec | 133 +++++++++++++++++++++++++ 14 files changed, 303 insertions(+), 6 deletions(-) create mode 100644 cmake/snappy.pc.in create mode 100644 debian/.gitignore create mode 100644 debian/changelog create mode 100644 debian/control create mode 100644 debian/copyright create mode 100644 debian/libsnappy-dev.install create mode 100644 debian/libsnappy-dev.lintian-overrides create mode 100644 debian/libsnappy1v5.install create mode 100644 debian/libsnappy1v5.lintian-overrides create mode 100755 debian/rules create mode 100644 debian/source/format create mode 100644 debian/source/lintian-overrides create mode 100644 snappy.spec diff --git a/CMakeLists.txt b/CMakeLists.txt index 85afe58..e30b384 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,7 +27,7 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. cmake_minimum_required(VERSION 3.1) -project(Snappy VERSION 1.1.10 LANGUAGES C CXX) +project(Snappy VERSION 1.2.0 LANGUAGES C CXX) # C++ standard can be overridden when this is used as a sub-project. if(NOT CMAKE_CXX_STANDARD) @@ -81,10 +81,6 @@ else(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") # Disable C++ exceptions. string(REGEX REPLACE "-fexceptions" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions") - - # Disable RTTI. - string(REGEX REPLACE "-frtti" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti") endif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") # BUILD_SHARED_LIBS is a standard CMake variable, but we declare it here to make @@ -284,6 +280,34 @@ if(BUILD_SHARED_LIBS) set_target_properties(snappy PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON) endif(BUILD_SHARED_LIBS) +if(UNIX) + configure_file( + "${PROJECT_SOURCE_DIR}/cmake/snappy.pc.in" + "${PROJECT_BINARY_DIR}/snappy.pc" + @ONLY + ) + install(FILES "${PROJECT_BINARY_DIR}/snappy.pc" DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") +endif(UNIX) + +ADD_LIBRARY(snappy-static STATIC + snappy-c.cc + snappy-c.h + snappy-sinksource.cc + snappy-sinksource.h + snappy-stubs-internal.cc + snappy-stubs-public.h + snappy.cc + snappy.h) + +target_include_directories(snappy-static + PUBLIC + $ + $ + $ +) + +SET_TARGET_PROPERTIES(snappy-static PROPERTIES OUTPUT_NAME snappy) + if(SNAPPY_BUILD_TESTS OR SNAPPY_BUILD_BENCHMARKS) add_library(snappy_test_support "") target_sources(snappy_test_support @@ -399,7 +423,7 @@ endif(SNAPPY_FUZZING_BUILD) include(GNUInstallDirs) if(SNAPPY_INSTALL) - install(TARGETS snappy + install(TARGETS snappy snappy-static EXPORT SnappyTargets RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} diff --git a/cmake/snappy.pc.in b/cmake/snappy.pc.in new file mode 100644 index 0000000..7971aee --- /dev/null +++ b/cmake/snappy.pc.in @@ -0,0 +1,10 @@ +prefix=@CMAKE_INSTALL_PREFIX@ +exec_prefix=${prefix} +libdir=@CMAKE_INSTALL_LIBDIR@ +includedir=${prefix}/include + +Name: @PROJECT_NAME@ +Description: A fast compression/decompression library +Version: @PROJECT_VERSION@ +Libs: -L${libdir} -lsnappy +Cflags: -I${includedir} \ No newline at end of file diff --git a/debian/.gitignore b/debian/.gitignore new file mode 100644 index 0000000..8f19b0c --- /dev/null +++ b/debian/.gitignore @@ -0,0 +1,9 @@ +*.substvars +*debhelper* +.debhelper +autoreconf.* +files +tmp + +libsnappy-dev +libsnappy1v5 diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..79fd585 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +snappy (100:1.2.0-1) UNRELEASED; urgency=medium + + * https://github.com/google/snappy/releases/tag/1.2.0 + + -- Wong Hoi Sing Edison Sat, 06 Apr 2024 11:21:20 +0900 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..135039f --- /dev/null +++ b/debian/control @@ -0,0 +1,42 @@ +Source: snappy +Section: libs +Priority: optional +Standards-Version: 4.5.0 +Maintainer: Wong Hoi Sing Edison +Homepage: https://github.com/google/snappy +Vcs-Browser: https://github.com/alvistack/google-snappy +Vcs-Git: https://github.com/alvistack/google-snappy.git +Build-Depends: + debhelper, + debhelper-compat (= 10), + cmake, + liblz4-dev, + liblzo2-dev, + pkg-config, + zlib1g-dev, + +Package: libsnappy1v5 +Section: libs +Architecture: amd64 +Description: Fast compression/decompression library + Snappy is a compression/decompression library. It does not aim for + maximum compression, or compatibility with any other compression + library; instead, it aims for very high speeds and reasonable + compression. +Pre-Depends: + ${misc:Pre-Depends}, +Depends: + ${shlibs:Depends}, + ${misc:Depends}, +Conflicts: + libsnappy1, + +Package: libsnappy-dev +Section: libdevel +Architecture: amd64 +Description: Fast compression/decompression library (development files) + This package contains the development files required to build programs + against Snappy. +Depends: + ${misc:Depends}, + libsnappy1v5 (= ${source:Version}), diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..12900b4 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,21 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ + +Files: debian/* +Copyright: 2024 Wong Hoi Sing Edison +License: Apache-2.0 + +License: Apache-2.0 + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + . + http://www.apache.org/licenses/LICENSE-2.0 + . + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + . + The complete text of the Apache version 2.0 license + can be found in "/usr/share/common-licenses/Apache-2.0". diff --git a/debian/libsnappy-dev.install b/debian/libsnappy-dev.install new file mode 100644 index 0000000..8f3c7d5 --- /dev/null +++ b/debian/libsnappy-dev.install @@ -0,0 +1,5 @@ +usr/include/* +usr/lib/*/*.a +usr/lib/*/*.so +usr/lib/*/cmake/* +usr/lib/*/pkgconfig/* diff --git a/debian/libsnappy-dev.lintian-overrides b/debian/libsnappy-dev.lintian-overrides new file mode 100644 index 0000000..42bb45a --- /dev/null +++ b/debian/libsnappy-dev.lintian-overrides @@ -0,0 +1 @@ +libsnappy-dev: initial-upload-closes-no-bugs diff --git a/debian/libsnappy1v5.install b/debian/libsnappy1v5.install new file mode 100644 index 0000000..3de3b10 --- /dev/null +++ b/debian/libsnappy1v5.install @@ -0,0 +1 @@ +usr/lib/*/*.so.* diff --git a/debian/libsnappy1v5.lintian-overrides b/debian/libsnappy1v5.lintian-overrides new file mode 100644 index 0000000..a52153f --- /dev/null +++ b/debian/libsnappy1v5.lintian-overrides @@ -0,0 +1 @@ +libsnappy1v5: initial-upload-closes-no-bugs diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..ebb23aa --- /dev/null +++ b/debian/rules @@ -0,0 +1,40 @@ +#!/usr/bin/make -f + +SHELL := /bin/bash + +override_dh_autoreconf: + +override_dh_auto_configure: + mkdir -p build + pushd build && \ + cmake \ + .. \ + -DBUILD_SHARED_LIBS=ON \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_LIBDIR=/usr/lib/${DEB_HOST_MULTIARCH} \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DSNAPPY_BUILD_BENCHMARKS=OFF \ + -DSNAPPY_BUILD_TESTS=OFF && \ + popd + +override_dh_auto_build: + pushd build && \ + cmake \ + --build . \ + --parallel 10 \ + --config Release && \ + popd + +override_dh_auto_install: + pushd build && \ + export DESTDIR=../debian/tmp && \ + cmake \ + --install . && \ + popd + +override_dh_auto_test: + +override_dh_auto_clean: + +%: + dh $@ diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 0000000..163aaf8 --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/debian/source/lintian-overrides b/debian/source/lintian-overrides new file mode 100644 index 0000000..d90423c --- /dev/null +++ b/debian/source/lintian-overrides @@ -0,0 +1,4 @@ +snappy source: file-without-copyright-information +snappy source: no-debian-changes +snappy source: not-binnmuable-any-depends-any +snappy source: weak-library-dev-dependency diff --git a/snappy.spec b/snappy.spec new file mode 100644 index 0000000..c78c6bf --- /dev/null +++ b/snappy.spec @@ -0,0 +1,133 @@ +# Copyright 2024 Wong Hoi Sing Edison +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +%global debug_package %{nil} + +%global source_date_epoch_from_changelog 0 + +Name: snappy +Epoch: 100 +Version: 1.2.0 +Release: 1%{?dist} +Summary: Fast compression/decompression library +License: BSD-3-Clause +URL: https://github.com/google/snappy/tags +Source0: %{name}_%{version}.orig.tar.gz +BuildRequires: cmake +BuildRequires: gcc-c++ +BuildRequires: lz4-devel +BuildRequires: lzo-devel +BuildRequires: pkgconfig +BuildRequires: zlib-devel + +%description +Snappy is a compression/decompression library. It does not aim for +maximum compression, or compatibility with any other compression +library; instead, it aims for very high speeds and reasonable +compression. + +%prep +%autosetup -T -c -n %{name}_%{version}-%{release} +tar -zx -f %{S:0} --strip-components=1 -C . + +%build +mkdir -p build +pushd build && \ + cmake \ + .. \ + -DBUILD_SHARED_LIBS=ON \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_LIBDIR=%{_libdir} \ + -DCMAKE_INSTALL_PREFIX=%{_prefix} \ + -DSNAPPY_BUILD_BENCHMARKS=OFF \ + -DSNAPPY_BUILD_TESTS=OFF && \ +popd +pushd build && \ + cmake \ + --build . \ + --parallel 10 \ + --config Release && \ +popd + +%install +pushd build && \ + export DESTDIR=%{buildroot} && \ + cmake \ + --install . && \ +popd + +%if 0%{?suse_version} > 1500 || 0%{?sle_version} > 150000 +%package -n libsnappy1 +Summary: Fast compression/decompression library + +%description -n libsnappy1 +Snappy is a compression/decompression library. It does not aim for +maximum compression, or compatibility with any other compression +library; instead, it aims for very high speeds and reasonable +compression. + +%package -n snappy-devel +Summary: Fast compression/decompression library (development files) +Requires: libsnappy1 = %{epoch}:%{version}-%{release} +Requires: pkgconfig + +%description -n snappy-devel +This package contains the development files required to build programs +against Snappy. + +%post -n libsnappy1 -p /sbin/ldconfig +%postun -n libsnappy1 -p /sbin/ldconfig + +%files +%license COPYING + +%files -n libsnappy1 +%{_libdir}/*.so.* + +%files -n snappy-devel +%dir %{_libdir}/cmake/Snappy/ +%{_includedir}/* +%{_libdir}/*.a +%{_libdir}/*.so +%{_libdir}/cmake/Snappy/* +%{_libdir}/pkgconfig/* +%endif + +%if !(0%{?suse_version} > 1500) && !(0%{?sle_version} > 150000) +%package -n snappy-devel +Summary: Fast compression/decompression library (development files) +Requires: snappy = %{epoch}:%{version}-%{release} +Requires: pkgconfig + +%description -n snappy-devel +This package contains the development files required to build programs +against Snappy. + +%post -p /sbin/ldconfig +%postun -p /sbin/ldconfig + +%files +%license COPYING +%{_libdir}/*.so.* + +%files -n snappy-devel +%dir %{_libdir}/cmake/Snappy/ +%{_includedir}/* +%{_libdir}/*.a +%{_libdir}/*.so +%{_libdir}/cmake/Snappy/* +%{_libdir}/pkgconfig/* +%endif + +%changelog