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 from GitHub as Submodule
- Update LuaJit 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 Mar 2, 2023
1 parent 44a94c1 commit 474ca12
Show file tree
Hide file tree
Showing 207 changed files with 247 additions and 114,043 deletions.
11 changes: 10 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
*.o
*.obj

*.a
wrk
*.lib

*.out
*.exe

wrk2

deps/luajit/src/host/buildvm
deps/luajit/src/host/buildvm_arch.h
Expand All @@ -16,3 +23,5 @@ deps/luajit/src/luajit

.idea
CMakeLists.txt

*Output
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
60 changes: 46 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
CFLAGS := -std=c99 -Wall -O2 -D_REENTRANT
LIBS := -lpthread -lm -lcrypto -lssl

CFLAGS := -Wall -O2 -D_REENTRANT
LIBS := -lpthread -lm
GIT := git
TARGET := $(shell uname -s | tr '[A-Z]' '[a-z]' 2>/dev/null || echo unknown)

ifeq ($(TARGET), sunos)
Expand All @@ -11,10 +11,9 @@ 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
CFLAGS += -D_POSIX_C_SOURCE=200809L -D_DEFAULT_SOURCE
LIBS += -ldl
LDFLAGS += -Wl,-E
else ifeq ($(TARGET), freebsd)
Expand All @@ -24,27 +23,52 @@ 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

LDIRFLAGS= BUILDMODE=static
SDIRFLAGS= --static -static

ifeq ($(STATIC), true)
CFLAGS += -static -static-libgcc
LDFLAGS += -static -static-libgcc
endif

all: $(BIN)
ifeq ($(DEBUG), true)
CFLAGS += -O0 -g3
LDFLAGS += -g3
endif

ifeq ($(JEMALLOC), true)
CFLAGS += -DUSE_JEMALLOC
LIBS := -ljemalloc $(LIBS)
endif

LOCLIBS := $(LDIR)/libluajit.a $(SDIR)/libssl.a $(SDIR)/libcrypto.a
LIBS := $(LOCLIBS) $(LIBS)
CFLAGS += -I$(LDIR) -I$(SDIR)/include/
LDFLAGS += -L$(LDIR) -L$(SDIR)

all: depends $(BIN)

depends:
$(GIT) submodule update --init --recursive

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 $(LOCLIBS) | $(ODIR)

$(ODIR):
@mkdir -p $@
Expand All @@ -57,9 +81,17 @@ $(ODIR)/%.o : %.c
@echo CC $<
@$(CC) $(CFLAGS) -c -o $@ $<

$(LDIR)/libluajit.a:
$(LDIR) $(SDIR): depends

$(LDIR)/libluajit.a: $(LDIR)
@echo Building LuaJIT...
@$(MAKE) -C $(LDIR) BUILDMODE=static
@$(MAKE) -C $(LDIR) $(LDIRFLAGS)

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

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

.PHONY: all clean
.SUFFIXES:
Expand Down
1 change: 1 addition & 0 deletions deps/luajit
Submodule luajit added at 880ca3
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 474ca12

Please sign in to comment.