mirror of
https://github.com/fluencelabs/redis
synced 2025-04-24 18:12:13 +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 \
|
||||
curl \
|
||||
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
|
||||
WORKDIR /code
|
||||
|
2
Makefile
2
Makefile
@ -6,7 +6,7 @@ default: all
|
||||
cd src && $(MAKE) $@
|
||||
|
||||
wasm:
|
||||
cd src && $(MAKE) -f Makefile_wasm
|
||||
cd src && $(MAKE) -f Makefile_wasm && mv redis.wasm ../
|
||||
|
||||
install:
|
||||
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 status;
|
||||
struct Smain s;
|
||||
@ -397,4 +398,4 @@ int main (int argc, char **argv) {
|
||||
lua_close(L);
|
||||
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;
|
||||
}
|
||||
|
||||
#if __redis_unmodified_upstream // Disable main to prevent name conflicts during linking
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
lua_State* L;
|
||||
@ -198,3 +199,4 @@ int main(int argc, char* argv[])
|
||||
lua_close(L);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
#endif
|
||||
|
@ -1,23 +1,24 @@
|
||||
TARGET = redis
|
||||
CC = /opt/wasi-sdk/bin/clang
|
||||
SYSROOT = /opt/wasi-sdk/share/sysroot
|
||||
SYSROOT = /opt/wasi-sdk/share/wasi-sysroot
|
||||
TARGET_TRIPLE = wasm32-unknown-wasi
|
||||
CFLAGS = -nostartfiles -fvisibility=hidden
|
||||
LDFLAGS = -Wl,--no-entry,--demangle,--allow-undefined
|
||||
EXPORT_FUNCS = --export=allocate,--export=deallocate,--export=invoke
|
||||
SDK = sdk/allocator.cpp sdk/logger.cpp
|
||||
EXPORT_FUNCS = --export=allocate,--export=deallocate,--export=invoke,--export=load,--export=store
|
||||
WRAPPER_SRC = wrapper.c
|
||||
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
|
||||
|
||||
default: $(TARGET)
|
||||
all: default
|
||||
|
||||
$(TARGET): $(REDIS_SERVER)
|
||||
$(CC) --sysroot=$(SYSROOT) --target=$(TARGET_TRIPLE) -I$(LUA) $(CFLAGS) $(LDFLAGS) -Wl,$(EXPORT_FUNCS) $^ -c
|
||||
$(TARGET): $(SDK) $(REDIS_SERVER) $(WRAPPER_SRC)
|
||||
$(CC) -O3 --sysroot=$(SYSROOT) --target=$(TARGET_TRIPLE) -I$(LUA) $(CFLAGS) $(LDFLAGS) -Wl,$(EXPORT_FUNCS) $^ -o $@.wasm
|
||||
|
||||
.PRECIOUS: $(TARGET)
|
||||
|
||||
clean:
|
||||
-rm -f $(TARGET).wasm
|
||||
-rm -f $(TARGET).wasm
|
@ -25,6 +25,14 @@ void deallocate(void *ptr, int size) {
|
||||
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
|
||||
// doesn't receive requests until output buffer isn't empty.
|
||||
void clean_client_buffer(client *c) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user