[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Minios-devel] [UNIKRAFT/REDIS PATCH 2/4] Build Redis server as library



Signed-off-by: Bogdan Lascu <lascu.bogdan96@xxxxxxxxx>
Signed-off-by: Costin Lupu <costin.lupu@xxxxxxxxx>
---
 Config.uk                                     |  19 +-
 Makefile.uk                                   | 199 ++++++++++++++++++
 ...se-linux-macros-for-Unikraft-as-well.patch |  26 +++
 3 files changed, 242 insertions(+), 2 deletions(-)
 create mode 100644 Makefile.uk
 create mode 100644 
patches/0001-hiredis-Use-linux-macros-for-Unikraft-as-well.patch

diff --git a/Config.uk b/Config.uk
index dea2ebf..1dd4f9d 100644
--- a/Config.uk
+++ b/Config.uk
@@ -1,7 +1,22 @@
-config LIBREDIS
+menuconfig LIBREDIS
        bool "Redis"
        default n
-       select LIBNOLIBC if !HAVE_LIBC
        select LIBUKDEBUG
        select LIBUKALLOC
        select LIBUKSCHED
+       select LIBNEWLIBC
+       select LIBNEWLIBC_WANT_IO_C99_FORMATS if LIBNEWLIBC
+       select LIBNEWLIBC_LINUX_ERRNO_EXTENSIONS if LIBNEWLIBC
+       select LIBPTHREAD_EMBEDDED
+       select UKSYSINFO
+       select LIBPOSIX_LIBDL
+       select LIBLWIP
+       select LWIP_IPV6
+
+if LIBREDIS
+config LIBREDIS_SERVER
+       bool "Redis server"
+       default y
+       help
+               Build the Redis server library.
+endif
diff --git a/Makefile.uk b/Makefile.uk
new file mode 100644
index 0000000..ae55caf
--- /dev/null
+++ b/Makefile.uk
@@ -0,0 +1,199 @@
+#  SPDX-License-Identifier: BSD-3-Clause
+#
+#  Redis Makefile.uk
+#
+#  Authors: Bogdan Lascu <lascu.bogdan96@xxxxxxxxx>
+#           Costin Lupu <costin.lupu@xxxxxxxxx>
+#
+#  Copyright (c) 2019, University Politehnica of Bucharest. All rights 
reserved.
+#
+#  Redistribution and use in source and binary forms, with or without
+#  modification, are permitted provided that the following conditions
+#  are met:
+#
+#  1. Redistributions of source code must retain the above copyright
+#     notice, this list of conditions and the following disclaimer.
+#  2. 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.
+#  3. Neither the name of the copyright holder 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 HOLDER 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.
+#
+#  THIS HEADER MAY NOT BE EXTRACTED OR MODIFIED IN ANY WAY.
+#
+
+################################################################################
+# Library registration
+################################################################################
+$(eval $(call addlib_s,libredis,$(CONFIG_LIBREDIS)))
+$(eval $(call addlib_s,libredis_server,$(CONFIG_LIBREDIS_SERVER)))
+
+################################################################################
+# Sources
+################################################################################
+LIBREDIS_VERSION=5.0.6
+LIBREDIS_URL=https://github.com/antirez/redis/archive/$(LIBREDIS_VERSION).zip
+LIBREDIS_BASENAME=redis-$(LIBREDIS_VERSION)
+LIBREDIS_PATCHDIR=$(LIBREDIS_BASE)/patches
+$(eval $(call fetch,libredis,$(LIBREDIS_URL)))
+$(eval $(call patch,libredis,$(LIBREDIS_PATCHDIR),$(LIBREDIS_BASENAME)))
+
+################################################################################
+# Helpers
+################################################################################
+LIBREDIS_SRC  = $(LIBREDIS_ORIGIN)/$(LIBREDIS_BASENAME)/src
+LIBREDIS_DEPS = $(LIBREDIS_ORIGIN)/$(LIBREDIS_BASENAME)/deps
+
+################################################################################
+# Library includes
+################################################################################
+CINCLUDES-y   += -I$(LIBREDIS_BASE)/include
+CXXINCLUDES-y += -I$(LIBREDIS_BASE)/include
+
+LIBREDIS_CINCLUDES-y += -I$(LIBREDIS_DEPS)/hiredis
+LIBREDIS_CINCLUDES-y += -I$(LIBREDIS_DEPS)/lua/src
+LIBREDIS_SERVER_CINCLUDES-y += $(LIBREDIS_CINCLUDES-y)
+
+################################################################################
+# Flags
+################################################################################
+# Suppress some warnings to make the build process look neater
+LIBREDIS_FLAGS_SUPPRESS = -Wno-unused-parameter -Wno-unused-variable \
+       -Wno-unused-value -Wno-implicit-fallthrough -Wno-char-subscripts \
+       -Wno-misleading-indentation
+LIBREDIS_CFLAGS-y += $(LIBREDIS_FLAGS_SUPPRESS)
+
+LIBREDIS_SERVER_CFLAGS-y += $(LIBREDIS_CFLAGS-y)
+LIBREDIS_SERVER_CFLAGS-y += -Wno-missing-field-initializers
+
+################################################################################
+# Sources
+################################################################################
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/adlist.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/ae.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/anet.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/aof.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/bio.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/bitops.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/blocked.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/childinfo.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/cluster.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/config.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/crc16.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/crc64.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/db.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/debug.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/defrag.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/dict.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/endianconv.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/evict.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/expire.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/geo.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/geohash.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/geohash_helper.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/hyperloglog.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/intset.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/latency.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/lazyfree.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/listpack.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/localtime.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/lolwut.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/lolwut5.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/lzf_c.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/lzf_d.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/memtest.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/module.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/multi.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/networking.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/notify.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/object.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/pqsort.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/pubsub.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/quicklist.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/rand.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/rax.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/rdb.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/redis-check-aof.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/redis-check-rdb.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/release.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/replication.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/rio.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/scripting.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/sds.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/sentinel.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/server.c
+LIBREDIS_SERVER_SERVER_FLAGS-y += -Dmain=redis_main
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/setproctitle.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/sha1.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/siphash.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/slowlog.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/sort.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/sparkline.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/syncio.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/t_hash.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/t_list.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/t_set.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/t_stream.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/t_string.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/t_zset.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/util.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/ziplist.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/zipmap.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/zmalloc.c
+
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_DEPS)/lua/src/fpconv.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_DEPS)/lua/src/lapi.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_DEPS)/lua/src/lauxlib.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_DEPS)/lua/src/lbaselib.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_DEPS)/lua/src/lcode.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_DEPS)/lua/src/ldblib.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_DEPS)/lua/src/ldebug.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_DEPS)/lua/src/ldo.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_DEPS)/lua/src/ldump.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_DEPS)/lua/src/lfunc.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_DEPS)/lua/src/lgc.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_DEPS)/lua/src/linit.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_DEPS)/lua/src/liolib.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_DEPS)/lua/src/llex.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_DEPS)/lua/src/lmathlib.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_DEPS)/lua/src/lmem.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_DEPS)/lua/src/loadlib.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_DEPS)/lua/src/lobject.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_DEPS)/lua/src/lopcodes.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_DEPS)/lua/src/loslib.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_DEPS)/lua/src/lparser.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_DEPS)/lua/src/lstate.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_DEPS)/lua/src/lstring.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_DEPS)/lua/src/lstrlib.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_DEPS)/lua/src/ltable.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_DEPS)/lua/src/ltablib.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_DEPS)/lua/src/ltm.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_DEPS)/lua/src/lua_bit.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_DEPS)/lua/src/lua_cjson.c
+LIBREDIS_SERVER_LUA_CJSON_FLAGS-y += -Wno-sign-compare
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_DEPS)/lua/src/lua_cmsgpack.c
+LIBREDIS_SERVER_LUA_CMSGPACK_FLAGS-y += -Wno-sign-compare
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_DEPS)/lua/src/lua_struct.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_DEPS)/lua/src/lundump.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_DEPS)/lua/src/lvm.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_DEPS)/lua/src/lzio.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_DEPS)/lua/src/strbuf.c
+
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_DEPS)/hiredis/async.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_DEPS)/hiredis/hiredis.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_DEPS)/hiredis/net.c
+LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_DEPS)/hiredis/read.c
+#LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_DEPS)/hiredis/sds.c
diff --git a/patches/0001-hiredis-Use-linux-macros-for-Unikraft-as-well.patch 
b/patches/0001-hiredis-Use-linux-macros-for-Unikraft-as-well.patch
new file mode 100644
index 0000000..b705ff5
--- /dev/null
+++ b/patches/0001-hiredis-Use-linux-macros-for-Unikraft-as-well.patch
@@ -0,0 +1,26 @@
+From b715e80ac71da7b13715e223d9169d11c71ad7ff Mon Sep 17 00:00:00 2001
+From: Costin Lupu <costin.lup@xxxxxxxxx>
+Date: Fri, 1 Nov 2019 12:57:22 +0200
+Subject: [UNIKRAFT PATCH] hiredis: Use linux macros for Unikraft as well
+
+Signed-off-by: Costin Lupu <costin.lupu@xxxxxxxxx>
+---
+ deps/hiredis/fmacros.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/deps/hiredis/fmacros.h b/deps/hiredis/fmacros.h
+index 9a56643..1c9828b 100644
+--- a/deps/hiredis/fmacros.h
++++ b/deps/hiredis/fmacros.h
+@@ -1,7 +1,7 @@
+ #ifndef __HIREDIS_FMACRO_H
+ #define __HIREDIS_FMACRO_H
+ 
+-#if defined(__linux__)
++#if defined(__linux__) || defined(__Unikraft__)
+ #define _BSD_SOURCE
+ #define _DEFAULT_SOURCE
+ #endif
+-- 
+2.20.1
+
-- 
2.20.1


_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.