new package: pika
This commit is contained in:
parent
c3f5b28356
commit
a98962347d
59
packages/pika/Makefile.patch
Normal file
59
packages/pika/Makefile.patch
Normal file
@ -0,0 +1,59 @@
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -1,7 +1,5 @@
|
||||
CLEAN_FILES = # deliberately empty, so we can append below.
|
||||
-CXX=g++
|
||||
-PLATFORM_LDFLAGS= -lpthread -lrt
|
||||
-PLATFORM_CXXFLAGS= -std=c++11 -fno-builtin-memcmp -msse -msse4.2
|
||||
+PLATFORM_CXXFLAGS= -std=c++11 -fno-builtin-memcmp $(CPPFLAGS)
|
||||
PROFILING_FLAGS=-pg
|
||||
OPT=
|
||||
LDFLAGS += -Wl,-rpath=$(RPATH)
|
||||
@@ -27,7 +25,7 @@
|
||||
|
||||
# compile with -O2 if debug level is not 2
|
||||
ifneq ($(DEBUG_LEVEL), 2)
|
||||
-OPT += -O2 -fno-omit-frame-pointer
|
||||
+OPT += -Oz -fno-omit-frame-pointer
|
||||
# if we're compiling for release, compile without debug code (-DNDEBUG) and
|
||||
# don't treat warnings as errors
|
||||
OPT += -DNDEBUG
|
||||
@@ -89,9 +87,7 @@
|
||||
INCLUDE_PATH = -I. \
|
||||
-I$(SLASH_PATH) \
|
||||
-I$(PINK_PATH) \
|
||||
- -I$(BLACKWIDOW_PATH)/include \
|
||||
- -I$(ROCKSDB_PATH) \
|
||||
- -I$(ROCKSDB_PATH)/include \
|
||||
+ -I$(BLACKWIDOW_PATH)/include
|
||||
|
||||
ifeq ($(360),1)
|
||||
INCLUDE_PATH += -I$(GLOG_PATH)/src
|
||||
@@ -100,8 +96,7 @@
|
||||
LIB_PATH = -L./ \
|
||||
-L$(SLASH_PATH)/slash/lib \
|
||||
-L$(PINK_PATH)/pink/lib \
|
||||
- -L$(BLACKWIDOW_PATH)/lib \
|
||||
- -L$(ROCKSDB_PATH) \
|
||||
+ -L$(BLACKWIDOW_PATH)/lib
|
||||
|
||||
ifeq ($(360),1)
|
||||
LIB_PATH += -L$(GLOG_PATH)/.libs
|
||||
@@ -111,7 +106,7 @@
|
||||
-lpink$(DEBUG_SUFFIX) \
|
||||
-lslash$(DEBUG_SUFFIX) \
|
||||
-lblackwidow$(DEBUG_SUFFIX) \
|
||||
- -lrocksdb$(DEBUG_SUFFIX) \
|
||||
+ -lrocksdb \
|
||||
-lglog \
|
||||
-lprotobuf \
|
||||
|
||||
@@ -210,7 +205,7 @@
|
||||
|
||||
dbg: $(BINARY)
|
||||
|
||||
-$(BINARY): $(SLASH) $(PINK) $(ROCKSDB) $(BLACKWIDOW) $(GLOG) $(PROTOOBJECTS) $(LIBOBJECTS)
|
||||
+$(BINARY): $(SLASH) $(PINK) $(BLACKWIDOW) $(PROTOOBJECTS) $(LIBOBJECTS)
|
||||
$(AM_V_at)rm -f $@
|
||||
$(AM_V_at)$(AM_LINK)
|
||||
$(AM_V_at)rm -rf $(OUTPUT)
|
32
packages/pika/build.sh
Normal file
32
packages/pika/build.sh
Normal file
@ -0,0 +1,32 @@
|
||||
TERMUX_PKG_HOMEPAGE=https://github.com/OpenAtomFoundation/pika
|
||||
TERMUX_PKG_DESCRIPTION="A persistent huge storage service, compatible with the vast majority of Redis interfaces"
|
||||
TERMUX_PKG_LICENSE="BSD 3-Clause"
|
||||
TERMUX_PKG_MAINTAINER="@termux"
|
||||
TERMUX_PKG_VERSION=3.4.0
|
||||
TERMUX_PKG_SRCURL=https://github.com/OpenAtomFoundation/pika.git
|
||||
TERMUX_PKG_DEPENDS="libc++, libglog, libprotobuf, librocksdb, zlib"
|
||||
TERMUX_PKG_BUILD_IN_SRC=true
|
||||
|
||||
# ```
|
||||
# [...]/src/pika_set.cc:107:58: error: cannot initialize a parameter of type
|
||||
# 'long *' with an rvalue of type 'int64_t *' (aka 'long long *')
|
||||
# if (!slash::string2l(argv_[2].data(), argv_[2].size(), &cursor_)) {
|
||||
# ^~~~~~~~
|
||||
# ```
|
||||
TERMUX_PKG_BLACKLISTED_ARCHES="arm, i686"
|
||||
|
||||
termux_step_post_get_source() {
|
||||
rm -fr third/rocksdb
|
||||
rm -fr third/blackwidow/deps/rocksdb
|
||||
}
|
||||
|
||||
termux_step_pre_configure() {
|
||||
termux_setup_protobuf
|
||||
|
||||
export DISABLE_UPDATE_SB=1
|
||||
}
|
||||
|
||||
termux_step_make_install() {
|
||||
install -Dm700 -t $TERMUX_PREFIX/bin output/bin/pika
|
||||
install -Dm600 -t $TERMUX_PREFIX/share/pika conf/pika.conf
|
||||
}
|
10
packages/pika/include-pika_statistic.h.patch
Normal file
10
packages/pika/include-pika_statistic.h.patch
Normal file
@ -0,0 +1,10 @@
|
||||
--- a/include/pika_statistic.h
|
||||
+++ b/include/pika_statistic.h
|
||||
@@ -6,6 +6,7 @@
|
||||
#ifndef PIKA_STATISTIC_H_
|
||||
#define PIKA_STATISTIC_H_
|
||||
|
||||
+#include <string>
|
||||
#include <atomic>
|
||||
#include <unordered_map>
|
||||
|
26
packages/pika/src-pika_admin.cc.patch
Normal file
26
packages/pika/src-pika_admin.cc.patch
Normal file
@ -0,0 +1,26 @@
|
||||
--- a/src/pika_admin.cc
|
||||
+++ b/src/pika_admin.cc
|
||||
@@ -822,19 +822,19 @@
|
||||
std::stringstream tmp_stream;
|
||||
tmp_stream << "# CPU\r\n";
|
||||
tmp_stream << "used_cpu_sys:" <<
|
||||
- setiosflags(std::ios::fixed) << std::setprecision(2) <<
|
||||
+ std::setiosflags(std::ios::fixed) << std::setprecision(2) <<
|
||||
(float)self_ru.ru_stime.tv_sec+(float)self_ru.ru_stime.tv_usec/1000000 <<
|
||||
"\r\n";
|
||||
tmp_stream << "used_cpu_user:" <<
|
||||
- setiosflags(std::ios::fixed) << std::setprecision(2) <<
|
||||
+ std::setiosflags(std::ios::fixed) << std::setprecision(2) <<
|
||||
(float)self_ru.ru_utime.tv_sec+(float)self_ru.ru_utime.tv_usec/1000000 <<
|
||||
"\r\n";
|
||||
tmp_stream << "used_cpu_sys_children:" <<
|
||||
- setiosflags(std::ios::fixed) << std::setprecision(2) <<
|
||||
+ std::setiosflags(std::ios::fixed) << std::setprecision(2) <<
|
||||
(float)c_ru.ru_stime.tv_sec+(float)c_ru.ru_stime.tv_usec/1000000 <<
|
||||
"\r\n";
|
||||
tmp_stream << "used_cpu_user_children:" <<
|
||||
- setiosflags(std::ios::fixed) << std::setprecision(2) <<
|
||||
+ std::setiosflags(std::ios::fixed) << std::setprecision(2) <<
|
||||
(float)c_ru.ru_utime.tv_sec+(float)c_ru.ru_utime.tv_usec/1000000 <<
|
||||
"\r\n";
|
||||
info.append(tmp_stream.str());
|
11
packages/pika/src-pika_repl_client_conn.cc.patch
Normal file
11
packages/pika/src-pika_repl_client_conn.cc.patch
Normal file
@ -0,0 +1,11 @@
|
||||
--- a/src/pika_repl_client_conn.cc
|
||||
+++ b/src/pika_repl_client_conn.cc
|
||||
@@ -47,7 +47,7 @@
|
||||
std::shared_ptr<InnerMessage::InnerResponse> response = std::make_shared<InnerMessage::InnerResponse>();
|
||||
::google::protobuf::io::ArrayInputStream input(rbuf_ + cur_pos_ - header_len_, header_len_);
|
||||
::google::protobuf::io::CodedInputStream decoder(&input);
|
||||
- decoder.SetTotalBytesLimit(g_pika_conf->max_conn_rbuf_size(), g_pika_conf->max_conn_rbuf_size());
|
||||
+ decoder.SetTotalBytesLimit(g_pika_conf->max_conn_rbuf_size());
|
||||
bool success = response->ParseFromCodedStream(&decoder) && decoder.ConsumedEntireMessage();
|
||||
if (!success) {
|
||||
LOG(WARNING) << "ParseFromArray FAILED! " << " msg_len: " << header_len_;
|
29
packages/pika/third-blackwidow-Makefile.patch
Normal file
29
packages/pika/third-blackwidow-Makefile.patch
Normal file
@ -0,0 +1,29 @@
|
||||
--- a/third/blackwidow/Makefile
|
||||
+++ b/third/blackwidow/Makefile
|
||||
@@ -1,7 +1,5 @@
|
||||
CLEAN_FILES = # deliberately empty, so we can append below.
|
||||
-CXX=g++
|
||||
-LDFLAGS= -lpthread -lrt
|
||||
-CXXFLAGS= -g -std=c++11 -fno-builtin-memcmp -msse -msse4.2 -pipe -fPIC
|
||||
+CXXFLAGS+= -std=c++11 -fno-builtin-memcmp -pipe -fPIC -fno-rtti $(CPPFLAGS)
|
||||
PROFILING_FLAGS=-pg
|
||||
ARFLAGS = rs
|
||||
OPT=
|
||||
@@ -18,7 +16,7 @@
|
||||
# don't treat warnings as errors
|
||||
ifeq ($(DEBUG_LEVEL),0)
|
||||
DISABLE_WARNING_AS_ERROR=1
|
||||
-OPT += -O2 -fno-omit-frame-pointer -DNDEBUG
|
||||
+OPT += -Oz -fno-omit-frame-pointer -DNDEBUG
|
||||
else
|
||||
$(warning Warning: Compiling in debug mode. Don't use the resulting binary in production)
|
||||
OPT += -O0 $(PROFILING_FLAGS)
|
||||
@@ -91,7 +89,7 @@
|
||||
WARNING_FLAGS += -Werror
|
||||
endif
|
||||
|
||||
-CXXFLAGS += $(WARNING_FLAGS) -I. -I./include -I$(ROCKSDB_INCLUDE_DIR) -I$(ROCKSDB_PATH) -I$(SLASH_INCLUDE_DIR) $(OPT)
|
||||
+CXXFLAGS += $(WARNING_FLAGS) -I. -I./include -I$(SLASH_INCLUDE_DIR) $(OPT)
|
||||
|
||||
date := $(shell date +%F)
|
||||
git_sha := $(shell git rev-parse HEAD 2>/dev/null)
|
10
packages/pika/third-blackwidow-src-coding.h.patch
Normal file
10
packages/pika/third-blackwidow-src-coding.h.patch
Normal file
@ -0,0 +1,10 @@
|
||||
--- a/third/blackwidow/src/coding.h
|
||||
+++ b/third/blackwidow/src/coding.h
|
||||
@@ -11,6 +11,7 @@
|
||||
#define BLACKWIDOW_PLATFORM_IS_LITTLE_ENDIAN (__BYTE_ORDER == __LITTLE_ENDIAN)
|
||||
#endif
|
||||
#include <string.h>
|
||||
+#include <sys/endian.h>
|
||||
|
||||
namespace blackwidow {
|
||||
static const bool kLittleEndian = BLACKWIDOW_PLATFORM_IS_LITTLE_ENDIAN;
|
84
packages/pika/third-blackwidow-src-db_checkpoint.cc.patch
Normal file
84
packages/pika/third-blackwidow-src-db_checkpoint.cc.patch
Normal file
@ -0,0 +1,84 @@
|
||||
--- a/third/blackwidow/src/db_checkpoint.cc
|
||||
+++ b/third/blackwidow/src/db_checkpoint.cc
|
||||
@@ -18,16 +18,29 @@
|
||||
#include <inttypes.h>
|
||||
|
||||
#include "rocksdb/db.h"
|
||||
-#include "util/file_util.h"
|
||||
+//#include "util/file_util.h"
|
||||
|
||||
#if (ROCKSDB_MAJOR < 5 || (ROCKSDB_MAJOR == 5 && ROCKSDB_MINOR < 3))
|
||||
#include "db/filename.h"
|
||||
#else
|
||||
-#include "util/filename.h"
|
||||
+//#include "util/filename.h"
|
||||
#endif
|
||||
|
||||
namespace rocksdb {
|
||||
|
||||
+class IOTracer;
|
||||
+
|
||||
+extern Status CopyFile(FileSystem* env, const std::string& source,
|
||||
+ const std::string& destination, uint64_t size,
|
||||
+ bool use_fsync,
|
||||
+ const std::shared_ptr<IOTracer>& io_tracer = nullptr);
|
||||
+
|
||||
+extern Status CreateFile(FileSystem* env, const std::string& destination,
|
||||
+ const std::string& contents, bool);
|
||||
+
|
||||
+extern bool ParseFileName(const std::string& filename, uint64_t* number,
|
||||
+ FileType* type, WalFileType* log_type = nullptr);
|
||||
+
|
||||
class DBCheckpointImpl : public DBCheckpoint {
|
||||
public:
|
||||
// Creates a DBCheckPoint object to be used for creating openable snapshots
|
||||
@@ -177,11 +190,11 @@
|
||||
if ((type != kTableFile) || (!same_fs)) {
|
||||
Log(db_->GetOptions().info_log, "Copying %s", src_fname.c_str());
|
||||
#if (ROCKSDB_MAJOR < 5 || (ROCKSDB_MAJOR == 5 && ROCKSDB_MINOR < 3))
|
||||
- s = CopyFile(db_->GetEnv(), db_->GetName() + src_fname,
|
||||
+ s = CopyFile(db_->GetFileSystem(), db_->GetName() + src_fname,
|
||||
full_private_path + src_fname,
|
||||
(type == kDescriptorFile) ? manifest_file_size : 0);
|
||||
#else
|
||||
- s = CopyFile(db_->GetEnv(), db_->GetName() + src_fname,
|
||||
+ s = CopyFile(db_->GetFileSystem(), db_->GetName() + src_fname,
|
||||
full_private_path + src_fname,
|
||||
(type == kDescriptorFile) ? manifest_file_size : 0, false);
|
||||
#endif
|
||||
@@ -193,7 +206,7 @@
|
||||
s = CreateFile(db_->GetEnv(), full_private_path + current_fname,
|
||||
manifest_fname.substr(1) + "\n");
|
||||
#else
|
||||
- s = CreateFile(db_->GetEnv(), full_private_path + current_fname,
|
||||
+ s = CreateFile(db_->GetFileSystem(), full_private_path + current_fname,
|
||||
manifest_fname.substr(1) + "\n", false);
|
||||
#endif
|
||||
}
|
||||
@@ -214,7 +227,7 @@
|
||||
full_private_path + live_wal_files[i]->PathName(),
|
||||
live_wal_files[i]->SizeFileBytes());
|
||||
#else
|
||||
- s = CopyFile(db_->GetEnv(),
|
||||
+ s = CopyFile(db_->GetFileSystem(),
|
||||
db_->GetOptions().wal_dir + live_wal_files[i]->PathName(),
|
||||
full_private_path + live_wal_files[i]->PathName(),
|
||||
live_wal_files[i]->SizeFileBytes(), false);
|
||||
@@ -241,7 +254,7 @@
|
||||
db_->GetOptions().wal_dir + live_wal_files[i]->PathName(),
|
||||
full_private_path + live_wal_files[i]->PathName(), 0);
|
||||
#else
|
||||
- s = CopyFile(db_->GetEnv(),
|
||||
+ s = CopyFile(db_->GetFileSystem(),
|
||||
db_->GetOptions().wal_dir + live_wal_files[i]->PathName(),
|
||||
full_private_path + live_wal_files[i]->PathName(),
|
||||
0, false);
|
||||
@@ -258,7 +271,7 @@
|
||||
s = db_->GetEnv()->RenameFile(full_private_path, checkpoint_dir);
|
||||
}
|
||||
if (s.ok()) {
|
||||
- unique_ptr<Directory> checkpoint_directory;
|
||||
+ std::unique_ptr<Directory> checkpoint_directory;
|
||||
db_->GetEnv()->NewDirectory(checkpoint_dir, &checkpoint_directory);
|
||||
if (checkpoint_directory != nullptr) {
|
||||
s = checkpoint_directory->Fsync();
|
20
packages/pika/third-pink-pink-Makefile.patch
Normal file
20
packages/pika/third-pink-pink-Makefile.patch
Normal file
@ -0,0 +1,20 @@
|
||||
--- a/third/pink/pink/Makefile
|
||||
+++ b/third/pink/pink/Makefile
|
||||
@@ -1,7 +1,5 @@
|
||||
CLEAN_FILES = # deliberately empty, so we can append below.
|
||||
-CXX=g++
|
||||
-LDFLAGS= -lpthread -lrt
|
||||
-CXXFLAGS= -g -std=c++11 -fno-builtin-memcmp -msse -msse4.2 -pipe -fPIC
|
||||
+CXXFLAGS+= -std=c++11 -fno-builtin-memcmp -pipe -fPIC $(CPPFLAGS)
|
||||
PROFILING_FLAGS=-pg
|
||||
ARFLAGS = rs
|
||||
OPT=
|
||||
@@ -27,7 +25,7 @@ endif
|
||||
# don't treat warnings as errors
|
||||
ifeq ($(DEBUG_LEVEL),0)
|
||||
DISABLE_WARNING_AS_ERROR=1
|
||||
-OPT += -O2 -fno-omit-frame-pointer -DNDEBUG
|
||||
+OPT += -Oz -fno-omit-frame-pointer -DNDEBUG
|
||||
else
|
||||
$(warning Warning: Compiling in debug mode. Don't use the resulting binary in production)
|
||||
OPT += -O0 -D__XDEBUG__ $(PROFILING_FLAGS)
|
11
packages/pika/third-pink-pink-src-http_conn.cc.patch
Normal file
11
packages/pika/third-pink-pink-src-http_conn.cc.patch
Normal file
@ -0,0 +1,11 @@
|
||||
--- a/third/pink/pink/src/http_conn.cc
|
||||
+++ b/third/pink/pink/src/http_conn.cc
|
||||
@@ -610,7 +610,7 @@
|
||||
}
|
||||
if (buf_len_ == 0) {
|
||||
size_t remain_buf = static_cast<uint64_t>(kHTTPMaxMessage) - wbuf_pos_;
|
||||
- size_t needed_size = std::min(remain_buf, remain_send_len_);
|
||||
+ size_t needed_size = remain_buf < remain_send_len_ ? remain_buf : remain_send_len_;
|
||||
buf_len_ = conn_->handles_->WriteResponseBody(
|
||||
wbuf_ + wbuf_pos_, needed_size);
|
||||
}
|
20
packages/pika/third-slash-slash-Makefile.patch
Normal file
20
packages/pika/third-slash-slash-Makefile.patch
Normal file
@ -0,0 +1,20 @@
|
||||
--- a/third/slash/slash/Makefile
|
||||
+++ b/third/slash/slash/Makefile
|
||||
@@ -1,7 +1,5 @@
|
||||
CLEAN_FILES = # deliberately empty, so we can append below.
|
||||
-CXX=g++
|
||||
-LDFLAGS= -lpthread -lrt
|
||||
-CXXFLAGS= -g -std=c++11 -fno-builtin-memcmp -msse -msse4.2 -pipe -fPIC
|
||||
+CXXFLAGS+= -std=c++11 -fno-builtin-memcmp -pipe -fPIC $(CPPFLAGS)
|
||||
PROFILING_FLAGS= -pg
|
||||
ARFLAGS = rs
|
||||
OPT=
|
||||
@@ -18,7 +16,7 @@ endif
|
||||
# don't treat warnings as errors
|
||||
ifeq ($(DEBUG_LEVEL),0)
|
||||
DISABLE_WARNING_AS_ERROR=1
|
||||
-OPT += -O2 -fno-omit-frame-pointer -DNDEBUG
|
||||
+OPT += -Oz -fno-omit-frame-pointer -DNDEBUG
|
||||
else
|
||||
$(warning Warning: Compiling in debug mode. Don't use the resulting binary in production)
|
||||
OPT += -O0 -D__XDEBUG__ -D_GNU_SOURCE $(PROFILING_FLAGS)
|
11
packages/pika/third-slash-slash-src-env.cc.patch
Normal file
11
packages/pika/third-slash-slash-src-env.cc.patch
Normal file
@ -0,0 +1,11 @@
|
||||
--- a/third/slash/slash/src/env.cc
|
||||
+++ b/third/slash/slash/src/env.cc
|
||||
@@ -348,7 +348,7 @@
|
||||
|
||||
virtual Status Read(size_t n, Slice* result, char* scratch) override {
|
||||
Status s;
|
||||
- size_t r = fread_unlocked(scratch, 1, n, file_);
|
||||
+ size_t r = fread(scratch, 1, n, file_);
|
||||
|
||||
*result = Slice(scratch, r);
|
||||
|
18
packages/pika/third-slash-slash-src-posix.cc.patch
Normal file
18
packages/pika/third-slash-slash-src-posix.cc.patch
Normal file
@ -0,0 +1,18 @@
|
||||
--- a/third/slash/slash/src/posix.cc
|
||||
+++ b/third/slash/slash/src/posix.cc
|
||||
@@ -471,11 +471,15 @@
|
||||
}
|
||||
|
||||
void Pthread_cancel(pthread_t tid) {
|
||||
+#ifndef __ANDROID__
|
||||
int rc;
|
||||
|
||||
if ((rc = pthread_cancel(tid)) != 0) {
|
||||
log_err("Pthread_cancel error: %s\n", strerror(rc));
|
||||
}
|
||||
+#else
|
||||
+ log_err("Pthread_cancel error: %s\n", strerror(ENOSYS));
|
||||
+#endif
|
||||
}
|
||||
|
||||
void Pthread_join(pthread_t tid, void **thread_return) {
|
Loading…
Reference in New Issue
Block a user