Skip to content

Commit

Permalink
alvistack/1.2.0
Browse files Browse the repository at this point in the history
    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 google#178

Signed-off-by: Wong Hoi Sing Edison <hswong3i@pantarei-design.com>
  • Loading branch information
hswong3i committed Apr 10, 2024
1 parent 72b736d commit 89989b3
Show file tree
Hide file tree
Showing 14 changed files with 303 additions and 6 deletions.
36 changes: 30 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}>
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>
$<INSTALL_INTERFACE:include>
)

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
Expand Down Expand Up @@ -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}
Expand Down
10 changes: 10 additions & 0 deletions cmake/snappy.pc.in
Original file line number Diff line number Diff line change
@@ -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}
9 changes: 9 additions & 0 deletions debian/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
*.substvars
*debhelper*
.debhelper
autoreconf.*
files
tmp

libsnappy-dev
libsnappy1v5
5 changes: 5 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -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 <hswong3i@pantarei-design.com> Sat, 06 Apr 2024 11:21:20 +0900
42 changes: 42 additions & 0 deletions debian/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
Source: snappy
Section: libs
Priority: optional
Standards-Version: 4.5.0
Maintainer: Wong Hoi Sing Edison <hswong3i@pantarei-design.com>
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}),
21 changes: 21 additions & 0 deletions debian/copyright
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/

Files: debian/*
Copyright: 2024 Wong Hoi Sing Edison <hswong3i@pantarei-design.com>
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".
5 changes: 5 additions & 0 deletions debian/libsnappy-dev.install
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
usr/include/*
usr/lib/*/*.a
usr/lib/*/*.so
usr/lib/*/cmake/*
usr/lib/*/pkgconfig/*
1 change: 1 addition & 0 deletions debian/libsnappy-dev.lintian-overrides
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
libsnappy-dev: initial-upload-closes-no-bugs
1 change: 1 addition & 0 deletions debian/libsnappy1v5.install
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
usr/lib/*/*.so.*
1 change: 1 addition & 0 deletions debian/libsnappy1v5.lintian-overrides
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
libsnappy1v5: initial-upload-closes-no-bugs
40 changes: 40 additions & 0 deletions debian/rules
Original file line number Diff line number Diff line change
@@ -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 $@
1 change: 1 addition & 0 deletions debian/source/format
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.0 (quilt)
4 changes: 4 additions & 0 deletions debian/source/lintian-overrides
Original file line number Diff line number Diff line change
@@ -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
133 changes: 133 additions & 0 deletions snappy.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
# Copyright 2024 Wong Hoi Sing Edison <hswong3i@pantarei-design.com>
#
# 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

0 comments on commit 89989b3

Please sign in to comment.