Skip to content

Commit

Permalink
Basic Build Imrpovements:
Browse files Browse the repository at this point in the history
- Remove Usage of System OpenSSL
- Update OpenSSL to master from GitHub as Submodule
- Update LuaJit to 2.1 from GitHub as Submodule
- Fixes for gettimeofday()
- Fixes to use x86 intrinsics only on x86
- Rename to wrk2

Integrate Improvements from GitHub:

- Fixes to Script Copy Value Order - PR giltene#113
- Add Fixes for Mutual TLS Authentication - PR giltene#99
- Add Fixes for TLS Ciphers - PR giltene#107
- Add EOF Handling Error - PR giltene#33
- Add JSON Example - PR giltene#51
- Make Rate Optional (use UINT64_MAX) - PR giltene#130
  • Loading branch information
guilt committed Feb 28, 2023
1 parent 44a94c1 commit 0adc2b4
Show file tree
Hide file tree
Showing 206 changed files with 210 additions and 114,042 deletions.
8 changes: 8 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[submodule "deps/luajit"]
path = deps/luajit
url = https://github.com/LuaJIT/LuaJIT
branch = v2.1
[submodule "deps/openssl"]
path = deps/openssl
url = https://github.com/openssl/openssl
branch = master
31 changes: 19 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
CFLAGS := -std=c99 -Wall -O2 -D_REENTRANT
LIBS := -lpthread -lm -lcrypto -lssl
CFLAGS := -Wall -O2 -D_REENTRANT
LIBS := -lpthread -lm

TARGET := $(shell uname -s | tr '[A-Z]' '[a-z]' 2>/dev/null || echo unknown)

Expand All @@ -11,40 +11,41 @@ else ifeq ($(TARGET), darwin)
# is not set then it's forced to 10.4, which breaks compile on Mojave.
export MACOSX_DEPLOYMENT_TARGET = $(shell sw_vers -productVersion)
LDFLAGS += -pagezero_size 10000 -image_base 100000000
LIBS += -L/usr/local/opt/openssl/lib
CFLAGS += -I/usr/local/include -I/usr/local/opt/openssl/include
CFLAGS += -I/usr/local/include
else ifeq ($(TARGET), linux)
CFLAGS += -D_POSIX_C_SOURCE=200809L -D_BSD_SOURCE
LIBS += -ldl
LDFLAGS += -Wl,-E
CFLAGS += -D_POSIX_C_SOURCE=200809L -D_DEFAULT_SOURCE
LIBS += -ldl -static -static-libgcc
LDFLAGS += -Wl,-E -static -static-libgcc
else ifeq ($(TARGET), freebsd)
CFLAGS += -D_DECLARE_C99_LDBL_MATH
LDFLAGS += -Wl,-E
endif

SRC := wrk.c net.c ssl.c aprintf.c stats.c script.c units.c \
ae.c zmalloc.c http_parser.c tinymt64.c hdr_histogram.c
BIN := wrk
BIN := wrk2

ODIR := obj
OBJ := $(patsubst %.c,$(ODIR)/%.o,$(SRC)) $(ODIR)/bytecode.o

LDIR = deps/luajit/src
LIBS := -lluajit $(LIBS)
CFLAGS += -I$(LDIR)
LDFLAGS += -L$(LDIR)
SDIR = deps/openssl
LIBS := -lssl -lcrypto -lluajit ${LIBS}
CFLAGS += -I$(LDIR) -I$(SDIR)/include/
LDFLAGS += -L$(LDIR) -L$(SDIR)

all: $(BIN)

clean:
$(RM) $(BIN) obj/*
@$(MAKE) -C deps/luajit clean
@$(MAKE) -C deps/openssl clean

$(BIN): $(OBJ)
@echo LINK $(BIN)
@$(CC) $(LDFLAGS) -o $@ $^ $(LIBS)

$(OBJ): config.h Makefile $(LDIR)/libluajit.a | $(ODIR)
$(OBJ): config.h Makefile $(LDIR)/libluajit.a $(SDIR)/libssl.a $(SDIR)/libcrypto.a | $(ODIR)

$(ODIR):
@mkdir -p $@
Expand All @@ -61,6 +62,12 @@ $(LDIR)/libluajit.a:
@echo Building LuaJIT...
@$(MAKE) -C $(LDIR) BUILDMODE=static

$(SDIR)/libcrypto.a:
@echo Building OpenSSL...
@cd $(SDIR) && ./config --static -static && $(MAKE)

$(SDIR)/libssl.a: $(SDIR)/libcrypto.a

.PHONY: all clean
.SUFFIXES:
.SUFFIXES: .c .o .lua
Expand Down
1 change: 1 addition & 0 deletions deps/luajit
Submodule luajit added at 505e2c
56 changes: 0 additions & 56 deletions deps/luajit/COPYRIGHT

This file was deleted.

151 changes: 0 additions & 151 deletions deps/luajit/Makefile

This file was deleted.

16 changes: 0 additions & 16 deletions deps/luajit/README

This file was deleted.

Loading

0 comments on commit 0adc2b4

Please sign in to comment.