mirror of
https://github.com/fluencelabs/redis
synced 2025-04-25 10:32:14 +00:00
add multimodules support and beter docker building
This commit is contained in:
parent
016c4dc113
commit
85011456ae
@ -4,9 +4,10 @@ RUN apt-get update \
|
|||||||
&& apt-get install -y ca-certificates \
|
&& apt-get install -y ca-certificates \
|
||||||
curl \
|
curl \
|
||||||
git \
|
git \
|
||||||
make
|
make \
|
||||||
|
libtinfo5
|
||||||
|
|
||||||
RUN curl -L https://github.com/CraneStation/wasi-sdk/releases/download/wasi-sdk-5/wasi-sdk-5.0-linux.tar.gz | tar xz --strip-components=1 -C /
|
RUN curl -L https://github.com/CraneStation/wasi-sdk/releases/download/wasi-sdk-6/wasi-sdk-6.0-linux.tar.gz | tar xz --strip-components=1 -C /
|
||||||
|
|
||||||
VOLUME /code
|
VOLUME /code
|
||||||
WORKDIR /code
|
WORKDIR /code
|
||||||
|
2
Makefile
2
Makefile
@ -6,7 +6,7 @@ default: all
|
|||||||
cd src && $(MAKE) $@
|
cd src && $(MAKE) $@
|
||||||
|
|
||||||
wasm:
|
wasm:
|
||||||
cd src && $(MAKE) -f Makefile_wasm
|
cd src && $(MAKE) -f Makefile_wasm && mv redis.wasm ../
|
||||||
|
|
||||||
install:
|
install:
|
||||||
cd src && $(MAKE) $@
|
cd src && $(MAKE) $@
|
||||||
|
3
deps/lua/src/lua.c
vendored
3
deps/lua/src/lua.c
vendored
@ -382,6 +382,7 @@ static int pmain (lua_State *L) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#if __redis_unmodified_upstream // Disable main to prevent name conflicts during linking
|
||||||
int main (int argc, char **argv) {
|
int main (int argc, char **argv) {
|
||||||
int status;
|
int status;
|
||||||
struct Smain s;
|
struct Smain s;
|
||||||
@ -397,4 +398,4 @@ int main (int argc, char **argv) {
|
|||||||
lua_close(L);
|
lua_close(L);
|
||||||
return (status || s.status) ? EXIT_FAILURE : EXIT_SUCCESS;
|
return (status || s.status) ? EXIT_FAILURE : EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
2
deps/lua/src/luac.c
vendored
2
deps/lua/src/luac.c
vendored
@ -183,6 +183,7 @@ static int pmain(lua_State* L)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if __redis_unmodified_upstream // Disable main to prevent name conflicts during linking
|
||||||
int main(int argc, char* argv[])
|
int main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
lua_State* L;
|
lua_State* L;
|
||||||
@ -198,3 +199,4 @@ int main(int argc, char* argv[])
|
|||||||
lua_close(L);
|
lua_close(L);
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
@ -1,21 +1,22 @@
|
|||||||
TARGET = redis
|
TARGET = redis
|
||||||
CC = /opt/wasi-sdk/bin/clang
|
CC = /opt/wasi-sdk/bin/clang
|
||||||
SYSROOT = /opt/wasi-sdk/share/sysroot
|
SYSROOT = /opt/wasi-sdk/share/wasi-sysroot
|
||||||
TARGET_TRIPLE = wasm32-unknown-wasi
|
TARGET_TRIPLE = wasm32-unknown-wasi
|
||||||
CFLAGS = -nostartfiles -fvisibility=hidden
|
CFLAGS = -nostartfiles -fvisibility=hidden
|
||||||
LDFLAGS = -Wl,--no-entry,--demangle,--allow-undefined
|
LDFLAGS = -Wl,--no-entry,--demangle,--allow-undefined
|
||||||
EXPORT_FUNCS = --export=allocate,--export=deallocate,--export=invoke
|
EXPORT_FUNCS = --export=allocate,--export=deallocate,--export=invoke,--export=load,--export=store
|
||||||
SDK = sdk/allocator.cpp sdk/logger.cpp
|
WRAPPER_SRC = wrapper.c
|
||||||
LUA =/code/deps/lua/src
|
LUA =/code/deps/lua/src
|
||||||
REDIS_SERVER = adlist.c quicklist.c dict.c server.c sds.c zmalloc.c lzf_c.c lzf_d.c pqsort.c zipmap.c sha1.c ziplist.c release.c networking.c util.c object.c db.c t_string.c t_list.c t_set.c t_zset.c t_hash.c multi.c sort.c intset.c crc16.c endianconv.c slowlog.c scripting.c rand.c crc64.c bitops.c notify.c hyperloglog.c latency.c sparkline.c geo.c evict.c expire.c geohash.c geohash_helper.c defrag.c siphash.c rax.c t_stream.c listpack.c lolwut.c lolwut5.c wrapper.c
|
REDIS_SERVER = adlist.c quicklist.c debug.c dict.c server.c sds.c zmalloc.c lzf_c.c lzf_d.c pqsort.c zipmap.c sha1.c ziplist.c release.c networking.c util.c object.c db.c t_string.c t_list.c t_set.c t_zset.c t_hash.c multi.c sort.c intset.c crc16.c endianconv.c slowlog.c scripting.c rand.c crc64.c bitops.c notify.c hyperloglog.c latency.c sparkline.c geo.c evict.c expire.c geohash.c geohash_helper.c defrag.c siphash.c rax.c t_stream.c listpack.c lolwut.c lolwut5.c ../deps/lua/src/*.c
|
||||||
|
SDK = sdk/logger.c
|
||||||
|
|
||||||
.PHONY: default all clean
|
.PHONY: default all clean
|
||||||
|
|
||||||
default: $(TARGET)
|
default: $(TARGET)
|
||||||
all: default
|
all: default
|
||||||
|
|
||||||
$(TARGET): $(REDIS_SERVER)
|
$(TARGET): $(SDK) $(REDIS_SERVER) $(WRAPPER_SRC)
|
||||||
$(CC) --sysroot=$(SYSROOT) --target=$(TARGET_TRIPLE) -I$(LUA) $(CFLAGS) $(LDFLAGS) -Wl,$(EXPORT_FUNCS) $^ -c
|
$(CC) -O3 --sysroot=$(SYSROOT) --target=$(TARGET_TRIPLE) -I$(LUA) $(CFLAGS) $(LDFLAGS) -Wl,$(EXPORT_FUNCS) $^ -o $@.wasm
|
||||||
|
|
||||||
.PRECIOUS: $(TARGET)
|
.PRECIOUS: $(TARGET)
|
||||||
|
|
||||||
|
@ -25,6 +25,14 @@ void deallocate(void *ptr, int size) {
|
|||||||
zfree(ptr);
|
zfree(ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void store(char *ptr, unsigned char byte) {
|
||||||
|
*ptr = byte;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned char load(const unsigned char *ptr) {
|
||||||
|
return *ptr;
|
||||||
|
}
|
||||||
|
|
||||||
// Cleans client output buffers to - client is blocked and
|
// Cleans client output buffers to - client is blocked and
|
||||||
// doesn't receive requests until output buffer isn't empty.
|
// doesn't receive requests until output buffer isn't empty.
|
||||||
void clean_client_buffer(client *c) {
|
void clean_client_buffer(client *c) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user