Skip to content

Commit 29b1848

Browse files
committed
refactor dependencies & bundle openssl
1 parent 03dc368 commit 29b1848

File tree

199 files changed

+39
-114300
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

199 files changed

+39
-114300
lines changed

.gitignore

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,2 @@
1-
*.o
2-
*.a
1+
obj/
32
wrk
4-
5-
deps/luajit/src/host/buildvm
6-
deps/luajit/src/host/buildvm_arch.h
7-
deps/luajit/src/host/minilua
8-
deps/luajit/src/jit/vmdef.lua
9-
deps/luajit/src/lj_bcdef.h
10-
deps/luajit/src/lj_ffdef.h
11-
deps/luajit/src/lj_folddef.h
12-
deps/luajit/src/lj_libdef.h
13-
deps/luajit/src/lj_recdef.h
14-
deps/luajit/src/lj_vm.s
15-
deps/luajit/src/lua/
16-
deps/luajit/src/luajit

Makefile

Lines changed: 34 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
CFLAGS := -std=c99 -Wall -O2 -D_REENTRANT
2-
LIBS := -lpthread -lm -lcrypto -lssl
2+
LIBS := -lpthread -lm -lssl -lcrypto
33

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

@@ -24,37 +24,60 @@ BIN := wrk
2424
ODIR := obj
2525
OBJ := $(patsubst %.c,$(ODIR)/%.o,$(SRC)) $(ODIR)/bytecode.o
2626

27-
LDIR = deps/luajit/src
28-
LIBS := -lluajit $(LIBS)
29-
CFLAGS += -I$(LDIR)
30-
LDFLAGS += -L$(LDIR)
27+
LIBS := -lluajit-5.1 $(LIBS)
28+
CFLAGS += -I$(ODIR)/include
29+
LDFLAGS += -L$(ODIR)/lib
30+
DEPS := $(ODIR)/lib/libluajit-5.1.a $(ODIR)/lib/libssl.a
3131

3232
all: $(BIN)
3333

3434
clean:
35-
$(RM) $(BIN) obj/*
36-
@$(MAKE) -C deps/luajit clean
35+
$(RM) -rf $(BIN) obj/*
3736

3837
$(BIN): $(OBJ)
3938
@echo LINK $(BIN)
4039
@$(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
4140

42-
$(OBJ): config.h Makefile $(LDIR)/libluajit.a | $(ODIR)
41+
$(OBJ): config.h Makefile $(DEPS) | $(ODIR)
4342

4443
$(ODIR):
4544
@mkdir -p $@
4645

4746
$(ODIR)/bytecode.o: src/wrk.lua
4847
@echo LUAJIT $<
49-
@$(SHELL) -c 'cd $(LDIR) && ./luajit -b $(CURDIR)/$< $(CURDIR)/$@'
48+
@$(SHELL) -c 'obj/bin/luajit -b $(CURDIR)/$< $(CURDIR)/$@'
5049

5150
$(ODIR)/%.o : %.c
5251
@echo CC $<
5352
@$(CC) $(CFLAGS) -c -o $@ $<
5453

55-
$(LDIR)/libluajit.a:
54+
# Dependencies
55+
56+
LUAJIT := $(notdir $(patsubst %.tar.gz,%,$(wildcard deps/LuaJIT*.tar.gz)))
57+
OPENSSL := $(notdir $(patsubst %.tar.gz,%,$(wildcard deps/openssl*.tar.gz)))
58+
59+
OPENSSL_OPTS = no-shared no-ssl2 no-psk no-srp no-dtls no-idea --prefix=$(abspath $(ODIR))
60+
61+
$(ODIR)/$(LUAJIT): deps/$(LUAJIT).tar.gz | $(ODIR)
62+
@tar -C $(ODIR) -xf $<
63+
64+
$(ODIR)/$(OPENSSL): deps/$(OPENSSL).tar.gz | $(ODIR)
65+
@tar -C $(ODIR) -xf $<
66+
67+
$(ODIR)/lib/libluajit-5.1.a: $(ODIR)/$(LUAJIT)
5668
@echo Building LuaJIT...
57-
@$(MAKE) -C $(LDIR) BUILDMODE=static
69+
@$(MAKE) -C $< PREFIX=$(abspath $(ODIR)) BUILDMODE=static install
70+
71+
$(ODIR)/lib/libssl.a: $(ODIR)/$(OPENSSL)
72+
@echo Building OpenSSL...
73+
ifeq ($(TARGET), darwin)
74+
@$(SHELL) -c "cd $< && ./Configure $(OPENSSL_OPTS) darwin64-x86_64-cc"
75+
else
76+
@$(SHELL) -c "cd $< && ./config $(OPENSSL_OPTS)"
77+
endif
78+
@$(MAKE) -C $< depend install
79+
80+
# ------------
5881

5982
.PHONY: all clean
6083
.SUFFIXES:

deps/LuaJIT-2.0.4.tar.gz

828 KB
Binary file not shown.

deps/luajit/COPYRIGHT

Lines changed: 0 additions & 56 deletions
This file was deleted.

deps/luajit/Makefile

Lines changed: 0 additions & 151 deletions
This file was deleted.

deps/luajit/README

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)