diff --git a/.gitignore b/.gitignore index 2048919..481a919 100644 --- a/.gitignore +++ b/.gitignore @@ -62,3 +62,6 @@ runtime/tests/tmp/ # Symlinks Dockerfile + +# Others +runtime/thirdparty/dist/ diff --git a/.gitmodules b/.gitmodules index b177dee..c0d22ed 100644 --- a/.gitmodules +++ b/.gitmodules @@ -3,8 +3,17 @@ url = https://github.com/gparmer/silverfish.git ignore = dirty [submodule "runtime/jsmn"] - path = runtime/jsmn - url = https://github.com/zserge/jsmn.git + path = runtime/thirdparty/jsmn + url = https://github.com/gwsystems/jsmn.git [submodule "runtime/http-parser"] - path = runtime/http-parser - url = https://github.com/nodejs/http-parser.git + path = runtime/thirdparty/http-parser + url = https://github.com/gwsystems/http-parser.git +[submodule "runtime/thirdparty/http-parser"] + path = runtime/thirdparty/http-parser + url = https://github.com/gwsystems/http-parser.git +[submodule "runtime/thirdparty/jsmn"] + path = runtime/thirdparty/jsmn + url = https://github.com/gwsystems/jsmn.git +[submodule "runtime/thirdparty/ck"] + path = runtime/thirdparty/ck + url = https://github.com/gwsystems/ck.git diff --git a/runtime/Makefile b/runtime/Makefile index 859ea76..9efc6db 100644 --- a/runtime/Makefile +++ b/runtime/Makefile @@ -28,16 +28,17 @@ CFLAGS += -DNCORES=${NCORES_CONF} CFLAGS += -DPAGE_SIZE=$(shell getconf PAGESIZE) MAKE= make --no-print-directory +THIRDPARTY=thirdparty -JSMN=jsmn -JSMNINC=-I${JSMN} -JSMNCFLAGS=${JSMNINC} -DJSMN_STATIC -DJSMN_STRICT +THIRDPARTY_DIST=${THIRDPARTY}/dist/ +THIRDPARTY_INC=${THIRDPARTY_DIST}/include/ +THIRDPARTY_LIB=${THIRDPARTY_DIST}/lib/ +LDFLAGS += -L${THIRDPARTY_LIB} +CFLAGS += -I${THIRDPARTY_INC} -HTTPPARSE=http-parser -HTTPPARSEINC=-I${HTTPPARSE} -HTTPPARSESRC=${HTTPPARSE}/http_parser.c -HTTPPARSECFLAGS=${HTTPPARSEINC} -CFILES += ${HTTPPARSESRC} +JSMNCFLAGS=-DJSMN_STATIC -DJSMN_STRICT +HTTPPARSEOBJ=${THIRDPARTY_LIB}/http_parser.o +CFILES += ${HTTPPARSEOBJ} ifeq ($(USE_MEM),USE_MEM_GENERIC) CFILES += ${RTDIR}/memory/generic.c @@ -45,13 +46,17 @@ else ifeq ($(USE_MEM),USE_MEM_VM) CFILES += ${RTDIR}/memory/64bit_nix.c endif -all: clean runtime #tools +all: clean runtime runtime: @echo "Compiling runtime" @mkdir -p bin/ @${CC} ${CFLAGS} ${LDFLAGS} ${CFILES} ${JSMNCFLAGS} ${HTTPPARSECFLAGS} -L/usr/lib/ -luv $^ -o ${RUNTIME} +thirdparty: + @echo "Compiling thirdparty" + @${MAKE} -C thirdparty build + tools: # @echo "Compiling tools" @${MAKE} -C tools @@ -61,11 +66,14 @@ clean: @echo "Cleaning up runtime" @rm -f ${RUNTIME} # @echo "Cleaning up tools" - @${MAKE} -C tools clean +# @${MAKE} -C tools clean + +distclean: clean + @${MAKE} -C thirdparty clean fetch: @git submodule update --init --recursive -init: fetch clean runtime tools +init: fetch clean thirdparty runtime -.PHONY: all init clean fetch libuv runtime tools +.PHONY: all init clean fetch thirdparty runtime tools diff --git a/runtime/http-parser b/runtime/http-parser deleted file mode 160000 index 28f3c35..0000000 --- a/runtime/http-parser +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 28f3c35c215ffbe0241685901338fad484660454 diff --git a/runtime/jsmn b/runtime/jsmn deleted file mode 160000 index 85695f3..0000000 --- a/runtime/jsmn +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 85695f3d5903b1cd5b4030efe50db3b4f5f3c928 diff --git a/runtime/thirdparty/Makefile b/runtime/thirdparty/Makefile new file mode 100644 index 0000000..ed69cc7 --- /dev/null +++ b/runtime/thirdparty/Makefile @@ -0,0 +1,26 @@ +CURR_DIR= $(shell pwd) +DIST_PREFIX=${CURR_DIR}/dist/ + +all: clean build + +build: ck jsmn http-parser + +ck: + mkdir -p ${DIST_PREFIX} + cd ck; ./configure --cores=$(shell getconf _NPROCESSORS_CONF) --prefix=${DIST_PREFIX} + make -C ck all + make -C ck install + +http-parser: http-parser/http_parser.c + mkdir -p ${DIST_PREFIX}/lib/ + cd http-parser; $(CC) $(CFLAGS) -I. -c http_parser.c; mv http_parser.o ${DIST_PREFIX}/lib/; cp http_parser.h ${DIST_PREFIX}/include/ + +jsmn: + mkdir -p ${DIST_PREFIX}/include/ + cp jsmn/jsmn.h ${DIST_PREFIX}/include/ + +clean: + make -C ck uninstall + rm -rf ${DIST_PREFIX} + +.PHONY: clean all build ck jsmn http-parser diff --git a/runtime/thirdparty/ck b/runtime/thirdparty/ck new file mode 160000 index 0000000..94f3712 --- /dev/null +++ b/runtime/thirdparty/ck @@ -0,0 +1 @@ +Subproject commit 94f37128144287d35274225f99da4927d3f41ab4 diff --git a/runtime/thirdparty/http-parser b/runtime/thirdparty/http-parser new file mode 160000 index 0000000..2343fd6 --- /dev/null +++ b/runtime/thirdparty/http-parser @@ -0,0 +1 @@ +Subproject commit 2343fd6b5214b2ded2cdcf76de2bf60903bb90cd diff --git a/runtime/thirdparty/jsmn b/runtime/thirdparty/jsmn new file mode 160000 index 0000000..053d3cd --- /dev/null +++ b/runtime/thirdparty/jsmn @@ -0,0 +1 @@ +Subproject commit 053d3cd29200edb1bfd181d917d140c16c1f8834