From 6d9f144ebc2b72c343eb3179c6c9286469bb8e01 Mon Sep 17 00:00:00 2001 From: miqlas <5569059+extrowerk@users.noreply.github.com> Date: Sun, 20 May 2018 16:54:16 +0200 Subject: [PATCH] LevelDB: new recipe (#2555) --- dev-libs/leveldb/leveldb-1.20.recipe | 81 +++++++++++++++++++ .../leveldb/patches/leveldb-1.20.patchset | 44 ++++++++++ 2 files changed, 125 insertions(+) create mode 100644 dev-libs/leveldb/leveldb-1.20.recipe create mode 100644 dev-libs/leveldb/patches/leveldb-1.20.patchset diff --git a/dev-libs/leveldb/leveldb-1.20.recipe b/dev-libs/leveldb/leveldb-1.20.recipe new file mode 100644 index 000000000..c01810fe7 --- /dev/null +++ b/dev-libs/leveldb/leveldb-1.20.recipe @@ -0,0 +1,81 @@ +SUMMARY="A fast key-value storage library written at Google" +DESCRIPTION="LevelDB stores keys and values in arbitrary byte arrays, and \ +data is sorted by key. It supports batching writes, forward and backward \ +iteration, and compression of the data via Google's Snappy compression \ +library. +LevelDB is not an SQL database. Like other NoSQL and Dbm stores, it does \ +not have a relational data model and it does not support SQL queries. Also, \ +it has no support for indexes. Applications use LevelDB as a library, as it \ +does not provide a server or command-line interface." +HOMEPAGE="http://leveldb.org/" +COPYRIGHT="2017 The LevelDB Authors" +LICENSE="BSD (3-clause)" +REVISION="1" +SOURCE_URI="https://github.com/google/leveldb/archive/v$portVersion.tar.gz" +CHECKSUM_SHA256="f5abe8b5b209c2f36560b75f32ce61412f39a2922f7045ae764a2c23335b6664" +SOURCE_FILENAME="leveldb-$portVersion.tar.gz" +PATCHES="leveldb-$portVersion.patchset" + +ARCHITECTURES="!x86_gcc2 ?x86 x86_64" +SECONDARY_ARCHITECTURES="x86" + +libVersion="$portVersion" +libVersionCompat="$libVersion compat >= ${libVersion%%.*}" + +PROVIDES=" + leveldb$secondaryArchSuffix = $portVersion + lib:libleveldb$secondaryArchSuffix = $libVersionCompat + " +REQUIRES=" + haiku$secondaryArchSuffix + lib:libsnappy$secondaryArchSuffix + " + +PROVIDES_devel=" + leveldb${secondaryArchSuffix}_devel = $portVersion + devel:libleveldb$secondaryArchSuffix = $libVersionCompat + devel:libmemenv$secondaryArchSuffix = $libVersionCompat + " +REQUIRES_devel=" + leveldb$secondaryArchSuffix == $portVersion base + " + +BUILD_REQUIRES=" + haiku${secondaryArchSuffix}_devel + devel:libsnappy$secondaryArchSuffix + " +BUILD_PREREQUIRES=" + haiku${secondaryArchSuffix}_devel + cmd:gcc$secondaryArchSuffix + cmd:ld$secondaryArchSuffix + cmd:libtoolize$secondaryArchSuffix + cmd:make + " + +defineDebugInfoPackage leveldb$secondaryArchSuffix \ + "$libDir"/libleveldb.so.$libVersion + +BUILD() +{ + make $jobArgs +} + +INSTALL() +{ + install -d -m 755 "$libDir" "$includeDir" "$developDocDir" + + cp -R include/* "$includeDir" + cp out-static/*.a "$libDir" + cp --no-dereference out-shared/libleveldb.so* "$libDir" + cp -R doc/* "$developDocDir" + + prepareInstalledDevelLibs libleveldb libmemenv + + packageEntries devel \ + "$developDir" +} + +TEST() +{ + make check +} diff --git a/dev-libs/leveldb/patches/leveldb-1.20.patchset b/dev-libs/leveldb/patches/leveldb-1.20.patchset new file mode 100644 index 000000000..fcc6d238b --- /dev/null +++ b/dev-libs/leveldb/patches/leveldb-1.20.patchset @@ -0,0 +1,44 @@ +From 0adb7c07e094fad72120b8a86fcf386a95f9be06 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Zolt=C3=A1n=20Mizsei?= +Date: Sun, 13 May 2018 17:00:39 +0200 +Subject: Haiku supporting patches + + +diff --git a/build_detect_platform b/build_detect_platform +index d2a20ce..e1fa25e 100755 +--- a/build_detect_platform ++++ b/build_detect_platform +@@ -131,6 +131,13 @@ case "$TARGET_OS" in + PORT_FILE=port/port_posix.cc + PORT_SSE_FILE=port/port_posix_sse.cc + ;; ++ Haiku) ++ PLATFORM=OS_HAIKU ++ COMMON_FLAGS="$MEMCMP_FLAG -D_REENTRANT -DOS_HAIKU" ++ PLATFORM_LIBS="-lpthread" ++ PORT_FILE=port/port_posix.cc ++ PORT_SSE_FILE=port/port_posix_sse.cc ++ ;; + OS_ANDROID_CROSSCOMPILE) + PLATFORM=OS_ANDROID + COMMON_FLAGS="$MEMCMP_FLAG -D_REENTRANT -DOS_ANDROID -DLEVELDB_PLATFORM_POSIX" +diff --git a/util/env_posix.cc b/util/env_posix.cc +index 84aabb2..58b00ee 100644 +--- a/util/env_posix.cc ++++ b/util/env_posix.cc +@@ -280,10 +280,12 @@ class PosixWritableFile : public WritableFile { + if (!s.ok()) { + return s; + } ++ #ifndef __HAIKU__ + if (fflush_unlocked(file_) != 0 || + fdatasync(fileno(file_)) != 0) { + s = Status::IOError(filename_, strerror(errno)); + } ++ #endif + return s; + } + }; +-- +2.16.2 +