Port of Snappy-1.1.7

A fast compressor/decompressor
https://github.com/google/snappy
This commit is contained in:
Emery Hemingway
2018-12-26 21:35:28 +01:00
committed by Norman Feske
parent 6bd43a2df5
commit 14098623de
12 changed files with 215 additions and 0 deletions

View File

@@ -0,0 +1,2 @@
SNAPPY_PORT_DIR := $(call select_from_ports,snappy)
INC_DIR += $(SNAPPY_PORT_DIR)/include/snappy

16
lib/mk/snappy.mk Normal file
View File

@@ -0,0 +1,16 @@
include $(REP_DIR)/lib/import/import-snappy.mk
SNAPPY_SRC_DIR = $(SNAPPY_PORT_DIR)/src/lib/snappy
INC_DIR += $(SNAPPY_SRC_DIR)
SRC_CC += snappy-c.cc snappy-sinksource.cc snappy-stubs-internal.cc snappy.cc
vpath %.cc $(SNAPPY_SRC_DIR)
LIBS += stdcxx
SHARED_LIB = yes
CC_WARN += -Wno-sign-compare
CC_CXX_WARN_STRICT =

46
lib/symbols/snappy Normal file
View File

@@ -0,0 +1,46 @@
_ZN6snappy10UncompressEPKcmPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE T
_ZN6snappy10UncompressEPNS_6SourceEPNS_4SinkE T
_ZN6snappy11RawCompressEPKcmPcPm T
_ZN6snappy13RawUncompressEPKcmPc T
_ZN6snappy13RawUncompressEPNS_6SourceEPc T
_ZN6snappy15ByteArraySource4PeekEPm T
_ZN6snappy15ByteArraySource4SkipEm T
_ZN6snappy15ByteArraySourceD0Ev T
_ZN6snappy15ByteArraySourceD1Ev T
_ZN6snappy15ByteArraySourceD2Ev T
_ZN6snappy17IsValidCompressedEPNS_6SourceE T
_ZN6snappy18SnappyDecompressor9RefillTagEv T
_ZN6snappy19MaxCompressedLengthEm T
_ZN6snappy20RawUncompressToIOVecEPKcmPK5iovecm T
_ZN6snappy20RawUncompressToIOVecEPNS_6SourceEPK5iovecm T
_ZN6snappy21GetUncompressedLengthEPKcmPm T
_ZN6snappy21GetUncompressedLengthEPNS_6SourceEPj T
_ZN6snappy22UncheckedByteArraySink15GetAppendBufferEmPc T
_ZN6snappy22UncheckedByteArraySink22AppendAndTakeOwnershipEPcmPFvPvPKcmES2_ T
_ZN6snappy22UncheckedByteArraySink23GetAppendBufferVariableEmmPcmPm T
_ZN6snappy22UncheckedByteArraySink6AppendEPKcm T
_ZN6snappy22UncheckedByteArraySinkD0Ev T
_ZN6snappy22UncheckedByteArraySinkD1Ev T
_ZN6snappy22UncheckedByteArraySinkD2Ev T
_ZN6snappy23IsValidCompressedBufferEPKcm T
_ZN6snappy26UncompressAsMuchAsPossibleEPNS_6SourceEPNS_4SinkE T
_ZN6snappy4Sink15GetAppendBufferEmPc T
_ZN6snappy4Sink22AppendAndTakeOwnershipEPcmPFvPvPKcmES2_ T
_ZN6snappy4Sink23GetAppendBufferVariableEmmPcmPm T
_ZN6snappy4SinkD0Ev T
_ZN6snappy4SinkD1Ev T
_ZN6snappy4SinkD2Ev T
_ZN6snappy6SourceD0Ev T
_ZN6snappy6SourceD1Ev T
_ZN6snappy6SourceD2Ev T
_ZN6snappy6Varint8Append32EPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEj T
_ZN6snappy8CompressEPKcmPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE T
_ZN6snappy8CompressEPNS_6SourceEPNS_4SinkE T
_ZN6snappy8internal13WorkingMemory12GetHashTableEmPi T
_ZN6snappy8internal16CompressFragmentEPKcmPcPti T
_ZNK6snappy15ByteArraySource9AvailableEv T
snappy_compress T
snappy_max_compressed_length T
snappy_uncompress T
snappy_uncompressed_length T
snappy_validate_compressed_buffer T

1
ports/snappy.hash Normal file
View File

@@ -0,0 +1 @@
a332fb997b87e7d89337e0d9b7473eecfe1ba940

15
ports/snappy.port Normal file
View File

@@ -0,0 +1,15 @@
LICENSE := BSD
VERSION := 1.1.7
DOWNLOADS := snappy.archive
URL(snappy) := https://github.com/google/snappy/archive/$(VERSION).tar.gz
SHA(snappy) := 3dfa02e873ff51a11ee02b9ca391807f0c8ea0529a4924afa645fbf97163f9d4
DIR(snappy) := src/lib/snappy
PATCHES := src/lib/snappy/header.patch
PATCH_OPT := -p1 -d src/lib/snappy
DIRS := include/snappy
DIR_CONTENT(include/snappy) := \
src/lib/snappy/snappy.h \
src/lib/snappy/snappy-stubs-public.h \

View File

@@ -0,0 +1,13 @@
content: include/snappy lib/symbols/snappy LICENSE
PORT_DIR := $(call port_dir,$(REP_DIR)/ports/snappy)
include/snappy:
mkdir -p $@
cp -r $(PORT_DIR)/$@/* $@
lib/symbols/snappy:
$(mirror_from_rep_dir)
LICENSE:
cp $(PORT_DIR)/src/lib/snappy/COPYING $@

1
recipes/api/snappy/hash Normal file
View File

@@ -0,0 +1 @@
-

1
recipes/src/snappy/api Normal file
View File

@@ -0,0 +1 @@
snappy

View File

@@ -0,0 +1,16 @@
MIRROR_FROM_REP_DIR = lib/import/import-snappy.mk lib/mk/snappy.mk
content: $(MIRROR_FROM_REP_DIR) src/lib/snappy/target.mk LICENSE
$(MIRROR_FROM_REP_DIR):
$(mirror_from_rep_dir)
PORT_DIR := $(call port_dir,$(REP_DIR)/ports/snappy)
src/lib/snappy/target.mk:
mkdir -p src/lib/snappy
cp -r $(PORT_DIR)/src/lib/snappy/* src/lib/snappy
echo "LIBS = snappy" > $@
LICENSE:
cp $(PORT_DIR)/src/lib/snappy/COPYING $@

1
recipes/src/snappy/hash Normal file
View File

@@ -0,0 +1 @@
-

View File

@@ -0,0 +1,3 @@
base
libc
stdcxx

100
src/lib/snappy/header.patch Normal file
View File

@@ -0,0 +1,100 @@
diff --git a/snappy-stubs-public.h b/snappy-stubs-public.h
new file mode 100644
index 0000000..8f47432
--- /dev/null
+++ b/snappy-stubs-public.h
@@ -0,0 +1,94 @@
+// Copyright 2011 Google Inc. All Rights Reserved.
+// Author: sesse@google.com (Steinar H. Gunderson)
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Various type stubs for the open-source version of Snappy.
+//
+// This file cannot include config.h, as it is included from snappy.h,
+// which is a public header. Instead, snappy-stubs-public.h is generated by
+// from snappy-stubs-public.h.in at configure time.
+
+#ifndef THIRD_PARTY_SNAPPY_OPENSOURCE_SNAPPY_STUBS_PUBLIC_H_
+#define THIRD_PARTY_SNAPPY_OPENSOURCE_SNAPPY_STUBS_PUBLIC_H_
+
+#if 1 // HAVE_STDINT_H
+#include <stdint.h>
+#endif // HAVE_STDDEF_H
+
+#if 1 // HAVE_STDDEF_H
+#include <stddef.h>
+#endif // HAVE_STDDEF_H
+
+#if 1 // HAVE_SYS_UIO_H
+#include <sys/uio.h>
+#endif // HAVE_SYS_UIO_H
+
+#define SNAPPY_MAJOR
+#define SNAPPY_MINOR
+#define SNAPPY_PATCHLEVEL
+#define SNAPPY_VERSION \
+ ((SNAPPY_MAJOR << 16) | (SNAPPY_MINOR << 8) | SNAPPY_PATCHLEVEL)
+
+#include <string>
+
+namespace snappy {
+
+#if 1 // HAVE_STDINT_H
+typedef int8_t int8;
+typedef uint8_t uint8;
+typedef int16_t int16;
+typedef uint16_t uint16;
+typedef int32_t int32;
+typedef uint32_t uint32;
+typedef int64_t int64;
+typedef uint64_t uint64;
+#else
+typedef signed char int8;
+typedef unsigned char uint8;
+typedef short int16;
+typedef unsigned short uint16;
+typedef int int32;
+typedef unsigned int uint32;
+typedef long long int64;
+typedef unsigned long long uint64;
+#endif // HAVE_STDINT_H
+
+typedef std::string string;
+
+#if !1 // !HAVE_SYS_UIO_H
+// Windows does not have an iovec type, yet the concept is universally useful.
+// It is simple to define it ourselves, so we put it inside our own namespace.
+struct iovec {
+ void* iov_base;
+ size_t iov_len;
+};
+#endif // !HAVE_SYS_UIO_H
+
+} // namespace snappy
+
+#endif // THIRD_PARTY_SNAPPY_OPENSOURCE_SNAPPY_STUBS_PUBLIC_H_