summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile3
-rw-r--r--Makerules8
-rw-r--r--Makethird29
3 files changed, 40 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index 7cfbdb3d..7138936b 100644
--- a/Makefile
+++ b/Makefile
@@ -23,18 +23,21 @@ THIRD_LIBS += $(FREETYPE_LIB)
THIRD_LIBS += $(JBIG2DEC_LIB)
THIRD_LIBS += $(JPEG_LIB)
THIRD_LIBS += $(OPENJPEG_LIB)
+THIRD_LIBS += $(OPENSSL_LIB)
THIRD_LIBS += $(ZLIB_LIB)
LIBS += $(FREETYPE_LIBS)
LIBS += $(JBIG2DEC_LIBS)
LIBS += $(JPEG_LIBS)
LIBS += $(OPENJPEG_LIBS)
+LIBS += $(OPENSSL_LIBS)
LIBS += $(ZLIB_LIBS)
CFLAGS += $(FREETYPE_CFLAGS)
CFLAGS += $(JBIG2DEC_CFLAGS)
CFLAGS += $(JPEG_CFLAGS)
CFLAGS += $(OPENJPEG_CFLAGS)
+CFLAGS += $(OPENSSL_CFLAGS)
CFLAGS += $(ZLIB_CFLAGS)
ifeq "$(verbose)" ""
diff --git a/Makerules b/Makerules
index 4f849f95..9dd6717a 100644
--- a/Makerules
+++ b/Makerules
@@ -25,6 +25,8 @@ endif
# Mac OS X doesn't have pkg-config so we hard code paths.
ifeq "$(OS)" "Darwin"
+SYS_OPENSSL_CFLAGS = -DHAVE_OPENSSL
+SYS_OPENSSL_LIBS = -lcrypto
SYS_X11_CFLAGS = -I/usr/X11R6/include
SYS_X11_LIBS = -L/usr/X11R6/lib -lX11 -lXext
@@ -39,6 +41,12 @@ RANLIB_CMD = ranlib $@
# Other Unixes use pkg-config for system libraries.
else
+
+ifeq "$(shell pkg-config --exists libcrypto && echo yes)" "yes"
+SYS_OPENSSL_CFLAGS = -DHAVE_OPENSSL $(shell pkg-config --cflags libcrypto)
+SYS_OPENSSL_LIBS = $(shell pkg-config --libs libcrypto)
+endif
+
SYS_X11_CFLAGS = $(shell pkg-config --cflags x11 xext)
SYS_X11_LIBS = $(shell pkg-config --libs x11 xext)
diff --git a/Makethird b/Makethird
index db3a9cee..72538e15 100644
--- a/Makethird
+++ b/Makethird
@@ -10,6 +10,7 @@ FREETYPE_DIR := thirdparty/freetype
JBIG2DEC_DIR := thirdparty/jbig2dec
JPEG_DIR := thirdparty/jpeg
OPENJPEG_DIR := thirdparty/openjpeg
+OPENSSL_DIR := thirdparty/openssl
ZLIB_DIR := thirdparty/zlib
# --- V8 ---
@@ -261,6 +262,34 @@ ZLIB_CFLAGS := $(SYS_ZLIB_CFLAGS)
ZLIB_LIBS := $(SYS_ZLIB_LIBS)
endif
+# --- OpenSSL ---
+
+ifneq "$(wildcard $(OPENSSL_DIR)/README)" ""
+
+OPENSSL_LIB := $(OUT)/libcrypto.a
+
+OPENSSL_DIR_MAK := $(OPENSSL_DIR)/Makefile
+OPENSSL_DIR_LIB := $(OPENSSL_DIR)/libcrypto.a
+
+$(OPENSSL_DIR_MAK):
+ cd $(OPENSSL_DIR) && ./config no-threads no-zlib no-shared no-asm no-dso
+
+$(OPENSSL_DIR_LIB): $(OPENSSL_DIR_MAK)
+ $(MAKE) -C $(OPENSSL_DIR) build_crypto
+
+$(OPENSSL_LIB): $(OPENSSL_DIR_LIB) | $(OUT)
+ cp $(OPENSSL_DIR_LIB) $(OPENSSL_LIB)
+
+openssl-clean:
+ $(MAKE) -C $(OPENSSL_DIR) clean
+ rm -f thirdparty/openssl/Makefile thirdparty/openssl/libcrypto.a
+
+OPENSSL_CFLAGS := -DHAVE_OPENSSL -I$(OPENSSL_DIR)/include
+else
+OPENSSL_CFLAGS := $(SYS_OPENSSL_CFLAGS)
+OPENSSL_LIBS := $(SYS_OPENSSL_LIBS)
+endif
+
# --- X11 ---
ifeq "$(NOX11)" ""