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 Mar 2, 2023
1 parent 44a94c1 commit e803ebb
Show file tree
Hide file tree
Showing 207 changed files with 228 additions and 114,047 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
42 changes: 27 additions & 15 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,40 +11,44 @@ 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: depends $(BIN)

all: $(BIN)
depends:
$(GIT) submodule update --init --recursive --force

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 @@ -57,10 +61,18 @@ $(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

$(SDIR)/libcrypto.a: $(SDIR)
@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 8135de
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 e803ebb

Please sign in to comment.