Make nginx compile on 32bit platform, fix bitcuit on riscv

Signed-off-by: Harry Chen <i@harrychen.xyz>
master
Harry Chen 6 years ago
parent b09e4e24ad
commit 1829ca47d4

@ -46,7 +46,6 @@ ifneq ($(arch), x86_64)
endif
biscuit:
ifeq ($(arch), $(filter $(arch), x86_64 aarch64 riscv64 mipsel))
ifneq ($(shell uname)-$(arch), Darwin-riscv64)
@echo Building biscuit programs
@mkdir -p biscuit/build
@ -54,7 +53,6 @@ ifneq ($(shell uname)-$(arch), Darwin-riscv64)
@rm -rf $(out_dir)/biscuit && mkdir -p $(out_dir)/biscuit
@cp $(biscuit_bin_path)/* $(out_dir)/biscuit
endif
endif
$(busybox):
ifeq ($(arch), x86_64)
@ -75,7 +73,6 @@ endif
busybox: $(busybox)
nginx:
ifneq ($(arch), riscv32)
ifneq ($(shell uname), Darwin)
@echo Building nginx
mkdir -p $(out_dir)/usr/local/nginx/conf
@ -84,7 +81,6 @@ ifneq ($(shell uname), Darwin)
@cp nginx/build/$(arch)/nginx $(out_dir)
@cp nginx/nginx.conf $(out_dir)/usr/local/nginx/conf
endif
endif
redis:
ifneq ($(shell uname), Darwin)

@ -55,8 +55,8 @@ A rootfs is created at `build/$(arch)` and converted to `qcow2`.
| ------------------ | ------ | ------- | ------- | ------- | ------ |
| ucore | ❌ | ✅ | ✅ | ✅ | ✅ |
| rust | ✅ | ✅ | ✅ | ✅ | ✅ |
| biscuit | ✅ | ✅ | | ✅ | ✅ |
| nginx (linux only) | ✅ | ✅ | 🚧 | ✅ | 🚧 |
| biscuit | ✅ | ✅ | | ✅ | ✅ |
| nginx (linux only) | ✅ | ✅ | ✅ | ✅ | ✅ |
| redis (linux only) | ✅ | ✅ | ✅ | ✅ | ✅ |
| busybox | ✅ | ✅ | ❌ | ✅ | 🚧 |
| alpine rootfs | ✅ | ✅ | ❌ | ❌ | ❌ |

@ -29,8 +29,7 @@ set(PREFIX ${ARCH}-linux-musl-)
if (${ARCH} STREQUAL x86_64)
set(CMAKE_C_FLAGS "-m64 -mno-red-zone")
elseif (${ARCH} STREQUAL riscv32)
set(PREFIX riscv64-unknown-elf-)
set(CMAKE_C_FLAGS "-march=rv32imac -mabi=ilp32 -mcmodel=medany")
set(CMAKE_C_FLAGS "-march=rv32imafdc -mabi=ilp32d -mcmodel=medany")
elseif (${ARCH} STREQUAL riscv64)
set(CMAKE_C_FLAGS "-march=rv64imafdc -mabi=lp64d -mcmodel=medany")
elseif (${ARCH} STREQUAL aarch64)

@ -23,7 +23,8 @@ $(nginx_dir)/objs/nginx: $(nginx_dir)
cd $(nginx_dir) && ./configure --with-cc=$(cc) --with-cc-opt=-static --with-ld-opt=-static --without-pcre --without-http_rewrite_module --without-http_gzip_module --with-poll_module --without-http_upstream_zone_module
cd $(nginx_dir) && printf "#ifndef NGX_SYS_NERR\n#define NGX_SYS_NERR 132\n#endif\n" >> objs/ngx_auto_config.h
cd $(nginx_dir) && printf "#ifndef NGX_HAVE_SVSVSHM\n#define NGX_HAVE_SYSVSHM 1\n#endif\n" >> objs/ngx_auto_config.h
cd $(nginx_dir) && make
# FIXME: overflow will occur on 32-bit platforms, this is only a temporary workaround
cd $(nginx_dir) && make CFLAGS="${CFLGAS} -Wno-error=overflow"
$(bin_unstripped): $(nginx_dir)/objs/nginx
cp $(nginx_dir)/objs/nginx $(bin_unstripped)

@ -25,6 +25,7 @@ $(redis_dir)/src/redis-server: $(redis_dir)/src/config.h
sed -i 's/#define HAVE_EPOLL 1//' $(redis_dir)/src/config.h
# our accept does not have backlog
sed -i 's/#define MAX_ACCEPTS_PER_CALL 1000/#define MAX_ACCEPTS_PER_CALL 1/' $(redis_dir)/src/networking.c
# note: on some platforms gcc seems to forget linking with libatomic, fix it anyway
cd $(redis_dir) && make CC=$(cc) LDFLAGS="${LDFLAGS} -latomic" MALLOC=libc
$(bin_server_unstripped): $(redis_dir)/src/redis-server

Loading…
Cancel
Save